非跳步 不执行finished
This commit is contained in:
parent
af131bfa4e
commit
f47ddf5c86
@ -31,7 +31,6 @@ namespace QFramework
|
|||||||
|
|
||||||
public void OnStart()
|
public void OnStart()
|
||||||
{
|
{
|
||||||
TypeEventSystem.Global.Send<OperationController.OnNextStep>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnExecute(float dt)
|
public void OnExecute(float dt)
|
||||||
@ -56,6 +55,10 @@ namespace QFramework
|
|||||||
{
|
{
|
||||||
if (!Deinited)
|
if (!Deinited)
|
||||||
{
|
{
|
||||||
|
if (Status != ActionStatus.NotStart)
|
||||||
|
{
|
||||||
|
TypeEventSystem.Global.Send<OperationController.OnNextStep>();
|
||||||
|
}
|
||||||
OnFinished = null;
|
OnFinished = null;
|
||||||
Deinited = true;
|
Deinited = true;
|
||||||
mPool.Recycle(this);
|
mPool.Recycle(this);
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
using HighlightPlus;
|
using HighlightPlus;
|
||||||
using QFramework;
|
using QFramework;
|
||||||
|
using QFramework.Example;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
using XMLTool;
|
using XMLTool;
|
||||||
|
|
||||||
public class DeviceController : MonoSingleton<DeviceController>
|
public class DeviceController : MonoSingleton<DeviceController>
|
||||||
@ -61,7 +63,31 @@ public class DeviceController : MonoSingleton<DeviceController>
|
|||||||
return GetDeviceItem(name)?.gameObject;
|
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)
|
public DeviceItem GetDeviceItem(string name)
|
||||||
{
|
{
|
||||||
if (deviceDict.ContainsKey(name))
|
if (deviceDict.ContainsKey(name))
|
||||||
|
|||||||
@ -116,6 +116,10 @@ public class OperationController : MonoSingleton<OperationController>
|
|||||||
|
|
||||||
public void Execute(int targetIndex)
|
public void Execute(int targetIndex)
|
||||||
{
|
{
|
||||||
|
if (this.index == targetIndex)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isStepRun)
|
if (isStepRun)
|
||||||
{
|
{
|
||||||
curAction?.Deinit();
|
curAction?.Deinit();
|
||||||
@ -127,7 +131,13 @@ public class OperationController : MonoSingleton<OperationController>
|
|||||||
var seq = ActionKit.Sequence();
|
var seq = ActionKit.Sequence();
|
||||||
if (this.index >= 0)
|
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);
|
IAction finishAction = ActionHelper.GetActionAndSub(steps[i].Finished);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using UnityEngine;
|
|||||||
public class DeviceItem : MonoBehaviour
|
public class DeviceItem : MonoBehaviour
|
||||||
{
|
{
|
||||||
public XMLTool.Device device;
|
public XMLTool.Device device;
|
||||||
|
public TipItem tipItem;
|
||||||
public void Init(XMLTool.Device device)
|
public void Init(XMLTool.Device device)
|
||||||
{
|
{
|
||||||
this.device = device;
|
this.device = device;
|
||||||
@ -34,11 +35,8 @@ public class DeviceItem : MonoBehaviour
|
|||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(device.Tip) == false)
|
if (string.IsNullOrEmpty(device.Tip) == false)
|
||||||
{
|
{
|
||||||
gameObject.AddComponent<TipItem>().Set(device.Tip);
|
tipItem = gameObject.GetOrAddComponent<TipItem>();
|
||||||
}
|
tipItem.Set(device.Tip);
|
||||||
else
|
|
||||||
{
|
|
||||||
gameObject.AddComponent<TipItem>().Set(device.Name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user