예제 #1
0
 public void RefreshChats(List <ChatManager.ChatInfo> chatInfos)
 {
     this.ClearChats();
     if (chatInfos.get_Count() == 0)
     {
         return;
     }
     for (int i = 0; i < chatInfos.get_Count(); i++)
     {
         ChatInfoBase chatInfoBase = ChatManager.CreatePrefab2TipChatInfo(string.Empty);
         chatInfoBase.ShowInfo(chatInfos.get_Item(i));
         this.Chats.Add(chatInfoBase);
     }
     while (this.Chats.get_Count() > 0 && this.CalHeight4Chats(this.Chats.get_Count()) > 88f)
     {
         ChatManager.Reuse2TipChatInfoPool(this.Chats.get_Item(0));
         this.Chats.RemoveAt(0);
     }
     for (int j = 0; j < this.Chats.get_Count(); j++)
     {
         RectTransform rectTransform = this.Chats.get_Item(j).get_transform() as RectTransform;
         UGUITools.ResetTransform(rectTransform.get_transform(), this.m_tranContent);
         rectTransform.set_anchoredPosition(new Vector2(0f, -this.CalHeight4Chats(j)));
     }
 }
예제 #2
0
    private void UpdateTeamChatTip(ChatManager.ChatInfo chatInfo)
    {
        if (!base.get_gameObject().get_activeInHierarchy())
        {
            return;
        }
        Transform transform = base.FindTransform("TeamTalkToot");
        int       num       = 0;

        if (chatInfo != null && this.m_memberResume.roleId == chatInfo.sender_uid)
        {
            if (transform.get_childCount() > num)
            {
                transform.GetChild(num).get_gameObject().SetActive(true);
                ChatInfoBase component = transform.GetChild(num).GetComponent <ChatInfo2Bubble>();
                if (component != null)
                {
                    component.Clear();
                    component.ShowInfo(chatInfo);
                }
            }
            else
            {
                GameObject chatInfo2Bubble = ChatManager.Instance.GetChatInfo2Bubble(chatInfo, transform);
                chatInfo2Bubble.set_name("chatInfoBubble");
                chatInfo2Bubble.get_transform().set_localPosition(Vector3.get_zero());
            }
            num++;
        }
        for (int i = num; i < transform.get_childCount(); i++)
        {
            GameObject gameObject = transform.GetChild(i).get_gameObject();
            gameObject.SetActive(false);
        }
    }
예제 #3
0
    protected override void SetContentSize(string datetime)
    {
        RectTransform rectTransform = this.m_lblContent.get_transform() as RectTransform;

        rectTransform.set_sizeDelta(new Vector2(this.LINE_WIDTH, Mathf.Max(200f, ChatInfoBase.GetContentHeight(this.m_lblContent))));
        this.SetBackgroundSize(ChatManager.IsVoice(this.m_chatInfo));
    }
예제 #4
0
 private void ResetChatsPos()
 {
     for (int i = 0; i < this.m_listChats.get_Count(); i++)
     {
         ChatInfoBase chatInfoBase = this.m_listChats.get_Item(i);
         chatInfoBase.get_transform().set_localPosition(new Vector3(0f, this.CalHeight4Chats(i), 0f));
     }
 }
예제 #5
0
 public static void Reuse2TipChatInfoPool(ChatInfoBase gridUI)
 {
     if (gridUI != null)
     {
         gridUI.Clear();
         ChatManager.ChatInfoTipPool.ReUse(gridUI.get_gameObject());
     }
 }
예제 #6
0
    public GameObject GetChatInfo2Bubble(ChatManager.ChatInfo chatInfo, Transform chatParent = null)
    {
        GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("ChatInfo2Bubble");

        if (chatParent != null)
        {
            instantiate2Prefab.get_transform().SetParent(chatParent);
        }
        instantiate2Prefab.GetComponent <RectTransform>().set_localScale(Vector3.get_one());
        ChatInfoBase component = instantiate2Prefab.GetComponent <ChatInfo2Bubble>();

        component.ShowInfo(chatInfo);
        return(instantiate2Prefab);
    }
예제 #7
0
    public void AddChat2Channel(ChatManager.ChatInfo chatInfo)
    {
        this.CheckNums();
        ChatInfoBase chatInfoBase = ChatManager.CreatePrefab2ChannelChatInfo("_ChatItem" + this.m_listChats.get_Count());

        UGUITools.ResetTransform(chatInfoBase.get_transform(), this.m_rChannelChatsOffset);
        chatInfoBase.get_transform().set_localPosition(new Vector3(0f, this.CalHeight4Chats(this.m_listChats.get_Count()), 0f));
        chatInfoBase.ShowInfo(chatInfo);
        this.m_listChats.Add(chatInfoBase);
        this.m_rChannelChats.set_sizeDelta(new Vector2(0f, Mathf.Abs(this.CalHeight4Chats(this.m_listChats.get_Count()))));
        this.SetContentPos();
        if (chatInfo.sender_uid == EntityWorld.Instance.EntSelf.ID)
        {
            this.OnBtnlockClick(null);
        }
        else if (this.Islock)
        {
            this.NewNum++;
            this.ShowLock(true);
        }
    }
예제 #8
0
 protected override void SetContentSize(string datetime)
 {
     if (ChatManager.IsVoice(this.m_chatInfo))
     {
         this.m_btnContentBg.set_enabled(true);
         int voiceTime = ChatManager.GetVoiceTime(this.m_chatInfo);
         this.m_lblRootVoiceTime.set_text(voiceTime + "''");
         int voiceBackgroundSize = ChatManager.GetVoiceBackgroundSize(Mathf.Max(2, voiceTime));
         if (string.IsNullOrEmpty(this.m_lblContent.get_text()))
         {
             this.m_lblContent.set_text(ChatManager.GetBlank((float)voiceBackgroundSize, this.FONT_SIZE));
         }
         else
         {
             this.m_lblContent.set_text("\n" + this.m_lblContent.get_text());
         }
         this.m_rootVoiceDOT.get_gameObject().SetActive(true);
         this.SetBackgroundSize();
         this.SetSender(this.IsOwn(), true, this.SenderName, datetime);
     }
     else
     {
         this.m_btnContentBg.set_enabled(false);
         if (this.CheckIsQuestionContent())
         {
             RectTransform rectTransform = this.m_questionContent.get_transform() as RectTransform;
             rectTransform.set_sizeDelta(new Vector2(325f, ChatInfoBase.GetContentHeight(this.m_questionContent)));
         }
         else
         {
             RectTransform rectTransform2 = this.m_lblContent.get_transform() as RectTransform;
             rectTransform2.set_sizeDelta(new Vector2(this.LINE_WIDTH, ChatInfoBase.GetContentHeight(this.m_lblContent)));
         }
         this.SetBackgroundSize();
         this.SetSender(this.IsOwn(), false, this.SenderName, datetime);
     }
     this.SetPreferredHeight();
 }
예제 #9
0
    private static void CreatePools()
    {
        ChatManager.ChatInfoChannelPoolTransform = new GameObject("Pool2ChatChannel").get_transform();
        ChatManager.ChatInfoChannelPoolTransform.set_parent(UINodesManager.NoEventsUIRoot);
        UGUITools.ResetTransform(ChatManager.ChatInfoChannelPoolTransform);
        ChatManager.ChatInfoChannelPool      = new UIPool("ChatInfo2Channel", ChatManager.ChatInfoChannelPoolTransform, false);
        ChatManager.ChatInfoTipPoolTransform = new GameObject("Pool2ChatTip").get_transform();
        ChatManager.ChatInfoTipPoolTransform.set_parent(UINodesManager.NoEventsUIRoot);
        ChatManager.ChatInfoTipPoolTransform.get_gameObject().SetActive(false);
        UGUITools.ResetTransform(ChatManager.ChatInfoTipPoolTransform);
        ChatManager.ChatInfoTipPool = new UIPool("ChatInfo2Tip", ChatManager.ChatInfoTipPoolTransform, false);
        ChatInfoBase component = ResourceManager.GetInstantiate2Prefab("ChatInfo2Tip").GetComponent <ChatInfoBase>();

        component.set_name("FontTool");
        component.get_transform().SetParent(UINodesManager.T4RootOfSpecial);
        ChatManager.mFontTool = component.get_transform().FindChild("Content").GetComponent <Text>();
        component.get_gameObject().SetActive(false);
        ChatManager.FacePoolTransform = new GameObject("Pool2Face").get_transform();
        ChatManager.FacePoolTransform.set_parent(UINodesManager.NoEventsUIRoot);
        ChatManager.FacePoolTransform.get_gameObject().SetActive(false);
        UGUITools.ResetTransform(ChatManager.FacePoolTransform);
        ChatManager.FacePool = new UIPool("Item2Face", ChatManager.FacePoolTransform, false);
    }
예제 #10
0
 protected override string GetContentTextInColor(string content)
 {
     return(ChatInfoBase.GetStringColorByChannel(this.m_chatInfo.src_channel, content));
 }
예제 #11
0
    protected override void SetContentSize(string datetime)
    {
        RectTransform rectTransform = this.m_lblContent.get_transform() as RectTransform;

        rectTransform.set_sizeDelta(new Vector2(this.LINE_WIDTH, ChatInfoBase.GetContentHeight(this.m_lblContent)));
    }