|
@@ -1,4 +1,5 @@
|
|
|
-using System.Collections;
|
|
|
+using System;
|
|
|
+using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
using KairoEngine.Core;
|
|
@@ -7,22 +8,34 @@ using Sirenix.OdinInspector;
|
|
|
|
|
|
namespace KairoEngine.UI
|
|
|
{
|
|
|
- public class UiSystemModule : IGameModule
|
|
|
+ [Serializable, HideReferenceObjectPicker]
|
|
|
+ public class UiSystemModule : GameModuleBase
|
|
|
{
|
|
|
- private string _name = "UI Module";
|
|
|
+ public override string name => "UI Module";
|
|
|
|
|
|
- public string name { get => _name; set => _name = value; }
|
|
|
+ public UiSystemModule(GameConfig config) : base(config)
|
|
|
+ {
|
|
|
+ this.gameConfig = config;
|
|
|
+ this.className = this.GetType().AssemblyQualifiedName;
|
|
|
+ this.typeName = "UiSystemModule";
|
|
|
+ }
|
|
|
|
|
|
- public void Load(Transform parent)
|
|
|
+ public override void Load(Transform parent)
|
|
|
{
|
|
|
Transform uiParent = CreateUiManager(parent);
|
|
|
+ Debug.Log("UI System has been loaded");
|
|
|
}
|
|
|
|
|
|
- public void Reset()
|
|
|
+ public override void Reset()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public override void Destroy()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private Transform CreateUiManager(Transform parent)
|
|
|
{
|
|
|
Transform UiTransform = parent.Find("UI");
|
|
@@ -37,10 +50,21 @@ namespace KairoEngine.UI
|
|
|
return uiObj.transform;
|
|
|
}
|
|
|
|
|
|
- public void Destroy()
|
|
|
+ public static UiSystemModule JSONToUiSystemModule(string data)
|
|
|
{
|
|
|
-
|
|
|
+ try
|
|
|
+ {
|
|
|
+ return JsonUtility.FromJson<UiSystemModule>(data);
|
|
|
+ }
|
|
|
+ catch (System.Exception e)
|
|
|
+ {
|
|
|
+ Debug.LogError($"Could not deserialize UiSystemModule: \n{e}");
|
|
|
+ return new UiSystemModule(null);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ public override void OnBeforeSerialize(ObjectSerializer serializer) { }
|
|
|
+ public override void OnBeforeDeserialize(ObjectSerializer serializer) { }
|
|
|
}
|
|
|
}
|
|
|
|