public InBatChatEntity ConstructEnt(ulong ullUid, string playerName, string content, byte camp)
    {
        InBatChatEntity validChatEntity = this.GetValidChatEntity();
        string          name            = string.Empty;
        Player          playerByUid     = Singleton <GamePlayerCenter> .instance.GetPlayerByUid(ullUid);

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

        if (camp == 0)
        {
            str2 = "[全部]";
        }
        string str3 = string.Format("{0}{1}({2}):", str2, playerName, name);

        validChatEntity.colorEnd = (byte)str3.Length;
        validChatEntity.rawText  = string.Format("{0}{1}", str3, content);
        validChatEntity.camp     = camp;
        validChatEntity.type     = InBatChatEntity.EType.Normal;
        return(validChatEntity);
    }
 private void ReclyChatEntity(InBatChatEntity ent)
 {
     if (ent != null)
     {
         int index = -1;
         for (int i = 0; i < this.m_chatEntityList.Count; i++)
         {
             InBatChatEntity entity = this.m_chatEntityList[i];
             if ((entity != null) && (ent.ullUid == entity.ullUid))
             {
                 index = i;
                 break;
             }
         }
         if (index != -1)
         {
             this.m_caches.Add(ent);
             this.m_chatEntityList.RemoveAt(index);
             if (this.m_view != null)
             {
                 this.m_view.Refresh(this.m_chatEntityList);
             }
         }
     }
 }
    private InBatChatEntity GetValidChatEntity()
    {
        InBatChatEntity entity = null;

        if (this.m_caches.Count > 0)
        {
            entity = this.m_caches[0];
            this.m_caches.RemoveAt(0);
            return(entity);
        }
        return(new InBatChatEntity());
    }
 public void Update()
 {
     for (int i = 0; i < this.m_chatEntityList.Count; i++)
     {
         InBatChatEntity entity = this.m_chatEntityList[i];
         if ((entity != null) && entity.bShow)
         {
             entity.UpdateCooldown();
         }
     }
     if (this.m_view != null)
     {
         this.m_view.Update();
     }
 }
    public InBatChatEntity ConstructEnt(string content, InBatChatEntity.EType type = 1)
    {
        InBatChatEntity validChatEntity = this.GetValidChatEntity();

        validChatEntity.ullUid = 0L;
        string str = string.Empty;

        if (type == InBatChatEntity.EType.System)
        {
            str = "[系统]";
        }
        validChatEntity.type     = type;
        validChatEntity.rawText  = string.Format("{0} {1}", str, content);
        validChatEntity.colorEnd = (byte)validChatEntity.rawText.Length;
        return(validChatEntity);
    }
 public void Add(InBatChatEntity ent)
 {
     if (ent != null)
     {
         bool flag       = false;
         int  num        = 0;
         int  startIndex = 0;
         for (int i = 0; i < ent.rawText.Length; i++)
         {
             int characterWidth = this.GetCharacterWidth(ent.rawText[i]);
             if ((num + characterWidth) > (this.m_view.lineWidth - 10))
             {
                 flag      = true;
                 ent.line1 = ent.rawText.Substring(startIndex, 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 == 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);
         }
     }
 }