Ajout du CoreSystem

This commit is contained in:
mrtoine 2025-10-10 18:03:51 +02:00
parent c9a83bebe3
commit 4b8d6108b9
221 changed files with 0 additions and 6171 deletions

View file

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

View file

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

View file

@ -1,17 +0,0 @@
{
"name": "Adventurer.Runtime",
"rootNamespace": "Adventurer.Runtime",
"references": [
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
"GUID:6055be8ebefd69e48b49212b09b47b2f"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

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

View file

@ -1,211 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Adventurer.Runtime
{
public class AdventurerClass
{
#region Getters and Setters
public Guid ID
{
get { return _id; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public AdventurerClassEnum AdventurerClassEnum
{
get { return _adventurerClassEnum; }
}
public int Level
{
get { return _level; }
set { _level = value; }
}
public int Experience
{
get { return _experience; }
set { _experience = value; }
}
public int Health
{
get { return _health; }
set { _health = value; }
}
public int MaxHealth
{
get { return _maxHealth; }
set { _maxHealth = value; }
}
public int Strength
{
get { return _strength; }
set { _strength = value; }
}
public int Defense
{
get { return _defense; }
set { _defense = value; }
}
public int Intelligence
{
get { return _intelligence; }
set { _intelligence = value; }
}
public int Agility
{
get { return _agility; }
set { _agility = value; }
}
public bool IsAvailable
{
get { return _isAvailable; }
set { _isAvailable = value; }
}
public DateTime RecruitmentDate
{
get { return _recruitmentDate; }
set { _recruitmentDate = value; }
}
public Dictionary<string, string> Equipments
{
get { return _equipments; }
set { _equipments = value; }
}
public Dictionary<string, string> ModelParts { get; private set; }
#endregion
#region Parameters
Guid _id;
string _name;
AdventurerClassEnum _adventurerClassEnum;
int _level;
int _experience;
int _health;
int _maxHealth;
int _strength;
int _defense;
int _intelligence;
int _agility;
bool _isAvailable;
DateTime _recruitmentDate;
Dictionary<string, string> _equipments;
#endregion
#region Constructor
public AdventurerClass(Guid id, string name, AdventurerClassEnum adventurerClassEnum, int level, int experience,
int strength, int defense,
int intelligence, int agility, Dictionary<string, string> modelParts, DateTime RecruitmentDate = default(DateTime))
{
_id = id;
_name = name;
_adventurerClassEnum = adventurerClassEnum;
_level = level;
_experience = experience;
_strength = strength;
_defense = defense;
_intelligence = intelligence;
_agility = agility;
ModelParts = modelParts;
_recruitmentDate = RecruitmentDate;
_isAvailable = true;
_equipments = new Dictionary<string, string>();
// Calcule de la vie Max
_maxHealth = CalculateMaxHp();
//Debug.Log($">>>>>>> {_name }[{_adventurerClassEnum}] | Niveau {_level} | {_experience} exp | {_strength} force | {_defense} def | {_agility} agi | {_intelligence} int | {_maxHealth} Hp Max <<<<<<<<<");
}
#endregion
#region Methods
public void SendOnMission()
{
_isAvailable = false;
}
public void ReturnFromMission()
{
_isAvailable = true;
}
public void ReceiveXP(int xp)
{
_experience += xp;
}
private void TryLevelUp()
{
int requiredXP = _level * 100;
if (_experience >= requiredXP)
{
_level++;
_experience -= requiredXP;
}
}
int CalculateMaxHp()
{
float classMultiplier = GetClassMultiplier();
return Mathf.RoundToInt((_strength + _defense + _level * 2) * classMultiplier);
}
private float GetClassMultiplier()
{
switch (_adventurerClassEnum)
{
case AdventurerClassEnum.Barbarian: return 1.5f;
case AdventurerClassEnum.Warrior: return 1.3f;
case AdventurerClassEnum.Paladin: return 1.2f;
case AdventurerClassEnum.Archer: return 1.0f;
case AdventurerClassEnum.Thief: return 0.9f;
case AdventurerClassEnum.Priest: return 0.8f;
default: return 1.0f;
}
}
public void TakeDamage(int effectValue)
{
Debug.Log($"Taking damage: {effectValue}");
}
public void Heal(int effectValue)
{
throw new NotImplementedException();
}
public void ApplyBuff(int effectValue)
{
throw new NotImplementedException();
}
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e46147717be340f99310b7ca71940eb1
timeCreated: 1753475759

View file

@ -1,13 +0,0 @@
namespace Adventurer.Runtime
{
public enum AdventurerClassEnum
{
Thief,
Warrior,
Archer,
Paladin,
Priest,
Mage,
Barbarian,
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 54b4d05cd4924762ab71f0aa436dfa0c
timeCreated: 1753475959

View file

@ -1,99 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
namespace Adventurer.Runtime
{
[CreateAssetMenu(fileName = "AdventurerClass Factory", menuName = "Guild Tycoon/Adventurers/Factory", order = 0)]
public class AdventurerFactorySO : ScriptableObject
{
public List<string> m_names;
public List<AdventurerClassEnum> m_classes;
public int m_baseLevel;
public int m_minStat;
public int m_maxStat;
public AdventurerClass CreateAdventurer()
{
string name = m_names[Random.Range(0, m_names.Count)];
AdventurerClassEnum chosenClassEnum = m_classes[Random.Range(0, m_classes.Count)];
int level = m_baseLevel;
int xp = 0;
int strength = 0;
int defense = 0;
int agility = 0;
int intelligence = 0;
switch (chosenClassEnum)
{
case AdventurerClassEnum.Warrior:
strength = Random.Range(14, 20);
defense = Random.Range(10, 16);
agility = Random.Range(6, 14);
intelligence = Random.Range(4, 8);
break;
case AdventurerClassEnum.Mage:
strength = Random.Range(4, 8);
defense = Random.Range(6, 10);
agility = Random.Range(6, 10);
intelligence = Random.Range(14, 20);
break;
case AdventurerClassEnum.Archer:
strength = Random.Range(4, 8);
defense = Random.Range(6, 10);
agility = Random.Range(14, 20);
intelligence = Random.Range(4, 8);
break;
case AdventurerClassEnum.Paladin:
strength = Random.Range(10, 14);
defense = Random.Range(14, 20);
agility = Random.Range(4, 8);
intelligence = Random.Range(8, 12);
break;
case AdventurerClassEnum.Priest:
strength = Random.Range(6, 10);
defense = Random.Range(8, 12);
agility = Random.Range(8, 12);
intelligence = Random.Range(14, 20);
break;
case AdventurerClassEnum.Thief:
strength = Random.Range(8, 14);
defense = Random.Range(8, 12);
agility = Random.Range(14, 20);
intelligence = Random.Range(4, 8);
break;
case AdventurerClassEnum.Barbarian:
strength = Random.Range(16, 20);
defense = Random.Range(10, 14);
agility = Random.Range(6, 10);
intelligence = Random.Range(2, 6);
break;
default:
// Classe non gérée
break;
}
var modelParts = new Dictionary<string, string>();
modelParts["Ears"] = $"EARS/Ears Type {Random.Range(1, 2)}";
modelParts["Eyebrows"] = $"EYEBROWS/Eyebrow Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
modelParts["Eyes"] = $"EYES/Eyes Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
modelParts["Face Hair"] = $"FACE HAIRS/Face Hair Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
modelParts["Hair"] = $"HAIRS/Hair Type {Random.Range(1, 5)} Color {Random.Range(1, 5)}";
modelParts["Nose"] = $"NOSES/Nose Type {Random.Range(1, 5)}";
modelParts["Feet Armor"] = $"FEETS/Feet Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
modelParts["Legs Armor"] = $"LEGS/Legs Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
modelParts["Belts Armor"] = $"BELTS/Belts Armor Type {Random.Range(1, 6)} Color {Random.Range(1, 3)}";
modelParts["Arm Armor"] = $"ARMORS/Arm Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
modelParts["Chest Armor"] = $"CHESTS/Chest Armor Type {Random.Range(1, 5)} Color {Random.Range(1, 3)}";
modelParts["Head Armor"] = $"HEADS/Head Armor Type {Random.Range(1, 6)} Color {Random.Range(1, 3)}";
DateTime now = DateTime.Now;
return new AdventurerClass(Guid.NewGuid(), name, chosenClassEnum, level, xp, strength, defense, intelligence, agility, modelParts, now);
}
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 4c824ea52e0c4c33bd42fdbb00a0b5a7
timeCreated: 1753476587

View file

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

View file

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

View file

@ -1,168 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using Core.Runtime;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
namespace AudioSystem.Runtime
{
public class AudioManager : BaseMonobehaviour
{
#region Publics
public static AudioManager Instance { get; private set; }
public enum AudioChannel
{
Master,
Music,
SFX,
Ambiance
}
#endregion
#region Unity API
private void Awake()
{
if (Instance != null)
{
Destroy(gameObject);
return;
}
Instance = this;
DontDestroyOnLoad(gameObject);
_sfxSource = gameObject.AddComponent<AudioSource>();
}
#endregion
#region Main Methods
public void PlayLevelMusic()
{
if (_levelMusic != null)
{
PlayMusic(_levelMusic, true);
}
}
public void PlaySFX(AudioClip clip)
{
if(clip == null) return;
_sfxSource.PlayOneShot(clip);
}
public void PlaySFXByName(string name)
{
AudioClip clip = _sfxLibrary.FirstOrDefault(c => c.name == name);
if (clip != null)
{
PlaySFX(clip);
}
}
public void PlayMusic(AudioClip clip, bool loop = true)
{
if(clip == null) return;
_musicSource.clip = clip;
_musicSource.loop = loop;
_musicSource.Play();
}
public void PlayAmbiance(AudioClip clip, bool loop = true)
{
if(clip == null) return;
_ambianceSource.clip = clip;
_ambianceSource.loop = true;
_ambianceSource.Play();
}
public void SetMasterVolume(float value)
{
if (_audioMixer != null)
{
_audioMixer.SetFloat("MasterVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
}
}
public void SetMusicVolume(float value)
{
if (_audioMixer != null)
{
_audioMixer.SetFloat("MusicVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
}
}
public void SetSFXVolume(float value)
{
if (_audioMixer != null)
{
_audioMixer.SetFloat("SFXVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
}
}
public void SetAmbianceVolume(float value)
{
if (_audioMixer != null)
{
_audioMixer.SetFloat("AmbianceVolume", Mathf.Log10(Mathf.Clamp(value, 0.0001f, 1)) * 20);
}
}
public void BinderVolume(Slider slider, AudioChannel channel)
{
if(slider == null) return;
switch (channel)
{
case AudioChannel.Master:
slider.onValueChanged.AddListener(SetMasterVolume);
break;
case AudioChannel.Music:
slider.onValueChanged.AddListener(SetMusicVolume);
break;
case AudioChannel.SFX:
slider.onValueChanged.AddListener(SetSFXVolume);
break;
case AudioChannel.Ambiance:
slider.onValueChanged.AddListener(SetAmbianceVolume);
break;
}
}
#endregion
#region Utils
/* Fonctions privées utiles */
#endregion
#region Privates and Protected
[Header("Source audio du level")]
[SerializeField] private AudioClip _levelMusic;
[Header("Audio Sources")]
[SerializeField] private AudioSource _musicSource;
[SerializeField] private AudioSource _ambianceSource;
[SerializeField] private List<AudioClip> _sfxLibrary;
[Header("Mixer (Optional)")]
[SerializeField] private AudioMixer _audioMixer;
private AudioSource _sfxSource;
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: bf71e6ed782e4713b95188fa52438cd0
timeCreated: 1751220977

View file

@ -1,80 +0,0 @@
using System;
using UnityEngine.SceneManagement;
namespace Core.Runtime
{
public class SceneLoader : BaseMonobehaviour
{
#region Publics
public static event Action<Scene> 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);
}
#endregion
#region Utils
private void HandleSceneLoaded(Scene scene, LoadSceneMode mode)
{
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
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: b6d9171f0555419780642bfda5037221
timeCreated: 1751223652

View file

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

View file

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

View file

@ -1,17 +0,0 @@
{
"name": "Cheat.Runtime",
"rootNamespace": "Cheat.Runtime",
"references": [
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
"GUID:6055be8ebefd69e48b49212b09b47b2f"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

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

View file

@ -1,230 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Core.Runtime;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Cheat.Runtime
{
public class Cheat : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
void OnValidate()
{
# if UNITY_EDITOR
if (!Application.isPlaying)
{
GetComponentInChildren<Canvas>().enabled = false;
}
# endif
}
void Awake()
{
// Liste des actions possibles
_commands.Add("quit", args => Application.Quit());
_commands.Add("add money", args =>
{
if (args.Length == 0)
{
Warning("Usage: add money <amount>");
return;
}
if (!int.TryParse(args[0], out int amount))
{
Warning($"Invalid amount: {args[0]}");
return;
}
AddMoney(amount);
});
_commands.Add("help", args => CommandsList());
_canvas = GetComponentInChildren<Canvas>();
_canvas.enabled = false;
_historyZone = GetComponentInChildren<TMP_Text>();
}
void Start()
{
//
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Tab))
{
ToggleConsole();
}
if (_consoleOpen)
{
foreach (char c in Input.inputString)
{
if (c == '\b') // Backspace
{
if (_input.Length > 0)
_input = _input.Substring(0, _input.Length - 1);
}
else if (c == '\n' || c == '\r') // Entrée
{
ProcessCommand(_input);
_input = string.Empty;
}
else
{
_input += c;
}
RefreshUI();
}
}
}
#endregion
#region Main Methods
//
#endregion
#region Utils
/* Fonctions privées utiles */
void RefreshUI()
{
if (_historyZone == null) return;
_historyZone.text = string.Join("\n", _history.ToArray());
}
void CommandsList()
{
AppendHistory("Rappel des commandes ");
foreach (var cmd in _commands)
{
AppendHistory(cmd.Key);
}
}
// Ajoute une ligne d'historique et limite à _historyMaxLines
void AppendHistory(string line)
{
if (string.IsNullOrEmpty(line)) return;
_history.Enqueue(line);
while (_history.Count > _historyMaxLines)
_history.Dequeue();
}
void ProcessCommand(string input)
{
if (string.IsNullOrWhiteSpace(input)) return;
string raw = input.Trim();
string lower = raw.ToLower();
// Find the longest matching command key at the start of the input
string matchedKey = _commands.Keys
.OrderByDescending(k => k.Length)
.FirstOrDefault(k => lower.StartsWith(k));
if (!string.IsNullOrEmpty(matchedKey))
{
string argString = lower.Substring(matchedKey.Length).Trim();
string[] args = string.IsNullOrEmpty(argString)
? Array.Empty<string>()
: argString.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
AppendHistory(raw);
try
{
_commands[matchedKey].Invoke(args);
}
catch (Exception e)
{
Warning($"Error executing '{matchedKey}': {e.Message}");
}
}
else
{
Warning($"🚨‼️ Command '{lower}' not found");
}
_input = string.Empty;
}
void ToggleConsole()
{
_consoleOpen = !_consoleOpen;
_canvas.enabled = _consoleOpen;
GameManager.Instance.IsOnPause = _consoleOpen;
if (_consoleOpen)
{
TextCaptured();
}
}
void TextCaptured()
{
foreach (char c in Input.inputString)
{
_input += c;
}
}
#endregion
#region Commands Console
void AddMoney(int amount)
{
// Update or create a Money fact
int current;
bool hasMoney = true;
try
{
current = GetFact<int>("Money");
}
catch
{
current = 0;
hasMoney = false;
}
int newValue = current + amount;
SetFact("Money", newValue, FactPersistence.Persistent);
AppendHistory($"Money set to {newValue}");
}
#endregion
#region Privates and Protected
// Variables privées
bool _consoleOpen = false;
Canvas _canvas;
string _input = string.Empty;
Dictionary<string, Action<string[]>> _commands = new Dictionary<string, Action<string[]>>();
Queue<string> _history = new Queue<string>();
const int _historyMaxLines = 5;
TMP_Text _historyZone;
#endregion
}
}

View file

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 3d81aa295d15c46f5b729d9afa859acb

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 2f78b835dfce4349ad7522d7b63084f1
timeCreated: 1754087596

View file

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

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e82eea4c6be94d0bb12fda846a7eaf10
timeCreated: 1754301470

View file

@ -1,43 +0,0 @@
using UnityEngine;
namespace Decor.Runtime
{
public class InfoAdventurer : MonoBehaviour
{
#region Publics
//
#endregion
#region Unity API
//
#endregion
#region Main Methods
//
#endregion
#region Utils
/* Fonctions privées utiles */
#endregion
#region Privates and Protected
// Variables privées
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: c255cd054d9a4063be4d44bce3a41fdb
timeCreated: 1754301480

View file

@ -1,78 +0,0 @@
using System.Collections.Generic;
using Adventurer.Runtime;
using Core.Runtime;
using EventSystem.Runtime;
using Player.Runtime;
using UnityEngine;
namespace Decor.Runtime
{
public class AdventurerApearanceSpawner : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
void Start()
{
AdventurerSignals.OnAdventurerSpawnRequested += OnSpawnAdventurerModel;
List<AdventurerClass> allAdventurers = GetFact<List<AdventurerClass>>("my_adventurers");
foreach (AdventurerClass adventurer in allAdventurers)
{
OnSpawnAdventurerModel(adventurer);
_countAdventurers++;
}
StartCoroutine(WaitAndDeactivatePortraitGenerator());
}
void OnDestroy()
{
AdventurerSignals.OnAdventurerSpawnRequested -= OnSpawnAdventurerModel;
}
#endregion
#region Main Methods
void OnSpawnAdventurerModel(AdventurerClass adventurerClass)
{
GameObject model = Instantiate(_adventurerPrefab, transform);
model.GetComponent<AdventurerModelBinder>().SetupFromAdventurer(adventurerClass);
_portraitGenerator.GeneratePortrait(adventurerClass, _adventurerPrefab);
}
#endregion
#region Utils
System.Collections.IEnumerator WaitAndDeactivatePortraitGenerator()
{
yield return new WaitUntil(() => _countAdventurers == GetFact<PlayerClass>(GameManager.Instance.Profile).AdventurersCount);
yield return new WaitForSeconds(1f);
_portraitGenerator.GameObject.SetActive(false);
}
#endregion
#region Privates and Protected
[SerializeField] GameObject _adventurerPrefab;
[SerializeField] PortraitGenerator _portraitGenerator;
int _countAdventurers = 0;
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: d4245e562f224986b9ea19f4b0917793
timeCreated: 1754087745

View file

@ -1,60 +0,0 @@
using Adventurer.Runtime;
using Core.Runtime;
using UnityEngine;
namespace Decor.Runtime
{
public class AdventurerModelBinder : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
//
#endregion
#region Main Methods
public void SetupFromAdventurer(AdventurerClass adventurerClass)
{
foreach (Transform part in partsRoot)
{
part.gameObject.SetActive(true);
}
foreach (string partName in adventurerClass.ModelParts.Values)
{
Transform target = partsRoot.Find(partName);
if (target != null)
{
target.gameObject.SetActive(true);
}
}
}
#endregion
#region Utils
/* Fonctions privées utiles */
#endregion
#region Privates and Protected
[SerializeField] private Transform partsRoot;
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 13ac9df85abf4e1686d9d9a345cc5758
timeCreated: 1754088153

View file

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

View file

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

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 17b019320dd2465ebce9f1a32399841e
timeCreated: 1754129237

View file

@ -1,93 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using _.Features.Decor.Runtime;
using Adventurer.Runtime;
using Core.Runtime;
using Player.Runtime;
using UnityEngine;
using UnityEngine.AI;
namespace Decor.Runtime
{
public class PortraitGenerator : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
//
#endregion
#region Main Methods
Queue<(AdventurerClass, GameObject)> _queue = new();
bool _isProcessing = false;
public void GeneratePortrait(AdventurerClass adventurerClass, GameObject prefab)
{
if (!gameObject.activeInHierarchy)
{
return;
}
_queue.Enqueue((adventurerClass, prefab));
if (!_isProcessing)
{
StartCoroutine(ProcessQueue());
}
}
IEnumerator ProcessQueue()
{
_isProcessing = true;
while (_queue.Count > 0)
{
var (adventurerClass, prefab) = _queue.Dequeue();
_currentAdventurerModel = Instantiate(prefab, transform);
_currentAdventurerModel.GetComponent<AdventurerModelBinder>().SetupFromAdventurer(adventurerClass);
_currentAdventurerModel.GetComponent<NavMeshAgent>().enabled = false;
_currentAdventurerModel.GetComponent<Deplacements>().enabled = false;
var photo = GetComponentInChildren<TakePhoto>();
if (photo != null)
{
yield return StartCoroutine(photo.CaptureRoutine(adventurerClass));
}
Destroy(_currentAdventurerModel);
yield return new WaitForEndOfFrame();
_currentAdventurerModel = null;
yield return new WaitForSeconds(0.1f); // courte pause pour laisser respirer Unity
}
_isProcessing = false;
gameObject.SetActive(false);
}
#endregion
#region Utils
#endregion
#region Privates and Protected
GameObject _currentAdventurerModel;
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 541e352eed3541beb25f9ba5966b080c
timeCreated: 1754125969

View file

@ -1,72 +0,0 @@
using System.Collections;
using Adventurer.Runtime;
using Core.Runtime;
using EventSystem.Runtime;
using UnityEngine;
using UnityEngine.UI;
namespace _.Features.Decor.Runtime
{
public class TakePhoto : BaseMonobehaviour
{
#region Publics
public Image m_targetImage;
#endregion
#region Unity API
//
#endregion
#region Main Methods
// Coroutine to capture the portrait asynchronously
public IEnumerator CaptureRoutine(AdventurerClass adventurer)
{
yield return new WaitForEndOfFrame(); // attendre le rendu de la frame
_camera.Render();
RenderTexture renderTexture = _camera.targetTexture;
RenderTexture currentRT = RenderTexture.active;
RenderTexture.active = renderTexture;
Texture2D image = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.RGB24, false);
image.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
image.Apply();
RenderTexture.active = currentRT;
Sprite portraitSprite = Sprite.Create(image, new Rect(0, 0, image.width, image.height), new Vector2(0.5f, 0.5f));
AdventurerSignals.RaisePortraitCaptured(adventurer, portraitSprite);
if (m_targetImage != null)
{
m_targetImage.sprite = portraitSprite;
}
yield return new WaitForSeconds(0.1f); // attendre un court instant avant de lever l'événement final
AdventurerSignals.RaisePhotoCaptured(adventurer);
}
#endregion
#region Utils
//
#endregion
#region Privates and Protected
[SerializeField] Camera _camera;
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 8eea51d84fd74e8eb6707e41ae1e383e
timeCreated: 1754124846

View file

@ -1,91 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Core.Runtime;
using EventSystem.Runtime;
using Player.Runtime;
using Quests.Runtime;
using UnityEngine;
namespace Decor.Runtime
{
public class QuestSign: BaseMonobehaviour
{
#region private & protected
[SerializeField] GameObject _parchment;
int _quests;
PlayerClass _player;
#endregion
#region Unity API
void Awake()
{
_player = GetFact<PlayerClass>(GameManager.Instance.Profile);
}
void Start()
{
// Trigger an initial refresh
QuestManager.Instance.NotifyAvailableQuestsUpdated(_player.GuildLevel);
UpdateParchmentState();
}
void OnEnable()
{
QuestManager.OnAvailableQuestsUpdated += HandleAvailableChanged;
QuestManager.OnQuestCompleted += HandleQuestCompleted;
}
void OnDisable()
{
QuestManager.OnAvailableQuestsUpdated -= HandleAvailableChanged;
QuestManager.OnQuestCompleted -= HandleQuestCompleted;
}
void HandleAvailableChanged(System.Collections.Generic.List<QuestTemplate> _)
{
UpdateParchmentState();
}
void HandleQuestCompleted(QuestClass _)
{
UpdateParchmentState();
}
#endregion
#region Main Methods
//
#endregion
#region Utils
void UpdateParchmentState()
{
List<QuestTemplate> availableTemplates = QuestManager.Instance.GetAvailableQuests(_player.GuildLevel);
var allPossibleQuests = QuestManager.Instance.GetAvailableQuests(_player.GuildLevel);
// 2. Quêtes déjà démarrées (actives OU complétées)
var startedQuests = QuestManager.Instance.ActiveQuests
.Concat(QuestManager.Instance.CompletedQuests)
.ToList();
// 3. Quêtes vraiment disponibles = possibles - déjà démarrées
bool hasTrulyAvailableQuests = allPossibleQuests
.Any(possibleQuest =>
!startedQuests.Any(startedQuest =>
startedQuest.Name == possibleQuest.data.Name
)
);
_parchment.SetActive(hasTrulyAvailableQuests);
}
#endregion
}
}

View file

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

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 4df74ca8c623491e993c524482db6054
timeCreated: 1754130690

View file

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

View file

@ -1,53 +0,0 @@
using System;
using Adventurer.Runtime;
using UnityEngine;
namespace EventSystem.Runtime
{
public static class AdventurerSignals
{
public static event Action<AdventurerClass> OnAdventurerSpawnRequested;
public static event Action OnRefresh;
public static event Action<AdventurerClass, Sprite> OnPortraitCaptured;
public static event Action<AdventurerClass> OnPhotoCaptured;
public static event Action<AdventurerClass> OnInfoAdventurerPanel;
public static event Action<AdventurerClass> OnAdventurerSelected;
public static event Action<AdventurerClass> OnAdventurerUnselected;
public static void RaiseSpawnRequested(AdventurerClass adventurerClass)
{
OnAdventurerSpawnRequested?.Invoke(adventurerClass);
}
public static void RaiseRefreshAdventurers()
{
OnRefresh?.Invoke();
}
public static void RaisePortraitCaptured(AdventurerClass adventurerClass, Sprite portrait)
{
OnPortraitCaptured?.Invoke(adventurerClass, portrait);
}
public static void RaisePhotoCaptured(AdventurerClass adventurerClass)
{
OnPhotoCaptured?.Invoke(adventurerClass);
}
public static void RaiseInfoAdventurerPanel(AdventurerClass adventurerClass)
{
OnInfoAdventurerPanel?.Invoke(adventurerClass);
}
public static void RaiseAdventurerSelected(AdventurerClass adventurerClass)
{
OnAdventurerSelected?.Invoke(adventurerClass);
}
public static void RaiseAdventurerUnselected(AdventurerClass adventurerClass)
{
OnAdventurerUnselected?.Invoke(adventurerClass);
}
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: f1abee8b62244c39b8ad5a2274687a39
timeCreated: 1754130783

View file

@ -1,17 +0,0 @@
{
"name": "EventSystem.Runtime",
"rootNamespace": "",
"references": [
"GUID:d01b71ecbce444a299cc1623f29e9d35",
"GUID:239153993e9574192a1980e14075369e"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

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

View file

@ -1,29 +0,0 @@
using System;
using Adventurer.Runtime;
using UnityEngine;
namespace EventSystem.Runtime
{
public class LegacyRecruitementEvents : MonoBehaviour
{
public static event Action<AdventurerClass> OnHeroRecruited;
public static event Action<AdventurerClass> OnSpawnAdventurerModel;
private void OnEnable()
{
AdventurerSignals.OnAdventurerSpawnRequested += RelaySpawn;
}
private void OnDisable()
{
AdventurerSignals.OnAdventurerSpawnRequested -= RelaySpawn;
}
private void RelaySpawn(AdventurerClass adventurer)
{
OnHeroRecruited?.Invoke(adventurer);
OnSpawnAdventurerModel?.Invoke(adventurer);
}
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 0c336ee078344ae8b087c3f878a86e17
timeCreated: 1754213587

View file

@ -1,15 +0,0 @@
using UnityEngine;
namespace EventSystem.Runtime
{
public static class PanelSignals
{
public static event System.Action<string> OnRefresh;
public static void RaiseRefresh(string panelName)
{
OnRefresh?.Invoke(panelName);
}
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: a13ce8bd705048828e3e4e72ca9912e8
timeCreated: 1754381771

View file

@ -1,27 +0,0 @@
using System;
using Quests.Runtime;
namespace EventSystem.Runtime
{
public static class QuestSignals
{
public static event Action<QuestClass> OnInfoQuestPanel;
public static event Action OnRefresh;
public static event Action OnNewQuestRegistered;
public static void RaiseInfoQuestPanel(QuestClass questClass)
{
OnInfoQuestPanel?.Invoke(questClass);
}
public static void RaiseRefreshQuests()
{
OnRefresh?.Invoke();
}
public static void RaiseNewQuestRegistered()
{
OnNewQuestRegistered?.Invoke();
}
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: b68f58866a514267adc2229cc420e814
timeCreated: 1754316276

View file

@ -1,9 +0,0 @@
using System;
namespace EventSystem.Runtime
{
public class TimeSignals
{
public static event Action<int> OnTimeChanged;
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: ed9d88020a2c4a76b587fee9b0d73714
timeCreated: 1754414418

View file

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

View file

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

View file

@ -1,84 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Goals.Runtime
{
public class Goal
{
#region Publics
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string[] RequiredFacts { get; set; }
public GoalType Type { get; set; }
public GoalState State { get; set; }
public bool IsCompleted { get; set; }
public List<Goal> SubGoals { get; set; } = new List<Goal>();
public Goal(string name, string description, string[] requiredFacts, GoalType type)
{
Id = $"{name}_{Time.deltaTime}";
Name = name;
Description = description;
RequiredFacts = requiredFacts;
Type = type;
State = GoalState.Pending;
IsCompleted = false;
}
#endregion
#region Main Methods
public bool Evaluate()
{
if (SubGoals.Any())
{
if (SubGoals.All(goal => goal.IsCompleted))
{
CompleteGoal();
return true;
}
return false;
}
return State == GoalState.Completed;
}
public void StartGoal()
{
if (State == GoalState.Pending)
{
State = GoalState.InProgress;
foreach (Goal goal in SubGoals)
{
goal.StartGoal();
}
}
}
public bool CompleteGoal()
{
// Vérifie si l'objectif peut être complété (par exemple, toutes les conditions sont remplies)
// Dans une implémentation réelle, on ajouterait ici plus de validation
if (State != GoalState.Completed)
{
State = GoalState.Completed;
IsCompleted = true;
return true;
}
return false;
}
public void AddSubGoal(Goal goal)
{
SubGoals.Add(goal);
}
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 8dea578de2274a129423ce5addd72022
timeCreated: 1752594095

View file

@ -1,9 +0,0 @@
namespace Goals.Runtime
{
public enum GoalState
{
Pending,
InProgress,
Completed,
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 1f8d8db08ba547039ee38622f24e4711
timeCreated: 1752594125

View file

@ -1,16 +0,0 @@
{
"name": "Goals.Runtime",
"rootNamespace": "Goals.Runtime",
"references": [
"GUID:2ca720bbf8aa349608caa5ce4acaa603"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

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

View file

@ -1,64 +0,0 @@
using System.Collections.Generic;
using Core.Runtime;
using UnityEngine;
namespace Goals.Runtime
{
public class GoalSystem : BaseMonobehaviour
{
#region Publics
List<Goal> AllGoals { get; set; } = new List<Goal>();
#endregion
#region Unity API
//
#endregion
#region Main Methods
public void AddGoal(Goal goal)
{
SetFact<Goal>(goal.Id, goal, FactPersistence.Persistent);
AllGoals.Add(goal);
}
public void EvaluateGoals(FactDictionnary goalsFacts)
{
//
}
public List<Goal> GetGoalsByState(GoalState state)
{
return AllGoals != null ? AllGoals.FindAll(goal => goal.State == state) : new List<Goal>();
}
public bool AreAllGoalsCompleted()
{
return AllGoals != null && AllGoals.TrueForAll(goal => goal.State == GoalState.Completed);
}
#endregion
#region Utils
/* Fonctions privées utiles */
#endregion
#region Privates and Protected
// Variables privées
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 0fcbd03cac2b48e08d757057b8bcc023
timeCreated: 1752593911

View file

@ -1,8 +0,0 @@
namespace Goals.Runtime
{
public enum GoalType
{
killEnemies,
collectItems,
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 266579ea5c494f9e8d019ee8408b2597
timeCreated: 1752596481

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e20109c0f47d47e4bed712ec3e13ce37
timeCreated: 1754301684

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 21757cdae3934530860918fd9e462f2b
timeCreated: 1754301691

View file

@ -1,16 +0,0 @@
{
"name": "Item.Runtime",
"rootNamespace": "Item.Runtime",
"references": [
"GUID:2ca720bbf8aa349608caa5ce4acaa603"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View file

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

View file

@ -1,55 +0,0 @@
using System;
namespace Item.Runtime
{
public class Item
{
#region Getters and Setters
public Guid ID
{
get { return _id; }
}
public ItemDefinitionSO Definition
{
get { return _definition; }
set { _definition = value; }
}
public int Quantity
{
get { return _quantity; }
set { _quantity = value; }
}
public float EffectValue
{
get { return _effectValue; }
set { _effectValue = value; }
}
#endregion
#region Parameters
Guid _id;
ItemDefinitionSO _definition;
int _quantity;
float _effectValue;
#endregion
#region Constructor
public Item(Guid id, ItemDefinitionSO definition, int quantity, float effectValue)
{
_id = id;
_definition = definition;
_quantity = quantity;
_effectValue = effectValue;
}
#endregion
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: a3c7c28ba74e48599195313ae236b394
timeCreated: 1754301773

View file

@ -1,12 +0,0 @@
using UnityEngine;
namespace Item.Runtime
{
[CreateAssetMenu(fileName = "New Item Definition", menuName = "Guild Tycoon/Items/Generation", order = 0)]
public class ItemDefinitionSO : ScriptableObject
{
[SerializeField] Item _data;
public string DisplayNameKey;
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: fd6d5bd4844d4b1ba600841206a74c75
timeCreated: 1754302284

View file

@ -1,10 +0,0 @@
namespace Item.Runtime
{
public enum ItemRarityEnum
{
Commun,
Rare,
Epic,
Legendary,
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: a6ff93a7faa14703aaf443396da632f2
timeCreated: 1754302818

View file

@ -1,9 +0,0 @@
namespace Item.Runtime
{
[System.Serializable]
public class ItemReward
{
public ItemDefinitionSO m_itemDefinition;
public int m_quantity;
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: a196415712e44226a632b5ebb42d9ebd
timeCreated: 1754304237

View file

@ -1,11 +0,0 @@
namespace Item.Runtime
{
public enum ItemTypeEnum
{
Weapon,
Armor,
Accessory,
Consumable,
Gold,
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 1f1d5303ccf146b3ad9ec50a6f74e5cd
timeCreated: 1754302857

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,62 +0,0 @@
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

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

View file

@ -1,88 +0,0 @@
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

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

View file

@ -1,21 +0,0 @@
{
"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

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

View file

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

View file

@ -1,83 +0,0 @@
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>>("accepted_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

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

View file

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

View file

@ -1,106 +0,0 @@
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

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

View file

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

View file

@ -1,50 +0,0 @@
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

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

Some files were not shown because too many files have changed in this diff Show more