public override void OnClickSendButton() { if (_inputChat.text == "") { return; } ChatDataItem chatDataItem = new ChatDataItem { sendUserId = GlobalUser.GetInstance().UserId, receiveUserId = _groupItem.groupId, date = System.DateTime.Now.Ticks, chatType = ChatDataItem.ChatType.TEXT, chatBody = _inputChat.text, targetType = ChatDataItem.TargetType.GROUP, }; GlobalChat.GetInstance().SendChatReq(chatDataItem); AddBubbleFrame(chatDataItem); UpdateChatBubbleGrid(); _inputChat.text = ""; }
public void SetUserItemData() { switch (_chatDataItem.targetType) { case ChatDataItem.TargetType.SYSTEM: UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Chat, "010"); break; case ChatDataItem.TargetType.INDIVIDUAL: _userItem = GlobalUser.GetInstance().Self; if (_chatDataItem.sendUserId != GlobalUser.GetInstance().UserId) { _userItem = GlobalContacts.GetInstance().GetUserItemById(_chatDataItem.sendUserId); } UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + _userItem.headIndex); break; case ChatDataItem.TargetType.GROUP: _userItem = GlobalGroup.GetInstance().GetGroupMember(_chatDataItem.sendUserId); if (_userItem != null) { UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + _userItem.headIndex); } break; default: break; } }
private void SetIsSend(Transform parent) { if (_chatDataItem.sendUserId != GlobalUser.GetInstance().UserId) { return; } GameObject buttonReSend = parent.Find("ReSendButton").gameObject; GameObject labelSending = parent.Find("SendingLabel").gameObject; buttonReSend.SetActive(false); labelSending.SetActive(false); if (!_chatDataItem.isSend) { if (GlobalChat.GetInstance().IsChatDataItemSending(_chatDataItem)) { labelSending.SetActive(true); } else { buttonReSend.SetActive(true); buttonReSend.GetComponent <Button>().onClick.AddListener(OnClickReSendButton); } } }
private void InitButtons() { _buttonAddFriend.gameObject.SetActive(false); _buttonDeleteFriend.gameObject.SetActive(false); _buttonBeginChat.gameObject.SetActive(false); _buttonAddFriend.onClick.RemoveAllListeners(); _buttonDeleteFriend.onClick.RemoveAllListeners(); _buttonBeginChat.onClick.RemoveAllListeners(); if (_userItem.userId == GlobalUser.GetInstance().UserId) { return; } else if (GlobalContacts.GetInstance().Contains(_userItem.userId)) { _buttonBeginChat.gameObject.SetActive(true); _buttonDeleteFriend.gameObject.SetActive(true); _buttonBeginChat.onClick.AddListener(OnClickBeginChatButton); _buttonDeleteFriend.onClick.AddListener(OnClickDeleteFriendButton); } else if (!GlobalContacts.GetInstance().Contains(_userItem.userId)) { _buttonAddFriend.gameObject.SetActive(true); _buttonAddFriend.onClick.AddListener(OnClickAddFriendButton); } }
protected void AddBubbleFrame(ChatDataItem chatDataItem) { EUIType uiType = (chatDataItem.sendUserId == GlobalUser.GetInstance().UserId) ? EUIType.PersonalChatBubbleFrame : EUIType.FriendChatBubbleFrame; GameObject bubbleFrame = UIManager.GetInstance().AddChild(_gridChatBubble.gameObject, uiType); bubbleFrame.GetComponent <ChatBubbleFrame>().Show(chatDataItem); _chatBubbleList.Add(bubbleFrame.GetComponent <ChatBubbleFrame>()); }
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 void PushFirstState() { if (GlobalUser.GetInstance().IsEnterMainMenu == false) { StateManager.GetInstance().PushState <LoginPanel>(EUIType.LoginPanel); } else { StateManager.GetInstance().PushState <MainMenuPanel>(EUIType.MainMenuPanel); } }
public void OnClickExitGroup() { ChangeGroupReq req = new ChangeGroupReq { changeType = ChangeGroupReq.ChangeType.DELETE, groupId = _groupItem.groupId, }; req.userId.Add(GlobalUser.GetInstance().UserId); NetworkManager.GetInstance().SendPacket <ChangeGroupReq>(ENetworkMessage.CHANGE_GROUP_REQ, req); }
public void OnRegisterRsp(uint iMessageType, object kParam) { RegisterRsp rsp = kParam as RegisterRsp; Log4U.LogInfo(rsp.resultCode); if (rsp.resultCode == RegisterRsp.ResultCode.SUCCESS) { GlobalUser.GetInstance().TryLogin(_userID, _userPassword); } else { DialogManager.GetInstance().CreateSingleButtonDialog(rsp.resultCode.ToString()); OnValueChangeRegisterInfo(); } }
public override void OnClickSendEmotionButton(int index) { ChatDataItem chatDataItem = new ChatDataItem { sendUserId = GlobalUser.GetInstance().UserId, receiveUserId = _groupItem.groupId, date = System.DateTime.Now.Ticks, chatType = ChatDataItem.ChatType.IMAGE, chatBody = index.ToString(), targetType = ChatDataItem.TargetType.GROUP, }; GlobalChat.GetInstance().SendChatReq(chatDataItem); AddBubbleFrame(chatDataItem); UpdateChatBubbleGrid(); }
private void AddChatDataItem(ChatDataItem chatDataItem) { string chatID = null; if (chatDataItem.targetType == ChatDataItem.TargetType.INDIVIDUAL) { if (chatDataItem.sendUserId == GlobalUser.GetInstance().UserId) { chatID = chatDataItem.receiveUserId; } else { chatID = chatDataItem.sendUserId; } } else { chatID = chatDataItem.receiveUserId; } if (!_chatLogDict.ContainsKey(chatID)) { ChatLog chatLog = new ChatLog { chatID = chatID, }; _chatLogDict.Add(chatID, chatLog); } if (chatDataItem.sendUserId == GlobalUser.GetInstance().UserId) { chatDataItem.isRead = true; } _chatLogDict[chatID].itemList.Remove(chatDataItem); _chatLogDict[chatID].date = chatDataItem.date; _chatLogDict[chatID].targetType = chatDataItem.targetType; _chatLogDict[chatID].itemList.Add(chatDataItem); }
public UserItem GetGroupMember(string userID) { if (_groupMemberDict.ContainsKey(userID)) { return(_groupMemberDict[userID]); } else { UserItem userItem = GlobalContacts.GetInstance().GetUserItemById(userID); if (userID == GlobalUser.GetInstance().UserId) { userItem = GlobalUser.GetInstance().Self; } if (userItem == null) { _waitQueryMemberSet.Add(userID); } return(userItem); } }
private string GetGroupDirPath() { return(GlobalUser.GetInstance().GetUserDir() + "/Group"); }
private string GetContactsDirPath() { return(GlobalUser.GetInstance().GetUserDir() + "/Contacts"); }
public void OnClickLoginButton() { GlobalUser.GetInstance().TryLogin(_inputId.text, _inputPassword.text); _buttonLogin.interactable = false; }
public void OnClickSetName() { DialogManager.GetInstance().CreateDoubleButtonInputDialog("修改昵称", "昵称", "长度不能超过6", GlobalUser.GetInstance().UserName, InputField.ContentType.Standard, OnConfirmChange); _personalSetType = PersonalSetType.NAME; }
public void OnClickSetPassword() { DialogManager.GetInstance().CreateDoubleButtonInputDialog("修改密码", "密码", "长度不能超过20", GlobalUser.GetInstance().UserPassword, InputField.ContentType.Password, OnConfirmChange); _personalSetType = PersonalSetType.PASSWORD; }
public void OnUpdatePersonalDetail(uint iMessageType, object kParam) { _laeblName.text = GlobalUser.GetInstance().UserName; UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + GlobalUser.GetInstance().HeadIndex); }
private string GetChatDirPath() { return(GlobalUser.GetInstance().GetUserDir() + "/Chat"); }