private void ConnectGameServer(string ip, int port) { System.Action <ClientType> connectSuccess = ( ClientType clientType ) => { DataManager.GetInstance().RegisterDataServerMessageHandler(); MultiDeviceListenerManager.RegisterHandler(); DebugToScreen.RegisterHandler(); HeartBeat.RegisterGameHeartMessageHandler(); NetworkManager.RegisterServerMessageHandler(MsgCode.LoginGameServerMessage, HandleLoginGameServerFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.CheckNoviceGuidanceMessage, HandleRegisterCheckNoviceGudanceFeedback); MessageDispatcher.PostMessage(MessageType.ConnectGameServer_GM); SendLoginGameServerMessage(); SendCheckNoviceGuidanceMessage(); ConnectSocialServer(socialServerIP, socialServerPort); }; NetworkManager.Connect(ServerType.GameServer, ip, port, connectSuccess, OnConnectGameServerFailed); }
private void OnConnectLobbyServer(ClientType clientType) { DebugUtils.Log(DebugUtils.Type.AsyncSocket, "Success! Connected to LobbyServer " + clientType); HeartBeat.RegisterLobbyHeartMessageHandler(); MultiDeviceListenerManager.RegisterHandler(); DebugToScreen.RegisterHandler(); NetworkManager.RemoveServerMessageHandler(ServerType.GameServer, MsgCode.MatchReadyDataMessage, HandleMatchReadyDataFeedback); NetworkManager.RemoveServerMessageHandler(ServerType.GameServer, MsgCode.MatchReadyDataRefreshMessage, HandleMatchReadyDataRefreshFeedback); NetworkManager.RemoveServerMessageHandler(ServerType.GameServer, MsgCode.ApplyRoomMessage, HandleApplyRoomFeedback); NetworkManager.RemoveServerMessageHandler(ServerType.GameServer, MsgCode.ChangeBattleConfigMessage, HandleChangeBattleConfigFeedback); NetworkManager.RemoveServerMessageHandler(ServerType.GameServer, MsgCode.InvitationMatchMessage, HandleInvationMatchFeedback); NetworkManager.RemoveServerMessageHandler(ServerType.GameServer, MsgCode.InvitationNoticeMessage, HandleInvationNoticeFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.MatchMessage, HandleMatchFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.BattleMessage, HandleBattleMessageFeedback); //NetworkManager.RegisterServerMessageHandler( MsgCode.NoticeMessage, HandleNoticeMessageFeedback ); SendApplyingMatchC2S(); }
private void OnConnectGameServer(ClientType clientType) { NetworkManager.RemoveServerMessageHandler(ServerType.LobbyServer, MsgCode.MatchMessage, HandleMatchFeedback); NetworkManager.RemoveServerMessageHandler(ServerType.LobbyServer, MsgCode.BattleMessage, HandleBattleMessageFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.InvitationMatchMessage, HandleInvationMatchFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.InvitationNoticeMessage, HandleInvationNoticeFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.ApplyRoomMessage, HandleApplyRoomFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.ChangeBattleConfigMessage, HandleChangeBattleConfigFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.MatchReadyDataMessage, HandleMatchReadyDataFeedback); NetworkManager.RegisterServerMessageHandler(MsgCode.MatchReadyDataRefreshMessage, HandleMatchReadyDataRefreshFeedback); DebugUtils.Log(DebugUtils.Type.AsyncSocket, "Success! Connected to GameServer " + clientType); //DataManager.GetInstance().RegisterDataServerMessageHandler(); HeartBeat.RegisterGameHeartMessageHandler(); MultiDeviceListenerManager.RegisterHandler(); DebugToScreen.RegisterHandler(); view.OpenMatchUI(); }