62 lines
1.4 KiB
C#
62 lines
1.4 KiB
C#
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
using QFramework;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
namespace QFramework.Example
|
||
|
|
{
|
||
|
|
public class DragPanelData : UIPanelData
|
||
|
|
{
|
||
|
|
|
||
|
|
public string DragItemName;
|
||
|
|
public string HieraNames;
|
||
|
|
public string TargetObjs;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
public partial class DragPanel: UIPanel
|
||
|
|
{
|
||
|
|
public List<DragUIItem> dragUIItems=new List<DragUIItem>();
|
||
|
|
protected override void OnInit(IUIData uiData = null)
|
||
|
|
{
|
||
|
|
mData = uiData as DragPanelData ?? new DragPanelData();
|
||
|
|
// please add init code here
|
||
|
|
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
|
||
|
|
}
|
||
|
|
public void OnModuleQuit(OnModuleQuit arg)
|
||
|
|
{
|
||
|
|
Hide();
|
||
|
|
}
|
||
|
|
protected override void OnOpen(IUIData uiData = null)
|
||
|
|
{
|
||
|
|
List<String> DragItem = mData.DragItemName.Split(',')?.ToList();
|
||
|
|
List<String> ShowTexts = mData.HieraNames.Split(',')?.ToList();
|
||
|
|
List<String> Tip = mData.TargetObjs.Split('|')?.ToList();
|
||
|
|
for (int i = 0; i < DragItem.Count; i++)
|
||
|
|
{
|
||
|
|
var tipItemObj = GameObject.Instantiate(ItemPrefab, Content.transform);
|
||
|
|
|
||
|
|
dragUIItems.Add(tipItemObj.GetComponent<DragUIItem>());
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnShow()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnHide()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnClose()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|