public void AddLinkerItem(string itemName, uint thisID, uint quality, int type) { string name = "[" + itemName + "]"; if (string.IsNullOrEmpty(name)) { return; } string temp = ""; if (m_dictItemLink.Count > 0) { temp = m_input_Input.value; } foreach (var item in m_dictItemLink) { temp = temp.Replace(item.Key, name); } m_dictItemLink.Clear(); string strLink = ChatDataManager.GetItemHrefString(name, MainPlayerHelper.GetPlayerID(), thisID, quality, false, type); name = DataManager.Manager <TextManager>().ReplaceSensitiveWord(name, TextManager.MatchType.Max); m_dictItemLink.Add(name, strLink); if (string.IsNullOrEmpty(temp)) { m_input_Input.value += name; } else { m_input_Input.value = temp; } m_input_Input.selectionStart = m_input_Input.value.Length; }
/// <summary> /// 物品被人买走了 /// </summary> /// <param name="cmd"></param> public void OnResponRemoveConsignItem(stRemoveItemInfoConsignmentUserCmd_S cmd) { needReqItemSellLog = true; BaseItem item = DataManager.Manager <ItemManager>().GetBaseItemByQwThisId((uint)cmd.market_id); if (item != null) { string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_jishouhangchushouwupin, item.Name); ChatDataManager.SendToChatSystem(txt); } if (itemSellInfo != null && cmd != null) { for (int i = 0; i < itemSellInfo.consignmentItemList.Count; i++) { if (itemSellInfo.consignmentItemList[i].Market_ID == cmd.market_id) { itemSellInfo.consignmentItemList.RemoveAt(i); return; } } } }
public override void ExecuteCommand(ChatSession session, StringRequestInfo requestInfo) { if (requestInfo.Parameters != null && requestInfo.Parameters.Length == 2) { var loginId = requestInfo.Parameters[0]; var passWord = requestInfo.Parameters[1]; #region 权限校验 var info = TestDataSource.Source.FirstOrDefault(x => x.Key == loginId); if (info.Key == null) { session.Send("登陆失败,账户或密码错误!"); return; } if (info.Value != passWord) { session.Send("登陆失败,账户或密码错误!"); return; } #endregion session.Id = requestInfo.Parameters[0]; session.PassWord = requestInfo.Parameters[1]; session.IsLogin = true; session.LoginTime = DateTime.Now; session.Send("登录成功"); // 获取当前登录用户的离线消息 ChatDataManager.SendLogin(session.Id, c => { session.Send($"{c.FromId} 给你发送离线消息:{c.Message} "); }); } }
/// <summary> /// 发送私聊 /// </summary> public bool SendPrivateChat(string msg, bool isRobot, string fileid = "", uint length = 0) { if (!ChatDataManager.CanSendChatMsgWithBlack(silentFriendUID, silentOPDestName, true)) { return(false); } stCommonMChatUserCmd_CS cmd = new stCommonMChatUserCmd_CS() { szInfo = msg, byChatType = CHATTYPE.CHAT_SILENT, dwOPDes = silentFriendUID, szOPDes = silentOPDestName, profession = (GameCmd.enumProfession)Client.ClientGlobal.Instance().MainPlayer.GetProp((int)Client.PlayerProp.Job), voiceFildId = fileid, voiceLength = length, }; SendMyChatCmdM(cmd); // 密聊不会回发给自己,所以发一份。 if (!isRobot) { NetService.Instance.Send(cmd); } return(true); }
public string FormatCharTitle(string channelHead, string name, string time, string srcText, uint uid = 0) { try { // if (srcText.FirstOrDefault() == '<') // { // return RichXmlHelper.RemoveP(RichXmlHelper.RichXmlAdapt(srcText)); // } // 普通文本转换成富文本 var color = string.Format("#{0:X8}", (uint)ConstDefine.GetChatColor(GameCmd.CHATTYPE.CHAT_PRIVATE)); var yellow = GXColor.Yellow; var colorYellow = string.Format("#{0:X8}", (uint)yellow); var gray = GXColor.Gray; var colorGray = string.Format("#{0:X8}", (uint)gray); string text = ""; text = RichXmlHelper.RichXmlAdapt(string.Format( //"<color value=\"{0}\">{1}</color>{2}", "{0} {1}", //color, channelHead, ChatDataManager.GetPlayerHrefString(name, uid, Cmd.GXColor.Yellow), new XText(srcText).ToString())); // xml escape //Debug.Log(text); return(text); } catch (Exception e) { Log.Error(string.Format("e.Message:{0},e.StackTrace:{1}", e.Message, e.StackTrace)); } return(String.Empty); }
public static ChatDataManager GetInstance() { if (_instance == null) { _instance = new ChatDataManager(); } return _instance; }
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); }
protected override void OnAwake() { base.OnAwake(); if (null != m_trans_OffsetContent) { startPosX = m_trans_OffsetContent.localPosition.x; m_fContentWidth = NGUIMath.CalculateRelativeWidgetBounds(m_trans_OffsetContent).size.x; } m_chatManager = DataManager.Manager <ChatDataManager>(); m_input_Input.characterLimit = GameTableManager.Instance.GetGlobalConfig <int>("ChatMaxCharacter"); m_chatItemPrefab = UIManager.GetResGameObj(GridID.Uichatitemgrid) as UnityEngine.GameObject; m_panel = m_scrollview_ChatScrollView.GetComponent <UIPanel>(); m_btnSendLable = m_btn_BtnSend.GetComponentInChildren <UILabel>(); GameObject btnShowMsg = m_trans_newmessage_warning.Find("btnShowMsg").gameObject; UIEventListener.Get(btnShowMsg).onClick = OnClickRefreshMsg; UIToggle[] toggles = m_trans_ChanelTabs.GetComponentsInChildren <UIToggle>(); for (int i = 0; i < toggles.Length; i++) { var item = toggles[i]; var channelName = item.name; BtnType btntype = (BtnType)System.Enum.Parse(typeof(BtnType), channelName); EventDelegate.Add(item.onChange, () => { if (btntype != BtnType.TabRed) { if (item.value) { this.OnToggleValueChange(channelName); } } }); if (btntype == BtnType.TabTeam) { m_teamLable = item.GetComponentInChildren <UILabel>(); } else if (btntype == BtnType.TabGhost) { m_goTabGhost = item.gameObject; } else if (btntype == BtnType.TabSystem) { m_transTabSys = item.transform; } else if (btntype == BtnType.TabRed) { m_transRedPacket = item.transform; UIEventListener.Get(item.gameObject).onClick = OnClickRedPacket; } item.transform.localPosition = new Vector3(-3, 320 - i * 65, 0); } m_scrollview_ChatScrollView.onStoppedMoving += OnDragPanelFinished; m_trans_voiceMicTips.gameObject.SetActive(false); UIEventListener.Get(m_btn_voice_input.gameObject).onPress = OnPreseVoice; UIEventListener.Get(m_btn_voice_input.gameObject).onDrag = OnDragEnd; m_voiceState = m_trans_voiceMicTips.Find("Spriteleft/Sprite").GetComponent <UISpriteEx>(); m_voiceStateLabel = m_trans_voiceMicTips.Find("Spriteleft/Label").GetComponent <UILabel>(); }