首次提交
This commit is contained in:
49
Assets/Scripts/UI/Bag/BagItem.cs
Normal file
49
Assets/Scripts/UI/Bag/BagItem.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using NBC;
|
||||
using NBF.Utils;
|
||||
using Log = NBC.Log;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BagItem : GButton
|
||||
{
|
||||
public ItemInfo ItemInfo;
|
||||
|
||||
// private string iconStr;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
onDragStart.Add(DragStart);
|
||||
// Oncl
|
||||
}
|
||||
|
||||
|
||||
private void DragStart(EventContext context)
|
||||
{
|
||||
context.PreventDefault();
|
||||
DragDropManager.inst.StartDrag(this, this.icon, this.icon, (int)context.data);
|
||||
// icon = string.Empty;
|
||||
}
|
||||
|
||||
public virtual void SetData(ItemInfo itemInfo)
|
||||
{
|
||||
draggable = false;
|
||||
ItemInfo = itemInfo;
|
||||
title = itemInfo.ConfigId.GetName();
|
||||
this.SetIcon(itemInfo.ConfigId);
|
||||
Quality.SetQuality(ItemInfo.Config.Quality);
|
||||
this.SetTitleQuality(ItemInfo.Config.Quality);
|
||||
// iconStr = icon;
|
||||
}
|
||||
|
||||
public void UpdateIcon()
|
||||
{
|
||||
this.SetIcon(ItemInfo.ConfigId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user