Exemplo n.º 1
0
 private void RecycleDropFlyTipItem(DropFlyTipItem item)
 {
     //item.gameObject.SetActive(false);
     item.gameObject.transform.SetRenderActive(false);
     mDropFlyTipItemList.Remove(item);
     mCachedFlyTipItemList.Add(item);
 }
Exemplo n.º 2
0
        //-------------------------------------------
        void Update()
        {
            float realTime = Time.realtimeSinceStartup;

            for (int i = 0; i < mDropFlyItemList.Count; i++)
            {
                DropFlyItem item = mDropFlyItemList[i];
                if (null != item)
                {
                    item.UpdateItem(realTime);

                    if (realTime > item.GetStayTime())
                    {
                        RecycleDropFlyItem(item, true);
                    }
                }
            }
            for (int i = 0; i < mDropGoldFlyItemList.Count; i++)
            {
                DropGoldFlyItem item = mDropGoldFlyItemList[i];
                if (null != item)
                {
                    item.UpdateItem(realTime);

                    if (realTime > item.GetAnimationTime() + item.mAniStart)
                    {
                        RecycleDropGoldFlyItem(item);
                    }
                }
            }
            for (int i = 0; i < mDropFlyTipItemList.Count; i++)
            {
                DropFlyTipItem item = mDropFlyTipItemList[i];
                if (null != item)
                {
                    item.UpdateItem(realTime);

                    if (realTime > item.GetAnimationTime() + item.mAniStart)
                    {
                        RecycleDropFlyTipItem(item);
                    }
                }
            }

            if (Time.realtimeSinceStartup - mLastTime > mIntervalTime)
            {
                if (mProcessFlyTips.Count > 0)
                {
                    FlyTipInfo info = mProcessFlyTips.Dequeue();

                    ShowDropFlyTipItem(info.name, info.quality);

                    mLastTime = Time.realtimeSinceStartup;
                }
            }
        }
Exemplo n.º 3
0
        private void ShowDropFlyTipItem(string itemName, int quality)
        {
            DropFlyTipItem item = null;
            int            cnt  = mCachedFlyTipItemList.Count;

            if (cnt > 0)
            {
                item = mCachedFlyTipItemList[cnt - 1];
                mCachedFlyTipItemList.RemoveAt(cnt - 1);

                //item.gameObject.SetActive(true);
                item.gameObject.transform.SetRenderActive(true);
            }
            else
            {
                GameObject prefab = (GameObject)CoreEntry.gResLoader.Load(mDropFlyTipItemPath, typeof(GameObject));
                if (null == prefab)
                {
                    return;
                }
                GameObject obj = Instantiate(prefab) as GameObject;
                if (null == obj)
                {
                    return;
                }

                obj.transform.SetParent(DropFlyRoot.Find("CenterTopRoot"));
                obj.transform.localScale = Vector3.one;
                obj.SetActive(true);
                item = obj.GetComponent <DropFlyTipItem>();
            }

            if (null != item)
            {
                mDropFlyTipItemList.Add(item);
                if (quality < mTipsTextColor.Count && quality < mTipsOutlineColor.Count)
                {
                    item.Init(Time.realtimeSinceStartup, itemName, mTipsTextColor[quality], mTipsOutlineColor[quality]);
                }
            }
        }