74 lines
1.7 KiB
C#
74 lines
1.7 KiB
C#
|
|
using System;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace QFramework
|
||
|
|
{
|
||
|
|
internal class LockCameraAction : IAction
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
public System.Action OnFinished { get; set; }
|
||
|
|
|
||
|
|
|
||
|
|
private LockCameraAction()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private static readonly SimpleObjectPool<LockCameraAction> mPool =
|
||
|
|
new SimpleObjectPool<LockCameraAction>(() => new LockCameraAction(), null, 10);
|
||
|
|
string isLock;
|
||
|
|
public static LockCameraAction Allocate(string isLock, System.Action OnFinished = null)
|
||
|
|
{
|
||
|
|
var retNode = mPool.Allocate();
|
||
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||
|
|
retNode.Deinited = false;
|
||
|
|
retNode.Reset();
|
||
|
|
retNode.isLock = isLock;
|
||
|
|
retNode.OnFinished = OnFinished;
|
||
|
|
return retNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public ulong ActionID { get; set; }
|
||
|
|
public ActionStatus Status { get; set; }
|
||
|
|
|
||
|
|
public void OnStart()
|
||
|
|
{
|
||
|
|
bool cameraLock = false;
|
||
|
|
bool.TryParse(isLock, out cameraLock);
|
||
|
|
FreeCameraController.instance.SetLock(cameraLock);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnExecute(float dt)
|
||
|
|
{
|
||
|
|
this.Finish();
|
||
|
|
OnFinished?.Invoke();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnFinish()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Reset()
|
||
|
|
{
|
||
|
|
Status = ActionStatus.NotStart;
|
||
|
|
Paused = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Paused { get; set; }
|
||
|
|
|
||
|
|
public void Deinit()
|
||
|
|
{
|
||
|
|
if (!Deinited)
|
||
|
|
{
|
||
|
|
OnFinished = null;
|
||
|
|
Deinited = true;
|
||
|
|
mPool.Recycle(this);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Deinited { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|