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 SendVoice(Byte[] voiceData) { float time = Director.GetInstance().scheduler.UnSchedulerCSFun(_recordKey); ChatData data = new ChatData(_playName, "#999", enumChatType.CHANEL_SYSTEM, enumSysInfoType.INFO_TYPE_CHAT, voiceData, 0, 1); ChatDataManager.GetInstance().AddChatData(data); RefreshChatPanel(); _isVoicePressed = false; _voiceOn.SetActive(false); }
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 override void OnLoadedUI(bool close3dTouch, object args) { base.OnLoadedUI(close3dTouch, args); _chatPanel = transform.Find("all_bf").gameObject; _chatWidget = transform.Find("all_bf/xinxikuang/Container").GetComponent <UIWidget>(); _btnTextInput = transform.Find("all_bf/text_button").gameObject; _btnVoiceInput = transform.Find("all_bf/voice_button ").gameObject; _chatScrollPanel = transform.Find("all_bf/xinxikuang/Container/Scroll View").GetComponent <UIPanel>(); _chatScrollView = transform.Find("all_bf/xinxikuang/Container/Scroll View").GetComponent <UIScrollView>(); _tableChatPanel = transform.Find("all_bf/xinxikuang/Container/Scroll View/Table").GetComponent <UITable>(); _lockMessage = transform.Find("all_bf/xinxikuang/Container/Panel/Message").gameObject; _labelLock = transform.Find("all_bf/xinxikuang/Container/Panel/Message/Label").GetComponent <UILabel>(); _textTemplate = transform.Find("all_bf/xinxikuang/Container/Scroll View/text_template").gameObject; _microPhoneInput = _chatPanel.GetComponent <MicroPhoneInput>(); _voiceOn = transform.Find("all_bf/voice_button /buttom_on").gameObject; _textTemplate.SetActive(false); _chatInfoItems = new TableItemList <ChatInfoItem>(null, this); _playName = "王五"; _tablePosition = _tableChatPanel.transform.localPosition; _scrollPosition = _chatScrollView.transform.localPosition; _panelOffset = _chatScrollPanel.clipOffset; _chatDataList = ChatDataManager.GetInstance().chatDataList; HideLockMessage(); _chatScrollView.onMomentumMove = () => { if (CheckChatPanelBottom() && _lockMessgeNum > 0) { RefreshChatPanel(); HideLockMessage(); } }; #region 注册点击函数 RegistOnPress(_btnVoiceInput, VoiceInputPress); RegistUIButton(_lockMessage, LockClick); RegistUIButton(_btnTextInput, (go) => { GetParentUI <ChatView>().chatDetailView.RefreshOpen(); }); #endregion }
public override void OnLoadedUI(bool close3dTouch, object args) { base.OnLoadedUI(close3dTouch, args); _btnEmoji = transform.Find("L/botton1").gameObject; _btnItem = transform.Find("L/botton2").gameObject; _btnPet = transform.Find("L/botton3").gameObject; _btnTask = transform.Find("L/botton4").gameObject; _btnHonor = transform.Find("L/botton5").gameObject; _btnQuickTalk = transform.Find("L/botton6").gameObject; _btnHistory = transform.Find("L/botton7").gameObject; _emojiPanel = transform.Find("R/Emoji"); _gridEmoji = transform.Find("R/Emoji/Grid").GetComponent <UIGrid>(); _emojiTemplate = transform.Find("R/Emoji/emoji_template").gameObject; _emojiTemplate.SetActive(false); _emojiGridList = new GridItemList <EmojiListItem>(null, this); _bagPanel = transform.Find("R/Bag"); _btnAllItem = transform.Find("R/Bag/bottom1").gameObject; _btnPotionItem = transform.Find("R/Bag/bottom2").gameObject; _gridBag = transform.Find("R/Bag/Scroll View/Grid").GetComponent <UIGrid>(); _petPanel = transform.Find("R/Pet"); _gridPet = transform.Find("R/Pet/Grid").GetComponent <UIGrid>(); _petTemplate = transform.Find("R/Pet/pet_template").gameObject; _petTemplate.SetActive(false); _taskPanel = transform.Find("R/quest"); _gridTask = transform.Find("R/quest/Grid").GetComponent <UIGrid>(); _taskTemplate = transform.Find("R/quest/quest_template").gameObject; _taskTemplate.SetActive(false); _honorPanel = transform.Find("R/chenghao"); _gridHonor = transform.Find("R/chenghao/Grid").GetComponent <UIGrid>(); _honorTemplate = transform.Find("R/chenghao/honor_template").gameObject; _honorTemplate.SetActive(false); _quickTalkPanel = transform.Find("R/massage"); _gridTalk = transform.Find("R/massage/Grid").GetComponent <UIGrid>(); _talkTemplate = transform.Find("R/massage/message_template").gameObject; _historyPanel = transform.Find("R/History"); _gridHistory = transform.Find("R/History/Grid").GetComponent <UIGrid>(); _historyTemplate = transform.Find("R/History/history_template").gameObject; _historyTemplate.SetActive(false); _historyGridList = new GridItemList <ChatHistoryItem>(null, this); _historyList = ChatDataManager.GetInstance().history; _parentUI = GetParentUI <ChatDetailView>(); List <List <Transform> > contents = new List <List <Transform> > { new List <Transform> { _emojiPanel }, new List <Transform> { _bagPanel }, new List <Transform> { _petPanel }, new List <Transform> { _taskPanel }, new List <Transform> { _honorPanel }, new List <Transform> { _quickTalkPanel }, new List <Transform> { _historyPanel }, }; List <GameObject> activeButtons = new List <GameObject> { _btnEmoji, _btnItem, _btnPet, _btnTask, _btnHonor, _btnQuickTalk, _btnHistory, }; _emojiNames = new List <string>(); _emojiNames.Add("000_2"); _emojiNames.Add("001_2"); _emojiNames.Add("002_2"); _gridEmoji.CreateScrollView <EmojiListItem>(_emojiTemplate, _emojiNames, _emojiGridList, GetParentUI <ChatDetailView>()); UIWidgetTools.RegistUITapButton(activeButtons, contents); RegistUIButton(_btnHistory, (go) => { RefreshHistory(); }); }
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); }