1
NGUI 3 Support / GUI to NGUI
« on: August 03, 2014, 02:58:53 AM »
Hi all, i am trying to convert Unity's GUI to NGUI but stuck...!!! i want to show list of available servers in game using NGUI but unable to convert and display it on scrollview items
here is the script
Thanks in Advance
here is the script
- function OnGUI()
- {
- // set up scaling
- var rx : float = Screen.width / native_width;
- var ry : float = Screen.height / native_height;
- GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (rx, ry, 1));
- // if(GUI.Button(RefreshR, "refresh",Buttonzs)){
- // Debug.Log("Requesting Masterserver list from: " + ServerName);
- // MasterServer.RequestHostList(ServerName);
- // }
- GUI.skin = mySkin;
- GUIUtility.RotateAroundPivot (rotAngle, pivotPoint);
- scrollPosition = GUI.BeginScrollView (ScrollR,scrollPosition, ScrollW);
- //GUI.BeginGroup (GroupArea);
- //GUILayout.BeginArea(AreaR,"", "");
- //GUILayout.Label("available servers",Lay);
- for (var match : HostData in MasterServer.PollHostList())
- {
- GUILayout.BeginHorizontal("Box");
- GUILayout.Label (match.gameName,Lay);
- GUILayout.Space(5);
- GUILayout.Label (curMapName,Lay);
- Debug.Log(match.ToString());
- if(GUILayout.Button ("Connect",Buttonzs))
- {
- Network.Connect(match);
- }
- GUILayout.EndHorizontal();
- }
- //GUILayout.EndArea();
- //GUI.EndGroup();
- GUI.EndScrollView ();
- }
Thanks in Advance