public void CancelSearch() { //发送取消请求 SearchCav.SetActive(false); CancelSearchReq req = new CancelSearchReq(); req.UserId = GameEntry.NetData.mUserData.UserId; NetWorkChannel.send(req); }
public void SearchUser() { SearchCav.SetActive(true); MatchReq matchReq = new MatchReq(); matchReq.UserId = GameEntry.NetData.mUserData.UserId; //searchReq.Account = loginRes.Account; //searchReq.UserId = loginRes.UserId; matchReq.Gold = GameEntry.NetData.mUserData.Gold; matchReq.Cup = GameEntry.NetData.mUserData.Cup; matchReq.UserName = GameEntry.NetData.mUserData.UserName; NetWorkChannel.send(matchReq); //m_procedureHome.StartGame(); }
// Every frame will be executed protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds) { base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds); if (!m_GameInit && GameEntry.LockManager.mActorDic.Count == 2) { GameInitReq gameInitReq = new GameInitReq(); gameInitReq.Success = true; Debug.Log("客户端 发送消息给服务器,玩家都实例化成功"); //客户端 发送消息给服务器,玩家都实例化成功 NetWorkChannel.send(gameInitReq); m_GameInit = true; } else { return; } // Monitor if the game is over if (m_CurrentGame != null && !m_CurrentGame.GameOver) { m_CurrentGame.Update(elapseSeconds, realElapseSeconds); return; } // change the flag of m_GotoMenu, and init the delaySecond, start the timer if (!m_GotoMenu) { m_GotoMenu = true; m_GotoMenuDelaySeconds = 0; } // accumulate the elapsed time of each frame m_GotoMenuDelaySeconds += elapseSeconds; // when the cumulative time exceed the GameOverDelayedSeconds, then Switch scene if (m_GotoMenuDelaySeconds >= GameOverDelayedSeconds) { //Debug.Log("游戏结束,跳转到大厅界面"); procedureOwner.SetData <VarInt>(Constant.ProcedureData.NextSceneId, GameEntry.Config.GetInt("Scene.Home")); ChangeState <ProcedureChangeScene>(procedureOwner); } }
public void LoginBtnClick() { string userName = UserName.text; string pwd = PassWord.text; if (userName == null || ("").Equals(userName) || (" ").Equals(userName)) { GameEntry.UI.OpenDialog(new DialogParams() { Mode = 1, Title = "用户名", Message = "请填写用户名", ConfirmText = "确认", OnClickConfirm = Return2Game }); } else if (pwd == null || ("").Equals(pwd) || (" ").Equals(pwd)) { GameEntry.UI.OpenDialog(new DialogParams() { Mode = 1, Title = "密码", Message = "请填写密码", ConfirmText = "确认", OnClickConfirm = Return2Game }); } else { string host = Host.text; int port = Convert.ToInt32(Port.text); NetWorkChannel.InitNetWork(host, port); System.Threading.Thread.Sleep(3000); LoginReq loginReq = new LoginReq(); loginReq.Username = userName; loginReq.Password = pwd; NetWorkChannel.send(loginReq); } }
private static void Send(PacketBase packet) { NetWorkChannel.send(packet); }