Exemplo n.º 1
0
 private void RecycleDropGoldFlyItem(DropGoldFlyItem item)
 {
     //item.gameObject.SetActive(false);
     item.gameObject.transform.SetRenderActive(false);
     mDropGoldFlyItemList.Remove(item);
     mCachedGoldFlyItemList.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 ShowDropGoldFlyItem(int count, Vector3 pos)
        {
            DropGoldFlyItem item = null;
            int             cnt  = mCachedGoldFlyItemList.Count;

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

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

                obj.transform.SetParent(DropFlyRoot);
                obj.transform.localScale = Vector3.one;
                obj.SetActive(true);
                item = obj.GetComponent <DropGoldFlyItem>();
            }

            if (null != item)
            {
                mDropGoldFlyItemList.Add(item);

                item.Init(Time.realtimeSinceStartup, count, pos);
            }
        }