VirtualFramework/Assets/Scripts/Actions/ReSetZhanShiCameraAction.cs

95 lines
2.2 KiB
C#
Raw Normal View History

using DG.Tweening;
using QFramework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2025-06-30 18:18:42 +08:00
namespace QFramework
{
2025-06-30 18:18:42 +08:00
public class ReSetZhanShiCameraAction : IAction
{
2025-06-30 18:18:42 +08:00
public ulong ActionID
{
get; set;
}
public bool Deinited
{
get; set;
}
public bool Paused
{
get; set;
}
public ActionStatus Status
{
get; set;
}
2025-06-30 18:18:42 +08:00
public string path;
public string x;
public string y;
public string Distance;
2025-06-30 18:18:42 +08:00
private static readonly SimpleObjectPool<ReSetZhanShiCameraAction> mPool =
new SimpleObjectPool<ReSetZhanShiCameraAction>(() => new(), null, 10);
Dictionary<string, string> datas;
2025-06-30 18:18:42 +08:00
public static ReSetZhanShiCameraAction Allocate(string path, Dictionary<string, string> datas, System.Action OnFinished = null)
{
2025-06-30 18:18:42 +08:00
var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false;
retNode.Reset();
retNode.path= datas.ContainsKey("path") ? datas["path"] : "";
retNode.x = datas.ContainsKey("x") ? datas["x"] : "";
retNode.y = datas.ContainsKey("y") ? datas["y"] : "";
retNode.Distance = datas.ContainsKey("Distance") ? datas["Distance"] : "";
return retNode;
}
public void Deinit()
{
if (!Deinited)
{
Deinited = true;
mPool.Recycle(this);
}
}
2025-06-30 18:18:42 +08:00
public void OnExecute(float dt)
{
}
2025-06-30 18:18:42 +08:00
public void OnFinish()
{
2025-06-30 18:18:42 +08:00
}
2025-06-30 18:18:42 +08:00
public void OnStart()
{
2025-06-30 18:18:42 +08:00
GameObject obj = Utility.FindObj(path);
var CameraMoveData = obj.GetComponent<ZhanShiCameraMove>();
CameraMoveData.x = x.ToFloat();
CameraMoveData.y = y.ToFloat();
CameraMoveData.distance = Distance.ToFloat();
this.Finish();
}
public void Reset()
{
Status = ActionStatus.NotStart;
Paused = false;
}
}
}
2025-06-30 18:18:42 +08:00