跳步骤时取消device高亮

增加报错日志
This commit is contained in:
shenjianxing 2025-01-20 18:28:24 +08:00
parent 2571489ea4
commit c24cfe0832
2 changed files with 13 additions and 1 deletions

View File

@ -75,7 +75,7 @@ public class ShowAction : IAction
if (obj == null) if (obj == null)
{ {
Debug.LogError("没有找到物体 :" + path); Debug.LogError($"没有找到物体 path:{path} deviceName:{deviceName}");
} }
else else
{ {

View File

@ -5,6 +5,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using static OperationController;
public class DeviceItem : MonoBehaviour public class DeviceItem : MonoBehaviour
{ {
@ -19,6 +20,7 @@ public class DeviceItem : MonoBehaviour
gameObject.GetOrAddComponent<HighlightTrigger>(); gameObject.GetOrAddComponent<HighlightTrigger>();
effect.outlineColor = Color.green; effect.outlineColor = Color.green;
StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent); StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
} }
if (device.MeshCollider) if (device.MeshCollider)
{ {
@ -40,11 +42,21 @@ public class DeviceItem : MonoBehaviour
} }
} }
private void OnStepChanged(StepStatusOnChange change)
{
var effect = gameObject.GetComponent<HighlightEffect>();
if (effect != null)
{
effect.highlighted = false;
}
}
public void Close() public void Close()
{ {
device = null; device = null;
tipItem = null; tipItem = null;
StringEventSystem.Global.UnRegister<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent); StringEventSystem.Global.UnRegister<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged);
} }
private void OnHighLightTriggerEvent(string[] obj) private void OnHighLightTriggerEvent(string[] obj)