HKI Core
UIScreen.cs
Go to the documentation of this file.
1 using UnityEngine;
2 
3 namespace HKI.Core.UI
4 {
8  [CreateAssetMenu(fileName = "Screen", menuName = "HKI/UI/Screen", order = 0)]
9  public class UIScreen : ScriptableObject
10  {
11  // Public variables
12  [SerializeField] GameObject ScreenPrefab = null;
13  [SerializeField] bool DestroyWhenClosed = true;
14  [SerializeField] bool DisableScreensUnderneath = true;
15 
16  int screenId = 0;
17 
18  // Getter
19  public int GetScreenId { get { return screenId; } }
20 
21  public GameObject GetScreenPrefab { get { return ScreenPrefab; } }
22  public bool GetDestroyWhenClosed { get { return DestroyWhenClosed; } }
23  public bool GetDisableScreensUnderneath { get { return DisableScreensUnderneath; } }
24 
25  // OnEnable function
26  void OnEnable()
27  {
28  screenId = GetInstanceID();
29  }
30 
31  // Interface function
32  public void Open()
33  {
34  if(UIScreenManager.Instance == null)
35  {
36  Debug.LogError("(UIScreen)" + name + " you are trying to open the screen but there is no screen manager in this scene(s)!");
37  return;
38  }
39 
41  }
42 
43  public void Close()
44  {
45  if(UIScreenManager.Instance == null)
46  {
47  Debug.LogError("(UIScreen)" + name + " you are trying to close the screen but there is no screen manager in this scene(s)!");
48  return;
49  }
50 
52  }
53  }
54 }
void OpenScreen(UIScreen screen)
The UIScreenManager is a simple window manager.
void CloseScreen(UIScreen screen)
This ScriptableObject holds all the information that is required by the UIScreenManager to display a ...
Definition: UIScreen.cs:9
static UIScreenManager Instance