Merge remote-tracking branch 'remotes/origin/master' into LouDi_Pig

This commit is contained in:
李浩 2024-12-19 10:03:06 +08:00
commit 44b53656c5
6 changed files with 82 additions and 1 deletions

View File

@ -96,6 +96,9 @@ public class ActionHelper
case "Rotate":
var rotate = (XMLTool.MoveOrAction)act;
return RotateAction.Allocate(act.Value, rotate.to, rotate.time);
case "Scale":
var scaleAct = (XMLTool.MoveOrAction)act;
return ScaleAction.Allocate(act.Value, scaleAct.to, scaleAct.time);
case "Btns":
return BtnsAction.Allocate(act.Value);
case "Anim":

View File

@ -51,7 +51,6 @@ namespace QFramework
if (isHigh)
{
var effect = obj.GetOrAddComponent<HighlightEffect>();
obj.GetOrAddComponent<HighlightTrigger>();
effect.outlineColor = color;
effect.highlighted = true;
}

View File

@ -0,0 +1,65 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using QFramework;
using System;
using QFramework.Example;
using DG.Tweening;
public class ScaleAction : IAction
{
public ulong ActionID { get; set; }
public bool Deinited { get; set; }
public bool Paused { get; set; }
public ActionStatus Status { get; set; }
private static readonly SimpleObjectPool<ScaleAction> mPool =
new SimpleObjectPool<ScaleAction>(() => new ScaleAction(), null, 10);
Vector3 scale;
float time;
string path;
public static ScaleAction Allocate(string path, Vector3 scale, float time, System.Action onDelayFinish = null)
{
var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false;
retNode.Reset();
retNode.scale = scale;
retNode.time = time;
retNode.path = path;
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);
obj.transform.DOScale(scale, time).onComplete = () => this.Finish(); ;
}
public void Reset()
{
Status = ActionStatus.NotStart;
Paused = false;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6bb2c14fa99141e4d9eba12563d28939
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -308,6 +308,7 @@ namespace XMLTool
{
case "Move":
case "Rotate":
case "Scale":
{
var act = new MoveOrAction();
act.to = Utility.GetVector3FromStrArray(action.Attribute("to").Value);

View File

@ -13,6 +13,8 @@
<Action type="Move" value="Main Camera" to="18.162,2.113,3.22" time="0"></Action>
<!--旋转物体 time是多长时间旋转到目标位置 0是瞬间完成-->
<Action type="Rotate" value="Main Camera" to="0,180,0" time="0"></Action>
<!--缩放物体 time是多长时间旋转到目标位置 0是瞬间完成-->
<Action type="Scale" value="Main Camera" to="0,180,0" time="0"></Action>
<!--执行下一步左侧步骤列表 默认开始的时候为-1步 要主动调用一次才到第1步-->
<Action type="NextOperation"></Action>
<!--播放动画 reset=true则动画停在第一帧-->