Esempio n. 1
0
 public static void InitGridView(this UILoopGridView self, int itemTotalCount,
                                 System.Func <LoopGridView, int, int, int, LoopGridViewItem> onGetItemByRowColumn,
                                 LoopGridViewSettingParam settingParam = null,
                                 LoopGridViewInitParam initParam       = null)
 {
     self.ActivatingComponent();
     self.unity_uiloopgridview.InitGridView(itemTotalCount, onGetItemByRowColumn, settingParam, initParam);
 }
Esempio n. 2
0
        //item是Unity侧的item对象,在这里创建相应的UI对象
        public static void AddItemViewComponent <T>(this UILoopGridView self, LoopGridViewItem item) where T : Entity, IAwake, IOnEnable
        {
            //保证名字不能相同 不然没法cache
            item.gameObject.name = item.gameObject.name + item.ItemId;
            T t = self.AddUIComponentNotCreate <T>(item.gameObject.name);

            t.AddUIComponent <UITransform, Transform>("", item.transform);
            UIEventSystem.Instance.OnCreate(t);
        }
Esempio n. 3
0
 public static void ActivatingComponent(this UILoopGridView self)
 {
     if (self.unity_uiloopgridview == null)
     {
         self.unity_uiloopgridview = self.GetGameObject().GetComponent <LoopGridView>();
         if (self.unity_uiloopgridview == null)
         {
             Log.Error($"添加UI侧组件UILoopGridView时,物体{ self.GetGameObject().name}上没有找到LoopGridView组件");
         }
     }
 }
Esempio n. 4
0
 public static void SetOnBeginDragAction(this UILoopGridView self, Action <PointerEventData> callback)
 {
     self.ActivatingComponent();
     self.unity_uiloopgridview.mOnBeginDragAction = callback;
 }
Esempio n. 5
0
 public static void SetItemSize(this UILoopGridView self, Vector2 sizeDelta)
 {
     self.ActivatingComponent();
     self.unity_uiloopgridview.SetItemSize(sizeDelta);
 }
Esempio n. 6
0
 public static void RefreshAllShownItem(this UILoopGridView self)
 {
     self.ActivatingComponent();
     self.unity_uiloopgridview.RefreshAllShownItem();
 }
Esempio n. 7
0
 public static void MovePanelToItemByRowColumn(this UILoopGridView self, int row, int column, int offsetX = 0, int offsetY = 0)
 {
     self.ActivatingComponent();
     self.unity_uiloopgridview.MovePanelToItemByRowColumn(row, column, offsetX, offsetY);
 }
Esempio n. 8
0
 //获取当前index对应的item 没有显示的话返回null
 public static LoopGridViewItem GetShownItemByItemIndex(this UILoopGridView self, int itemIndex)
 {
     self.ActivatingComponent();
     return(self.unity_uiloopgridview.GetShownItemByItemIndex(itemIndex));
 }
Esempio n. 9
0
 //itemCount重设item的数量,resetPos是否刷新当前显示的位置
 public static void SetListItemCount(this UILoopGridView self, int itemCount, bool resetPos = true)
 {
     self.ActivatingComponent();
     self.unity_uiloopgridview.SetListItemCount(itemCount, resetPos);
 }
Esempio n. 10
0
 //根据Unity侧item获取UI侧的item
 public static T GetUIItemView <T>(this UILoopGridView self, LoopGridViewItem item) where T : Entity, IAwake
 {
     return(self.GetUIComponent <T>(item.gameObject.name));
 }