123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine.Core.ModuleSystem
- {
- [System.Serializable]
- public class GameModule
- {
- [SerializeField, HideInInspector] private string _name = "Empty Module Slot";
- [InlineButton("ResetModule", "Reset")]
- [InlineButton("RemoveModule", "Remove")]
- [FoldoutGroup("@_name"), HideIf("@module == null")] public bool enableModule = true;
- [SerializeReference, InlineProperty, HideLabel, FoldoutGroup("@_name"), OnValueChanged("UpdateModuleName"), PropertySpace(SpaceBefore = 5, SpaceAfter = 5)]
- public IGameModule module;
- [HideInInspector] public bool isInitialized = false;
- [HideInInspector] public GameConfig gameConfig;
- private void UpdateModuleName()
- {
- if(module != null) _name = module.name;
- else _name = "Empty Module Slot";
- }
- private void ResetModule()
- {
- module.Reset();
- }
- [FoldoutGroup("@_name"), HideIf("@module != null"), Button("Remove Empty Module")]
- private void RemoveModule()
- {
- gameConfig.modules.Remove(this);
- }
- }
- }
|