2025-06-25 13:45:30 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using QFramework;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Linq;
|
2025-06-26 14:07:29 +08:00
|
|
|
|
using TMPro;
|
|
|
|
|
|
using static OperationController;
|
2025-06-25 13:45:30 +08:00
|
|
|
|
|
|
|
|
|
|
namespace QFramework.Example
|
|
|
|
|
|
{
|
|
|
|
|
|
public class DragPanelData : UIPanelData
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public string DragItemName;
|
|
|
|
|
|
public string HieraNames;
|
|
|
|
|
|
public string TargetObjs;
|
2025-06-26 14:07:29 +08:00
|
|
|
|
public string FinishedEvent;
|
2025-06-25 13:45:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public partial class DragPanel: UIPanel
|
|
|
|
|
|
{
|
|
|
|
|
|
public List<DragUIItem> dragUIItems=new List<DragUIItem>();
|
2025-06-26 14:07:29 +08:00
|
|
|
|
public Button NextButton;
|
|
|
|
|
|
|
|
|
|
|
|
//public string Finished;
|
|
|
|
|
|
protected override void OnInit(IUIData uiData = null)
|
2025-06-25 13:45:30 +08:00
|
|
|
|
{
|
2025-06-26 14:07:29 +08:00
|
|
|
|
// please add init code here
|
|
|
|
|
|
|
2025-06-25 13:45:30 +08:00
|
|
|
|
}
|
2025-06-26 14:07:29 +08:00
|
|
|
|
|
|
|
|
|
|
//private void OnStepChanged(StepStatusOnChange change)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// Hide();
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
2025-06-25 13:45:30 +08:00
|
|
|
|
protected override void OnOpen(IUIData uiData = null)
|
|
|
|
|
|
{
|
2025-06-26 14:07:29 +08:00
|
|
|
|
mData = uiData as DragPanelData ?? new DragPanelData();
|
|
|
|
|
|
|
|
|
|
|
|
TypeEventSystem.Global.Register<OnModuleQuit>(OnModuleQuit).UnRegisterWhenGameObjectDestroyed(gameObject);
|
|
|
|
|
|
//TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged).UnRegisterWhenDisabled(gameObject);
|
|
|
|
|
|
|
|
|
|
|
|
NextButton.onClick.RemoveAllListeners();
|
|
|
|
|
|
NextButton.onClick.AddListener(() => {
|
|
|
|
|
|
StringEventSystem.Global.Send(mData.FinishedEvent);
|
|
|
|
|
|
Hide();
|
|
|
|
|
|
});
|
|
|
|
|
|
dragUIItems.Clear();
|
|
|
|
|
|
Content.transform.RemoveAllChildren();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> DragItem = mData.DragItemName.Split('|')?.ToList();
|
|
|
|
|
|
List<String> ShowNames = mData.HieraNames.Split('|')?.ToList();
|
|
|
|
|
|
List<String> TargetObjs = mData.TargetObjs.Split('|')?.ToList();
|
|
|
|
|
|
var finished = mData.FinishedEvent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < DragItem.Count; i++)
|
2025-06-25 13:45:30 +08:00
|
|
|
|
{
|
2025-06-26 14:07:29 +08:00
|
|
|
|
int j = i;
|
2025-06-25 13:45:30 +08:00
|
|
|
|
var tipItemObj = GameObject.Instantiate(ItemPrefab, Content.transform);
|
|
|
|
|
|
|
2025-06-26 14:07:29 +08:00
|
|
|
|
tipItemObj.GetComponentInChildren<TextMeshProUGUI>().text = DragItem[j];
|
|
|
|
|
|
|
|
|
|
|
|
tipItemObj.name = ShowNames[j];
|
|
|
|
|
|
|
|
|
|
|
|
tipItemObj.GetComponent<DragUIItem>().targetName= TargetObjs[j];
|
|
|
|
|
|
tipItemObj.GetComponent<DragUIItem>().IsFirst = true;
|
|
|
|
|
|
dragUIItems.Add(tipItemObj.GetComponent<DragUIItem>());
|
2025-06-25 13:45:30 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnShow()
|
|
|
|
|
|
{
|
2025-06-26 14:07:29 +08:00
|
|
|
|
Debug.Log("<22><>ʾ");
|
|
|
|
|
|
}
|
2025-06-25 13:45:30 +08:00
|
|
|
|
|
|
|
|
|
|
protected override void OnHide()
|
|
|
|
|
|
{
|
2025-06-26 14:07:29 +08:00
|
|
|
|
|
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnClose()
|
|
|
|
|
|
{
|
|
|
|
|
|
// StringEventSystem.Global.Send(mData.FinishedEvent);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public void OnModuleQuit(OnModuleQuit arg)
|
|
|
|
|
|
{
|
|
|
|
|
|
Hide();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-06-25 13:45:30 +08:00
|
|
|
|
}
|