public void SetCurrServer(ClientServerNode server) { m_CurrServer = new XServer(); m_CurrServer.ID = server.SvrID; m_CurrServer.Name = server.SvrName; m_CurrServer.State = (int)server.SvrState; }
//响应账号登录成功 private void OnAck_AccountLogin(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); AccountLoginAck ack = Serializer.Deserialize <AccountLoginAck>(ms); ClientServerNode newNode = new ClientServerNode(); newNode.SvrID = ack.LastSvrID; newNode.SvrName = ack.LastSvrName; LoginModule.Instance.SetCurrServer(newNode); LoginModule.Instance.LastAccountID = ack.AccountID; GTEventCenter.FireEvent(GTEventID.TYPE_ACCLOGIN_CALLBACK); }
private void OnAck_AccountLogin(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); AccountLoginAck ack = Serializer.Deserialize <AccountLoginAck>(ms); if (GTItemHelper.ShowNetworkError(ack.RetCode) == false) { return; } ClientServerNode newNode = new ClientServerNode(); newNode.SvrID = ack.LastSvrID; newNode.SvrName = ack.LastSvrName; MLLogin.Instance.SetCurrServer(newNode); MLLogin.Instance.LastAccountID = ack.AccountID; GTEventCenter.FireEvent(GTEventID.TYPE_LOGIN_ACCOUNT_LOGIN); }
protected override void OnEnable() { List <ClientServerNode> list = MLLogin.Instance.GetServerList(); for (int i = 0; i < list.Count; i++) { GameObject item = NGUITools.AddChild(grid.gameObject, temp); item.SetActive(true); ClientServerNode data = list[i]; item.transform.Find("Label").GetComponent <UILabel>().text = data.SvrName; UIEventListener.Get(item).onClick = (go) => { MLLogin.Instance.SetCurrServer(data); currSeverLabel.text = data.SvrName; GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK2); GTWindowManager.Instance.GetWindow <UILogin>(EWindowID.UILogin).ShowCurrServer(); }; } }