98 lines
2.3 KiB
C#
98 lines
2.3 KiB
C#
using QFramework.Example;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using UnityEngine;
|
|
namespace QFramework
|
|
{
|
|
|
|
|
|
public class ActionDragJiHe : IAction
|
|
{
|
|
public System.Action OnFinished
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
public ulong ActionID
|
|
{
|
|
get; set;
|
|
}
|
|
public ActionStatus Status
|
|
{
|
|
get; set;
|
|
}
|
|
public bool Deinited
|
|
{
|
|
get; set;
|
|
}
|
|
public bool Paused
|
|
{
|
|
get; set;
|
|
}
|
|
private ActionDragJiHe()
|
|
{
|
|
}
|
|
private static readonly SimpleObjectPool<ActionDragJiHe> mPool =
|
|
new SimpleObjectPool<ActionDragJiHe>(() => new(), null, 10);
|
|
Dictionary<string, string> datas;
|
|
|
|
public static ActionDragJiHe Allocate(Dictionary<string, string> datas, System.Action onDelayFinish = null)
|
|
{
|
|
var retNode = mPool.Allocate();
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
|
retNode.Deinited = false;
|
|
retNode.Reset();
|
|
retNode.datas = datas;
|
|
return retNode;
|
|
}
|
|
public void Deinit()
|
|
{
|
|
if (!Deinited)
|
|
{
|
|
Deinited = true;
|
|
mPool.Recycle(this);
|
|
}
|
|
}
|
|
|
|
public void OnExecute(float dt)
|
|
{
|
|
}
|
|
|
|
public void OnFinish()
|
|
{
|
|
// Debug.Log("Action OnFinish???");
|
|
}
|
|
|
|
|
|
public void OnStart()
|
|
{
|
|
UIImageSelectMap_JiHeData data = new UIImageSelectMap_JiHeData();
|
|
|
|
|
|
|
|
//拖拽对象,
|
|
data.DragItemName = datas.ContainsKey("DragItemName") ? datas["DragItemName"] : string.Empty;
|
|
//正确的框的名称
|
|
data.TargetObj = datas.ContainsKey("TargetObj") ? datas["TargetObj"] : string.Empty;
|
|
//图片路径
|
|
data.ItemPath = datas.ContainsKey("ItemPath") ? datas["ItemPath"] : string.Empty;
|
|
|
|
|
|
|
|
|
|
UIKit.OpenPanelAsync<UIImageSelectMap_JiHe>(uiData: data, canvasLevel: UILevel.Common).ToAction().StartGlobal(() =>
|
|
{
|
|
this.Finish();
|
|
});
|
|
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
Status = ActionStatus.NotStart;
|
|
Paused = false;
|
|
}
|
|
|
|
}
|
|
} |