非跳步 不执行finished
This commit is contained in:
parent
af131bfa4e
commit
f47ddf5c86
@ -15,7 +15,7 @@ namespace QFramework
|
||||
private static readonly SimpleObjectPool<NextOperationAction> mPool =
|
||||
new SimpleObjectPool<NextOperationAction>(() => new NextOperationAction(), null, 10);
|
||||
|
||||
public static NextOperationAction Allocate( System.Action OnFinished = null)
|
||||
public static NextOperationAction Allocate(System.Action OnFinished = null)
|
||||
{
|
||||
var retNode = mPool.Allocate();
|
||||
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||||
@ -31,7 +31,6 @@ namespace QFramework
|
||||
|
||||
public void OnStart()
|
||||
{
|
||||
TypeEventSystem.Global.Send<OperationController.OnNextStep>();
|
||||
}
|
||||
|
||||
public void OnExecute(float dt)
|
||||
@ -56,6 +55,10 @@ namespace QFramework
|
||||
{
|
||||
if (!Deinited)
|
||||
{
|
||||
if (Status != ActionStatus.NotStart)
|
||||
{
|
||||
TypeEventSystem.Global.Send<OperationController.OnNextStep>();
|
||||
}
|
||||
OnFinished = null;
|
||||
Deinited = true;
|
||||
mPool.Recycle(this);
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
using HighlightPlus;
|
||||
using QFramework;
|
||||
using QFramework.Example;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using XMLTool;
|
||||
|
||||
public class DeviceController : MonoSingleton<DeviceController>
|
||||
@ -61,7 +63,31 @@ public class DeviceController : MonoSingleton<DeviceController>
|
||||
return GetDeviceItem(name)?.gameObject;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var uitip = UIKit.GetPanel<UIDeviceTip>();
|
||||
if (uitip != null)
|
||||
{
|
||||
UIKit.OpenPanelAsync<UIDeviceTip>(UILevel.PopUI).ToAction().Start(this, () =>
|
||||
{
|
||||
});
|
||||
}
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray, out hit))
|
||||
{
|
||||
var deviceItem = hit.transform.GetComponent<DeviceItem>();
|
||||
|
||||
if (uitip != null && deviceItem != null && deviceItem.tipItem != null && EventSystem.current.IsPointerOverGameObject() == false)
|
||||
{
|
||||
uitip.Set(deviceItem.tipItem.label);
|
||||
uitip.Active(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
uitip?.Active(false);
|
||||
|
||||
}
|
||||
public DeviceItem GetDeviceItem(string name)
|
||||
{
|
||||
if (deviceDict.ContainsKey(name))
|
||||
|
||||
@ -116,6 +116,10 @@ public class OperationController : MonoSingleton<OperationController>
|
||||
|
||||
public void Execute(int targetIndex)
|
||||
{
|
||||
if (this.index == targetIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (isStepRun)
|
||||
{
|
||||
curAction?.Deinit();
|
||||
@ -127,7 +131,13 @@ public class OperationController : MonoSingleton<OperationController>
|
||||
var seq = ActionKit.Sequence();
|
||||
if (this.index >= 0)
|
||||
{
|
||||
for (int i = this.index; i < targetIndex; i++)
|
||||
int startIndex = this.index;
|
||||
// 当前这步 已经做完了 不需要finished
|
||||
if (curAction != null && curAction.Status == ActionStatus.Finished)
|
||||
{
|
||||
startIndex += 1;
|
||||
}
|
||||
for (int i = startIndex; i < targetIndex; i++)
|
||||
{
|
||||
// 完成动作 直接执行
|
||||
IAction finishAction = ActionHelper.GetActionAndSub(steps[i].Finished);
|
||||
|
||||
@ -9,6 +9,7 @@ using UnityEngine;
|
||||
public class DeviceItem : MonoBehaviour
|
||||
{
|
||||
public XMLTool.Device device;
|
||||
public TipItem tipItem;
|
||||
public void Init(XMLTool.Device device)
|
||||
{
|
||||
this.device = device;
|
||||
@ -34,11 +35,8 @@ public class DeviceItem : MonoBehaviour
|
||||
}
|
||||
if (string.IsNullOrEmpty(device.Tip) == false)
|
||||
{
|
||||
gameObject.AddComponent<TipItem>().Set(device.Tip);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.AddComponent<TipItem>().Set(device.Name);
|
||||
tipItem = gameObject.GetOrAddComponent<TipItem>();
|
||||
tipItem.Set(device.Tip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user