91 lines
2.2 KiB
C#
91 lines
2.2 KiB
C#
using QFramework;
|
|
using QFramework.Example;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
namespace QFramework
|
|
{
|
|
|
|
public class SliderAnimAction: 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 SliderAnimAction()
|
|
{
|
|
}
|
|
|
|
private static readonly SimpleObjectPool<SliderAnimAction> mPool =
|
|
new SimpleObjectPool<SliderAnimAction>(() => new(), null, 10);
|
|
Dictionary<string, string> datas;
|
|
|
|
public static SliderAnimAction 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()
|
|
{
|
|
UISliderAnimData data = new UISliderAnimData();
|
|
|
|
data.title = datas.ContainsKey("title") ? datas["title"] : string.Empty;
|
|
data.targetObj = datas.ContainsKey("targetObj") ? datas["targetObj"] : string.Empty;
|
|
data.HideObject = datas.ContainsKey("HideObject") ? datas["HideObject"] : string.Empty;
|
|
|
|
|
|
UIKit.OpenPanelAsync<UISliderAnim>(uiData: data, canvasLevel: UILevel.Common).ToAction().StartGlobal(() =>
|
|
{
|
|
this.Finish();
|
|
});
|
|
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
Status = ActionStatus.NotStart;
|
|
Paused = false;
|
|
}
|
|
}
|
|
} |