95 lines
2.2 KiB
C#
95 lines
2.2 KiB
C#
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<ReSetZhanShiCameraAction> mPool =
|
|
new SimpleObjectPool<ReSetZhanShiCameraAction>(() => new(), null, 10);
|
|
Dictionary<string, string> datas;
|
|
|
|
|
|
public static ReSetZhanShiCameraAction Allocate(string path, Dictionary<string, string> 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<ZhanShiCameraMove>();
|
|
CameraMoveData.x = x.ToFloat();
|
|
CameraMoveData.y = y.ToFloat();
|
|
CameraMoveData.distance = Distance.ToFloat();
|
|
this.Finish();
|
|
|
|
|
|
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
Status = ActionStatus.NotStart;
|
|
Paused = false;
|
|
}
|
|
}
|
|
}
|
|
|