/// <summary> /// 响应接收到服务器设置加密验证消息 /// </summary> /// <param name="args"></param> public static void on_set_encode(VarList args) { ///通知服务器接收完成 IGameSender iGameSender = Game.Instance.mGameSender; if (iGameSender == null) { LogSystem.Log("Error!! LoginStage::on_set_encode iGameSender is null"); return; } iGameSender.ClientRetEncode(); }
/* @brief:登录成功回调,返回角色列表 * @param: args 回调参数列表 * @return void */ public static void on_login_succeed(VarList args) { ConnectStage.mbTryingConnect = false; WorldStage.mbReConnected = false; miErrorCode = 0; if (ConnectStage.isChangeRole) { Game.Instance.ReChooseRoleClear(); } IGameReceiver iGameRecv = Game.Instance.mGameRecv; if (iGameRecv == null) { LogSystem.Log("Error!! LoginStage::on_login_succeed iGameRecv is null"); return; } loginStatus = true; IGameSender iGameSender = Game.Instance.mGameSender; ///如果重连发来了角色列表,超过保护时间了,直接连吧 // if( (ConnectStage.mbNeedReConnect || ConnectStage.mbSecondTimeConnect) && !string.IsNullOrEmpty(ConnectStage.mstrRoleName)) // { // mstrAutoChooseName = ConnectStage.mstrRoleName; // } int roleCount = iGameRecv.GetRoleCount(); //LoginUI ui = UIManager.Instance.GetUI<LoginUI>("LoginUI"); //if (ui == null) //{ // return; //} //// 无角色,跳转创角界面 //// 有角色,跳转选角界面 //ui.SwitchUI(roleCount == 0 ? LoginUIState.LoginUIState_CreateRole : LoginUIState.LoginUIState_ChooseRole); }
/// <summary> /// 初始化网络模块 /// </summary> public void InitNetWork() { if (mbNetInit) { mClientNet.ShutDown(); mClientNet.UnInit(); } try { InitVerify(); mbNetInit = mClientNet.Init(GlobalData.mDeviceMac, null, null); mGameSock = mClientNet.GetGameSock(); mGameClient = mClientNet.GetGameClient(); mGameRecv = mGameSock.GetGameReceiver(); mGameSender = mGameSock.GetGameSender(); GameCommand.SetSender(mGameSender); } catch (System.Exception e) { LogSystem.LogError("InitNetWork::", e.ToString()); } }
public static void SetSender(IGameSender gameSender) { mGameSender = gameSender; }