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 - MoPhat

Pages: [1]
1
Thank you LightSky

I have created the scrollview>grid> and added new prefabs via "NGUITools.AddChild(Parent, Prefab);" and works fine and fast  ;D

But i have now a few other questions.

How can i Position the prefab, should i add a Transformation on each AddChild() execution?
How can i Access the objects/UI elements in the prefab to polulate it with own text/Images etc. before it added to the grid?

Thank you for the help
MoPhat

2
Hi, i'm new with NGUI and trying to re-create code from unity UI to NGUI.

I Need a way to polulate a scrollview for touch from a dynamic list.

My old code is this:

  1.     void Update()
  2.     {
  3.         if (Input.touchCount > 0)
  4.         {
  5.             touch = Input.touches[0];
  6.             if (touch.phase == TouchPhase.Moved)
  7.             {
  8.                 scrollPosition.y += 5 * touch.deltaPosition.y;
  9.             }
  10.         }
  11.     }
  12.  
  13.     void OnGUI()
  14.     {
  15.         nextTileValue = 0;
  16.         int i = 0;
  17.         while (i <= repeats)
  18.         {
  19.             scrollPosition = GUI.BeginScrollView(new Rect(0, 0, Screen.width, Screen.height), scrollPosition, new Rect(0, 0, Screen.width, repeats * nextTileDefault), GUIStyle.none, GUIStyle.none);
  20.  
  21.             GUI.skin = TileMain;
  22.             GUI.Box(new Rect(posMainLeft, posMainTop, tileWidth, tileHeight), "");
  23.  
  24.             GUI.skin = TileLeftBar;
  25.             GUI.Box(new Rect(posMainLeft, posMainTop, leftBarWidth, tileHeight), "");
  26.  
  27.             GUI.skin = TileBottomBar;
  28.             GUI.Box(new Rect(posMainLeft, posBottomBarTop, tileWidth, bottomBarHeight), "");
  29.  
  30.             GUI.skin = TileMain;
  31.             GUI.Box(new Rect(posScreenShotLeft, posScreenShotTop, screenShotSize, screenShotSize), screenshot);
  32.  
  33.             GUI.Label(new Rect(posTitleLeft, posTitleTop, tileWidth, tileHeight), "Title #" + i.ToString(), titleStyle);
  34.             GUI.Label(new Rect(posDescriptionLeft, posDescriptionTop, descriptionWidth, tileHeight), "The description here!", titleDescription);
  35.  
  36.             nextTileValue = nextTileValue + nextTileDefault;
  37.             i++;
  38.  
  39.             GUI.EndScrollView();
  40.         }
  41.     }

What is the best to Archive this with NGUI, the code only draw boxes with content vertical for Scrolling.

Thank you for any help  ;D
MoPhat

Pages: [1]