public void SetServerList(Dictionary <string, object>[] serverarr) { if (serverarr == null) { return; } if (serverMgr.GetInstance().serverkeymap.Count != 0) { serverMgr.GetInstance().serverkeymap.Clear(); } if (serverMgr.GetInstance().serverlist.Count != 0) { serverMgr.GetInstance().serverlist.Clear(); } for (int i = 0; i < serverarr.Length; i++) { ServeData dater = new ServeData(); dater.name = serverarr[i]["name"].ToString(); dater.ip = serverarr[i]["ip"].ToString(); dater.port = int.Parse(serverarr[i]["port"].ToString()); dater.state = byte.Parse(serverarr[i]["state"].ToString()); dater.Desc = serverarr[i]["desc"].ToString(); dater.areaId = int.Parse(serverarr[i]["areaId"].ToString()); dater.playerId = uint.Parse(serverarr[i]["playerId"].ToString()); if (dater.playerId != 0) { if (serverarr[i].ContainsKey("playerName")) { dater.playerName = serverarr[i]["playerName"].ToString(); } if (serverarr[i].ContainsKey("heroId")) { dater.heroId = long.Parse(serverarr[i]["heroId"].ToString()); } } serverMgr.GetInstance().serverkeymap.Add(dater.areaId, dater.name); serverMgr.GetInstance().serverlist.Add(dater); if (FSDataNodeTable <UIGameAfficheNode> .GetSingleton().DataNodeList != null) { foreach (var item in FSDataNodeTable <UIGameAfficheNode> .GetSingleton().DataNodeList.Values) { if (item.id == 1) { if ((serverMgr.GetInstance().GetGameAfficheStart() * 100) != (item.version * 100)) { Control.ShowGUI(UIPanleID.UIGameAffiche, EnumOpenUIType.DefaultUIOrSecond); serverMgr.GetInstance().SetGameAfficheStart(item.version); serverMgr.GetInstance().saveData(); } } } } // UISelectServer.Instance.InitServerList(); } Control.ShowGUI(UIPanleID.UI_SelectServer, EnumOpenUIType.DefaultUIOrSecond, false); }
void InitServerList(Dictionary <string, object>[] serverarr) { for (int i = 0; i < serverarr.Length; i++) { ServeData dater = new ServeData(); dater.name = serverarr[i]["name"].ToString(); dater.ip = serverarr[i]["ip"].ToString(); dater.port = int.Parse(serverarr[i]["port"].ToString()); dater.state = byte.Parse(serverarr[i]["state"].ToString()); dater.Desc = serverarr[i]["desc"].ToString(); dater.areaId = int.Parse(serverarr[i]["areaId"].ToString()); dater.playerId = uint.Parse(serverarr[i]["playerId"].ToString()); if (dater.playerId != 0) { if (serverarr[i].ContainsKey("playerName")) { dater.playerName = serverarr[i]["playerName"].ToString(); } if (serverarr[i].ContainsKey("heroId")) { dater.heroId = long.Parse(serverarr[i]["heroId"].ToString()); } } serverMgr.GetInstance().serverkeymap.Add(dater.areaId, dater.name); serverMgr.GetInstance().serverlist.Add(dater); } Globe.SelectedServer = serverMgr.GetInstance().serverlist[serverarr.Length - 1]; UISelectServer.Instance.InitServerList(); }
public override void Info(object obj) { if (obj == null) { } else { ServeData svdata = (ServeData)obj; if (svdata.state == 1) { label.text = svdata.name;// (index + 1) + " 区"; } else { label.text = svdata.name + svdata.Desc; } } }
public void GetServedrDate(Dictionary <string, object> serverlist) { ServeData data = new ServeData(); if (serverlist.ContainsKey("descd")) { data.Desc = serverlist["desc"].ToString(); } if (serverlist.ContainsKey("ip")) { data.ip = serverlist["ip"].ToString(); } if (serverlist.ContainsKey("areaId")) { data.areaId = int.Parse(serverlist["areaId"].ToString()); } if (serverlist.ContainsKey("playerId")) { data.playerId = uint.Parse(serverlist["playerId"].ToString()); } if (serverlist.ContainsKey("name")) { data.name = serverlist["name"].ToString(); } if (serverlist.ContainsKey("state")) { data.state = byte.Parse(serverlist["state"].ToString()); } if (serverlist.ContainsKey("port")) { data.port = int.Parse(serverlist["port"].ToString()); } Globe.SelectedServer = data; }