migration from new repo

This commit is contained in:
mrtoine 2025-09-06 23:56:47 +02:00
commit 423134a840
26930 changed files with 3458568 additions and 0 deletions

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: db80233461c624322bd14998c9902819
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,10 @@
using UnityEngine;
namespace MenuSystem.Runtime
{
public interface IMenuModule
{
string GetMenuName();
GameObject GetMenuPanel();
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2ff83d97ef54495aaa6544369410715c
timeCreated: 1751214645

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b27dd738e46446c9944b51ab7887325
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using Core.Runtime;
using UnityEngine;
namespace MenuSystem.Runtime.LoadGame
{
public class LoadGame : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
private void Start()
{
_allSaves = GetAllSaves();
_slotPanel = transform.Find("ListPanel").gameObject;
CreateSlots();
}
#endregion
#region Main Methods
//
#endregion
#region Utils
/* Fonctions privées utiles */
private void CreateSlots()
{
foreach (var slot in _allSaves)
{
GameObject slotGO = Instantiate(_slotPrefab, _slotPanel.transform);
slotGO.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = slot;
}
}
#endregion
#region Privates and Protected
[SerializeField] private GameObject _slotPrefab;
List<string> _allSaves = new List<string>();
private GameObject _slotPanel;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 414a6674ba084a369bbd3330c62853cf
timeCreated: 1752237140

View file

@ -0,0 +1,88 @@
using System.Collections.Generic;
using Core.Runtime;
using UnityEngine;
using UnityEngine.UI;
namespace MenuSystem.Runtime
{
public class MenuManager : BaseMonobehaviour
{
#region Publics
public static MenuManager Instance { get; private set; }
#endregion
#region Unity API
private void Awake()
{
if (Instance != null)
{
Destroy(gameObject);
return;
}
Instance = this;
}
#endregion
#region Main Methods
public void RegisterMenu(IMenuModule module)
{
_registeredMenus.Add(module);
GameObject btn = Instantiate(_buttonPrefab, _menuContainer);
btn.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = module.GetMenuName();
btn.GetComponent<Button>().onClick.AddListener(() =>
{
ShowPanel(module.GetMenuPanel());
var pauseMenu = FindAnyObjectByType<PauseMenu>();
pauseMenu?.SetMainPanelVisible(false);
GameObject btnReturn = Instantiate(_buttonPrefab, module.GetMenuPanel().transform);
btnReturn.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Return";
btnReturn.GetComponent<Button>().onClick.AddListener(() =>
{
module.GetMenuPanel().SetActive(false);
var pauseMenu = FindAnyObjectByType<PauseMenu>();
pauseMenu?.SetMainPanelVisible(true);
});
});
module.GetMenuPanel().SetActive(false);
}
#endregion
#region Utils
private void ShowPanel(GameObject panelToShow)
{
foreach (var module in _registeredMenus)
{
module.GetMenuPanel().SetActive(false);
}
panelToShow.SetActive(true);
}
#endregion
#region Privates and Protected
private readonly List<IMenuModule> _registeredMenus = new();
[SerializeField] private Transform _menuContainer;
[SerializeField] private GameObject _buttonPrefab;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cacbb75ba4e54f6c9b59cab6f7f9d54b
timeCreated: 1751214817

View file

@ -0,0 +1,21 @@
{
"name": "MenuSystem.Runtime",
"rootNamespace": "",
"references": [
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:4a640bb60ad60478bba0cc41f9b80929",
"GUID:b76af64e599e34c6faee51acccc63c66",
"GUID:d01b71ecbce444a299cc1623f29e9d35",
"GUID:239153993e9574192a1980e14075369e"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5207b8f2797a349cf827eff832b0e140
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 712517ad8d1f42b6971d87b09e581647
timeCreated: 1754055239

View file

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Adventurer.Runtime;
using Core.Runtime;
using Player.Runtime;
using Quests.Runtime;
using TMPro;
using UnityEngine;
namespace MenuSystem.Runtime
{
public class NewGame : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
//
#endregion
#region Main Methods
public void CreateProfile()
{
if (_guildName.text != "")
{
string rawName = _guildName.text;
string cleanedName = CleanInput(rawName);
PlayerClass newPlayerClass = new PlayerClass(cleanedName, 1, 1000, 5);
string saveName = newPlayerClass.GuildName.Replace(" ", "_");
/* Creation du FakeProfile "Continuer" */
SetFact<string>("profile", saveName, FactPersistence.Persistent);;
SaveFacts("continue");
RemoveFact<string>("profile");
/* Création du profile joueur */
SetFact<PlayerClass>(saveName, newPlayerClass, FactPersistence.Persistent);
SetFact<GameTime>("game_time", new GameTime(), FactPersistence.Persistent);
SetFact<List<AdventurerClass>>("my_adventurers", new List<AdventurerClass>(), FactPersistence.Persistent);
SetFact<List<QuestClass>>("quests", new List<QuestClass>(), FactPersistence.Persistent);
SetFact<List<QuestClass>>("active_quests", new List<QuestClass>(), FactPersistence.Persistent);
SetFact<List<QuestClass>>("completed_quests", new List<QuestClass>(), FactPersistence.Persistent);
SetFact<Dictionary<Guid, List<QuestEventLog>>>("events_quests_history", new Dictionary<Guid, List<QuestEventLog>>(), FactPersistence.Persistent);
GameManager.Instance.Profile = saveName;
SaveFacts();
SceneLoader.Instance.LoadScene("Game");
}
}
#endregion
#region Utils
string CleanInput(string input)
{
return Regex.Replace(input.Trim(), @"[\u200B-\u200D\uFEFF]", ""); // supprime les espaces invisibles
}
#endregion
#region Privates and Protected
[SerializeField] private TextMeshProUGUI _guildName;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c982040e65ab4046a77203bc6e1f24b2
timeCreated: 1754055252

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6022e74cdd52c46898d81004e325b067
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,106 @@
using Core.Runtime;
using DG.Tweening;
using UnityEngine;
using Cursor = UnityEngine.Cursor;
namespace MenuSystem.Runtime
{
public class PauseMenu : BaseMonobehaviour
{
#region Publics
public bool IsOpen;
#endregion
#region Unity API
void Update()
{
if (GameManager.Instance.CanPause)
{
if (IsOpen)
{
SlideIn();
}
else
{
SlideOut();
}
if (Input.GetKeyDown(KeyCode.Escape))
{
TogglePause();
}
}
}
void TogglePause()
{
IsOpen = !IsOpen;
Time.timeScale = IsOpen ? 0 : 1;
Cursor.visible = IsOpen;
Cursor.lockState = IsOpen ? CursorLockMode.None : CursorLockMode.Locked;
GameManager.Instance.IsOnPause = IsOpen;
_panel.gameObject.SetActive(IsOpen);
}
#endregion
#region Main Methods
public void Resume()
{
TogglePause();
}
public void Restart()
{
GameManager.Instance.ReloadScene();
}
public void Quit()
{
Application.Quit();
}
public void SetMainPanelVisible(bool visible)
{
_defaultFocusPanel.SetActive(visible);
}
#endregion
#region Utils
private void SlideIn()
{
// Slide IN
//_panel.position = new Vector2(200, _panel.position.y);
_panel.transform.DOMove(new Vector3(99, _panel.position.y, 0), 0.3f).SetEase(Ease.Linear).SetUpdate(true);
}
private void SlideOut()
{
//_panel.position = new Vector2(-200, _panel.position.y);
_panel.transform.DOMove(new Vector3(-100, _panel.position.y, 0), 0.3f).SetEase(Ease.Linear);
}
#endregion
#region Privates and Protected
[Header("Referencement")]
[SerializeField] private RectTransform _panel;
[SerializeField] private GameObject _defaultFocusPanel;
#endregion
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c98e8d487c61c497ab387b6aae53daaf

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 834c84e830fd403cba24affae029a1de
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,50 @@
using Core.Runtime;
using UnityEngine;
namespace MenuSystem.Runtime.Settings
{
public class AudioMenuModule : BaseMonobehaviour, IMenuModule
{
#region Publics
public string GetMenuName() => "Audio";
public GameObject GetMenuPanel() => _audioPanel;
#endregion
#region Unity API
void Start()
{
if (MenuManager.Instance != null)
{
MenuManager.Instance.RegisterMenu(this);
}
}
#endregion
#region Main Methods
//
#endregion
#region Utils
/* Fonctions privées utiles */
#endregion
#region Privates and Protected
[SerializeField] private GameObject _audioPanel;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2191e1aff27f44e3b0075022d40bcc99
timeCreated: 1751218235

View file

@ -0,0 +1,56 @@
using Core.Runtime;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace MenuSystem.Runtime
{
public class SettingsMenu : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
private void Start()
{
if (_settingsPanel)
{
foreach (var btn in _settingsPanel.GetComponentsInChildren<TMP_Text>())
{
btn.text = LocalizationSystem.Instance.GetLocalizedText(btn.text);
}
}
}
#endregion
#region Main Methods
//
#endregion
#region Utils
/* Fonctions privées utiles */
#endregion
#region Privates and Protected
[SerializeField] private GameObject _settingsPanel;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c99f4fc7ad4f4bc99c3248b325b139bc
timeCreated: 1751216302

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3a9ff0950c78c48c3b8d2758e7589e6a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,157 @@
using System.Collections.Generic;
using Core.Runtime;
using DG.Tweening;
using Shared.Runtime;
using TMPro;
using UnityEngine;
namespace MenuSystem.Runtime.TitleScreen
{
public class TitleScreen : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
void Start()
{
LocalizationSystem.Instance.LocalizeAllTextsIn(_menuPanel.transform);
LocalizationSystem.Instance.LocalizeAllTextsIn(_newGamePanel.transform);
LocalizationSystem.Instance.LocalizeAllTextsIn(_settingsPanel.transform);
LocalizationSystem.Instance.LocalizeAllTextsIn(_loadPanel.transform);
}
private void Update()
{
//GameManager.Instance.CanPause = false;
if (!GameManager.Instance.SaveFileExist)
{
_continueButton.SetActive(false);
_loadButton.SetActive(false);
}
}
#endregion
#region Main Methods
public void Continue()
{
GameManager.Instance.Profile = "continue";
// Chargement du profile continue
LoadFacts();
string profileName = GetFact<string>("profile");
GameManager.Instance.Profile = profileName;
LoadFacts();
SceneLoader.Instance.LoadScene("Game");
}
public void New()
{
NewGame();
}
public void ReturnHome()
{
ReturnToMenu();
}
public void GoSettings()
{
Settings();
}
public void LoadGame()
{
Load();
}
#endregion
#region Utils
private void NewGame()
{
_seq = DOTween.Sequence();
Slide(_menuPanel, "out");
Slide(_newGamePanel);
}
private void Settings()
{
_seq = DOTween.Sequence();
Slide(_menuPanel, "out");
Slide(_settingsPanel, "in");
}
private void Load()
{
_seq = DOTween.Sequence();
Slide(_menuPanel, "out");
Slide(_loadPanel, "in");
}
private void ReturnToMenu()
{
_seq = DOTween.Sequence();
if (_newGamePanel.transform.position.x == Screen.width / 2f)
{
Slide(_newGamePanel, "out");
}
if (_settingsPanel.transform.position.x == Screen.width / 2f)
{
Slide(_settingsPanel, "out");
}
if (_loadPanel.transform.position.x == Screen.width / 2f)
{
Slide(_loadPanel, "out");
}
Slide(_menuPanel, "in");
}
private void Slide(GameObject gameObject, string state = "in")
{
if(state == "in")
{
//_panel.position = new Vector2(200, _panel.position.y);
_seq.Append(gameObject.transform.DOMove(new Vector3(Screen.width / 2f, gameObject.transform.position.y, 0), 0.3f).SetEase(Ease.Linear).SetUpdate(true));
}
else
{
//_panel.position = new Vector2(-200, _panel.position.y);
_seq.Append(gameObject.transform.DOMove(new Vector3(-1135, gameObject.transform.position.y, 0), 0.3f).SetEase(Ease.Linear));
}
}
#endregion
#region Privates and Protected
[Header("Panels")]
[SerializeField] private GameObject _newGamePanel;
[SerializeField] private GameObject _menuPanel;
[SerializeField] private GameObject _settingsPanel;
[SerializeField] private GameObject _loadPanel;
[Header("Buttons")]
[SerializeField] private GameObject _continueButton;
[SerializeField] private GameObject _loadButton;
private List<GameObject> _panels = new List<GameObject>();
private Sequence _seq;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d70cf0c09e0c4461bc479736067e0e33
timeCreated: 1752220010