void ShowWorldChatHandle(object obj) { if (WorldChild.transform.localPosition != Vector3.zero) { NewChat_prompt.SetActive(true); } SMsgChat_SC sMsgChat_SC = (SMsgChat_SC)obj; this.CreateChat(sMsgChat_SC); Table_Chat.Reposition(); StartCoroutine("SetDragAmount"); }
CommandCallbackType ReceiveSpaceMsgHandle(byte[] dataBuffer, int socketID) { SMsgChat_SC sMsgChat_SC = SMsgChat_SC.ParsePackage(dataBuffer); sMsgChat_SC.L_LabelChat = ChatRecordManager.Instance.ParseColorChat(Chat.WindowType.Town, sMsgChat_SC); sMsgChat_SC.L_Channel = (int)Chat.WindowType.Town; if (sMsgChat_SC.senderActorID == PlayerManager.Instance.FindHeroDataModel().ActorID&& sMsgChat_SC.bChatType == 1) { return(CommandCallbackType.Continue); } ChatRecordManager.Instance.AddPublicRecord(Chat.WindowType.Town, sMsgChat_SC); UIEventManager.Instance.TriggerUIEvent(UIEventType.WorldChatMsg, sMsgChat_SC); return(CommandCallbackType.Continue); }
//世界频道 CommandCallbackType ReceiveWorldMsgHandle(byte[] dataBuffer, int socketID) { SMsgChat_SC sMsgChat_SC = SMsgChat_SC.ParsePackage(dataBuffer); sMsgChat_SC.L_LabelChat = ChatRecordManager.Instance.ParseColorChat(Chat.WindowType.World, sMsgChat_SC); sMsgChat_SC.L_Channel = (int)Chat.WindowType.World; if (GameManager.Instance.CurrentState == GameManager.GameState.GAME_STATE_TOWN) { UI.GoodsMessageManager.Instance.AddNoticeMessage(sMsgChat_SC); } ChatRecordManager.Instance.AddPublicRecord(Chat.WindowType.World, sMsgChat_SC); UIEventManager.Instance.TriggerUIEvent(UIEventType.WorldChatMsg, sMsgChat_SC); return(CommandCallbackType.Continue); }
private void CreateChat(SMsgChat_SC sMsgChat_SC) { string chatContent = ""; chatContent = ColoringChannel("[世界]") + ColoringName(sMsgChat_SC.SenderName + " : ") + sMsgChat_SC.Chat; GameObject chat = (GameObject)Instantiate(ChatInfoItemPrefab.gameObject); chat.transform.parent = Table_Chat.transform; chat.transform.localScale = Vector3.one; chat.transform.localPosition = Vector3.zero; var chatControl = chat.GetComponent <ChatInfoItemControl>(); //chatControl.Init(sMsgChat_SC.L_Channel,sMsgChat_SC.senderActorID, sMsgChat_SC.SenderName, chatContent, sMsgChat_SC.bChatType, sMsgChat_SC.friendTeamID, ClickChatTargetCallBack); AddChatRecord(chatControl); }
//接收处理聊天信息 void ReceiveChatMsgHandle(object obj) { SMsgChat_SC sMsgChat_SC = (SMsgChat_SC)obj; this.CreateChatMsg(sMsgChat_SC); //新消息提示 if (Child.transform.localPosition != Vector3.zero) { Button_Open.gameObject.SetActive(true); SoundManager.Instance.PlaySoundEffect("Sound_Voice_ChatMsg"); } else { SoundManager.Instance.PlaySoundEffect("Sound_Msg_Chat"); } }
//接收私信 void ReceiveChatMsgHandle(object obj) { SMsgChat_SC sMsgChat_SC = (SMsgChat_SC)obj; if (m_privateWindowDict.ContainsKey(sMsgChat_SC.L_ChaterID)) { m_privateWindowDict[sMsgChat_SC.L_ChaterID].AddChat(sMsgChat_SC); } else { //初始化 GameObject talker = UI.CreatObjectToNGUI.InstantiateObj(TalkerItemPrefab, TitlePoint); PrivateTalkerItem privateTalkerItem = talker.GetComponent <PrivateTalkerItem>(); privateTalkerItem.Init(sMsgChat_SC.L_ChaterID, sMsgChat_SC.SenderName); m_privateTalkerDict.Add(sMsgChat_SC.L_ChaterID, privateTalkerItem); int index = 0; m_privateTalkerDict.ApplyAllItem(p => { p.Value.transform.localPosition = Vector3.right * SPACING_TITLE_BUTTON * index; index++; }); InitPrivateWindow(sMsgChat_SC.L_ChaterID, ChatRecordManager.Instance.GetPrivateChatRecordList(sMsgChat_SC.L_ChaterID)); if (m_curWindowType != WindowType.Private) { talker.SetActive(false); } } //开启未读动画提示 if (transform.localPosition != Vector3.zero || sMsgChat_SC.L_ChaterID != iTalkToWorldID) { m_privateTalkerDict[sMsgChat_SC.L_ChaterID].ShowNewTip(); } //关闭私信提醒 // if(ChatPanel.transform.localPosition == Vector3.zero && !m_privateTalkerDict.Values.Any(p=>p.IsHasNewMessage)) // { // UIEventManager.Instance.TriggerUIEvent(UIEventType.ClosePrivateMessageTip,null); // } if (transform.localPosition == Vector3.zero && m_curWindowType == WindowType.Private) { UIEventManager.Instance.TriggerUIEvent(UIEventType.ClosePrivateMessageTip, null); } else { UIEventManager.Instance.TriggerUIEvent(UIEventType.ShowPrivateMessageTip, null); } }
//接收公共信息 void ShowWorldChatHandle(object obj) { SMsgChat_SC sMsgChat_SC = (SMsgChat_SC)obj; if (m_windowDict.ContainsKey((WindowType)sMsgChat_SC.L_Channel)) { m_windowDict[(WindowType)sMsgChat_SC.L_Channel].AddChat(sMsgChat_SC); } //更新喇叭数量显示 // if(sMsgChat_SC.L_Channel == (int)WindowType.World) // { // int itemNum = ContainerInfomanager.Instance.GetItemNumber(CommonDefineManager.Instance.CommonDefine.WorldChatItem); // Label_SpeakerNum.text = itemNum.ToString(); // Label_SpeakerNum.color = itemNum>0?new Color(1f,0.98f,0.435f):Color.red; // } }
//接收公共信息 void ShowWorldChatHandle(object obj) { SMsgChat_SC sMsgChat_SC = (SMsgChat_SC)obj; if (sMsgChat_SC.L_Channel == (int)WindowType.Team) { if (m_windowDict.ContainsKey((WindowType)sMsgChat_SC.L_Channel)) { m_windowDict[(WindowType)sMsgChat_SC.L_Channel].AddChat(sMsgChat_SC); } if (transform.localPosition != Vector3.zero) { UIEventManager.Instance.TriggerUIEvent(UIEventType.NewTeamMessage, null); } } }
public void CreateChat(SMsgChat_SC sMsgChat_SC) { string chatContent = ""; chatContent = ChatPanelUIManager.ColoringChannel("[房间]") + ChatPanelUIManager.ColoringName(sMsgChat_SC.SenderName + " : ") + sMsgChat_SC.Chat; GameObject chat = (GameObject)Instantiate(ChatLabelItemPrefab.gameObject); chat.transform.parent = Table.transform; chat.transform.localScale = Vector3.one; chat.transform.localPosition = Vector3.zero; var chatControl = chat.GetComponent <ChatLabelItem>(); bool isMyChat = sMsgChat_SC.senderActorID == PlayerManager.Instance.FindHeroDataModel().ActorID; chatControl.Init(isMyChat, chatContent); Table.Reposition(); StartCoroutine("SetDragAmount"); }
CommandCallbackType ReceiveGetItemtipHandle(byte[] dataBuffer, int socketID) { SMsgChat_SC sMsgChat_SC = SMsgChat_SC.ParsePackage(dataBuffer); SMsgTipChat_SC sMsgTipChat_SC = SMsgTipChat_SC.ParsePackage(sMsgChat_SC.tipsMessage); if (sMsgTipChat_SC.byTipLevel == (byte)SMsgTipChat_SC.CHAT_TIPS_LEVEL.CHAT_TIPS_LEVEL3) { if (UI.GoodsMessageManager.Instance != null) { for (int i = 0; i < sMsgTipChat_SC.byNumber; i++) { UI.GoodsMessageManager.Instance.Show(sMsgTipChat_SC.ShowGoodsInfos[i].dwGoodsID, sMsgTipChat_SC.ShowGoodsInfos[i].dwGoodsNum); } } } return(CommandCallbackType.Continue); }
public void AddPrivateRecord(SMsgChat_SC sChat) { if (mMyActorID == 0) { mMyActorID = PlayerManager.Instance.FindHeroDataModel().ActorID; } if (GameManager.Instance.CurrentState != GameManager.GameState.GAME_STATE_TOWN) { mHasNewPrivateSmg = true; } if (sChat.senderActorID == mMyActorID) { if (mPrivateRecordList.ContainsKey(sChat.accepterActorID)) { mPrivateRecordList[sChat.accepterActorID].AddChatRecord(sChat); } else { mPrivateRecordList.Add(sChat.accepterActorID, new List <SMsgChat_SC>()); mPrivateRecordList[sChat.accepterActorID].AddChatRecord(sChat); } } else { if (mPrivateRecordList.ContainsKey(sChat.senderActorID)) { mPrivateRecordList[sChat.senderActorID].AddChatRecord(sChat); } else { mPrivateRecordList.Add(sChat.senderActorID, new List <SMsgChat_SC>()); mPrivateRecordList[sChat.senderActorID].AddChatRecord(sChat); } } }
private void CreateChatItem(SMsgChat_SC sChat) { string chatContent = ""; if (sChat.bySenderVipLevel > 0) { chatContent = ISVIP + sChat.L_LabelChat; } else { chatContent = ISNOTVIP + sChat.L_LabelChat; } ////// /// 判断颜色 vip /// // chatContent = NGUIColor.SetTxtColor(sChat.SenderName + " : ", TextColor.ChatBlue) // + NGUIColor.SetTxtColor(sChat.Chat, TextColor.white); GameObject chat = CreatObjectToNGUI.InstantiateObj(ChatInfoItemPrefab, Table.transform); chat.transform.localPosition += Vector3.back * 5; var chatControl = chat.GetComponent <ChatInfoItemControl>(); chatControl.Init(sChat.L_Channel, sChat.senderActorID, sChat.SenderName, sChat.bySenderVipLevel, chatContent, sChat.bChatType, sChat.friendTeamID, m_Delegate); m_itemList.Add(chatControl); if (m_itemList.Count > 100) { var item = m_itemList[0]; m_itemList.RemoveAt(0); Destroy(item.gameObject); } }
public void AddNoticeMessage(SMsgChat_SC sChat) { m_noticeMessageList.Add(sChat); ShowNoticeMessage(); }
void ReceiveRoomChatMsgHandle(object obj) { SMsgChat_SC chat = (SMsgChat_SC)obj; Panel_Chat.CreateChat(chat); }
void SendChat(object obj) { SoundManager.Instance.PlaySoundEffect("Sound_Button_Default"); string chat = Input_Chat.text; if (chat == "") { return; } string accpecterName = ""; var playerData = PlayerManager.Instance.FindHeroDataModel(); ChatDefine chatDefine = ChatDefine.MSG_CHAT_CURRENT; switch (m_curWindowType) { case WindowType.Town: chatDefine = ChatDefine.MSG_CHAT_CURRENT; break; case WindowType.World: if (ContainerInfomanager.Instance.GetItemNumber(CommonDefineManager.Instance.CommonDefine.WorldChatItem) <= 0) { UI.MessageBox.Instance.Show(4, "", LanguageTextManager.GetString("IDS_I24_11"), LanguageTextManager.GetString("IDS_I24_12"), LanguageTextManager.GetString("IDS_I24_13"), CancelQuickBuySpeaker, SureQuickBuySpeaker); return; } chatDefine = ChatDefine.MSG_CHAT_WORLD; break; case WindowType.System: chatDefine = ChatDefine.MSG_CHAT_SYSTEM; break; case WindowType.Team: chatDefine = ChatDefine.MSG_CHAT_TEAM; break; case WindowType.Private: chatDefine = ChatDefine.MSG_CHAT_PRIVATE; accpecterName = m_privateTalkerDict[(int)iTalkToWorldID].TalkerInfo.Name; break; } if (iTalkToWorldID == 0) { SMsgChat_SC sMsgChat = new SMsgChat_SC(); sMsgChat.SenderName = playerData.Name; sMsgChat.Chat = chat; sMsgChat.L_LabelChat = ChatRecordManager.Instance.ParseColorChat(Chat.WindowType.Private, sMsgChat); sMsgChat.L_Channel = (int)Chat.WindowType.Private; ReceiveChatMsgHandle(sMsgChat); } else { NetServiceManager.Instance.ChatService.SendChat((uint)playerData.ActorID, iTalkToWorldID, accpecterName, chat, 0, chatDefine); } Input_Chat.text = ""; }
//系统频道 CommandCallbackType ReceiveSystemMsgHandle(byte[] dataBuffer, int socketID) { switch ((Chat.CHAT_MSG_SYSTYPE)dataBuffer[0]) { case Chat.CHAT_MSG_SYSTYPE.NONE_SYS_CHAT_TYPE: case Chat.CHAT_MSG_SYSTYPE.WARING_SYS_CHAT_TYPE: SMsgSysChat_SC sMsgSysChat_SC = SMsgSysChat_SC.ParsePackage(dataBuffer); SMsgChat_SC sMsgChat_SC = new SMsgChat_SC(); sMsgChat_SC.Chat = sMsgSysChat_SC.Chat; sMsgChat_SC.L_LabelChat = ChatRecordManager.Instance.ParseColorChat(Chat.WindowType.System, sMsgChat_SC); sMsgChat_SC.L_Channel = (int)Chat.WindowType.System; if (GameManager.Instance.CurrentState == GameManager.GameState.GAME_STATE_TOWN) { SMsgChat_SC bChat = sMsgChat_SC; bChat.L_LabelChat = bChat.L_LabelChat.Remove(8, 1); UI.GoodsMessageManager.Instance.AddNoticeMessage(bChat); } ChatRecordManager.Instance.AddPublicRecord(Chat.WindowType.System, sMsgChat_SC); UIEventManager.Instance.TriggerUIEvent(UIEventType.WorldChatMsg, sMsgChat_SC); break; case Chat.CHAT_MSG_SYSTYPE.BROADCAST_SYS_CHAT_TYPE: SMsgBroadCastSysTips_SC sMsgBroadCastSysTips_SC = SMsgBroadCastSysTips_SC.ParsePackage(dataBuffer); SMsgChat_SC broadcastChat = new SMsgChat_SC(); if (TownRobotManager.Instance == null) { return(CommandCallbackType.Continue); } BroadcastConfigData configData = TownRobotManager.Instance.GetBroadcastConfig(sMsgBroadCastSysTips_SC.dwSysTipsID); string parmStr = ""; switch (configData.BroadcastType) { case 1: var sirenData = SirenDataManager.Instance.GetPlayerSirenList().SingleOrDefault(p => p._sirenID == configData.BroadcastConditions); parmStr = LanguageTextManager.GetString(sirenData._name); break; case 2: var itemData = ItemDataManager.Instance.GetItemData(configData.BroadcastConditions); parmStr = UI.NGUIColor.SetTxtColor(LanguageTextManager.GetString(itemData._szGoodsName), (UI.TextColor)itemData._ColorLevel); break; case 3: var ectypeData = EctypeConfigManager.Instance.EctypeContainerConfigList[configData.BroadcastConditions]; parmStr = LanguageTextManager.GetString(ectypeData.lEctypeName); break; case 4: var titleData = PlayerDataManager.Instance.GetPlayerTitleConfigData(configData.BroadcastConditions); //parmStr = LanguageTextManager.GetString(titleData._TitleName); break; case 5: var taskData = GuideConfigManager.Instance.TaskNewConfigFile.Datas.SingleOrDefault(p => p.TaskID == configData.BroadcastConditions); parmStr = LanguageTextManager.GetString(taskData.TaskTitle); break; } broadcastChat.Chat = string.Format(LanguageTextManager.GetString(configData.BroadcastContent), sMsgBroadCastSysTips_SC.SZActorName, parmStr); broadcastChat.L_LabelChat = ChatRecordManager.Instance.ParseColorChat(Chat.WindowType.System, broadcastChat); broadcastChat.L_Channel = (int)Chat.WindowType.System; if (GameManager.Instance.CurrentState == GameManager.GameState.GAME_STATE_TOWN) { SMsgChat_SC bChat = broadcastChat; bChat.L_LabelChat = bChat.L_LabelChat.Remove(8, 1); UI.GoodsMessageManager.Instance.AddNoticeMessage(bChat); } ChatRecordManager.Instance.AddPublicRecord(Chat.WindowType.System, broadcastChat); UIEventManager.Instance.TriggerUIEvent(UIEventType.WorldChatMsg, broadcastChat); break; } return(CommandCallbackType.Continue); }
//接收公共信息 void ShowWorldChatHandle(object obj) { SMsgChat_SC sMsgChat_SC = (SMsgChat_SC)obj; }
//接收私信 void ReceiveChatMsgHandle(object obj) { SMsgChat_SC sMsgChat_SC = (SMsgChat_SC)obj; }
public void AddChat(SMsgChat_SC sChat) { this.CreateChatItem(sChat); Table.Reposition(); StartCoroutine("SetDragAmount"); }