Ejemplo n.º 1
0
        private void DisplayData(ChatMessageNew chatMessage, bool isSelf)
        {
            string        str = chatMessage.Message;
            AgentBaseInfo abi = chatMessage.Client;

            if (chatMessage.ChatType == 8)
            {
                str = "#e062" + str;
                if (Singleton <TrumpetView> .Instance != null && isSelf)
                {
                    Singleton <TrumpetView> .Instance.ClearContent();
                }
                CtrlManager.CloseWindow(WindowID.TrumpetView);
            }
            GridHelper.AddToGrid <ChatItem>(this.transGrid, (!isSelf) ? this.otherChatItem : this.myChatItem, isSelf, delegate(int idx, ChatItem comp)
            {
                comp.Init(abi, str, idx, isSelf, (ChatType)chatMessage.ChatType);
                comp.name = idx.ToString();
                this.queueChat.Enqueue(comp);
            });
            if (this.queueChat.Count > 99)
            {
                ChatItem chatItem = this.queueChat.Dequeue();
                UnityEngine.Object.Destroy(chatItem.gameObject);
            }
            this.usv.contentPivot = UIWidget.Pivot.Bottom;
            this.usv.ResetPosition();
            this.JudgePosition();
        }
        public void ShowPlayer(AgentBaseInfo _data)
        {
            this.mGameObject.SetActive(true);
            SysSummonersHeadportraitVo dataById  = BaseDataMgr.instance.GetDataById <SysSummonersHeadportraitVo>(_data.head.ToString());
            SysSummonersPictureframeVo dataById2 = BaseDataMgr.instance.GetDataById <SysSummonersPictureframeVo>(_data.headFrame.ToString());

            this.mHeadIcon.spriteName     = dataById.headportrait_icon;
            this.mHeadFrame.spriteName    = dataById2.pictureframe_icon;
            this.targetData               = _data;
            this.targetSummId             = ((_data.UserId <= 100000L) ? _data.UserId : (_data.UserId - 100000L));
            this.mSummonerLevelLabel.text = _data.Level.ToString();
            this.mSummonerName.text       = _data.NickName.ToString();
            this.mSummonerName.gameObject.GetComponent <AllochroicLabelChecker>().RenderLabel(_data.CharmRankvalue);
            this.mStageLabel.text  = ChatPlayerInfoController.mStatePrefix + _data.Ladder.ToString();
            this.mBottleLabel.text = ChatPlayerInfoController.mBottlePrefix + _data.BotLevel.ToString();
            if (string.IsNullOrEmpty(_data.TeamName))
            {
                this.mTeamLabel.gameObject.SetActive(false);
            }
            else
            {
                this.mTeamLabel.gameObject.SetActive(true);
                this.mTeamLabel.text = ChatPlayerInfoController.mTeamPrefix + _data.TeamName.ToString();
            }
            this.isFriend = (ModelManager.Instance.Get_FriendDataList_X().Find((FriendData obj) => obj.TargetId == this.targetSummId) != null);
            this.mAddFriend.SetActive(!this.isFriend);
        }
Ejemplo n.º 3
0
        private void DisplayData(ChatMessageNew chatMessage, bool isSelf)
        {
            string        str = chatMessage.Message;
            AgentBaseInfo abi = chatMessage.Client;

            GridHelper.AddToGrid <ChatItem>(this.mChatGrid, (!isSelf) ? this.normalChatItem : this.selfChatItem, isSelf, delegate(int idx, ChatItem comp)
            {
                comp.Init(abi, str, idx, isSelf, (ChatType)chatMessage.ChatType);
                comp.name = idx.ToString();
                this.queueChat.Enqueue(comp);
            });
            if (this.queueChat.Count > 99)
            {
                ChatItem chatItem = this.queueChat.Dequeue();
                UnityEngine.Object.Destroy(chatItem.gameObject);
            }
        }
Ejemplo n.º 4
0
        private void SendChat()
        {
            string        nickName       = ModelManager.Instance.Get_userData_X().NickName;
            long          userId         = long.Parse(ModelManager.Instance.Get_userData_X().UserId);
            int           userLevel      = CharacterDataMgr.instance.GetUserLevel(ModelManager.Instance.Get_userData_X().Exp);
            int           ladder         = ToolsFacade.Instance.ToInt32(ModelManager.Instance.Get_userData_X().LadderScore);
            int           botLevel       = ModelManager.Instance.Get_BottleData_Level();
            int           head           = ModelManager.Instance.Get_userData_filed_X("Avatar");
            int           headFrame      = ModelManager.Instance.Get_userData_filed_X("PictureFrame");
            int           charmRankvalue = ModelManager.Instance.Get_userData_filed_X("CharmRankValue");
            AgentBaseInfo client         = new AgentBaseInfo
            {
                NickName       = nickName,
                UserId         = userId,
                head           = head,
                headFrame      = headFrame,
                Level          = userLevel,
                Ladder         = ladder,
                BotLevel       = botLevel,
                CharmRankvalue = charmRankvalue
            };
            string value = this.mChatInput.value;

            if (!ToolsFacade.Instance.IsLegalString(ref value))
            {
                return;
            }
            ChatMessageNew data = new ChatMessageNew
            {
                Client   = client,
                ChatType = 2,
                Message  = value,
                TargetId = null,
                TimeTick = ToolsFacade.ServerCurrentTime.Ticks
            };
            Dictionary <byte, object> dictionary = new Dictionary <byte, object>();

            dictionary.Add(100, SerializeHelper.Serialize <ChatMessageNew>(data));
            MobaMessageManagerTools.SendClientMsg(ClientV2C.chatviewSendChatToServer, dictionary, false);
            this.mChatInput.value = null;
        }
Ejemplo n.º 5
0
 private void OnMsg_chatviewFillChatHistory(MobaMessage msg)
 {
     if (msg.Param != null)
     {
         bool flag = (bool)msg.Param;
         long num  = long.Parse(ModelManager.Instance.Get_userData_X().UserId);
         Queue <ChatMessageNew> source = new Queue <ChatMessageNew>();
         source = ModelManager.Instance.Get_TempHallChatView();
         List <ChatMessageNew> chatMessageArray = (!flag) ? source.ToList <ChatMessageNew>() : ModelManager.Instance.Get_Hall_Chat_DataX().ToList <ChatMessageNew>();
         int i;
         for (i = 0; i != chatMessageArray.Count; i++)
         {
             string        str = chatMessageArray[i].Message;
             AgentBaseInfo abi = chatMessageArray[i].Client;
             if (chatMessageArray[i].ChatType == 8)
             {
                 str = "#e062" + str;
             }
             bool isSelf = chatMessageArray[i].Client.UserId == num;
             GridHelper.AddToGrid <ChatItem>(this.transGrid, (!isSelf) ? this.otherChatItem : this.myChatItem, isSelf, delegate(int idx, ChatItem comp)
             {
                 comp.Init(abi, str, idx, isSelf, (ChatType)chatMessageArray[i].ChatType);
                 comp.name = idx.ToString();
                 this.queueChat.Enqueue(comp);
             });
             if (this.queueChat.Count > 40)
             {
                 ChatItem chatItem = this.queueChat.Dequeue();
                 UnityEngine.Object.Destroy(chatItem.gameObject);
             }
         }
         this.usv.contentPivot = UIWidget.Pivot.Bottom;
         this.usv.ResetPosition();
         this.JudgePosition();
         ModelManager.Instance.Set_ReSetTempHallChatView();
         HomeChatCtrl.GetInstance().sendState = SendState.Nothing;
     }
 }
Ejemplo n.º 6
0
 public void Init(AgentBaseInfo abinfo, string str, int idx, bool isSelf, ChatType type)
 {
     UIEventListener.Get(base.gameObject).onClick = new UIEventListener.VoidDelegate(this.ShowSomeDetails);
     this.agentInfoData = abinfo;
     this.chatType      = type;
     this.ParseData(str);
     this.normalChat.height = ((this.line != 1) ? 114 : 62);
     if (isSelf)
     {
         this.normalChat.spriteName = ((this.line != 1) ? "Home_chatting_talking_frame_05" : "Home_chatting_talking_frame_06");
     }
     else
     {
         this.normalChat.spriteName = ((this.line != 1) ? "Home_chatting_talking_frame_01" : "Home_chatting_talking_frame_02");
     }
     if (this.chatType == ChatType.VIP && !isSelf)
     {
         this.normalChat.spriteName = ((this.line != 1) ? "Home_chatting_talking_frame_03" : "Home_chatting_talking_frame_04");
     }
     if (type != ChatType.GM)
     {
         string text = BaseDataMgr.instance.GetDataById <SysSummonersHeadportraitVo>(abinfo.head.ToString()).headportrait_icon;
         if (text != null)
         {
             this.headPortrait.spriteName = text;
         }
         text = BaseDataMgr.instance.GetDataById <SysSummonersPictureframeVo>(abinfo.headFrame.ToString()).pictureframe_icon;
         if (text != null)
         {
             this.frame.spriteName = text;
         }
     }
     this.nickName.text = abinfo.NickName;
     this.nickName.gameObject.GetComponent <AllochroicLabelChecker>().RenderLabel(abinfo.CharmRankvalue);
     this.chatContent.text = this.strFinal;
     this.GenerateEmotion();
 }
Ejemplo n.º 7
0
        private void SendChat(GameObject obj)
        {
            if (HomeChatCtrl.GetInstance().sendState == SendState.Sending)
            {
                return;
            }
            if (this.task_countDown != null && this.task_countDown.Running)
            {
                Singleton <TipView> .Instance.ShowViewSetText("休息一下 稍后再发", 1f);

                return;
            }
            HomeChatCtrl.GetInstance().sendState = SendState.Sending;
            this.GetSetEmojiPanelState(false);
            string nickName       = ModelManager.Instance.Get_userData_X().NickName;
            long   userId         = long.Parse(ModelManager.Instance.Get_userData_X().UserId);
            int    userLevel      = CharacterDataMgr.instance.GetUserLevel(ModelManager.Instance.Get_userData_X().Exp);
            int    ladder         = ToolsFacade.Instance.ToInt32(ModelManager.Instance.Get_userData_X().LadderScore);
            int    botLevel       = ModelManager.Instance.Get_BottleData_Level();
            int    head           = ModelManager.Instance.Get_userData_filed_X("Avatar");
            int    headFrame      = ModelManager.Instance.Get_userData_filed_X("PictureFrame");
            int    charmRankvalue = ModelManager.Instance.Get_userData_filed_X("CharmRankValue");
            string value          = this.content.value;
            bool   flag           = false;

            if (!string.IsNullOrEmpty(value) && value.Length > 1 && value[0] == '/')
            {
                flag = true;
            }
            AgentBaseInfo client = new AgentBaseInfo
            {
                NickName       = nickName,
                UserId         = userId,
                head           = head,
                headFrame      = headFrame,
                Level          = userLevel,
                Ladder         = ladder,
                BotLevel       = botLevel,
                CharmRankvalue = charmRankvalue
            };

            if (!flag)
            {
                if (!ToolsFacade.Instance.IsLegalString(ref value))
                {
                    UnityEngine.Debug.LogError("return");
                    return;
                }
            }
            ChatMessageNew data = new ChatMessageNew
            {
                Client   = client,
                ChatType = 3,
                Message  = value,
                TargetId = null,
                TimeTick = ToolsFacade.ServerCurrentTime.Ticks
            };
            Dictionary <byte, object> dictionary = new Dictionary <byte, object>();

            dictionary.Add(100, SerializeHelper.Serialize <ChatMessageNew>(data));
            dictionary.Add(5, Model_HomeChat.LastMsgId);
            MobaMessageManagerTools.SendClientMsg(ClientV2C.chatviewSendChatToServer, dictionary, false);
        }
Ejemplo n.º 8
0
        public void ConfirmSendMessage(GameObject obj)
        {
            if (null != obj)
            {
                if (HomeChatCtrl.GetInstance().sendState == SendState.Sending)
                {
                    return;
                }
                UserData userData = ModelManager.Instance.Get_userData_X();
                if (userData.Speaker <= 0)
                {
                    CtrlManager.OpenWindow(WindowID.PurchasePopupView, null);
                    Singleton <PurchasePopupView> .Instance.onSuccess.Add(new Callback(this.AfterBuying));

                    Singleton <PurchasePopupView> .Instance.Show(GoodsSubject.Currency, "11", 1, false);

                    return;
                }
                if (this.content.value.Length > 28)
                {
                    Singleton <TipView> .Instance.ShowViewSetText("最多发送28个字!!!", 1f);

                    return;
                }
                HomeChatCtrl.GetInstance().sendState = SendState.Sending;
                this.GetSetEmojiPanelState(false);
                string        nickName       = ModelManager.Instance.Get_userData_X().NickName;
                long          userId         = long.Parse(ModelManager.Instance.Get_userData_X().UserId);
                int           userLevel      = CharacterDataMgr.instance.GetUserLevel(ModelManager.Instance.Get_userData_X().Exp);
                int           ladder         = ToolsFacade.Instance.ToInt32(ModelManager.Instance.Get_userData_X().LadderScore);
                int           botLevel       = ModelManager.Instance.Get_BottleData_Level();
                int           head           = ModelManager.Instance.Get_userData_filed_X("Avatar");
                int           headFrame      = ModelManager.Instance.Get_userData_filed_X("PictureFrame");
                int           charmRankvalue = ModelManager.Instance.Get_userData_filed_X("CharmRankValue");
                string        value          = this.content.value;
                AgentBaseInfo client         = new AgentBaseInfo
                {
                    NickName       = nickName,
                    UserId         = userId,
                    head           = head,
                    headFrame      = headFrame,
                    Level          = userLevel,
                    Ladder         = ladder,
                    BotLevel       = botLevel,
                    CharmRankvalue = charmRankvalue
                };
                if (!ToolsFacade.Instance.IsLegalString(ref value))
                {
                    Debug.LogError("return");
                    HomeChatCtrl.GetInstance().sendState = SendState.Nothing;
                    return;
                }
                ChatMessageNew data = new ChatMessageNew
                {
                    Client   = client,
                    ChatType = 8,
                    Message  = value,
                    TargetId = null,
                    TimeTick = ToolsFacade.ServerCurrentTime.Ticks
                };
                Dictionary <byte, object> dictionary = new Dictionary <byte, object>();
                dictionary.Add(100, SerializeHelper.Serialize <ChatMessageNew>(data));
                SendMsgManager.SendMsgParam sendMsgParam = new SendMsgManager.SendMsgParam(true, "正在发送...", false, 15f);
                NetWorkHelper.Instance.client.SendSessionChannelMessage(2, MobaChannel.Chat, dictionary);
                this.content.defaultText = "点此输入文字";
            }
        }