public void OnSendChatRsp(uint iMessageType, object kParam) { NetworkMessageParam param = kParam as NetworkMessageParam; SendChatRsp rsp = param.rsp as SendChatRsp; Log4U.LogDebug(rsp.resultCode); if (rsp.resultCode == SendChatRsp.ResultCode.SUCCESS) { if (_waitSendChatDict.ContainsKey(param.msgID)) { SendChatReq req = param.req as SendChatReq; _waitSendChatDict[param.msgID].isSend = true; _waitSendChatDict.Remove(param.msgID); } MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.UPDATE_SEND_CHAT); } else { if (_waitSendChatDict.ContainsKey(param.msgID)) { SendChatReq req = param.req as SendChatReq; _waitSendChatDict[param.msgID].isSend = false; _waitSendChatDict.Remove(param.msgID); } MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.UPDATE_SEND_CHAT); } }
private IEnumerator BeginSendPacket <T>(ENetworkMessage networkMessage, T packet, uint timeoutMessage, byte[] msgIDBytes) where T : global::ProtoBuf.IExtensible { string msgID = BitConverter.ToString(msgIDBytes); lock (_msgIDDict) { _msgIDDict.Add(BitConverter.ToString(msgIDBytes), packet); } Log4U.LogInfo("Send : " + networkMessage + " msgID : " + msgID); DoBeginSendPacket <T>(networkMessage, packet, msgIDBytes); yield return(new WaitForSeconds(REQ_TIME_OUT)); lock (_msgIDDict) { if (_msgIDDict.ContainsKey(msgID)) { RemoveMsgID(msgID); NetworkMessageParam param = new NetworkMessageParam { msgID = msgID, req = packet, }; MessageDispatcher.GetInstance().DispatchMessage(timeoutMessage, param); DialogManager.GetInstance().CreateSingleButtonDialog("Send Packet Type : " + networkMessage + " msgID : " + msgID + " timeout "); } } }
public override void OnHide() { base.OnHide(); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.REGISTER_RSP, OnRegisterRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.LOGIN_RSP, OnLoginRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.REQ_TIMEOUT, OnReqTimeOut); }
public override void OnHide() { base.OnHide(); _mainMenuNaviBar.GetCurPanel().Hide(); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EUIMessage.UPDATE_CHAT_LIST, OnUpdateChatList); }
public override void OnShow(object param = null) { base.OnShow(param); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.LOGIN_RSP, OnLoginRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.REQ_TIMEOUT, OnReqTimeOut); _inputId.text = PlayerPrefs.GetString(GlobalVars.PREF_USER_ID); }
public override void OnShow(object param = null) { base.OnShow(param); _inputUserID.text = ""; _buttonSearchFriend.interactable = false; MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.GET_USERINFO_RSP, OnGetUserInfoRsp); }
public void OnChangeIP(string[] args) { if (args.Length >= 2) { GlobalVars.IPAddress = args[1]; MessageDispatcher.GetInstance().DispatchMessageAsync((uint)EModelMessage.SOCKET_DISCONNECTED); } }
public override void OnHide() { base.OnHide(); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EUIMessage.UPDATE_RECEIVE_CHAT, OnUpdateReceiveChat); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EUIMessage.UPDATE_SEND_CHAT, OnUpdateSendChat); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EUIMessage.DELETE_CHAT_ITEM, OnDeleteChatItem); }
public void OnClickToggleMemeber(bool check) { MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.TOGGLE_GROUP_MEMBER, new ToggleGroupMemberParam { userID = _userItem.userId, check = check, }); }
public override void OnShow(object param = null) { base.OnShow(param); _mainMenuNaviBar.GetCurPanel().Show(); _imageUnReadChat.gameObject.SetActive(GlobalChat.GetInstance().IsAnyUnReadChat()); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.UPDATE_CHAT_LIST, OnUpdateChatList); }
private void FinishConnection(IAsyncResult ar) { _socket.EndConnect(ar); if (_socket.Connected) { MessageDispatcher.GetInstance().DispatchMessageAsync((uint)EModelMessage.SOCKET_CONNECTED, null); } }
public override void Release() { MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.SOCKET_CONNECTED, OnSocketConnected); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.SOCKET_DISCONNECTED, OnSocketDisConnected); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.KEEP_ALIVE_SYNC, OnKeepAliveSync); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.REQ_FINISH, OnReqFinish); CloseConnection(); }
public void OnConfirmDeleteChatBubble() { MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.DELETE_CHAT_ITEM, new DeleteChatParam { chatBubbleFrame = this, chatDataItem = _chatDataItem, }); Destroy(gameObject); }
public override void Show(object param = null) { base.Show(param); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.UPDATE_PERSONAL_DETAIL, OnUpdatePersonalDetail); _laeblName.text = GlobalUser.GetInstance().UserName; _labelId.text = GlobalUser.GetInstance().UserId; UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + GlobalUser.GetInstance().HeadIndex); }
public override void Release() { MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.GET_PERSONALINFO_RSP, OnGetPersonalInfoRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.LOGIN_RSP, OnLoginRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.PERSONALSETTINGS_RSP, OnPersonalSetRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.PERSONALSETTINGS_RSP, OnLogOutRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.SOCKET_CONNECTED, TryLoginWithPref); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnOffLineSync); SaveUserInfo(); }
public void OnReceiveChatSync(uint iMessageType, object kParam) { ReceiveChatSync rsp = kParam as ReceiveChatSync; foreach (var chatItem in rsp.chatData) { AddChatDataItem(MiniConverter.ChatItemToDataItem(chatItem)); } MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.UPDATE_CHAT_LIST, null); MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.UPDATE_RECEIVE_CHAT, null); }
public void OnSendChatTimeOut(uint iMessageType, object kParam) { NetworkMessageParam param = kParam as NetworkMessageParam; if (_waitSendChatDict.ContainsKey(param.msgID)) { SendChatReq req = param.req as SendChatReq; _waitSendChatDict[param.msgID].isSend = false; _waitSendChatDict.Remove(param.msgID); } MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.UPDATE_SEND_CHAT); }
public override void Init() { base.Init(); _friendDict = new Dictionary <string, UserItem>(); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.GET_PERSONALINFO_RSP, OnGetPersonalInfoRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.CHANGE_FRIEND_SYNC, OnChangeFriendSync); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.LOGOUT_RSP, OnLogOut); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnLogOut); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.TRY_LOGIN, OnTryLogin); LoadFriendDict(); }
public override void Release() { base.Release(); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.GET_PERSONALINFO_RSP, OnGetPersonalInfoRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.CHANGE_FRIEND_SYNC, OnChangeFriendSync); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.LOGOUT_RSP, OnLogOut); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnLogOut); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.TRY_LOGIN, OnTryLogin); SaveFriendDict(); }
public void TryLogin(string id, string password) { LoginReq req = new LoginReq { userId = id, userPassword = password }; _userId = id; _userPassword = password; MessageDispatcher.GetInstance().DispatchMessage((uint)EModelMessage.TRY_LOGIN, null); NetworkManager.GetInstance().SendPacket <LoginReq>(ENetworkMessage.LOGIN_REQ, req); }
public void OnGetPersonalInfoRsp(uint iMessageType, object kParam) { NetworkMessageParam param = kParam as NetworkMessageParam; GetPersonalInfoRsp rsp = param.rsp as GetPersonalInfoRsp; GetPersonalInfoReq req = param.req as GetPersonalInfoReq; if (rsp.resultCode == GetPersonalInfoRsp.ResultCode.SUCCESS && req.userInfo) { _userName = rsp.userInfo.userName; _headIndex = rsp.userInfo.headIndex; MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.UPDATE_PERSONAL_DETAIL, null); } }
public override void Release() { base.Release(); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.RECEIVE_CHAT_SYNC, OnReceiveChatSync); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.SEND_CHAT_RSP, OnSendChatRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.SEND_CHAT_TIMEOUT, OnSendChatTimeOut); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.LOGIN_RSP, OnLoginRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.LOGOUT_RSP, OnLogOutRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnLogOutRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.TRY_LOGIN, OnTryLogin); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.CHANGE_FRIEND_SYNC, OnChangeFriendSync); SaveLogDict(); }
public override void Release() { base.Release(); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.GET_PERSONALINFO_RSP, OnGetPersonalInfoRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.CHANGE_GROUP_SYNC, OnChangeGroupSync); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.CHANGE_GROUP_RSP, OnChangeGroupRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.GET_USERINFO_RSP, OnGetUserInfo); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)EModelMessage.TRY_LOGIN, OnTryLogin); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.LOGOUT_RSP, OnLogOutRsp); MessageDispatcher.GetInstance().UnRegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnLogOutRsp); SaveGroupDict(); }
public override void OnShow(object param = null) { base.OnShow(param); if (param != null) { _chatLog = param as ChatLog; } RefreshChatLog(); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.UPDATE_RECEIVE_CHAT, OnUpdateReceiveChat); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.UPDATE_SEND_CHAT, OnUpdateSendChat); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EUIMessage.DELETE_CHAT_ITEM, OnDeleteChatItem); }
public override void Init() { Log4U.LogInfo("Client Running..."); _msgIDDict = new Dictionary <string, IExtensible>(); InitForcePushMessageType(); InitNeedReqMessageType(); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.SOCKET_CONNECTED, OnSocketConnected); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.SOCKET_DISCONNECTED, OnSocketDisConnected); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.KEEP_ALIVE_SYNC, OnKeepAliveSync); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.REQ_FINISH, OnReqFinish); MessageDispatcher.GetInstance().DispatchMessageAsync((uint)EModelMessage.SOCKET_DISCONNECTED, null); }
public void OnChangeFriendSync(uint iMessageType, object kParam) { ChangeFriendSync rsp = kParam as ChangeFriendSync; if (rsp.changeType == ChangeFriendSync.ChangeType.ADD) { _friendDict.Add(rsp.userItem.userId, rsp.userItem); } else if (rsp.changeType == ChangeFriendSync.ChangeType.DELETE) { _friendDict.Remove(rsp.userItem.userId); } MessageDispatcher.GetInstance().DispatchMessage((uint)EUIMessage.UPDATE_FRIEND_DETAIL); }
public override void Init() { base.Init(); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.GET_PERSONALINFO_RSP, OnGetPersonalInfoRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.CHANGE_GROUP_SYNC, OnChangeGroupSync); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.CHANGE_GROUP_RSP, OnChangeGroupRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.GET_USERINFO_RSP, OnGetUserInfo); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.TRY_LOGIN, OnTryLogin); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.LOGOUT_RSP, OnLogOutRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnLogOutRsp); StartCoroutine(QueryMemberData()); }
public override void Init() { MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.GET_PERSONALINFO_RSP, OnGetPersonalInfoRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.LOGIN_RSP, OnLoginRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.PERSONALSETTINGS_RSP, OnPersonalSetRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.LOGOUT_RSP, OnLogOutRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.SOCKET_CONNECTED, TryLoginWithPref); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnOffLineSync); if (PlayerPrefs.HasKey(GlobalVars.PREF_USER_ID)) { _userId = PlayerPrefs.GetString(GlobalVars.PREF_USER_ID); } LoadUserInfo(); }
public override void Init() { base.Init(); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.RECEIVE_CHAT_SYNC, OnReceiveChatSync); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.SEND_CHAT_RSP, OnSendChatRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.SEND_CHAT_TIMEOUT, OnSendChatTimeOut); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.LOGIN_RSP, OnLoginRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.LOGOUT_RSP, OnLogOutRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.OFFLINE_SYNC, OnLogOutRsp); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)EModelMessage.TRY_LOGIN, OnTryLogin); MessageDispatcher.GetInstance().RegisterMessageHandler((uint)ENetworkMessage.CHANGE_FRIEND_SYNC, OnChangeFriendSync); _chatLogDict = new Dictionary <string, ChatLog>(); _waitSendChatDict = new Dictionary <string, ChatDataItem>(); LoadLogDict(); }
public void OnGetPersonalInfoRsp(uint iMessageType, object kParam) { NetworkMessageParam param = kParam as NetworkMessageParam; GetPersonalInfoRsp rsp = param.rsp as GetPersonalInfoRsp; GetPersonalInfoReq req = param.req as GetPersonalInfoReq; if (rsp.resultCode == GetPersonalInfoRsp.ResultCode.SUCCESS && req.friendInfo) { _friendDict.Clear(); foreach (UserItem friend in rsp.friends) { _friendDict[friend.userId] = friend; } MessageDispatcher.GetInstance().DispatchMessageAsync((uint)EUIMessage.UPDATE_CHAT_LIST, null); } }