From 5e4b4b608244b8bcdbed8d059045f7ea02c3be2a Mon Sep 17 00:00:00 2001 From: mrtoine Date: Fri, 10 Oct 2025 18:04:44 +0200 Subject: [PATCH] premier commit --- Assets/_/Features/Core.meta | 8 - Assets/_/Features/Core/Runtime.meta | 8 - .../Core/Runtime/BaseMonoBehaviour.cs | 131 ----------- .../Core/Runtime/BaseMonoBehaviour.cs.meta | 2 - .../Features/Core/Runtime/Core.Runtime.asmdef | 16 -- .../Core/Runtime/Core.Runtime.asmdef.meta | 7 - Assets/_/Features/Core/Runtime/Enums.meta | 3 - .../Core/Runtime/Enums/EnumLanguage.cs | 8 - .../Core/Runtime/Enums/EnumLanguage.cs.meta | 3 - .../_/Features/Core/Runtime/FactsSystem.meta | 8 - .../Features/Core/Runtime/FactsSystem/Fact.cs | 42 ---- .../Core/Runtime/FactsSystem/Fact.cs.meta | 3 - .../Runtime/FactsSystem/FactDictionary.cs | 214 ----------------- .../FactsSystem/FactDictionary.cs.meta | 3 - Assets/_/Features/Core/Runtime/GameManager.cs | 217 ------------------ .../Features/Core/Runtime/GameManager.cs.meta | 11 - Assets/_/Features/Core/Runtime/GameTime.cs | 39 ---- .../_/Features/Core/Runtime/GameTime.cs.meta | 3 - .../_/Features/Core/Runtime/Interfaces.meta | 8 - .../Features/Core/Runtime/Interfaces/IFact.cs | 12 - .../Core/Runtime/Interfaces/IFact.cs.meta | 3 - .../Core/Runtime/LocalizationSystem.cs | 105 --------- .../Core/Runtime/LocalizationSystem.cs.meta | 3 - Assets/_/Features/Core/Runtime/SceneLoader.cs | 111 --------- .../Features/Core/Runtime/SceneLoader.cs.meta | 3 - Assets/_/Features/Core/Runtime/UIManager.cs | 53 ----- .../_/Features/Core/Runtime/UIManager.cs.meta | 3 - Assets/_/Features/Core/Runtime/XmlLoader.cs | 21 -- .../_/Features/Core/Runtime/XmlLoader.cs.meta | 3 - Assets/_/Features/Core/Runtime/datas.meta | 3 - .../Core/Runtime/datas/GeneralSettings.cs | 26 --- .../Runtime/datas/GeneralSettings.cs.meta | 3 - 32 files changed, 1083 deletions(-) delete mode 100644 Assets/_/Features/Core.meta delete mode 100644 Assets/_/Features/Core/Runtime.meta delete mode 100644 Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs delete mode 100644 Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/Core.Runtime.asmdef delete mode 100644 Assets/_/Features/Core/Runtime/Core.Runtime.asmdef.meta delete mode 100644 Assets/_/Features/Core/Runtime/Enums.meta delete mode 100644 Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs delete mode 100644 Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/FactsSystem.meta delete mode 100644 Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs delete mode 100644 Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs delete mode 100644 Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/GameManager.cs delete mode 100644 Assets/_/Features/Core/Runtime/GameManager.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/GameTime.cs delete mode 100644 Assets/_/Features/Core/Runtime/GameTime.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/Interfaces.meta delete mode 100644 Assets/_/Features/Core/Runtime/Interfaces/IFact.cs delete mode 100644 Assets/_/Features/Core/Runtime/Interfaces/IFact.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/LocalizationSystem.cs delete mode 100644 Assets/_/Features/Core/Runtime/LocalizationSystem.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/SceneLoader.cs delete mode 100644 Assets/_/Features/Core/Runtime/SceneLoader.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/UIManager.cs delete mode 100644 Assets/_/Features/Core/Runtime/UIManager.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/XmlLoader.cs delete mode 100644 Assets/_/Features/Core/Runtime/XmlLoader.cs.meta delete mode 100644 Assets/_/Features/Core/Runtime/datas.meta delete mode 100644 Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs delete mode 100644 Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs.meta diff --git a/Assets/_/Features/Core.meta b/Assets/_/Features/Core.meta deleted file mode 100644 index 0916fc43..00000000 --- a/Assets/_/Features/Core.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 48cfbe4e898706c4dad037e29ac2342c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_/Features/Core/Runtime.meta b/Assets/_/Features/Core/Runtime.meta deleted file mode 100644 index 410df214..00000000 --- a/Assets/_/Features/Core/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 99b0b58844aa49643b4d7a4ba155fbef -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs b/Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs deleted file mode 100644 index 0badbe02..00000000 --- a/Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System.Collections.Generic; -using Core.Runtime.Interfaces; -using UnityEngine; - -namespace Core.Runtime -{ - public class BaseMonobehaviour : MonoBehaviour - { - #region Publics - - [Header("Debug")] - [SerializeField] protected bool m_isVerbose; - - public enum FactPersistence - { - Normal, - Persistent, - } - - public GameObject GameObject => _gameObject ? _gameObject : _gameObject = gameObject; - public Rigidbody Rigidbody => _rigidbody ? _rigidbody : _rigidbody = GetComponent(); - public Transform Transform => _transform ? _transform : _transform = GetComponent(); - - #endregion - - #region Fact Dictionnary - - protected bool FactExists(string key, out T value) - { - GameFacts.FactExists(key, out value); - return value != null; - } - - protected T GetFact(string key) - { - return GameFacts.GetFact(key); - } - - protected Dictionary GetAllFacts() - { - return GameFacts.GetAllFacts(); - } - - protected List GetAllFactsOfType() - { - return GameFacts.GetAllFactsOfType(); - } - - protected void SetFact(string key, T value, FactPersistence persistence = FactPersistence.Normal) - { - GameFacts.SetFact(key, value, persistence); - } - - protected void RemoveFact(string key) - { - GameFacts.RemoveFact(key); - } - - #endregion - - #region Save System - - protected void GenerateProfile(string profileName) - { - - } - - protected List GetAllSaves() - { - return GameFacts.GetAllSaves(); - } - - protected void SaveFacts(string slotName = "") - { - string slot = GameManager.Instance.Profile; - if (slotName != "") - { - slot = slotName; - } - - GameFacts.SaveFacts(slot); - } - - protected void LoadFacts(string slotName = "") - { - string slot = GameManager.Instance.Profile; - if (slotName != "") - { - slot = slotName; - } - - GameFacts.LoadFacts(slot); - } - - protected void DeleteSaveFile() - { - GameFacts.DeleteSaveFile(GameManager.Instance.Profile); - } - - #endregion - - #region DEBUG - - protected void Info(string message) - { - Debug.Log(message); - } - - protected void Error(string message) - { - Debug.LogError(message); - } - - protected void Warning(string message) - { - Debug.LogWarning(message); - } - - #endregion - - #region GETTERS - - private GameObject _gameObject; - private Rigidbody _rigidbody; - private Transform _transform; - - protected FactDictionnary GameFacts => GameManager.m_gameFacts; - - #endregion - } -} diff --git a/Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs.meta b/Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs.meta deleted file mode 100644 index 4672b2c6..00000000 --- a/Assets/_/Features/Core/Runtime/BaseMonoBehaviour.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 5a0991893b6c24954afe021de03614ad diff --git a/Assets/_/Features/Core/Runtime/Core.Runtime.asmdef b/Assets/_/Features/Core/Runtime/Core.Runtime.asmdef deleted file mode 100644 index 45175fef..00000000 --- a/Assets/_/Features/Core/Runtime/Core.Runtime.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Core.Runtime", - "rootNamespace": "Core.Runtime", - "references": [ - "GUID:6055be8ebefd69e48b49212b09b47b2f" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/Core.Runtime.asmdef.meta b/Assets/_/Features/Core/Runtime/Core.Runtime.asmdef.meta deleted file mode 100644 index 66ade167..00000000 --- a/Assets/_/Features/Core/Runtime/Core.Runtime.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 2ca720bbf8aa349608caa5ce4acaa603 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_/Features/Core/Runtime/Enums.meta b/Assets/_/Features/Core/Runtime/Enums.meta deleted file mode 100644 index acf1ab59..00000000 --- a/Assets/_/Features/Core/Runtime/Enums.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7aeca2c5510942e5a3c45ff5272bc040 -timeCreated: 1759234532 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs b/Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs deleted file mode 100644 index bb437071..00000000 --- a/Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Core.Runtime.Enums -{ - public enum EnumLanguage - { - English, - French, - } -} diff --git a/Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs.meta b/Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs.meta deleted file mode 100644 index 05458334..00000000 --- a/Assets/_/Features/Core/Runtime/Enums/EnumLanguage.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: a1f020b6f635444c89c9d8b30acec48b -timeCreated: 1759234549 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/FactsSystem.meta b/Assets/_/Features/Core/Runtime/FactsSystem.meta deleted file mode 100644 index f8f7e70f..00000000 --- a/Assets/_/Features/Core/Runtime/FactsSystem.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 50fff7e431d747439539a559d25219d3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs b/Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs deleted file mode 100644 index 0e4d5955..00000000 --- a/Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Core.Runtime.Interfaces; -using Newtonsoft.Json; - -namespace Core.Runtime -{ - public class Fact : IFact - { - - #region Publics - - public T Value; - - public Fact(object value, bool isPersistent) - { - Value = (T) value; - IsPersistent = isPersistent; - } - - public Type ValueType => typeof(T); - - [JsonIgnore] - public object GetObjectValue => Value; - - public void SetObjectValue(object value) - { - if (value is T cast) - { - Value = cast; - } - else - { - throw new InvalidCastException("Cannot asign a value to a fact"); - } - } - - public bool IsPersistent { get; set; } - - #endregion - } -} - diff --git a/Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs.meta b/Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs.meta deleted file mode 100644 index 3f85a797..00000000 --- a/Assets/_/Features/Core/Runtime/FactsSystem/Fact.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: dbdaad04e901476ebafb6f2c0d22a257 -timeCreated: 1752132457 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs b/Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs deleted file mode 100644 index 924a9a8b..00000000 --- a/Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Core.Runtime.Interfaces; -using Newtonsoft.Json; -using UnityEngine; - -namespace Core.Runtime -{ - public class FactDictionnary - { - #region Publics - - public Dictionary AllFacts => _facts; - - #endregion - - #region Main Methods - - public bool FactExists(string key, out T value) - { - if (_facts.TryGetValue(key, out var fact) && fact is Fact typedFact) - { - value = typedFact.Value; - return true; - } - - value = default; - return false; - } - - public void SetFact(string key, T value, BaseMonobehaviour.FactPersistence persistence) - { - if (_facts.TryGetValue(key, out var existingFact)) - { - if (existingFact is Fact typedFact) - { - typedFact.Value = value; - typedFact.IsPersistent = persistence == BaseMonobehaviour.FactPersistence.Persistent; - } - else - { - throw new InvalidCastException("Fact exists but is a wrong type"); - } - } - else - { - bool isPersistent = persistence == BaseMonobehaviour.FactPersistence.Persistent; - _facts[key] = new Fact(value, isPersistent); - } - } - - public T GetFact(string key) - { - if (!_facts.TryGetValue(key, out var fact)) - { - throw new InvalidCastException($"Fact {key} does not exist"); - } - - if (_facts[key] is not Fact typedFact) - { - throw new InvalidCastException($"Fact {key} is not of type {typeof(T)}"); - } - - return typedFact.Value; - } - - public Dictionary GetAllFacts() - { - return AllFacts; - } - - public List GetAllFactsOfType() - { - List list = new(); - foreach (var fact in _facts.Values) - { - if (fact is Fact typedFact) - { - list.Add(typedFact.Value); - } - } - return list; - } - - public void RemoveFact(string key) - { - _facts.Remove(key); - } - - public List GetAllSaves() - { - foreach (var slot in Directory.GetFiles(Application.persistentDataPath)) - { - if (slot.Contains("_save.json") && (!slot.Contains("GeneralSettings") || !slot.Contains("continue"))) - { - string fileName = Path.GetFileNameWithoutExtension(slot); - if (fileName.EndsWith("_save")) - { - string slotName = fileName.Substring(0, fileName.Length - "_save".Length); // "Rom1" - _saves.Add(slotName); - } - } - } - return _saves; - } - - public bool SaveFileExists(string slotName= "") - { - if (slotName != "") - { - string filename = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json"); - return File.Exists(filename); - } - - int nbFiles = Directory.GetFiles(Application.persistentDataPath, "*.json").Length; - string fileSettings = Path.Combine(Application.persistentDataPath, "GeneralSettings_save.json"); - string fileContinue = Path.Combine(Application.persistentDataPath, "continue_save.json"); - if (File.Exists(fileSettings)) nbFiles--; // On retire le fichier nommé GeneralSettings_save.json - if (File.Exists(fileContinue)) nbFiles--; // On retire le fichier nommé continue_save.json - - if(nbFiles <= 0) return false; - - return true; - } - - public bool SaveFacts(string slotName) - { - Dictionary persistentsFacts = GetPersistentsFacts(); - - // Permet à Newtonsoft de savoir quel type concret sérialiser via le champ $type - JsonSerializerSettings settings = new JsonSerializerSettings - { - Formatting = Formatting.Indented, - NullValueHandling = NullValueHandling.Ignore, - DateFormatHandling = DateFormatHandling.IsoDateFormat, - TypeNameHandling = TypeNameHandling.All // Ajout du type dans le JSON - }; - - string json = JsonConvert.SerializeObject(persistentsFacts, settings); - string filename = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json"); - - Debug.Log($"Saving to {filename}"); - - try - { - File.WriteAllText(filename, json); - _saves.Add(slotName); - return true; - } - catch (Exception e) - { - return false; - } - } - - public bool LoadFacts(string slotName) - { - string file = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json"); - if (File.Exists(file)) - { - // Permet à Newtonsoft de savoir quel type concret désérialiser via le champ $type - JsonSerializerSettings settings = new JsonSerializerSettings - { - TypeNameHandling = TypeNameHandling.All - }; - - string json = File.ReadAllText(file); - Dictionary facts = JsonConvert.DeserializeObject>(json, settings); - - foreach (var fact in facts) - { - _facts[fact.Key] = fact.Value; - } - return true; - } - - return false; - } - - public void DeleteSaveFile(string slotName) - { - string file = Path.Combine(Application.persistentDataPath, $"{slotName}_save.json"); - File.Delete(file); - } - - #endregion - - #region Utils - - private Dictionary GetPersistentsFacts() - { - Dictionary persistentsFacts = new(); - - foreach (var fact in _facts) - { - if (fact.Value.IsPersistent) - { - persistentsFacts.Add(fact.Key, fact.Value); - } - } - return persistentsFacts; - } - - #endregion - - #region private - - private Dictionary _facts = new(); - private List _saves = new List(); - - #endregion - } -} \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs.meta b/Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs.meta deleted file mode 100644 index b04f6d96..00000000 --- a/Assets/_/Features/Core/Runtime/FactsSystem/FactDictionary.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: bb7f99aca4b5495aaecca229e21225ef -timeCreated: 1752132416 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/GameManager.cs b/Assets/_/Features/Core/Runtime/GameManager.cs deleted file mode 100644 index 441daea3..00000000 --- a/Assets/_/Features/Core/Runtime/GameManager.cs +++ /dev/null @@ -1,217 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using Core.Runtime.Enums; -using UnityEngine; -using UnityEngine.SceneManagement; - -namespace Core.Runtime -{ - public class GameManager: BaseMonobehaviour - { - - #region Publics - - public static GameManager Instance { get; private set; } - - public static FactDictionnary m_gameFacts; - - public bool IsOnPause - { - get => isOnPause; - set => isOnPause = value; - } - - public FactDictionnary Fact - { - get - { - return _fact; - } - set - { - _fact = value; - } - } - - public String Profile - { - get - { - return _profile; - } - set - { - _profile = value; - } - } - - public bool SaveFileExist => m_gameFacts.SaveFileExists(); - - public bool CanPause - { - get => _canPause; - set => _canPause = value; - } - - public EnumLanguage CurrentLanguage - { - get - { - return _currentLanguage; - } - set - { - _currentLanguage = value; - } - } - - public Dictionary GetLocalTexts - { - get - { - return _localTexts; - } - set - { - _localTexts = value; - } - } - - public int CurrentGameTime - { - get - { - return _currentGameTime; - } - set - { - _currentGameTime = value; - } - } - - public bool LaunchedTime - { - get - { - return _launchedTime; - } - set - { - _launchedTime = value; - } - } - - public static event Action OnTimeAdvanced; - - #endregion - - - #region Unity API - - private void Awake() - { - _sceneLoader = GetComponent(); - // Si une instance existe déjà et que ce n’est pas celle-ci, détruire ce GameObject - if (Instance != null && Instance != this) - { - Destroy(gameObject); - return; - } - - // Sinon, cette instance devient l’instance unique - Instance = this; - DontDestroyOnLoad(gameObject); - - m_gameFacts = new FactDictionnary(); - _localTexts = new Dictionary(); - - // Chargement ou création des paramètres - if (m_gameFacts.SaveFileExists("GeneralSettings")) - { - LoadFacts("GeneralSettings"); - } - else - { - GeneralSettings settings = new GeneralSettings - { - Language = EnumLanguage.English, - }; - SetFact("GeneralSettings", settings, FactPersistence.Persistent); - SaveFacts("GeneralSettings"); - } - - CurrentLanguage = GetFact("GeneralSettings").Language; - LocalizationSystem.Instance.LoadLanguage(CurrentLanguage); - } - - void Start() - { - Debug.Log("Chemin des sauvegardes : " + Application.persistentDataPath); - } - - #endregion - - - #region Main Methods - - public void ReloadScene() - { - string sceneName = SceneManager.GetActiveScene().name; - _sceneLoader.LoadScene(sceneName); - } - - public void UpdateGameTime(GameTime gameTime) - { - _gameTime = gameTime; - } - - // Time Gestion - public void AdvanceTime(int secondes) - { - _gameTime.Advance(secondes); - OnTimeAdvanced?.Invoke(_gameTime.TotalSeconds); - } - - public void LaunchGameTime() - { - if (LaunchedTime) return; - LaunchedTime = true; - StartCoroutine(TimeTickLoop()); - } - - #endregion - - - #region Utils - - /* Fonctions privées utiles */ - private IEnumerator TimeTickLoop() - { - while (true) - { - yield return new WaitForSecondsRealtime(1f); - AdvanceTime(1); - _currentGameTime++; - } - } - - #endregion - - - #region Privates and Protected - - bool isOnPause = false; - SceneLoader _sceneLoader; - FactDictionnary _fact; - bool _canPause; - string _profile; - EnumLanguage _currentLanguage; - Dictionary _localTexts; - bool _launchedTime; - int _currentGameTime = 0; - GameTime _gameTime; - - #endregion - } -} \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/GameManager.cs.meta b/Assets/_/Features/Core/Runtime/GameManager.cs.meta deleted file mode 100644 index 19611dda..00000000 --- a/Assets/_/Features/Core/Runtime/GameManager.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3664fb5e6bffa4a6cbfc8fce31b53be3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 11 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_/Features/Core/Runtime/GameTime.cs b/Assets/_/Features/Core/Runtime/GameTime.cs deleted file mode 100644 index b15a08b0..00000000 --- a/Assets/_/Features/Core/Runtime/GameTime.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; - -namespace Core.Runtime -{ - [Serializable] - public class GameTime - { - public int Seconds { get; set; } - public int Minutes { get; set; } - public int Hours { get; set; } - public int Days { get; set; } - - public int TotalSeconds => Days * 86400 + Hours * 3600 + Minutes * 60 + Seconds; - public int TotalMinutes => Days * 1440 + Hours * 60 + Minutes; - public int TotalHours => Days * 24 + Hours; - public int TotalDays => Days; - - public GameTime() - { - Minutes = 0; - Hours = 0; - Days = 0; - } - - public void Advance(int seconds) - { - Seconds += seconds; - - while (Seconds >= 60) { Seconds -= 60; Minutes++; } - while (Minutes >= 60) { Minutes -= 60; Hours++; } - while (Hours >= 24) { Hours -= 24; Days++; } - } - - public int SnapTime() - { - return TotalSeconds; - } - } -} diff --git a/Assets/_/Features/Core/Runtime/GameTime.cs.meta b/Assets/_/Features/Core/Runtime/GameTime.cs.meta deleted file mode 100644 index 3d9a12d4..00000000 --- a/Assets/_/Features/Core/Runtime/GameTime.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 6afd02148ba241d8ae8592ca5fb38d9f -timeCreated: 1754390983 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/Interfaces.meta b/Assets/_/Features/Core/Runtime/Interfaces.meta deleted file mode 100644 index d89d9ced..00000000 --- a/Assets/_/Features/Core/Runtime/Interfaces.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c2c2153ca77294f16adf4ecf6b122114 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/_/Features/Core/Runtime/Interfaces/IFact.cs b/Assets/_/Features/Core/Runtime/Interfaces/IFact.cs deleted file mode 100644 index 0c549d8e..00000000 --- a/Assets/_/Features/Core/Runtime/Interfaces/IFact.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Core.Runtime.Interfaces -{ - public interface IFact - { - Type ValueType { get; } - object GetObjectValue { get; } - void SetObjectValue(object value); - bool IsPersistent { get; } - } -} diff --git a/Assets/_/Features/Core/Runtime/Interfaces/IFact.cs.meta b/Assets/_/Features/Core/Runtime/Interfaces/IFact.cs.meta deleted file mode 100644 index d12e9100..00000000 --- a/Assets/_/Features/Core/Runtime/Interfaces/IFact.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 28d823c3a267436eaf00bf170c9669f9 -timeCreated: 1752132484 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/LocalizationSystem.cs b/Assets/_/Features/Core/Runtime/LocalizationSystem.cs deleted file mode 100644 index a4ed5eeb..00000000 --- a/Assets/_/Features/Core/Runtime/LocalizationSystem.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.IO; -using Core.Runtime.Enums; -using TMPro; -using UnityEngine; - -namespace Core.Runtime -{ - public class LocalizationSystem : BaseMonobehaviour - { - - #region Publics - - public static LocalizationSystem Instance { get; private set; } - - #endregion - - - #region Unity API - - private void Awake() - { - if (Instance != null && Instance != this) - { - Destroy(gameObject); - return; - } - - Instance = this; - DontDestroyOnLoad(gameObject); - } - - #endregion - - - #region Main Methods - - public void LocalizeAllTextsIn(Transform root) - { - foreach (var txt in root.GetComponentsInChildren(true)) - { - txt.text = GetLocalizedText(txt.text); - } - } - - public string GetLocalizedText(string key) - { - if (GameManager.Instance.GetLocalTexts.TryGetValue(key, out var value)) - return value; - - return $"{key}"; - } - - public void SaveLanguage(string newLanguage) - { - if (FactExists("language", out var language)) - { - RemoveFact("language"); - SetFact("language", newLanguage, FactPersistence.Persistent); - } - SetFact("language", newLanguage, FactPersistence.Persistent); - } - - public void LoadLanguage(EnumLanguage langReceived) - { - string lang = langReceived.ToString(); - - if (Enum.TryParse(lang, out EnumLanguage parsedLang)) - { - GameManager.Instance.GetLocalTexts = XmlLoader.LoadDictionary(GetLanguageFile(parsedLang)); - } - else - { - Debug.LogError($"Language {lang} not found"); - return; - } - } - - #endregion - - #region Utils - - private string GetLanguage() - { - string file = GetLanguageFile(); - - return file.Split('/')[file.Split('/').Length - 1].Split('.')[0]; - } - - private string GetLanguageFile(EnumLanguage lang = EnumLanguage.French) - { - string filename = $"Localization/{lang}.xml"; - string filepath = Path.Combine(Application.streamingAssetsPath, filename); - - if (File.Exists(filepath)) - { - return filepath; - } - return Path.Combine(Application.streamingAssetsPath, "French.xml"); - } - - #endregion - } -} - diff --git a/Assets/_/Features/Core/Runtime/LocalizationSystem.cs.meta b/Assets/_/Features/Core/Runtime/LocalizationSystem.cs.meta deleted file mode 100644 index e8b05fde..00000000 --- a/Assets/_/Features/Core/Runtime/LocalizationSystem.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 02c5410883674e91875167d2ef34abe5 -timeCreated: 1752475493 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/SceneLoader.cs b/Assets/_/Features/Core/Runtime/SceneLoader.cs deleted file mode 100644 index a4818f23..00000000 --- a/Assets/_/Features/Core/Runtime/SceneLoader.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections; -using UnityEngine; -using UnityEngine.SceneManagement; -using Random = UnityEngine.Random; - -namespace Core.Runtime -{ - public class SceneLoader : BaseMonobehaviour - { - - #region Publics - - public static event Action OnSceneLoaded; - public static string CurrentSceneName => SceneManager.GetActiveScene().name; - public static SceneLoader Instance { get; private set; } - - #endregion - - - #region Unity API - - private void Awake() - { - if (Instance != null) - { - Destroy(gameObject); - return; - } - Instance = this; - DontDestroyOnLoad(gameObject); - - SceneManager.sceneLoaded += HandleSceneLoaded; - } - - void OnDestroy() - { - SceneManager.sceneLoaded -= HandleSceneLoaded; - } - - #endregion - - - #region Main Methods - - public void LoadScene(string sceneName) - { - SceneManager.LoadScene(sceneName); - } - - public void FakeLoading(string nextSceneName) - { - if (SceneExists("Loading")) - { - LoadScene("Loading"); - StartCoroutine(WaitingLoading(nextSceneName)); - } - } - - #endregion - - - #region Utils - - private IEnumerator WaitingLoading(string nextSceneName) - { - int time = Random.Range(3, 6); - yield return new WaitForSeconds(time); - LoadScene(nextSceneName); - } - - private void HandleSceneLoaded(Scene scene, LoadSceneMode mode) - { - if (FactExists("game_time", out _)) - { - GameTime gameTime = GetFact("game_time"); - GameManager.Instance.UpdateGameTime(gameTime); - GameManager.Instance.CurrentGameTime = gameTime.TotalSeconds; - GameManager.Instance.LaunchGameTime(); - } - else - { - // Debug supprimé - } - - OnSceneLoaded?.Invoke(scene); - } - - private bool SceneExists(string sceneName) - { - for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++) - { - string path = SceneUtility.GetScenePathByBuildIndex(i); - string name = System.IO.Path.GetFileNameWithoutExtension(path); - if (name == sceneName) - return true; - } - return false; - } - - #endregion - - - #region Privates and Protected - - // - - #endregion - } -} - diff --git a/Assets/_/Features/Core/Runtime/SceneLoader.cs.meta b/Assets/_/Features/Core/Runtime/SceneLoader.cs.meta deleted file mode 100644 index 980d793f..00000000 --- a/Assets/_/Features/Core/Runtime/SceneLoader.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9a4bd386e20d414fb3e91c510e890143 -timeCreated: 1751130958 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/UIManager.cs b/Assets/_/Features/Core/Runtime/UIManager.cs deleted file mode 100644 index 3525cea1..00000000 --- a/Assets/_/Features/Core/Runtime/UIManager.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace Core.Runtime -{ - public class UIManager : BaseMonobehaviour - { - - #region Publics - - public void ShowPanel(GameObject panel) - { - panel.SetActive(true); - } - - public void HideAllPanels() - { - foreach (var p in panels) - p.SetActive(false); - } - - #endregion - - - #region Unity API - - // - - #endregion - - - #region Main Methods - - // - - #endregion - - - #region Utils - - /* Fonctions privées utiles */ - - #endregion - - - #region Privates and Protected - - [SerializeField] private List panels; - - #endregion - } -} - diff --git a/Assets/_/Features/Core/Runtime/UIManager.cs.meta b/Assets/_/Features/Core/Runtime/UIManager.cs.meta deleted file mode 100644 index 4d0d2f02..00000000 --- a/Assets/_/Features/Core/Runtime/UIManager.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1ae1264b4c494dc9b3afa715fe5100e0 -timeCreated: 1754230913 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/XmlLoader.cs b/Assets/_/Features/Core/Runtime/XmlLoader.cs deleted file mode 100644 index 80a253a5..00000000 --- a/Assets/_/Features/Core/Runtime/XmlLoader.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Xml.Linq; - -namespace Core.Runtime -{ - public class XmlLoader - { - public static Dictionary LoadDictionary(string filepath) - { - XDocument xmlDoc = XDocument.Load(filepath); - return xmlDoc.Root - .Elements() - .ToDictionary( - e => e.Name.LocalName, - e => e.Value - ); - } - } -} - diff --git a/Assets/_/Features/Core/Runtime/XmlLoader.cs.meta b/Assets/_/Features/Core/Runtime/XmlLoader.cs.meta deleted file mode 100644 index b4c4127a..00000000 --- a/Assets/_/Features/Core/Runtime/XmlLoader.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f0170f390842426a826731a88149968e -timeCreated: 1752483882 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/datas.meta b/Assets/_/Features/Core/Runtime/datas.meta deleted file mode 100644 index b930eaee..00000000 --- a/Assets/_/Features/Core/Runtime/datas.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c462b8bd55c644cd93431eff1f2da5d2 -timeCreated: 1759234811 \ No newline at end of file diff --git a/Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs b/Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs deleted file mode 100644 index 6678855b..00000000 --- a/Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Core.Runtime.Enums; - -namespace Core.Runtime -{ - public class GeneralSettings - { - #region Attributes - - EnumLanguage _language; - - #endregion - - - public EnumLanguage Language - { - get - { - return _language; - } - set - { - _language = value; - } - } - } -} diff --git a/Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs.meta b/Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs.meta deleted file mode 100644 index 29c0301d..00000000 --- a/Assets/_/Features/Core/Runtime/datas/GeneralSettings.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 45ead23d22c643d8be8bf9c1e34904fc -timeCreated: 1759234823 \ No newline at end of file