修改注册事件

This commit is contained in:
YangHua 2024-08-27 18:56:19 +08:00
parent 7d9fc1250c
commit 57338dc352
3 changed files with 9 additions and 9 deletions

View File

@ -17,25 +17,27 @@ public class ImageTips : MonoBehaviour
gameObject.SetActive(true); gameObject.SetActive(true);
selfRect = GetComponent<RectTransform>(); selfRect = GetComponent<RectTransform>();
image = GetComponent<Image>(); image = GetComponent<Image>();
image.enabled = true;
selfRect.SetParent(target); selfRect.SetParent(target);
selfRect.anchorMin = Vector2.zero; selfRect.anchorMin = Vector2.zero;
selfRect.anchorMax = new Vector2(1, 1); selfRect.anchorMax = new Vector2(1, 1);
selfRect.offsetMax = Vector2.zero; selfRect.offsetMax = Vector2.zero;
selfRect.offsetMin = Vector2.zero; selfRect.offsetMin = Vector2.zero;
//selfRect.sizeDelta = target.sizeDelta + sizeOffset; //selfRect.sizeDelta = target.sizeDelta + sizeOffset;
if (gameObject.activeSelf) if (gameObject.activeSelf && gameObject.activeInHierarchy)
StartCoroutine(FlashRoutine()); StartCoroutine(FlashRoutine());
} }
public void HideTips() public void HideTips()
{ {
transform.parent = null; transform.parent = null;
if (gameObject.activeSelf) if (gameObject.activeSelf && gameObject.activeInHierarchy)
{ {
StopCoroutine(FlashRoutine()); StopCoroutine(FlashRoutine());
gameObject.SetActive(false); gameObject.SetActive(false);
} }
} }
private IEnumerator FlashRoutine() private IEnumerator FlashRoutine()
{ {
while (true) while (true)

View File

@ -83,11 +83,8 @@ public class PermanentTriggerBase : MonoBehaviour
{ {
GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID); GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
} }
private void OnDisable() //private void OnDisable()
{ //{
GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID); // GameManager.EventMgr.RemoveEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
} //}
} }

View File

@ -64,6 +64,7 @@ public class UI_ToolOrMaterialsOrDeviceItem : BaseItem
currentTool.GetComponent<Collider>().enabled = false; currentTool.GetComponent<Collider>().enabled = false;
currentTool.name = currentItem.toolName; currentTool.name = currentItem.toolName;
LiveSceneManager.Instance.SetSpawnToolInfo(currentTool); LiveSceneManager.Instance.SetSpawnToolInfo(currentTool);
GameManager.UIMgr.imageTips.HideTips();
} }
break; break;
} }