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

Pages: [1]
1
NGUI 3 Support / Adding contents to multiple tables in order?
« on: June 24, 2014, 01:27:20 PM »
Basically I have a set of 3 tables, first table is labels, other 2 are textboxes, they are added to dynamically during runtime with different numbers of objects. You can think of it working basically of like a spreadsheet.

For example if my data contents are the following:

Item01 - 1 - 1.11
Item02 - 2 - 2.22
Item03 - 3 - 3.33
Item04 - 4 - 4.44

When I add those to the table, I have a loop to add to my interface using the following code:

  1.             // load label object
  2.             var newItem = Instantiate(productLabelObject, this.transform.position, this.transform.rotation) as GameObject;
  3.             newItem.transform.parent = productCodeList.transform;
  4.             newItem.transform.localScale = Vector3.one;
  5.  
  6.             // load quantity object
  7.             var newItem2 = Instantiate(productTextObject, this.transform.position, this.transform.rotation) as GameObject;
  8.             newItem2.transform.parent = quantityList.transform;
  9.             newItem2.transform.localScale = Vector3.one;
  10.  
  11.             // load price object
  12.             var newItem3 = Instantiate(productTextObject, this.transform.position, this.transform.rotation) as GameObject;
  13.             newItem3.transform.parent = priceList.transform;
  14.             newItem3.transform.localScale = Vector3.one;
  15.  
  16.             // set text of label object
  17.             UILabel labelScript = newItem.GetComponent<UILabel>();
  18.             labelScript.text =  orderArray[0, yT];
  19.  
  20.             // set text of quantity object ([2])
  21.             UIInput inputScript = newItem2.GetComponent<UIInput>();
  22.             inputScript.value = orderArray[2, yT];
  23.  
  24.             // set text of price object ([2])
  25.             UIInput inputScript2 = newItem3.GetComponent<UIInput>();
  26.             inputScript2.value = orderArray[1, yT];
  27.  

Then I call Reposition() for each table at the end.

Even though I added each object to the table in the same exact order, for some reason the textboxes are all mixed up in the order they display. This is the current display I get for the data I listed above:

Item01 - 2 - 2.22
Item02 - 4 - 4.44
Item03 - 3 - 3.33
Item04 - 1 - 1.11

I have no idea why this is happening like this? Sort is unchecked, so I'm not sure how to get them ordered in the appropriate order. Is there any way I could get them always listed in the order that I add them to the table?

Thanks

2
NGUI 3 Support / Scrollview thinks it's larger than it really is?
« on: June 18, 2014, 12:12:29 PM »
I'm having a problem with the scroll view functionality. For an example of the problem, lets say I make a scrollview that could fit 8 of my objects horizontally in it. Then I make 10 of my objects. I will see 8 on screen, the other 2 are clipped off, but it gives NO scrollbar.

If I change the scrollbar show condition to Always, it seems to be working okay, but a slight problem is the thumb on the scrollbar shows very tiny, as if it would look if there were many objects on the list.

To make the problem even weirder, if I reduce it to only 3 objects on the list, it seems to be aligned properly upon hitting play, but when I move the scroll bar to the right, it actually drags those 3 objects to the right side of the panel. It's as if it thinks there are a number of objects before my objects appear?

The scrollbar is not appearing and the objects are aligning as if the scrollview is larger than it actually is, and I'm not sure why? I've been messing with the settings such as content origin, but even if I attempt to set the origin to "top left" when I hit play they are aligned properly, but I can scroll to the left even more. If I set top left origin on my scrollview, isn't that supposed to be to the top left of the contents inside the panel? Becuase it's only setting to the top left of the scrollview as it's rendered on screen, but is not aligned to the top left of the contents inside the scroll view...

Hope this makes sense, hard to explain.

Any help would be appreciated.

3
I have a table that lists a number of objects, not too different from the quest log example. But my problem is I'm not sure the best way to get which object is clicked on without adding a collider to every single object on the list - which is not acceptable becuase if I have that many box colliders it makes the scroll view so laggy that it's unusable.

Is there any way I could do a single collider, similar to how the UIDragScrollView works, and have it figure out which object is being clicked on? That way I do not have 100 colliders in the same window...?

4
NGUI 3 Support / How to receive which item on chat list was clicked?
« on: June 12, 2014, 04:12:01 PM »
I'm trying to modify the chat window that was provided by default in NGUI sample scenes. If I want to add functionality where it will message the user who is speaking when you click their name, I need to be able to receive an index of which item was clicked.

How would I go about receiving an index of which item was clicked in chat box? I tried to add a collider to it with code but had no success... Any guidance (or even better some sample code) would be appreciated!

Thanks!

Pages: [1]