75 lines
1.7 KiB
C#
75 lines
1.7 KiB
C#
|
|
using QFramework.Example;
|
||
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace QFramework
|
||
|
|
{
|
||
|
|
internal class Show3DAction : IAction
|
||
|
|
{
|
||
|
|
public System.Action OnFinished { get; set; }
|
||
|
|
|
||
|
|
|
||
|
|
private Show3DAction()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private static readonly SimpleObjectPool<Show3DAction> mPool =
|
||
|
|
new SimpleObjectPool<Show3DAction>(() => new Show3DAction(), null, 10);
|
||
|
|
UI3DObjShowData data;
|
||
|
|
public static Show3DAction Allocate(UI3DObjShowData data, System.Action OnFinished = null)
|
||
|
|
{
|
||
|
|
var retNode = mPool.Allocate();
|
||
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||
|
|
retNode.Deinited = false;
|
||
|
|
retNode.Reset();
|
||
|
|
retNode.OnFinished = OnFinished;
|
||
|
|
retNode.data = data;
|
||
|
|
return retNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public ulong ActionID { get; set; }
|
||
|
|
public ActionStatus Status { get; set; }
|
||
|
|
|
||
|
|
public void OnStart()
|
||
|
|
{
|
||
|
|
UIKit.OpenPanelAsync<UI3DObjShow>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
|
||
|
|
{
|
||
|
|
this.Finish();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnExecute(float dt)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnFinish()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Reset()
|
||
|
|
{
|
||
|
|
Status = ActionStatus.NotStart;
|
||
|
|
Paused = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Paused { get; set; }
|
||
|
|
|
||
|
|
public void Deinit()
|
||
|
|
{
|
||
|
|
if (!Deinited)
|
||
|
|
{
|
||
|
|
data = null;
|
||
|
|
OnFinished = null;
|
||
|
|
Deinited = true;
|
||
|
|
mPool.Recycle(this);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Deinited { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|