コード例 #1
0
    public InBattleInputChat.InBatChatEntity ConstructEnt(ulong ullUid, string playerName, string content, byte camp)
    {
        InBattleInputChat.InBatChatEntity validChatEntity = this.GetValidChatEntity();
        string text        = string.Empty;
        Player playerByUid = Singleton <GamePlayerCenter> .instance.GetPlayerByUid(ullUid);

        if (playerByUid != null && playerByUid.Captain)
        {
            text = playerByUid.Captain.handle.TheStaticData.TheResInfo.Name;
            validChatEntity.bAlice = playerByUid.Captain.handle.IsHostCamp();
        }
        validChatEntity.ullUid = ullUid;
        string text2 = string.Empty;

        if (camp == 0)
        {
            text2 = "[全部]";
        }
        string text3 = string.Format("{0}{1}({2}):", text2, playerName, text);

        validChatEntity.colorEnd = (byte)text3.get_Length();
        validChatEntity.rawText  = string.Format("{0}{1}", text3, content);
        validChatEntity.camp     = camp;
        validChatEntity.type     = InBattleInputChat.InBatChatEntity.EType.Normal;
        return(validChatEntity);
    }
コード例 #2
0
    private void ReclyChatEntity(InBattleInputChat.InBatChatEntity ent)
    {
        if (ent == null)
        {
            return;
        }
        int num = -1;

        for (int i = 0; i < this.m_chatEntityList.Count; i++)
        {
            InBattleInputChat.InBatChatEntity inBatChatEntity = this.m_chatEntityList[i];
            if (inBatChatEntity != null && ent.ullUid == inBatChatEntity.ullUid)
            {
                num = i;
                break;
            }
        }
        if (num != -1)
        {
            this.m_caches.Add(ent);
            this.m_chatEntityList.RemoveAt(num);
            if (this.m_view != null)
            {
                this.m_view.Refresh(this.m_chatEntityList);
            }
        }
    }
コード例 #3
0
 public void InnerHandle_InBat_InputChat(ulong ullUid, string playerName, string content, byte camp)
 {
     if (this.m_InputChat != null)
     {
         InBattleInputChat.InBatChatEntity ent = this.m_InputChat.ConstructEnt(ullUid, playerName, content, camp);
         this.m_InputChat.Add(ent);
     }
 }
コード例 #4
0
    public void Add(InBattleInputChat.InBatChatEntity ent)
    {
        if (ent == null)
        {
            return;
        }
        if (ent.type == InBattleInputChat.InBatChatEntity.EType.ParseAllColor)
        {
            List <string> list = Singleton <CChatController> .instance.ColorParser.Parse(this.m_view.lineWidth - 10, ent.rawText, this.m_view.fontSize);

            if (list.get_Count() == 1)
            {
                ent.line1 = list.get_Item(0);
            }
            else if (list.get_Count() >= 2)
            {
                ent.line1 = list.get_Item(0);
                ent.line2 = list.get_Item(1);
            }
        }
        else
        {
            bool flag = false;
            int  num  = 0;
            int  num2 = 0;
            for (int i = 0; i < ent.rawText.get_Length(); i++)
            {
                int characterWidth = CChatParser.GetCharacterWidth(ent.rawText.get_Chars(i), this.m_view.fontSize);
                if (num + characterWidth > this.m_view.lineWidth - 10)
                {
                    flag      = true;
                    ent.line1 = ent.rawText.Substring(num2, i);
                    ent.line2 = ent.rawText.Substring(i);
                    break;
                }
                num += characterWidth;
            }
            if (!flag)
            {
                ent.line1 = ent.rawText;
            }
        }
        if (this.m_view != null && this.m_view.IsAllTextLineShowed())
        {
            this.m_chatEntityList.RemoveAt(0);
        }
        if (this.m_chatEntityList.Count == InBattleInputChat.CHAT_LINE_COUNT)
        {
            this.m_chatEntityList.RemoveAt(0);
        }
        this.m_chatEntityList.Add(ent);
        if (this.m_view != null)
        {
            this.m_view.Refresh(this.m_chatEntityList);
        }
    }
コード例 #5
0
    public void Refresh(ListView <InBattleInputChat.InBatChatEntity> chatEntityList)
    {
        if (chatEntityList == null)
        {
            return;
        }
        int i   = 0;
        int num = 0;

        while (num < chatEntityList.Count && i < InBattleInputChat.CHAT_LINE_COUNT)
        {
            InBattleInputChat.InBatChatEntity inBatChatEntity = chatEntityList[num];
            if (inBatChatEntity != null)
            {
                if (inBatChatEntity.type != InBattleInputChat.InBatChatEntity.EType.ParseAllColor)
                {
                    inBatChatEntity.Shade(this.lineBuilder);
                }
                if (!string.IsNullOrEmpty(inBatChatEntity.line1) && this.ShowTextInLine(i, inBatChatEntity.line1, inBatChatEntity.camp, inBatChatEntity.type, inBatChatEntity.ullUid))
                {
                    inBatChatEntity.bShow = true;
                    if (this.m_cacheNode[i] != null)
                    {
                        this.m_cacheNode[i].CustomSetActive(true);
                    }
                    if (!inBatChatEntity.IsInCoolDown())
                    {
                        inBatChatEntity.StartCooldown(0u);
                    }
                    i++;
                }
                if (!string.IsNullOrEmpty(inBatChatEntity.line2) && this.ShowTextInLine(i, inBatChatEntity.line2, inBatChatEntity.camp, inBatChatEntity.type, inBatChatEntity.ullUid))
                {
                    inBatChatEntity.bShow = true;
                    if (this.m_cacheNode[i] != null)
                    {
                        this.m_cacheNode[i].CustomSetActive(true);
                    }
                    if (!inBatChatEntity.IsInCoolDown())
                    {
                        inBatChatEntity.StartCooldown(0u);
                    }
                    i++;
                }
            }
            num++;
        }
        while (i < InBattleInputChat.CHAT_LINE_COUNT)
        {
            if (this.m_cacheNode[i] != null)
            {
                this.m_cacheNode[i].CustomSetActive(false);
            }
            i++;
        }
    }
コード例 #6
0
 private InBattleInputChat.InBatChatEntity GetValidChatEntity()
 {
     InBattleInputChat.InBatChatEntity result;
     if (this.m_caches.Count > 0)
     {
         result = this.m_caches[0];
         this.m_caches.RemoveAt(0);
     }
     else
     {
         result = new InBattleInputChat.InBatChatEntity();
     }
     return(result);
 }
コード例 #7
0
 public void Refresh(ListView <InBattleInputChat.InBatChatEntity> chatEntityList)
 {
     if (chatEntityList != null)
     {
         int index = 0;
         for (int i = 0; (i < chatEntityList.Count) && (index < InBattleInputChat.CHAT_LINE_COUNT); i++)
         {
             InBattleInputChat.InBatChatEntity entity = chatEntityList[i];
             if (entity != null)
             {
                 entity.Shade(this.lineBuilder);
                 if (!string.IsNullOrEmpty(entity.line1) && this.ShowTextInLine(index, entity.line1, entity.camp, entity.type, entity.ullUid))
                 {
                     entity.bShow = true;
                     if (this.m_cacheNode[index] != null)
                     {
                         this.m_cacheNode[index].CustomSetActive(true);
                     }
                     if (!entity.IsInCoolDown())
                     {
                         entity.StartCooldown(0);
                     }
                     index++;
                 }
                 if (!string.IsNullOrEmpty(entity.line2) && this.ShowTextInLine(index, entity.line2, entity.camp, entity.type, entity.ullUid))
                 {
                     entity.bShow = true;
                     if (this.m_cacheNode[index] != null)
                     {
                         this.m_cacheNode[index].CustomSetActive(true);
                     }
                     if (!entity.IsInCoolDown())
                     {
                         entity.StartCooldown(0);
                     }
                     index++;
                 }
             }
         }
         while (index < InBattleInputChat.CHAT_LINE_COUNT)
         {
             if (this.m_cacheNode[index] != null)
             {
                 this.m_cacheNode[index].CustomSetActive(false);
             }
             index++;
         }
     }
 }
コード例 #8
0
 public void Update()
 {
     for (int i = 0; i < this.m_chatEntityList.Count; i++)
     {
         InBattleInputChat.InBatChatEntity inBatChatEntity = this.m_chatEntityList[i];
         if (inBatChatEntity != null && inBatChatEntity.bShow)
         {
             inBatChatEntity.UpdateCooldown();
         }
     }
     if (this.m_view != null)
     {
         this.m_view.Update();
     }
 }
コード例 #9
0
    public InBattleInputChat.InBatChatEntity ConstructEnt(string content, InBattleInputChat.InBatChatEntity.EType type = InBattleInputChat.InBatChatEntity.EType.System)
    {
        InBattleInputChat.InBatChatEntity validChatEntity = this.GetValidChatEntity();
        validChatEntity.ullUid = 0uL;
        string text = string.Empty;

        if (type == InBattleInputChat.InBatChatEntity.EType.System)
        {
            text = "[系统]";
        }
        validChatEntity.type     = type;
        validChatEntity.rawText  = string.Format("{0} {1}", text, content);
        validChatEntity.colorEnd = (byte)validChatEntity.rawText.get_Length();
        return(validChatEntity);
    }
コード例 #10
0
    public InBattleInputChat.InBatChatEntity ConstructColorFlagEnt(string content)
    {
        InBattleInputChat.InBatChatEntity validChatEntity = this.GetValidChatEntity();
        validChatEntity.ullUid = 0uL;
        string text = "[系统]";

        validChatEntity.type    = InBattleInputChat.InBatChatEntity.EType.ParseAllColor;
        validChatEntity.rawText = string.Format("{0}{1}{2} {3}", new object[]
        {
            InBattleInputChat.InBatChatEntity.COLOR_SYSTEM,
            text,
            "</color>",
            content
        });
        return(validChatEntity);
    }
コード例 #11
0
        public static void OnObserveTipsCome(CSPkg msg)
        {
            InBattleInputChat inputChat = Singleton <InBattleMsgMgr> .get_instance().m_InputChat;

            if (inputChat != null)
            {
                SCPKG_OBTIPS_NTF    stOBTipsNtf = msg.stPkgData.get_stOBTipsNtf();
                COM_OBNUM_TIPS_TYPE bTipsType   = stOBTipsNtf.bTipsType;
                string text        = string.Empty;
                Player playerByUid = Singleton <GamePlayerCenter> .GetInstance().GetPlayerByUid(stOBTipsNtf.ullRecomUid);

                if (playerByUid != null)
                {
                    text = playerByUid.Name;
                }
                InBattleInputChat.InBatChatEntity ent = inputChat.ConstructColorFlagEnt(string.Format(Singleton <CTextManager> .GetInstance().GetText(bTipsType.ToString()), stOBTipsNtf.dwOBNum, text));
                inputChat.Add(ent);
            }
        }
コード例 #12
0
    private void On_EndEdit(string content)
    {
        Singleton <InBattleMsgMgr> .instance.HideView();

        if (this.m_inputField != null)
        {
            this.m_inputField.set_text(string.Empty);
        }
        if (this.intimeMSecond_StartTime != 0uL)
        {
            uint num = (uint)(Singleton <FrameSynchr> .GetInstance().LogicFrameTick - this.intimeMSecond_StartTime);
            if ((ulong)num < (ulong)((long)this.intimeMSecond))
            {
                if (this.intimeSendCount + 1 > this.intimeMaxCount)
                {
                    if (this.m_inputButton != null)
                    {
                        this.m_inputButton.StartCooldown(this.intime_cd, new Action(this.OnBlockCDEnd));
                    }
                    InBattleInputChat inputChat = Singleton <InBattleMsgMgr> .instance.m_InputChat;
                    if (inputChat != null)
                    {
                        InBattleInputChat.InBatChatEntity ent = inputChat.ConstructEnt(this.m_inCDTxt, InBattleInputChat.InBatChatEntity.EType.System);
                        inputChat.Add(ent);
                    }
                    this.intimeSendCount = 0;
                    return;
                }
            }
            else
            {
                this.intimeSendCount = 0;
            }
        }
        InBattleInputChat inputChat2 = Singleton <InBattleMsgMgr> .instance.m_InputChat;

        if (inputChat2 == null)
        {
            return;
        }
        if (string.IsNullOrEmpty(content))
        {
            return;
        }
        content = CUIUtility.RemoveEmoji(content);
        if (this.m_inputText != null)
        {
            this.m_inputText.CustomSetActive(false);
        }
        SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext();

        if (curLvelContext != null && !Singleton <InBattleMsgMgr> .instance.ShouldBeThroughNet(curLvelContext))
        {
            InBattleInputChat inputChat3 = Singleton <InBattleMsgMgr> .instance.m_InputChat;
            if (inputChat3 != null)
            {
                InBattleInputChat.InBatChatEntity ent2 = inputChat3.ConstructEnt(this.m_inWramBattle, InBattleInputChat.InBatChatEntity.EType.System);
                inputChat3.Add(ent2);
            }
        }
        else if (!string.IsNullOrEmpty(content))
        {
            InBattleMsgNetCore.SendInBattleMsg_InputChat(content, (byte)inputChat2.m_curChatCamp);
        }
        if (this.intimeSendCount == 0)
        {
            this.intimeMSecond_StartTime = Singleton <FrameSynchr> .GetInstance().LogicFrameTick;
        }
        this.intimeSendCount++;
    }