//Rect rect=new Rect(680,Screen.height-50,1000,1000); //GUIStyle style=new GUIStyle(); void OnDestroy() { if (netSession != null) { NetFrameMgr.GetInstance().CloseNetSession(netSession.GetSessionID()); } if (chatSession != null) { NetFrameMgr.GetInstance().CloseNetSession(chatSession.GetSessionID()); } }
public static void ReChangeAccount() { //main.SendNoReturnNetMessage(PlayerMessageRegister.CLOSE_GAME, null); if (netSession != null) { NetFrameMgr.GetInstance().CloseNetSession(netSession.GetSessionID()); netSession = null; } if (chatSession != null) { NetFrameMgr.GetInstance().CloseNetSession(chatSession.GetSessionID()); chatSession = null; } NetFrameMgr.GetInstance().Shutdown(); GameObject parentUI = GameObject.Find("UI"); //gameGlobal.g_curPage.hide(); for (int i = parentUI.transform.GetChildCount() - 1; i > 0; i--) { Destroy(parentUI.transform.GetChild(i).gameObject); } parentUI = GameObject.Find("UI Root (2D)/Camera/Anchor/Panel"); for (int i = parentUI.transform.GetChildCount() - 1; i > 0; i--) { Destroy(parentUI.transform.GetChild(i).gameObject); } //shutDownNet = true; fileMgr.GetInstance().monsterCsvData.dataDic.Clear(); fileMgr.GetInstance().resouceCsvData.dataDic.Clear(); //fileMgr.GetInstance().guideCsvData.dataDic.Clear(); //fileMgr.GetInstance().NameCsvData.dataDic.Clear(); //fileMgr.GetInstance().vipCsvData.dataDic.Clear(); fileMgr.GetInstance().skillCsvData.dataDic.Clear(); fileMgr.GetInstance().buffCsvData.dataDic.Clear(); fileMgr.GetInstance().playerCsvData.dataDic.Clear(); fileMgr.GetInstance().itemCsvData.dataDic.Clear(); fileMgr.GetInstance().talkCsvData.dataDic.Clear(); //fileMgr.GetInstance().minLevelData.dataDic.Clear(); //fileMgr.GetInstance().searchingData.dataDic.Clear(); //fileMgr.GetInstance().achieveData.dataDic.Clear(); //fileMgr.GetInstance().titleData.dataDic.Clear(); fileMgr.GetInstance().petCsvData.dataDic.Clear(); fileMgr.GetInstance().skillLvCsvData.dataDic.Clear(); fileMgr.GetInstance().taskCsvData.dataDic.Clear(); fileMgr.GetInstance().expUpCsvData.dataDic.Clear(); //fileMgr.GetInstance().levelCsvData.dataDic.Clear(); //gameGlobal.g_loginUIPanel.show(); //gameGlobal.g_loginUIPanel.isBeginGame = true; }
static public void RegisterMessage() { NetFrameMgr.GetInstance().RegisterMsgHanle((ushort)NetWork.emNETMSG.emNET_MSG_JSON_UNZIP, MessgeHandle.HandleMsg2000); NetFrameMgr.GetInstance().RegisterMsgHanle((ushort)NetWork.emNETMSG.emNET_MSG_JSON_ZIP, MessgeHandle.HandleMsg2001); //NetFrameMgr.GetInstance().RegisterMsgHanle((ushort)NetWork.emNETMSG.emNET_MSG_JSON_ZIP, MessgeHandle.HandleMsg2001); //LoginMessageRegister.RegisterMessage(); //LevelMessageRegister.RegisterMessage(); //BuildingMessageRegister.RegisterMessage(); CommonMessageRegister.RegisterMessage(); //PlayerMessageRegister.RegisterMessage(); //PackageMessageRegister.RegisterMessage(); //ChatMessageRegister.RegisterMessage(); //FightAreaMessageRegister.RegisterMessage(); //AchieveMessageRegister.RegisterMessage(); }
public void Relogin() { if (netSession != null) { NetFrameMgr.GetInstance().CloseNetSession(netSession.GetSessionID()); netSession = null; } if (chatSession != null) { NetFrameMgr.GetInstance().CloseNetSession(chatSession.GetSessionID()); chatSession = null; } NetFrameMgr.GetInstance().Shutdown(); Reconnect(); //Invoke("Reconnect",10.0f); //bool connectRet = false; //netSession = NetFrameMgr.GetInstance().Connect(stringToEditSeverIP, Gameport, true, ref connectRet); //print("reconnect session id :" + netSession.GetSessionID()) ; }
static public bool InitNetWork() { if (fileMgr.GetInstance().config.connectServerIP == "") { return(false); } NetModuleInit netModuleInit = new NetModuleInit(); netModuleInit.bufferReserves = 10; netModuleInit.sendBufSize = 8192; netModuleInit.sendBufExtend = 6000; netModuleInit.rcvBufSize = 8192; netModuleInit.rcvBufExtend = 6000; netModuleInit.sessionInitCount = 4; netModuleInit.sessionExtendCount = 2; netModuleInit.msgBufferCounts = 4; netModuleInit.msgBufferSize = 8192; netModuleInit.netSessionClosedCallbackFunc = AppNetSessionClosed; netModuleInit.netSessionConnectedCallbackFunc = AppNetSesssionConnected; NetFrameMgr.GetInstance().Init(ref netModuleInit); GameMessgeHandle.MessageRegister.RegisterMessage(); string ip = fileMgr.GetInstance().config.userServerIP; bool connectRet = false; netSession = NetFrameMgr.GetInstance().Connect(stringToEditSeverIP, Gameport, true, ref connectRet); if (connectRet == true) { chatSession = NetFrameMgr.GetInstance().Connect(chatSeverIP, chatPort, true, ref connectRet); } return(true); }