Exemplo n.º 1
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.º 2
0
        private void OnEvent()
        {
            if (EventToUI.sEvent.CompareTo("EU_ADD_DROPITEMTEXT") == 0)
            {
                GameObject dropItemObj = (GameObject)EventToUI.GetArg(UIEventArg.Arg1);
                string     text        = (string)EventToUI.GetArg(UIEventArg.Arg2);
                int        quality     = (int)EventToUI.GetArg(UIEventArg.Arg3);
                if (-1 == quality)
                {
                    return;
                }

                Create(dropItemObj, text, quality);
            }
            else if (EventToUI.sEvent.CompareTo("EU_REMOVE_DROPITEMTEXT") == 0)
            {
                GameObject dropItemObj = (GameObject)EventToUI.GetArg(UIEventArg.Arg1);
                for (int i = 0; i < mDropTextList.Count; ++i)
                {
                    if (mDropTextList[i].dropItemObj == dropItemObj)
                    {
                        RecycleDropText(mDropTextList[i]);
                    }
                }
            }
            else if (EventToUI.sEvent.CompareTo("EU_SHOW_DROPFLY") == 0)
            {
                string  icon     = (string)EventToUI.GetArg(UIEventArg.Arg1);
                Vector3 from     = (Vector3)EventToUI.GetArg(UIEventArg.Arg2);
                Vector3 to       = (Vector3)EventToUI.GetArg(UIEventArg.Arg3);
                string  itemName = (string)EventToUI.GetArg(UIEventArg.Arg4);
                int     quality  = (int)EventToUI.GetArg(UIEventArg.Arg5);

                ShowDropFlyItem(Time.realtimeSinceStartup, icon, from, to, itemName, quality);
            }
            else if (EventToUI.sEvent.CompareTo("EU_SHOW_DROPGOLDGFLY") == 0)
            {
                int     count = (int)EventToUI.GetArg(UIEventArg.Arg1);
                Vector3 pos   = (Vector3)EventToUI.GetArg(UIEventArg.Arg2);

                ShowDropGoldFlyItem(count, pos);
            }
            else if (EventToUI.sEvent.CompareTo("EU_SHOW_DROPFLYTIP") == 0)
            {
                FlyTipInfo info = new FlyTipInfo();

                info.name    = (string)EventToUI.GetArg(UIEventArg.Arg1);
                info.quality = (int)EventToUI.GetArg(UIEventArg.Arg2);

                mProcessFlyTips.Enqueue(info);
            }
        }