// 等获取到服务器配置文件再调用 public void init() { // 优先使用热更新的代码 if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("LoginScript_hotfix", "init")) { ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.LoginScript_hotfix", "init", null, null); return; } try { LoginServiceSocket.create(); NetLoading.getInstance().Show(); LoginServiceSocket.s_instance.setOnLoginService_Connect(onSocketConnect); LoginServiceSocket.s_instance.setOnLoginService_Receive(onSocketReceive); LoginServiceSocket.s_instance.setOnLoginService_Close(onSocketClose); LoginServiceSocket.s_instance.startConnect(); } catch (Exception ex) { LogUtil.Log(ex.Message); } }
void Awake() { s_instance = this.GetComponent <LoginServiceSocket>(); m_socketUtil = new SocketUtil(); m_socketUtil.init(NetConfig.s_loginService_ip, NetConfig.s_loginService_yuming, NetConfig.s_loginService_port); m_socketUtil.setOnSocketEvent_Connect(onSocketConnect); m_socketUtil.setOnSocketEvent_Receive(onSocketReceive); m_socketUtil.setOnSocketEvent_Close(onSocketClose); m_socketUtil.setOnSocketEvent_Stop(onSocketStop); //DontDestroyOnLoad(gameObject); }