123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using Fort23.Core;
- using Fort23.Mono;
- using UnityEngine;
- public class ItemWidgetBasic : UIComponent, IScorllListWidget
- {
-
- protected RectTransform _rectTransform;
- public System.Action<ItemWidgetBasic> onClick;
- public System.Action<ItemWidgetBasic> onContinueClick;
- public override void AddButtonEvent()
- {
- LongPressBtn longPressBtn = own.GetComponent<LongPressBtn>();
- if(longPressBtn == null)
- longPressBtn = own.AddComponent<LongPressBtn>();
- longPressBtn.onClick =() => onClick?.Invoke(this);
- longPressBtn.longPress =() => onContinueClick?.Invoke(this);
- base.AddButtonEvent();
-
- }
- public override CTask<bool> AsyncInit(object[] uiData)
- {
- if (_rectTransform == null)
- {
- _rectTransform = GObjectPoolInterface.GetComponent<RectTransform>();
- }
-
- return base.AsyncInit(uiData);
- }
-
- public RectTransform Transform
- {
- get { return _rectTransform; }
- }
- public int index { get; set; }
- public virtual Vector2 GetSize()
- {
- return _rectTransform.sizeDelta;
- }
- public override void DormancyObj()
- {
-
- transform.GetComponent<RectTransform>().anchorMax = Vector2.one * 0.5f;
- transform.GetComponent<RectTransform>().anchorMin = Vector2.one * 0.5f;
- base.DormancyObj();
- }
-
- public void OnPointerClick()
- {
- onClick?.Invoke(this);
- }
- public void OnPointerContinueClick()
- {
- onContinueClick?.Invoke(this);
- }
- }
|