コード例 #1
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);
        }
    }
コード例 #2
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)));
     }
 }
コード例 #3
0
ファイル: ChatManager.cs プロジェクト: unseen-code/tianqi_src
    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);
    }
コード例 #4
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);
        }
    }