using DG.Tweening; using QFramework; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace QFramework { public class ReSetZhanShiCameraAction : IAction { public ulong ActionID { get; set; } public bool Deinited { get; set; } public bool Paused { get; set; } public ActionStatus Status { get; set; } public string path; public string x; public string y; public string Distance; private static readonly SimpleObjectPool mPool = new SimpleObjectPool(() => new(), null, 10); Dictionary datas; public static ReSetZhanShiCameraAction Allocate(string path, Dictionary datas, System.Action OnFinished = null) { 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); } } public void OnExecute(float dt) { } public void OnFinish() { } public void OnStart() { GameObject obj = Utility.FindObj(path); var CameraMoveData = obj.GetComponent(); CameraMoveData.x = x.ToFloat(); CameraMoveData.y = y.ToFloat(); CameraMoveData.distance = Distance.ToFloat(); this.Finish(); } public void Reset() { Status = ActionStatus.NotStart; Paused = false; } } }