2024-12-17 14:26:40 +08:00
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace QFramework
|
|
|
|
|
{
|
2024-12-19 16:38:42 +08:00
|
|
|
internal class CameraLockAction : IAction
|
2024-12-17 14:26:40 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public System.Action OnFinished { get; set; }
|
|
|
|
|
|
|
|
|
|
|
2024-12-19 16:38:42 +08:00
|
|
|
private CameraLockAction()
|
2024-12-17 14:26:40 +08:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-19 16:38:42 +08:00
|
|
|
private static readonly SimpleObjectPool<CameraLockAction> mPool =
|
|
|
|
|
new SimpleObjectPool<CameraLockAction>(() => new CameraLockAction(), null, 10);
|
|
|
|
|
string isMove;
|
|
|
|
|
string isRotate;
|
|
|
|
|
public static CameraLockAction Allocate(string isMove, string isRotate, System.Action OnFinished = null)
|
2024-12-17 14:26:40 +08:00
|
|
|
{
|
|
|
|
|
var retNode = mPool.Allocate();
|
|
|
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
|
|
|
|
retNode.Deinited = false;
|
|
|
|
|
retNode.Reset();
|
2024-12-19 16:38:42 +08:00
|
|
|
retNode.isMove = isMove;
|
|
|
|
|
retNode.isRotate = isRotate;
|
2024-12-17 14:26:40 +08:00
|
|
|
retNode.OnFinished = OnFinished;
|
|
|
|
|
return retNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ulong ActionID { get; set; }
|
|
|
|
|
public ActionStatus Status { get; set; }
|
|
|
|
|
|
|
|
|
|
public void OnStart()
|
2024-12-19 16:38:42 +08:00
|
|
|
{
|
|
|
|
|
bool isMov = true;
|
|
|
|
|
bool isRot = true;
|
|
|
|
|
bool.TryParse(isMove, out isMov);
|
|
|
|
|
bool.TryParse(isRotate, out isRot);
|
|
|
|
|
FreeCameraController.instance.SetLock(isMov, isRot);
|
2024-12-17 14:26:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|