修复高亮bug
新增缩放Action
This commit is contained in:
parent
3fc72569c5
commit
dda01c2648
@ -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":
|
||||
|
||||
@ -51,7 +51,6 @@ namespace QFramework
|
||||
if (isHigh)
|
||||
{
|
||||
var effect = obj.GetOrAddComponent<HighlightEffect>();
|
||||
obj.GetOrAddComponent<HighlightTrigger>();
|
||||
effect.outlineColor = color;
|
||||
effect.highlighted = true;
|
||||
}
|
||||
|
||||
65
Assets/Scripts/Actions/ScaleAction.cs
Normal file
65
Assets/Scripts/Actions/ScaleAction.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Actions/ScaleAction.cs.meta
Normal file
11
Assets/Scripts/Actions/ScaleAction.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bb2c14fa99141e4d9eba12563d28939
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -308,6 +308,7 @@ namespace XMLTool
|
||||
{
|
||||
case "Move":
|
||||
case "Rotate":
|
||||
case "Scale":
|
||||
{
|
||||
var act = new MoveOrAction();
|
||||
act.to = Utility.GetVector3FromStrArray(action.Attribute("to").Value);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user