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

Pages: [1]
1
When attempting to select the source for a Property Binding, my get properties aren't listed. Is this intended? Any way to work around this? Using 3.6.8.

2
NGUI 3 Support / Re: Dynamic button placement and creation
« on: October 02, 2013, 07:54:28 PM »
I'm just wondering how I'd go about handling each gameobject. UITextList only uses a single label because you can only interact with the label itself (to scroll). However, if I wanted a button beside each listing I'd need to create a new button object for each listing unless I'm missing something.

One way I'm thinking of doing it is, on start, create (and set inactive) X gameobjects with a button component (where X is the number of servers the browser can display) and store it in an array. Then, whenever the server list is updated (which returns an array), set active the matching index in the button array. All other buttons would be set inactive.

Somewhat pseudocode to help visualize what I just said:
  1. private CustomizedUIButton[] buttons;
  2.  
  3. private void Start()
  4. {
  5.         buttons = new CustomizedUIButton[maxServersDisplay];
  6.         for (int i = 0; i < buttons.Length; i++) buttons[i] = MakeAButtonAtTheProperLocation();
  7.         RefreshServers();
  8. }
  9.  
  10. public void RefreshServers()
  11. {
  12.         SetAllInactive(buttons);
  13.        
  14.         Server[] servers = GetServers();
  15.         for (int i = 0; i < servers.Length; i++) buttons[i].SetActive(true);
  16. }

Am I on the right track here or am I completely off the mark? It just seems wrong to make ~50 or so individual button objects, even if they are mostly inactive.

3
NGUI 3 Support / Dynamic button placement and creation
« on: October 02, 2013, 08:44:07 AM »
I'm making a server browser for a multiplayer a game. Currently, I'm using the default UITextList script to display active servers, however, I need a way to interact with them. Each line (server) in the text list should be able to be double clicked (or have a button placed beside them).

What would be a good way to do this? Is the UITextList too basic to handle this kind of thing? How would I handle possibly dozens of buttons/clickable labels (keeping in mind the server list can be refreshed with new servers appearing and old ones disappearing).

For reference, here's a screenshot of the current (barebones) implementation of the server browser:

Each line in the list (representing a room) should be individually interact-able.

Pages: [1]