using vnxbqy.UI;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
using UnityEngine;
|
|
public class GarbageGirdCell : ILBehaviour
|
{
|
ItemCell itemCell;
|
UIDragDropBehaviour dragDrop;
|
Image imgSelect;
|
|
int objIndex = 0;
|
protected override void Awake()
|
{
|
itemCell = proxy.GetWidgtEx<ItemCell>("ItemCell");
|
imgSelect = proxy.GetWidgtEx<Image>("SelectImage");
|
dragDrop = proxy.GetWidgtEx<UIDragDropBehaviour>("dragItem");
|
|
}
|
|
|
//index档位字典的数组索引
|
public void Display(int index)
|
{
|
objIndex = index;
|
var item = HolidayRefuseClassificationModel.Instance.packModel.GetItemByIndex(index);
|
if (item == null)
|
{
|
itemCell.SetActiveIL(false);
|
imgSelect.SetActiveIL(false);
|
dragDrop.SetActiveIL(false);
|
return;
|
}
|
|
itemCell.SetActiveIL(true);
|
imgSelect.SetActiveIL(HolidayRefuseClassificationModel.Instance.selectIndex == index);
|
dragDrop.SetActiveIL(true);
|
|
dragDrop.Init(objIndex);
|
dragDrop.onClick -= OnClick;
|
dragDrop.onClick += OnClick;
|
|
var model = new ItemCellModel(item.itemId, false, (ulong)item.count);
|
itemCell.Init(model);
|
itemCell.auctionIcon.SetActiveIL(item.isAuction);
|
}
|
|
void OnClick(int index)
|
{
|
//在UIDragDropBehaviour的draging超过0.2秒 不触发onclick
|
HolidayRefuseClassificationModel.Instance.selectIndex = index;
|
//脱离物品时触发主动设置数据
|
UIDragDropBehaviour.draging = true;
|
UIDragDropBehaviour.dragData = objIndex;
|
}
|
}
|