Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jeffpk

Pages: [1] 2
1
NGUI 3 Support / Re: Quick Q about ordering
« on: March 21, 2014, 06:05:43 PM »
NM Im figuring it out.

It has to do with the fact that some widgets have their own UIPanel and some don't.

UIPanel seems pretty key, its purpose and use should really be explained better and right up front as the first thing you talk about in documentation

2
NGUI 3 Support / Re: Quick Q about ordering
« on: March 21, 2014, 06:00:06 PM »
Spoke too son.

The aberrant ordering behavior has returned just like before.

This is the current code:
  1. void Start () {
  2.                 MapCursor cursor = FindObjectOfType<MapCursor>();
  3.                 List<TileRecord> tileRecords = GameManager.currentTileMap.Tileset.tileList;
  4.                 UIGrid grid = GetComponent<UIGrid>();
  5.                 UIWidget widget = transform.parent.GetComponent<UIWidget>();
  6.                 foreach(TileRecord rec in tileRecords){
  7.                         UITexture nguiTexture = NGUITools.AddWidget<UITexture>(gameObject);
  8.                         GameObject panel = nguiTexture.gameObject;
  9.                         nguiTexture.mainTexture = rec.tilePreviewImage;
  10.                         nguiTexture.depth = widget.depth+1;
  11.                         NGUITools.AddWidgetCollider(panel);
  12.                         UIDragScrollView dsv = NGUITools.AddMissingComponent<UIDragScrollView>(panel);
  13.                         dsv.scrollView = grid.transform.parent.GetComponent<UIScrollView>();
  14.                         TileClickManager tcm = NGUITools.AddMissingComponent<TileClickManager>(panel);
  15.                         tcm.tileRec = rec;
  16.                         tcm.mapCursor = cursor;
  17.                 }
  18.                 grid.Reposition();
  19.                 widget.MarkAsChanged();
  20.         }
  21.  

Are there any component settings I should check?

3
NGUI 3 Support / Re: Quick Q about ordering
« on: March 20, 2014, 11:38:55 AM »
Found it!

For some reason,. creating a child between the grid and the Texture widget was causing the problem.  (I didn't realize that AddWidget actually creates an entire game object, like Instantiate does when give a component.)

Thanks for all your help!

4
NGUI 3 Support / Re: Quick Q about ordering
« on: March 20, 2014, 11:21:27 AM »
Unfortunately its still doing the exact same thing.

I stripped down that code to remove all dinosaur code.  It currently looks like this:

  1. void Start () {
  2.                 MapCursor cursor = FindObjectOfType<MapCursor>();
  3.                 List<TileRecord> tileRecords = GameManager.currentTileMap.Tileset.tileList;
  4.                 UIGrid grid = GetComponent<UIGrid>();
  5.                 UIWidget widget = transform.parent.GetComponent<UIWidget>();
  6.                 foreach(TileRecord rec in tileRecords){
  7.                         GameObject panel = NGUITools.AddChild(grid.gameObject);
  8.                         UITexture nguiTexture = NGUITools.AddWidget<UITexture>(panel);
  9.                         nguiTexture.mainTexture = rec.tilePreviewImage;
  10.                         nguiTexture.depth = widget.depth+1;
  11.                         NGUITools.AddWidgetCollider(panel);
  12.                         UIDragScrollView dsv = NGUITools.AddMissingComponent<UIDragScrollView>(panel);
  13.                         dsv.scrollView = grid.transform.parent.GetComponent<UIScrollView>();
  14.                         TileClickManager tcm = NGUITools.AddMissingComponent<TileClickManager>(panel);
  15.                         tcm.tileRec = rec;
  16.                         tcm.mapCursor = cursor;
  17.                 }
  18.                 grid.Reposition();
  19.                 widget.MarkAsChanged();
  20.         }
  21.  

5
NGUI 3 Support / Re: Quick Q about ordering
« on: March 20, 2014, 10:55:12 AM »
Ah, the second is to reset position.  Mostly I wanted to make sure the Z was set to 0.  But I'
ll take it out.

The first you are right is just dinosaur code i missed removing and might be the problem!

6
NGUI 3 Support / Re: Does NGUI support multiline text editing?
« on: March 19, 2014, 12:54:27 PM »
I bought this, but its erring on compilation.
Errors attached.


7
NGUI 3 Support / Re: Quick Q about ordering
« on: March 19, 2014, 10:40:03 AM »
Hmm. Code now looks like this.  No visual change in result

  1. UIGrid grid = GetComponent<UIGrid>();
  2.                 UIWidget widget = transform.parent.GetComponent<UIWidget>();
  3.                 foreach(TileRecord rec in tileRecords){
  4.                         GameObject panel = NGUITools.AddChild(grid.gameObject);
  5.                         //UITexture nguiTexture = panel.AddComponent<UITexture>();
  6.                         UITexture nguiTexture = NGUITools.AddWidget<UITexture>(panel);
  7.                         nguiTexture.mainTexture = rec.tilePreviewImage;
  8.                         nguiTexture.depth = widget.depth+1;
  9.                         //nguiTexture.transform.localScale = new Vector3(0.5f,0.5f,1);
  10.                         panel.transform.parent = transform;
  11.                         panel.transform.localPosition = Vector3.zero;
  12.                         nguiTexture.MarkAsChanged();
  13.                         NGUITools.AddWidgetCollider(panel);
  14.                         //UIDragScrollView dsv = panel.AddComponent<UIDragScrollView>();
  15.                         UIDragScrollView dsv = NGUITools.AddMissingComponent<UIDragScrollView>(panel);
  16.                         dsv.scrollView = grid.transform.parent.GetComponent<UIScrollView>();
  17.                         //TileClickManager tcm = panel.AddComponent<TileClickManager>();
  18.                         TileClickManager tcm = NGUITools.AddMissingComponent<TileClickManager>(panel);
  19.                         tcm.tileRec = rec;
  20.                         tcm.mapCursor = cursor;
  21.                 }
  22.                 grid.Reposition();
  23.                 transform.parent.GetComponent<UIWidget>().MarkAsChanged();
  24.  

8
NGUI 3 Support / Re: Quick Q about ordering
« on: March 18, 2014, 09:54:19 PM »
THanks.  It would probably save you some time if you eventually created a manual that laid out the organizational paradigms for NGUI and how things go together.

I'll  try applying all this and see what happens.

9
NGUI 3 Support / Re: Quick Q about ordering
« on: March 18, 2014, 06:14:16 PM »
Took a look at it in Panel View

The TilePicker has one Panel which is a parent of the grid which contains the tile images that are bleeding through.

It has a depth of 1.  The images have a depth of 3.

All of the Script editor depths are 20 or greater, including all the panels.

This really seems to be a result of those images having been added to the tile picker in code.  If you are curious, here is the code that adds them:

  1.  
  2.         UIGrid grid = GetComponent<UIGrid>();
  3.                 UIWidget widget = transform.parent.GetComponent<UIWidget>();
  4.                 foreach(TileRecord rec in tileRecords){
  5.                         GameObject panel = new GameObject();
  6.                         UITexture nguiTexture = panel.AddComponent<UITexture>();
  7.                         nguiTexture.mainTexture = rec.tilePreviewImage;
  8.                         nguiTexture.depth = widget.depth+1;
  9.                         nguiTexture.transform.localScale = new Vector3(0.5f,0.5f,1);
  10.                         panel.transform.parent = transform;
  11.                         panel.transform.localPosition = Vector3.zero;
  12.                         nguiTexture.MarkAsChanged();
  13.                         NGUITools.AddWidgetCollider(panel);
  14.                         UIDragScrollView dsv = panel.AddComponent<UIDragScrollView>();
  15.                         dsv.scrollView = grid.transform.parent.GetComponent<UIScrollView>();
  16.                         TileClickManager tcm = panel.AddComponent<TileClickManager>();
  17.                         tcm.tileRec = rec;
  18.                         tcm.mapCursor = cursor;
  19.                 }
  20.         grid.Reposition();
  21.                 transform.parent.GetComponent<UIWidget>().MarkAsChanged();
  22.  

10
NGUI 3 Support / Re: Quick Q about ordering
« on: March 18, 2014, 05:53:12 PM »
Do you mean that all the children of one panel should be above or below all the children of another panel?

Because thats not what I'm seeing.  Take a look at the images below.  The images inside of the "tile Picker" are added at run-time.  They show up above the pop up script editor which is its own complex hierarchy, but the rest of the tile picker is hidden.

The root sprite of the script editor starts at depth 20 and all its children are higher.

The tile images are all at depth 8.

11
NGUI 3 Support / Re: Dynamic scrolling grid: 3 problems
« on: March 18, 2014, 10:59:52 AM »
Thanks, i got it working  well enough.

As for version, unfortunately I have made some changes to NGUi internals so upgrading isn't easy right now.  In specific, I hacked in a soft cursor because I needed it to make NGUi respond correctly with the Oculus RIFT.

12
NGUI 3 Support / Re: Stupid little question
« on: March 17, 2014, 10:42:34 PM »
Okay Ill check them out.  Thanks.

13
NGUI 3 Support / Quick Q about ordering
« on: March 17, 2014, 10:42:13 PM »
Hey,

Im adding some elements to my NGUI gui at run time and even though they are lower precedence then the prebuilt gui items they are showing ontop of them.

Is there a call I need to make to kick NGUi into reprioritizing everything properly?

Thanks

14
NGUI 3 Support / Re: UIButtons inside ScrollView work randomly
« on: March 14, 2014, 07:09:26 PM »
This

"Deactivate the Box Collider on the parents of the buttons (1) and the buttons work but the menu does not scroll"

Suggests you have a depth problem and something invisible is blocking the clicks.  My suspicion is that you ar moving the buttons from behind it to not behind it when you scroll around.

Make sure that the buttons' depth are all set well bigger then the rest of the gui.

15
NGUI 3 Support / Re: Stupid little question
« on: March 14, 2014, 06:17:15 PM »
See the attached image explanation:


Pages: [1] 2