1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine.UI
- {
- [HideMonoScript]
- public class UiSystemElement : MonoBehaviour, IUiSystemElement
- {
- public string elementTitle = "New UI Element";
- public RectTransform targetRectTransform;
- public bool isVisible = true;
- public void Hide()
- {
- targetRectTransform.gameObject.SetActive(false);
- isVisible = false;
- }
- public void Show()
- {
- targetRectTransform.gameObject.SetActive(true);
- isVisible = true;
- }
- public bool IsVisible() => isVisible;
- private void OnDisable()
- {
- UiManager.UnregisterElement(this);
- }
- private void OnEnable()
- {
- UiManager.RegisterElement(elementTitle, this, this.transform, isVisible);
- }
- }
- }
|