HKI Core
GameSystemUpdateManagerEditor.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using UnityEditor;
3 using HKI.Core.Editor.Misc;
4 
5 
6 namespace HKI.Core.GameSystems.Editor
7 {
11  [CustomEditor(typeof(GameSystemUpdateManager))]
13  {
14  // Private function
15  SerializedProperty sceneLoaderSP = null;
16  SerializedProperty failedInitSceneSP = null;
17  SerializedProperty initFinishedGameEventSP = null;
18 
19  SerializedProperty timeSystemSP = null;
20  SerializedProperty gameSpeedSP = null;
21  SerializedProperty deltaTimeSP = null;
22  SerializedProperty fixedDeltaTimeSP = null;
23  SerializedProperty unscaledDeltaTimeSP = null;
24  SerializedProperty unscaledFixedDeltaTimeSP = null;
25 
26  StandardReorderableList gameSystemsForInitRL = null;
27  StandardReorderableList gameSystemsForUpdateRL = null;
28  StandardReorderableList gameSystemsForFixedUpdateRL = null;
29  StandardReorderableList gameSystemsForLateUpdateRL = null;
30  StandardReorderableList gameSystemsForShutdownRL = null;
31 
32  // OnEnable function
33  void OnEnable()
34  {
35  sceneLoaderSP = serializedObject.FindProperty("SceneLoader");
36  failedInitSceneSP = serializedObject.FindProperty("FailedInitScene");
37  initFinishedGameEventSP = serializedObject.FindProperty("InitFinishedGameEvent");
38 
39  timeSystemSP = serializedObject.FindProperty("TimeSystem");
40  gameSpeedSP = timeSystemSP.FindPropertyRelative("GameSpeed");
41  deltaTimeSP = timeSystemSP.FindPropertyRelative("DeltaTime");
42  fixedDeltaTimeSP = timeSystemSP.FindPropertyRelative("FixedDeltaTime");
43  unscaledDeltaTimeSP = timeSystemSP.FindPropertyRelative("UnscaledDeltaTime");
44  unscaledFixedDeltaTimeSP = timeSystemSP.FindPropertyRelative("UnscaledFixedDeltaTime");
45 
46  gameSystemsForInitRL = new StandardReorderableList(serializedObject, "GameSystemsForInit", "Game Systems for Init");
47  gameSystemsForUpdateRL = new StandardReorderableList(serializedObject, "GameSystemsForUpdate", "Game Systems for Update");
48  gameSystemsForFixedUpdateRL = new StandardReorderableList(serializedObject, "GameSystemsForFixedUpdate", "Game Systems for Fixed Update");
49  gameSystemsForLateUpdateRL = new StandardReorderableList(serializedObject, "GameSystemsForLateUpdate", "Game Systems for Late Update");
50  gameSystemsForShutdownRL = new StandardReorderableList(serializedObject, "GameSystemsForShutdown", "Game Systems for Shutdown");
51  }
52 
53  // OnInspectorGUI function
54  public override void OnInspectorGUI()
55  {
56  serializedObject.Update();
57 
58  EditorGUILayout.LabelField("Initialization:", EditorStyles.boldLabel);
59  EditorGUILayout.PropertyField(sceneLoaderSP);
60  EditorGUILayout.PropertyField(failedInitSceneSP);
61  EditorGUILayout.PropertyField(initFinishedGameEventSP);
62  EditorGUILayout.PropertyField(gameSpeedSP);
63  EditorGUILayout.Space();
64  gameSystemsForInitRL.DoLayoutList();
65  EditorGUILayout.Space();
66 
67  EditorGUILayout.LabelField("Update:", EditorStyles.boldLabel);
68  EditorGUILayout.PropertyField(deltaTimeSP);
69  EditorGUILayout.PropertyField(unscaledDeltaTimeSP);
70  EditorGUILayout.Space();
71  gameSystemsForUpdateRL.DoLayoutList();
72  EditorGUILayout.Space();
73 
74  EditorGUILayout.LabelField("Fixed Update:", EditorStyles.boldLabel);
75  EditorGUILayout.PropertyField(fixedDeltaTimeSP);
76  EditorGUILayout.PropertyField(unscaledFixedDeltaTimeSP);
77  EditorGUILayout.Space();
78  gameSystemsForFixedUpdateRL.DoLayoutList();
79  EditorGUILayout.Space();
80 
81  EditorGUILayout.LabelField("Late Update:", EditorStyles.boldLabel);
82  gameSystemsForLateUpdateRL.DoLayoutList();
83  EditorGUILayout.Space();
84 
85  EditorGUILayout.LabelField("Shutdown:", EditorStyles.boldLabel);
86  gameSystemsForShutdownRL.DoLayoutList();
87  EditorGUILayout.Space();
88 
89  serializedObject.ApplyModifiedProperties();
90  }
91 
92  }
93 }
This MonoBehaviour controlls all GameSystems. It's responsble to initialize, update and shutdown this...
Custom inspector for the GameSystemUpdateManager class.
This class provides you with a better handling of ReorderableList so that ReorderableLists can be use...