| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | using System.Drawing;using Fort23.Core;using GameLogic.Bag;using UnityEngine;using Utility.UITool;namespace Fort23.Mono{    [UIBinding(prefab = "ShowItemNumberCom")]    public partial class ShowItemNumberCom : UIComponent    {        private float _currentTime;        private float _originY;        private TimerEntity _timerEntity;        private void Init()        {        }                public override void AddEvent()        {        }        public override void DelEvent()        {        }        public override void AddButtonEvent()        {        }        public static async CTask<ShowItemNumberCom> Open(Vector3 pos, ItemInfo itemInfo)        {            ShowItemNumberCom showItemNumberCom = await UIManager.Instance.CreateGComponent<ShowItemNumberCom>(null, UIManager.Instance.GetLayer(UILayer.Bottom));            Vector3 p = UIManager.Instance.CurrCustomCameraStack.camera.WorldToScreenPoint(pos);            Vector3 p2 = UIManager.Instance.UICamera.ScreenToWorldPoint(p);            showItemNumberCom.GObjectPoolInterface.GetComponent<RectTransform>().position = p2;            showItemNumberCom.ShowTips(itemInfo);            return showItemNumberCom;        }        public void ShowTips(ItemInfo itemInfo)        {            Vector3 pos = transform.GetComponent<RectTransform>().localPosition;            Text_Number.text = $"+{itemInfo.count}";            Icon_Item.gameObject.SetActive(true);            Text_Number.gameObject.SetActive(true);            Icon_Item.icon_name = itemInfo.config.icon;            _currentTime = 0;            _originY = transform.GetComponent<RectTransform>().localPosition.y;            _timerEntity = TimerComponent.Instance.AddTimer(20, (() => { Close(); }), 50, () =>            {                _currentTime += 0.02f;                float offsetY = _originY + AnimationCurveManager.Instance.AnimationCurveLibrary.JumpY.Evaluate(_currentTime) * 100;                transform.localPosition = new Vector3(pos.x, offsetY, pos.z);            });        }        public override void Close()        {            UIManager.Instance.DormancyGComponent(this);            _timerEntity?.Dispose();            _timerEntity = null;            base.Close();        }    }}
 |