84 lines
2.0 KiB
C#
Raw Normal View History

2025-06-19 18:23:31 +08:00
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using UnityEngine.EventSystems;
namespace QFramework.Example
{
public class UIImageSelectMap_JiHeData : UIPanelData
{
public string DragItemName;
public string TargetObj;
public string ItemPath;
}
public partial class UIImageSelectMap_JiHe : UIPanel
{
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIImageSelectMap_JiHeData ?? new UIImageSelectMap_JiHeData();
loader = ResLoader.Allocate();
}
ResLoader loader;
protected override void OnOpen(IUIData uiData = null)
{
string s = mData.DragItemName;
// <20><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GameObject obj = GameObject.Instantiate(LeftItem, LeftContent.transform);
obj.name = s;
string path = Global.deviceIconsPath + mData.ItemPath;
Debug.Log(path + "????");
loader.Add2Load(path.ToNetImageResName(), (success, res) =>
{
if (success)
{
obj.GetComponent<Image>().sprite = Utility.GetSprite(res.Asset as Texture2D);
obj.GetComponentInChildren<Text>().text = s;
}
});
uIImageDrag_JiHe = obj.GetComponent<UIImageDrag_JiHe>();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD>¼<EFBFBD>
//obj.OnBeginDragEvent(LeftOnBeginDrag);
//obj.OnDragEvent(LeftOnDrag);
//obj.OnEndDragEvent(LeftOnEndDrag);
loader.LoadAsync();
}
public UIImageDrag_JiHe uIImageDrag_JiHe;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ק״̬
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
if (loader != null)
{
loader.Recycle2Cache();
loader = null;
}
}
}
}