- Home /
Question by
DevonJavaScript · Sep 05, 2011 at 08:32 AM ·
javascriptguinetworkingprivateip
Network list connecting (Storing variables)
How would I go about storing many variables per single "Item". Say a server list were the player just pressed connect and connects. This is my GUI for that so far.
private var hostIP;
private var hostPort;
var scrollPosition: Vector2;
var ServerSelected : int = 0;
var Serverlist : String[] = { "" };
var hostGameType = String = "";
var hostMap = String = "";
var hostPlayers = int;
function OnGUI(){
//Start window
scrollPosition = GUI.BeginScrollView (Rect (20,20,600,340),
//current scroll position
scrollPosition, Rect (0, 0, 600, 800));
//show list
ServerSelected = GUI.SelectionGrid(Rect(20,20,600,800),ServerSelected,Serverlist,1);
//end of list.
GUI.EndScrollView ();
//if pressed connect connect to server
if(GUI.Button(Rect(500,365,100,20),"Connect")){
connectToServer(ServerSelected);
}
//if pressed info button gather host info.
if(GUI.Button(Rect(450,365,100,20),"Info")){
getServerInfo(ServerSelected);
}
}
function connectToServer(x: int){
if(hostIP || hostPort == null)
{
getServerInfo(ServerSelected);
}
if(hostIP && hostPort != null)
{
Network.Connect(hostIP, hostPort);
}
}
function getServerInfo(a: int){
//Get the host info such as game type also
}
I'm sorry if this is quite a burden for someone to answer. So if you didn't get the message my main question is. Host can I receive hosts for games and not display the IP address yet still connect?
Comment
Your answer
Follow this Question
Related Questions
More like a bulletin than chat box 0 Answers
Setting Scroll View Width GUILayout 1 Answer
networkview + GUI 2 Answers