Example #1
0
 private MainMenuChatItem Use()
 {
     if (mPool.Count > 0)
     {
         MainMenuChatItem item = mPool[mPool.Count - 1];
         mPool.RemoveAt(mPool.Count - 1);
         item.mDMono.gameObject.SetActive(true);
         mActive.Enqueue(item);
         item.mDMono.transform.parent           = previewTable.transform;
         item.mDMono.transform.localPosition    = Vector3.zero;
         item.mDMono.transform.localScale       = Vector3.one;
         item.mDMono.transform.localEulerAngles = Vector3.zero;
         item.mDMono.transform.SetAsFirstSibling();
         return(item);
     }
     else
     {
         MainMenuChatItem item = Object.Instantiate(mActive[mActive.Count - 1].mDMono.transform).GetMonoILRComponent <MainMenuChatItem>();
         mActive.Enqueue(item);
         item.mDMono.transform.parent           = previewTable.transform;
         item.mDMono.transform.localPosition    = Vector3.zero;
         item.mDMono.transform.localScale       = Vector3.one;
         item.mDMono.transform.localEulerAngles = Vector3.zero;
         item.mDMono.transform.SetAsFirstSibling();
         item.SetSysItemData(null);
         return(item);
     }
 }
Example #2
0
 private void Recycle(MainMenuChatItem item)
 {
     item.SetItemData(null);
     item.mDMono.transform.SetAsLastSibling();
     item.mDMono.gameObject.SetActive(false);
     mPool.Add(item);
 }
Example #3
0
 private MainMenuChatItem Use()
 {
     if (mPool.Count > 0)
     {
         MainMenuChatItem item = mPool[mPool.Count - 1];
         mPool.RemoveAt(mPool.Count - 1);
         item.mDMono.gameObject.SetActive(true);
         mActive.Enqueue(item);
         item.mDMono.transform.SetParent(mPreviewTableTransform);
         item.mDMono.transform.localPosition    = Vector3.zero;
         item.mDMono.transform.localScale       = Vector3.one;
         item.mDMono.transform.localEulerAngles = Vector3.zero;
         item.mDMono.transform.SetAsFirstSibling();
         return(item);
     }
     else
     {
         var ilr = Object.Instantiate(mActive[mActive.Count - 1].mDMono);
         MainMenuChatItem item = ilr._ilrObject as MainMenuChatItem;
         mActive.Enqueue(item);
         item.mDMono.transform.SetParent(mPreviewTableTransform);
         item.mDMono.transform.localPosition    = Vector3.zero;
         item.mDMono.transform.localScale       = Vector3.one;
         item.mDMono.transform.localEulerAngles = Vector3.zero;
         item.mDMono.transform.SetAsFirstSibling();
         item.SetItemData(null);
         return(item);
     }
 }
Example #4
0
        public override void Awake()
        {
            base.Awake();

            var t = mDMono.transform;

            CurrentPanel      = t.GetComponent <UIPanel>("Scroll View");
            RedPoint          = t.FindEx("RedPoint").gameObject;
            chatContentParent = t.GetComponent <UIWidget>("Scroll View/Placeholder");
            previewTable      = t.GetComponent <UITable>("Scroll View/Placeholder/Container");
            placeholder       = t.GetComponent <UIWidget>("Scroll View/Placeholder");
            scrollView        = t.GetComponent <UIScrollView>("Scroll View");
            expandTweener     = t.GetComponent <TweenHeight>("PreviewBg");
            expandToggle      = t.GetComponent <UIToggle>("ExpandBtn");
            hasNewSysMessage  = false;

            t.GetComponent <UIToggle>("ExpandBtn").onChange.Add(new EventDelegate(OnExtendBtnClick));
            t.GetComponent <UIEventTrigger>("PreviewBg").onClick.Add(new EventDelegate(OnOpenChatUIBtnClick));

            mPreviewTableTransform = previewTable.transform;

            for (int i = mPreviewTableTransform.childCount - 1; i >= 0; --i)
            {
                MainMenuChatItem item = mPreviewTableTransform.GetChild(i).GetMonoILRComponent <MainMenuChatItem>();
                Recycle(item);
            }

            mPanel      = scrollView.GetComponent <UIPanel>();
            mClipRegion = mPanel.baseClipRegion;
            isFirst     = true;
        }
Example #5
0
 private void RecycleAll()
 {
     while (mActive.Count > 0)
     {
         MainMenuChatItem item = mActive.Dequeue();
         Recycle(item);
     }
 }
Example #6
0
        private void CleanOverflow()
        {
            int clean = mActive.Count + 1 - MaxHistoryCount;

            for (int i = 0; i < clean; ++i)
            {
                MainMenuChatItem item = mActive.Dequeue();
                Recycle(item);
            }
        }
Example #7
0
        private void AddMessage(EB.Sparx.ChatMessage msg)
        {
            MainMenuChatItem item = Use();

            ChatUIMessage uimsg   = new ChatUIMessage(msg);
            var           channel = ChatRule.STR2CHANNEL[msg.channelType];

            uimsg.Channel           = channel;
            uimsg.ChannelSpriteName = ChatRule.CHANNEL2ICON.ContainsKey(channel) ? ChatRule.CHANNEL2ICON[channel] : "";
            item.SetSysItemData(uimsg);
        }
Example #8
0
        public override void Awake()
        {
            base.Awake();

            var t = mDMono.transform;

            chatContentParent = t.parent.GetComponent <UIWidget>();
            previewTable      = t.GetComponent <UITable>();
            placeholder       = t.parent.GetComponent <UIWidget>();
            scrollView        = t.parent.parent.GetComponent <UIScrollView>();

            for (int i = previewTable.transform.childCount - 1; i >= 0; --i)
            {
                MainMenuChatItem item = previewTable.transform.GetChild(i).GetMonoILRComponent <MainMenuChatItem>();
                Recycle(item);
            }

            mPanel      = scrollView.GetComponent <UIPanel>();
            mClipRegion = mPanel.baseClipRegion;
        }