Exemplo n.º 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);
            }
        }
Exemplo n.º 2
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);
        }