修复模块切换bug
This commit is contained in:
parent
aed257f957
commit
114b996c3c
@ -29,6 +29,10 @@ public class DeviceController : MonoSingleton<DeviceController>
|
|||||||
|
|
||||||
private void OnQuit(OnModuleQuit quit)
|
private void OnQuit(OnModuleQuit quit)
|
||||||
{
|
{
|
||||||
|
foreach (var item in deviceDict)
|
||||||
|
{
|
||||||
|
item.Value.item.Close();
|
||||||
|
}
|
||||||
deviceDict.Clear();
|
deviceDict.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,8 @@ public class DeviceItem : MonoBehaviour
|
|||||||
var effect = gameObject.GetOrAddComponent<HighlightEffect>();
|
var effect = gameObject.GetOrAddComponent<HighlightEffect>();
|
||||||
gameObject.GetOrAddComponent<HighlightTrigger>();
|
gameObject.GetOrAddComponent<HighlightTrigger>();
|
||||||
effect.outlineColor = Color.green;
|
effect.outlineColor = Color.green;
|
||||||
StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent).UnRegisterWhenGameObjectDestroyed(gameObject);
|
Debug.LogError("Regitser £º " + gameObject.name);
|
||||||
|
StringEventSystem.Global.Register<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
|
||||||
}
|
}
|
||||||
if (device.MeshCollider)
|
if (device.MeshCollider)
|
||||||
{
|
{
|
||||||
@ -40,6 +41,14 @@ public class DeviceItem : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
device = null;
|
||||||
|
tipItem = null;
|
||||||
|
Debug.LogError(gameObject.name);
|
||||||
|
StringEventSystem.Global.UnRegister<string[]>(Global.HighLightTrigger, OnHighLightTriggerEvent);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnHighLightTriggerEvent(string[] obj)
|
private void OnHighLightTriggerEvent(string[] obj)
|
||||||
{
|
{
|
||||||
if (obj.Length > 0)
|
if (obj.Length > 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user