private string SetTextColor(string text, enumChatType chatType){ switch(chatType) { case enumChatType.CHANEL_WORLD: text = "[ff0000]" + text + "[-]"; break; } return text; }
public ChatData(string playName, string text, enumChatType chatType, enumSysInfoType systemType, byte[] voiceData,float time,long userID) { this.playName = playName; this.text = SetTextColor(text, chatType); this.chatType = chatType; this.systemType = systemType; this.voiceData = voiceData; this.time = time; this.userID = userID; }
public override void OnLoadedUI(bool close3dTouch, object args) { base.OnLoadedUI(close3dTouch, args); _closeButton = transform.Find("chat_forward/botton_close").gameObject; _toggleSound = transform.Find("chat_forward/sound_swith").GetComponent <UIToggle>(); _chatTemplate = transform.Find("chat_forward/chat_scroll/chat_template").gameObject; _tableChatPanel = transform.Find("chat_forward/chat_scroll/Table").GetComponent <UITable>(); _chatScrollView = transform.Find("chat_forward/chat_scroll").GetComponent <UIScrollView>(); _chatPanel = transform.Find("chat_forward/chat_scroll").GetComponent <UIPanel>(); _gridChanel = transform.Find("chat_forward/grid_chanel").GetComponent <UIGrid>(); _chanelTemplate = transform.Find("chat_forward/chanel_button_template").gameObject; _sendButton = transform.Find("chat_forward/send_group/botton_send").gameObject; _recordButton = transform.Find("chat_forward/send_group/botton_v").gameObject; _inputBox = transform.Find("chat_forward/send_group").GetComponent <UIInput>(); _playTweeen = transform.Find("chat_forward/send_group/botton_menu").GetComponent <UIPlayTween>(); _popMenu = transform.Find("Panel/Pop"); _lockMessage = transform.Find("Panel/Message").gameObject; _labelLock = transform.Find("Panel/Message/Label").GetComponent <UILabel>(); chatDataList = ChatDataManager.GetInstance().chatDataList; _tablePosition = _tableChatPanel.transform.localPosition; _scrollPosition = _chatScrollView.transform.localPosition; _panelOffset = _chatPanel.clipOffset; needIgnoreList = new List <Transform> { _popMenu, _playTweeen.transform }; _chatInfoItems = new TableItemList <ChatDetailItem>(null, this); chatType = enumChatType.CHANEL_CURRENT; HideLockMessage(); _popMenu.gameObject.SetActive(false); _chanelTemplate.SetActive(false); _chatTemplate.SetActive(false); EventDelegate.Add(_inputBox.onChange, InputTextChange); EventDelegate.Add(_toggleSound.onChange, () => { _isAutoAudioList[(int)chatType] = _toggleSound.value; }); _chatScrollView.onMomentumMove = () => { if (CheckChatPanelBottom() && _lockMessgeNum > 0) { RefreshChangeTap(); } }; _gridChanel.CreateScrollView(_chanelTemplate, GameConst.ChanelList, FillChanelItem); RegistUIBase <ChatUIPopMenu>(_popMenu); RegistUIButton(_closeButton, CloseClick); RegistUIButton(_sendButton, SendClick); RegistUIButton(_recordButton, RecordClick); RegistUIButton(_lockMessage, LockClick); }
private string SetTextColor(string text, enumChatType chatType) { switch (chatType) { case enumChatType.CHANEL_WORLD: text = "[ff0000]" + text + "[-]"; break; } return(text); }
public ChatData(string playName, string text, enumChatType chatType, enumSysInfoType systemType, byte[] voiceData, float time, long userID) { this.playName = playName; this.text = SetTextColor(text, chatType); this.chatType = chatType; this.systemType = systemType; this.voiceData = voiceData; this.time = time; this.userID = userID; }
private void OnChatTapClicked(enumChatType chatType) { if (chatType == enumChatType.CHANEL_CURRENT) { chatDataList = ChatDataManager.GetInstance().chatDataList; } else { chatDataList = ChatDataManager.GetInstance().SortChatData(chatType); } RefreshChangeTap(); }
public void OnSendButtonClicked(UIInput iptChat, enumChatType chatType, string text) { if (iptChat.value == "" || iptChat.value == string.Empty) { return; } if (iptChat.value.Length > ChatDataManager.MAX_TEXT_LENGTH) { return; } ChatDataManager.GetInstance().AddHistory(text); SendMessage(text, chatType); iptChat.isSelected = false; iptChat.value = ""; }
public List <ChatData> SortChatData(enumChatType chatType) { List <ChatData> result; if (!mChatDataDict.TryGetValue(chatType, out result)) { result = new List <ChatData>(); for (int i = 0; i < mChatDataList.Count; i++) { if (mChatDataList[i].chatType == chatType) { result.Add(mChatDataList[i]); } } mChatDataDict[chatType] = result; } return(result); }
private void FillChanelItem(Transform fillItem, object data) { string title = data.ToString(); int index = GameConst.ChanelList.IndexOf(title); enumChatType chatType = (enumChatType)index; if (chatType == enumChatType.CHANEL_CURRENT) { fillItem.GetComponent <UIToggle>().startsActive = true; this.chatType = chatType; } _isAutoAudioList.Add(false); fillItem.Find("xuanzhong/Label").GetComponent <UILabel>().text = title; fillItem.Find("weixuan/Label").GetComponent <UILabel>().text = title; RegistUIButton(fillItem.gameObject, (go) => { this.chatType = chatType; OnChatTapClicked(chatType); _toggleSound.value = _isAutoAudioList[index]; }); }
public List<ChatData> SortChatData(enumChatType chatType) { List<ChatData> result; if (!mChatDataDict.TryGetValue(chatType, out result)) { result = new List<ChatData>(); for (int i = 0; i < mChatDataList.Count; i++) { if (mChatDataList[i].chatType == chatType) { result.Add(mChatDataList[i]); } } mChatDataDict[chatType] = result; } return result; }
public ChatData(string playName, string text, enumChatType chatType, enumSysInfoType systemType) : this(playName, text, chatType, systemType, null, 0, 0) { }
public void OnSendButtonClicked(UIInput iptChat,enumChatType chatType,string text){ if (iptChat.value == "" || iptChat.value == string.Empty) { return; } if (iptChat.value.Length > ChatDataManager.MAX_TEXT_LENGTH) { return; } ChatDataManager.GetInstance().AddHistory(text); SendMessage(text, chatType); iptChat.isSelected = false; iptChat.value = ""; }
public override void OnLoadedUI(bool close3dTouch, object args) { base.OnLoadedUI(close3dTouch, args); _closeButton = transform.Find("chat_forward/botton_close").gameObject; _toggleSound = transform.Find("chat_forward/sound_swith").GetComponent<UIToggle>(); _chatTemplate = transform.Find("chat_forward/chat_scroll/chat_template").gameObject; _tableChatPanel = transform.Find("chat_forward/chat_scroll/Table").GetComponent<UITable>(); _chatScrollView = transform.Find("chat_forward/chat_scroll").GetComponent<UIScrollView>(); _chatPanel = transform.Find("chat_forward/chat_scroll").GetComponent<UIPanel>(); _gridChanel = transform.Find("chat_forward/grid_chanel").GetComponent<UIGrid>(); _chanelTemplate = transform.Find("chat_forward/chanel_button_template").gameObject; _sendButton = transform.Find("chat_forward/send_group/botton_send").gameObject; _recordButton = transform.Find("chat_forward/send_group/botton_v").gameObject; _inputBox = transform.Find("chat_forward/send_group").GetComponent<UIInput>(); _playTweeen = transform.Find("chat_forward/send_group/botton_menu").GetComponent<UIPlayTween>(); _popMenu = transform.Find("Panel/Pop"); _lockMessage = transform.Find("Panel/Message").gameObject; _labelLock = transform.Find("Panel/Message/Label").GetComponent<UILabel>(); chatDataList = ChatDataManager.GetInstance().chatDataList; _tablePosition = _tableChatPanel.transform.localPosition; _scrollPosition = _chatScrollView.transform.localPosition; _panelOffset = _chatPanel.clipOffset; needIgnoreList = new List<Transform> { _popMenu, _playTweeen.transform }; _chatInfoItems = new TableItemList<ChatDetailItem>(null, this); chatType = enumChatType.CHANEL_CURRENT; HideLockMessage(); _popMenu.gameObject.SetActive(false); _chanelTemplate.SetActive(false); _chatTemplate.SetActive(false); EventDelegate.Add(_inputBox.onChange, InputTextChange); EventDelegate.Add(_toggleSound.onChange, () => { _isAutoAudioList[(int)chatType] = _toggleSound.value; }); _chatScrollView.onMomentumMove = () => { if (CheckChatPanelBottom() && _lockMessgeNum > 0) { RefreshChangeTap(); } }; _gridChanel.CreateScrollView(_chanelTemplate, GameConst.ChanelList, FillChanelItem); RegistUIBase<ChatUIPopMenu>(_popMenu); RegistUIButton(_closeButton, CloseClick); RegistUIButton(_sendButton, SendClick); RegistUIButton(_recordButton, RecordClick); RegistUIButton(_lockMessage, LockClick); }
private void FillChanelItem(Transform fillItem, object data) { string title = data.ToString(); int index = GameConst.ChanelList.IndexOf(title); enumChatType chatType = (enumChatType)index; if (chatType == enumChatType.CHANEL_CURRENT) { fillItem.GetComponent<UIToggle>().startsActive = true; this.chatType = chatType; } _isAutoAudioList.Add(false); fillItem.Find("xuanzhong/Label").GetComponent<UILabel>().text = title; fillItem.Find("weixuan/Label").GetComponent<UILabel>().text = title; RegistUIButton(fillItem.gameObject, (go) => { this.chatType = chatType; OnChatTapClicked(chatType); _toggleSound.value = _isAutoAudioList[index]; }); }
public void SendMessage(string text, enumChatType chatType) { ChatData data = new ChatData(playName, text, chatType, enumSysInfoType.INFO_TYPE_CHAT, null, 0, 1); ChatDataManager.GetInstance().AddChatData(data); }