修复高亮bug

新增缩放Action
This commit is contained in:
shenjianxing 2024-12-18 14:26:20 +08:00
parent 3fc72569c5
commit dda01c2648
5 changed files with 80 additions and 1 deletions

View File

@ -96,6 +96,9 @@ public class ActionHelper
case "Rotate": case "Rotate":
var rotate = (XMLTool.MoveOrAction)act; var rotate = (XMLTool.MoveOrAction)act;
return RotateAction.Allocate(act.Value, rotate.to, rotate.time); 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": case "Btns":
return BtnsAction.Allocate(act.Value); return BtnsAction.Allocate(act.Value);
case "Anim": case "Anim":

View File

@ -51,7 +51,6 @@ namespace QFramework
if (isHigh) if (isHigh)
{ {
var effect = obj.GetOrAddComponent<HighlightEffect>(); var effect = obj.GetOrAddComponent<HighlightEffect>();
obj.GetOrAddComponent<HighlightTrigger>();
effect.outlineColor = color; effect.outlineColor = color;
effect.highlighted = true; 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 "Move":
case "Rotate": case "Rotate":
case "Scale":
{ {
var act = new MoveOrAction(); var act = new MoveOrAction();
act.to = Utility.GetVector3FromStrArray(action.Attribute("to").Value); act.to = Utility.GetVector3FromStrArray(action.Attribute("to").Value);