コード例 #1
0
        /*private void Reposition()
         * {
         *  scrollView.InvalidateBounds();
         *  if (scrollView.canMoveVertically)
         *  {
         #if REVERSE_ORDER
         *      float target = 0.0f;
         #else
         *      float target = 1.0f;
         #endif
         *      if (mInvalid)
         *      {
         *          scrollView.SetDragAmount(1f, target, false);
         *          scrollView.SetDragAmount(1f, target, true);
         *      }
         *      else if (Mathf.Abs(target - scrollView.verticalScrollBar.value) < 0.01f)
         *      {
         *          scrollView.SetDragAmount(1f, target, false);
         *      }
         *      scrollView.UpdatePosition();
         *  }
         *  mInvalid = false;
         * }*/

        private ChatItem Use()
        {
            if (mPool.Count > 0)
            {
                ChatItem item = mPool.Dequeue();
                item.mDMono.gameObject.CustomSetActive(true);
                mActive.Enqueue(item);
                item.mDMono.transform.parent           = mainTable.transform;
                item.mDMono.transform.localPosition    = Vector3.zero;
                item.mDMono.transform.localScale       = Vector3.one;
                item.mDMono.transform.localEulerAngles = Vector3.zero;
                item.mDMono.transform.SetAsLastSibling();
                return(item);
            }
            else
            {
                DynamicMonoILR ilr  = UnityEngine.Object.Instantiate(mActive[mActive.Count - 1].mDMono);
                ChatItem       item = ilr._ilrObject as ChatItem;
                mActive.Enqueue(item);
                item.mDMono.transform.parent           = mainTable.transform;
                item.mDMono.transform.localPosition    = Vector3.zero;
                item.mDMono.transform.localScale       = Vector3.one;
                item.mDMono.transform.localEulerAngles = Vector3.zero;
                item.mDMono.transform.SetAsLastSibling();
                item.SetItemData(null);
                return(item);
            }
        }
コード例 #2
0
 private void RecycleAll()
 {
     while (mActive.Count > 0)
     {
         ChatItem item = mActive.Dequeue();
         Recycle(item);
     }
 }
コード例 #3
0
        private void CleanOverflow()
        {
            int clean = mActive.Count + 1 - MaxHistoryCount;

            for (int i = 0; i < clean; ++i)
            {
                ChatItem item = mActive.Dequeue();
                Recycle(item);
            }
        }
コード例 #4
0
        private void AddMessage(EB.Sparx.ChatMessage msg)
        {
            ChatItem 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.SetItemData(uimsg);
        }
コード例 #5
0
 void SetChatItem()
 {
     if (isfirst)
     {
         isfirst = false;
         for (int i = 0; i < mainTable.transform.childCount; ++i)
         {
             ChatItem item = mainTable.transform.GetChild(i).GetMonoILRComponent <ChatItem>();
             Recycle(item);
         }
     }
 }
コード例 #6
0
 private void Recycle(ChatItem item)
 {
     item.mDMono.gameObject.CustomSetActive(false);
     mPool.Enqueue(item);
 }