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

Binary file not shown.

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a3a810e3a5f145b3aa9dd2eb4a74cd0f
timeCreated: 1754590089

View file

@ -0,0 +1,69 @@
using System;
using Core.Runtime;
using Quests.Runtime;
using TMPro;
using UnityEngine;
namespace GameUI.Runtime.Events
{
public class EventsDisplayUI : BaseMonobehaviour
{
#region Publics
public TextMeshProUGUI m_questNameText;
public TextMeshProUGUI m_questDescriptionText;
#endregion
#region Unity API
void Start()
{
QuestManager.OnEventReceived += ShowEvent;
QuestManager.OnEventFromQuest += ShowQuestName;
m_questNameText.text = "";
m_questDescriptionText.text = "";
}
void OnDestroy()
{
QuestManager.OnEventReceived -= ShowEvent;
QuestManager.OnEventFromQuest -= ShowQuestName;
}
#endregion
#region Main Methods
//
#endregion
#region Utils
/* Fonctions privées utiles */
void ShowQuestName(QuestClass quest)
{
m_questNameText.text = LocalizationSystem.Instance.GetLocalizedText(quest.Name);
}
void ShowEvent(QuestEvent questEvent)
{
m_questDescriptionText.text = LocalizationSystem.Instance.GetLocalizedText(questEvent.DescriptionKey);
}
#endregion
#region Privates and Protected
// Variables privées
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5849cda3e5bb40ba805ebf198aa1465e
timeCreated: 1754590246

View file

@ -0,0 +1,53 @@
using Codice.CM.Common;
using Core.Runtime;
using TMPro;
using UnityEngine;
namespace GameUI.Runtime.Events
{
public class QuestLogUI : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
//
#endregion
#region Main Methods
public void setDatas(int time, string description)
{
_timeLogLabel.text = $"{time.ToString()} secs.";
description = $"{LocalizationSystem.Instance.GetLocalizedText(description)}";
_descriptionLogLabel.text = description;
}
#endregion
#region Utils
/* Fonctions privées utiles */
#endregion
#region Privates and Protected
// Variables privées
[SerializeField] TMP_Text _timeLogLabel;
[SerializeField] TMP_Text _descriptionLogLabel;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5eca0fd92d064a449b71fe52ae375cd8
timeCreated: 1754762284

View file

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Core.Runtime;
using Quests.Runtime;
using UnityEngine;
namespace GameUI.Runtime.Events
{
public class QuestLogsListUI : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
//
#endregion
#region Main Methods
public void Refresh(Guid questId)
{
for (int i = _logPanel.transform.childCount - 1; i >= 0; i--)
{
Destroy(_logPanel.transform.GetChild(i).gameObject);
}
var logs = GetQuestEventsLogList(questId);
foreach (var log in logs.OrderBy(l => l.Time))
{
QuestEvent questEvent = QuestManager.Instance.GetEventById(log.EventId);
GenerateLog(log.Time, questEvent);
}
}
public void ShowFor(Guid questId)
{
gameObject.SetActive(true);
Refresh(questId);
}
public void GenerateList(Guid questId)
{
Refresh(questId);
}
#endregion
#region Utils
/* Fonctions privées utiles */
List<QuestEventLog> GetQuestEventsLogList(Guid questId)
{
Dictionary<Guid, List<QuestEventLog>> eventsDict = GetFact<Dictionary<Guid, List<QuestEventLog>>>("events_quests_history");
if (eventsDict != null && eventsDict.TryGetValue(questId, out var logs))
return logs;
return new List<QuestEventLog>();
}
void GenerateLog(int time, QuestEvent questEvent)
{
GameObject logGO = Instantiate(_questLogPrefab, _logPanel.transform);
QuestLogUI logUI = logGO.GetComponent<QuestLogUI>();
logUI.setDatas(time, questEvent.DescriptionKey);
}
#endregion
#region Privates and Protected
// Variables privées
[SerializeField] GameObject _questLogPrefab;
[SerializeField] GameObject _logPanel;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 599b7d2c983c43beb15f0242026c5c98
timeCreated: 1754762587

View file

@ -0,0 +1,210 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Adventurer.Runtime;
using Core.Runtime;
using EventSystem.Runtime;
using GameUI.Runtime.Events;
using Item.Runtime;
using Quests.Runtime;
using TMPro;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace GameUI.Runtime
{
public class InfoQuestPanel : BaseMonobehaviour
{
#region Publics
[Header("UI Text Elements")]
public TextMeshProUGUI m_title;
public TextMeshProUGUI m_description;
public TextMeshProUGUI m_objective;
public TextMeshProUGUI m_reward;
#endregion
#region Privates and Protected
[Header("UI Control Elements")]
[SerializeField] private GameObject _buttonActivation;
[FormerlySerializedAs("_buttonRecap")]
[SerializeField] private GameObject _panelRecap;
[SerializeField] private GameObject _adventurersOnThisQuestPanel;
[SerializeField] private GameObject _adventurersSelection;
private List<AdventurerClass> _adventurersSelected = new List<AdventurerClass>();
private Button _activationButton;
private TMP_Text _activationButtonText;
#endregion
#region Unity API
private void Start()
{
InitializeUI();
RegisterEventHandlers();
LocalizeTexts();
}
private void OnDestroy()
{
UnregisterEventHandlers();
}
private void Update()
{
UpdateActivationButtonState();
}
#endregion
#region Initialization
private void InitializeUI()
{
_activationButton = _buttonActivation.GetComponent<Button>();
_activationButtonText = _buttonActivation.GetComponentInChildren<TMP_Text>();
}
private void RegisterEventHandlers()
{
AdventurerSignals.OnAdventurerSelected += HandleAddAdventurersFromQuest;
AdventurerSignals.OnAdventurerUnselected += HandleRemoveAdventurersFromQuest;
}
private void UnregisterEventHandlers()
{
AdventurerSignals.OnAdventurerSelected -= HandleAddAdventurersFromQuest;
AdventurerSignals.OnAdventurerUnselected -= HandleRemoveAdventurersFromQuest;
}
private void LocalizeTexts()
{
foreach (var txt in GetComponentsInChildren<TMP_Text>())
{
txt.text = LocalizationSystem.Instance.GetLocalizedText(txt.text);
}
}
#endregion
#region UI Updates
private void UpdateActivationButtonState()
{
bool hasAdventurers = _adventurersSelected.Count >= 1;
_activationButton.interactable = hasAdventurers;
_activationButtonText.color = hasAdventurers ? Color.yellow : Color.grey;
}
private void ConfigureUIForQuestState(QuestStateEnum state)
{
switch (state)
{
case QuestStateEnum.Disponible:
_buttonActivation.SetActive(true);
_adventurersOnThisQuestPanel.SetActive(false);
_panelRecap.SetActive(false);
break;
case QuestStateEnum.Completed:
_buttonActivation.SetActive(false);
_adventurersOnThisQuestPanel.SetActive(false);
_adventurersSelection.SetActive(false);
_panelRecap.SetActive(true);
_panelRecap.GetComponent<QuestLogsListUI>().ShowFor(QuestManager.Instance.CurrentQuest.ID);
break;
case QuestStateEnum.Active:
Info("La quête est active.");
_buttonActivation.SetActive(false);
_adventurersOnThisQuestPanel.SetActive(true);
_adventurersSelection.SetActive(false);
_panelRecap.SetActive(false);
break;
default:
_buttonActivation.SetActive(false);
_adventurersOnThisQuestPanel.SetActive(true);
_panelRecap.SetActive(false);
break;
}
}
#endregion
#region Main Methods
public void ShowInfo(QuestClass quest)
{
quest = FindMatchingActiveQuest(quest);
QuestManager.Instance.CurrentQuest = quest;
UpdateQuestInfoDisplay(quest);
ConfigureUIForQuestState(quest.State);
}
public void LaunchQuest()
{
if (_adventurersSelected.Count <= 0) return;
StartQuestWithSelectedAdventurers();
CleanupAfterQuestLaunch();
}
#endregion
#region Quest Operations
private QuestClass FindMatchingActiveQuest(QuestClass quest)
{
if (!FactExists<List<QuestClass>>("active_quests", out _)) return quest;
var activeQuests = GetFact<List<QuestClass>>("active_quests");
var matchingQuest = activeQuests.FirstOrDefault(q => q.ID == quest.ID);
return matchingQuest ?? quest;
}
private void UpdateQuestInfoDisplay(QuestClass quest)
{
m_title.text = LocalizationSystem.Instance.GetLocalizedText(quest?.Name);
string descKey = quest?.Description;
if (string.IsNullOrEmpty(descKey))
{
Debug.LogWarning($"🧨 Clé de localisation vide ou nulle pour la quête ! ({quest.Description})");
}
m_description.text = LocalizationSystem.Instance.GetLocalizedText(descKey);
m_objective.text = LocalizationSystem.Instance.GetLocalizedText(quest?.Objective);
m_reward.text = FormatRewardsList(quest.Rewards);
}
private void StartQuestWithSelectedAdventurers()
{
var gameTime = GetFact<GameTime>("game_time");
QuestManager.Instance.StartQuest(QuestManager.Instance.CurrentQuest, _adventurersSelected, gameTime);
// Ajouter la quête à la liste des quêtes actives
var activeQuests = GetFact<List<QuestClass>>("active_quests");
activeQuests.Add(QuestManager.Instance.CurrentQuest);
}
private void CleanupAfterQuestLaunch()
{
_adventurersSelected.Clear();
AdventurerSignals.RaiseRefreshAdventurers();
QuestSignals.RaiseRefreshQuests();
gameObject.SetActive(false);
}
#endregion
#region Utils
private string FormatRewardsList(List<ItemReward> rewards)
{
return string.Join(", ", rewards.Select(r => {
if (r.m_itemDefinition.DisplayNameKey == null) return "???";
return LocalizationSystem.Instance.GetLocalizedText(r.m_itemDefinition.DisplayNameKey);
}));
}
private void HandleAddAdventurersFromQuest(AdventurerClass adventurer)
{
_adventurersSelected.Add(adventurer);
Debug.Log($"Aventurier sélectionné: {adventurer.Name}. Total: {_adventurersSelected.Count}");
}
private void HandleRemoveAdventurersFromQuest(AdventurerClass adventurer)
{
_adventurersSelected.Remove(adventurer);
Debug.Log($"Aventurier retiré: {adventurer.Name}. Total: {_adventurersSelected.Count}");
}
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c1f21a6ed56d470d9ce0bbe00914d159
timeCreated: 1754316542

View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using Core.Runtime;
using EventSystem.Runtime;
using Quest.Runtime;
using Quests.Runtime;
using UnityEngine;
namespace GameUI.Runtime
{
public class InteractionQuestCard : BaseMonobehaviour
{
[SerializeField] QuestFactoryDatabase _questDatabase;
QuestClass _quest;
public void SetQuest(QuestClass quest)
{
_quest = quest;
}
public void OnClick()
{
if (_quest != null)
{
QuestManager.Instance.CurrentQuest = _quest;
Info($"⏱MAJ de la current quest {QuestManager.Instance.CurrentQuest.Name}");
QuestSignals.RaiseInfoQuestPanel(_quest);
}
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ad2c11555d8e49929481d17c51562af9
timeCreated: 1754315536

View file

@ -0,0 +1,88 @@
using System.Collections.Generic;
using System.Linq;
using Core.Runtime;
using EventSystem.Runtime;
using Item.Runtime;
using Quests.Runtime;
using TMPro;
using UnityEngine;
namespace GameUI.Runtime
{
public class QuestCardUI : BaseMonobehaviour
{
#region Publics
[Header("UI References")]
public TMPro.TextMeshProUGUI m_title;
public TMPro.TextMeshProUGUI m_description;
public TMPro.TextMeshProUGUI m_objective;
public TMPro.TextMeshProUGUI m_duration;
public TMPro.TextMeshProUGUI m_difficulty;
public TMPro.TextMeshProUGUI m_reward;
public TMPro.TextMeshProUGUI m_minLevel;
public QuestClass Quest => _quest;
#endregion
#region Unity API
void Start()
{
foreach (var txt in GetComponentsInChildren<TMP_Text>())
{
txt.text = LocalizationSystem.Instance.GetLocalizedText(txt.text);
}
}
#endregion
#region Main Methods
public void Setup(QuestClass quest)
{
_quest = quest;
m_title.text = quest.Name;
m_description.text = quest.Description;
m_objective.text = quest.Objective;
//m_duration.text = quest.Duration.ToString();
m_difficulty.text = quest.Difficulty.ToString();
m_reward.text = RewardsListJoined(quest.Rewards);
m_minLevel.text = quest.MinLevel.ToString();
}
public void AcceptQuest()
{
List<QuestClass> quests = GetFact<List<QuestClass>>("quests");
quests.Add(_quest);
SaveFacts();
QuestSignals.RaiseRefreshQuests();
Destroy(gameObject);
}
#endregion
#region Utils
string RewardsListJoined(List<ItemReward> rewards)
{
return string.Join(", ", rewards.Select(r => r.m_itemDefinition.DisplayNameKey != null
? LocalizationSystem.Instance.GetLocalizedText(r.m_itemDefinition.DisplayNameKey)
: "???"));
}
#endregion
#region Privates and Protected
QuestClass _quest;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c18e7bb0735f48db9cf238d0b0e23036
timeCreated: 1754253737

View file

@ -0,0 +1,82 @@
using System;
using Core.Runtime;
using Quests.Runtime;
using UnityEngine;
namespace GameUI.Runtime
{
public class QuestMini : BaseMonobehaviour
{
#region Publics
public GameObject m_check;
public GameObject m_hourglass;
#endregion
#region Unity API
void Start()
{
QuestManager.OnQuestCompleted += HandleQuestCompleted;
}
void OnDestroy()
{
QuestManager.OnQuestCompleted -= HandleQuestCompleted;
}
#endregion
#region Main Methods
public void SetQuestName(string name)
{
_questName = name;
}
public bool MatchesQuest(string questNameToCheck)
{
return _questName == questNameToCheck;
}
#endregion
#region Utils
/* Fonctions privées utiles */
void HandleQuestCompleted(QuestClass quest)
{
if (!MatchesQuest(quest.Name)) return;
switch (quest.State)
{
case QuestStateEnum.Disponible:
m_check.SetActive(false);
m_hourglass.SetActive(false);
break;
case QuestStateEnum.Active:
m_check.SetActive(false);
m_hourglass.SetActive(true);
break;
case QuestStateEnum.Completed:
m_check.SetActive(true);
m_hourglass.SetActive(false);
break;
}
}
#endregion
#region Privates and Protected
// Variables privées
string _questName;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7d7dbf81dcf3411484f2b34e5e36775d
timeCreated: 1754426707

View file

@ -0,0 +1,57 @@
using System;
using Core.Runtime;
using EventSystem.Runtime;
using Quests.Runtime;
using UnityEngine;
namespace GameUI.Runtime
{
public class QuestUIController : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
void Start()
{
QuestSignals.OnInfoQuestPanel += HandleInfoPanel;
_uiManager = GetComponent<UIManager>();
}
#endregion
#region Main Methods
//
#endregion
#region Utils
/* Fonctions privées utiles */
void HandleInfoPanel(QuestClass quest)
{
_uiManager.ShowPanel(_infoQuestPanel);
_infoQuestPanel.GetComponent<InfoQuestPanel>().ShowInfo(quest);
}
#endregion
#region Privates and Protected
UIManager _uiManager;
[SerializeField] GameObject _infoQuestPanel;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fc179d0d729745ac911b52434d5e5fb0
timeCreated: 1754316815

View file

@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Core.Runtime;
using Player.Runtime;
using Quest.Runtime;
using Quests.Runtime;
using TMPro;
using UnityEngine;
namespace GameUI.Runtime
{
public class QuestsBoardPanel : BaseMonobehaviour
{
#region Publics
public QuestFactoryDatabase _questFactoryDatabase;
#endregion
#region Unity API
void OnEnable()
{
_player = GetFact<PlayerClass>(GameManager.Instance.Profile);
}
/*void Start()
{
foreach (var txt in GetComponentsInChildren<TMP_Text>())
{
txt.text = LocalizationSystem.Instance.GetLocalizedText(txt.text);
}
var factory = _questFactoryDatabase.GetFactoryForLevel(_player.GuildLevel);
if (factory != null)
{
var availableTemplates = factory.questTemplates
.Where(q => q.data.MinLevel <= _player.GuildLevel)
.ToList();
List<QuestClass> acceptedQuestNames = new List<QuestClass>();
if (FactExists<List<QuestClass>>("quests", out _))
{
acceptedQuestNames = GetFact<List<QuestClass>>("quests");
}
foreach (var quest in availableTemplates)
{
if (acceptedQuestNames != null && acceptedQuestNames.Any(q => q.ID == quest.data.ID))
continue;
DisplayCard(quest);
}
}
}*/
void Start()
{
InitializeLocalization();
List<QuestTemplate> availableTemplates = GetAvailableQuests();
List<QuestClass> acceptedQuests = GetAcceptedQuests();
DisplayAvailableQuests(availableTemplates, acceptedQuests);
}
#endregion
#region Main Methods
//
#endregion
#region Utils
void InitializeLocalization()
{
foreach (var txt in GetComponentsInChildren<TMP_Text>())
{
txt.text = LocalizationSystem.Instance.GetLocalizedText(txt.text);
}
}
List<QuestTemplate> GetAvailableQuests()
{
var factory = _questFactoryDatabase.GetFactoryForLevel(_player.GuildLevel);
if (factory == null)
return new List<QuestTemplate>();
return factory.questTemplates
.Where(q => q.data.MinLevel <= _player.GuildLevel)
.ToList();
}
List<QuestClass> GetAcceptedQuests()
{
if (FactExists<List<QuestClass>>("quests", out _))
{
return GetFact<List<QuestClass>>("quests");
}
return new List<QuestClass>();
}
void DisplayAvailableQuests(List<QuestTemplate> availableTemplates, List<QuestClass> acceptedQuests)
{
foreach(var quest in availableTemplates)
{
if (acceptedQuests.Any(q => q.Name == quest.data.Name))
continue;
DisplayCard(quest);
}
}
void DisplayCard(QuestTemplate quest)
{
GameObject GO = Instantiate(_questCardPrefab, _panel.transform);
QuestCardUI card = GO.GetComponent<QuestCardUI>();
card.Setup(quest.ToQuestClass(QuestStateEnum.Disponible));
}
#endregion
#region Privates and Protected
PlayerClass _player;
[SerializeField] GameObject _panel;
[SerializeField] GameObject _questCardPrefab;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c74283006b49480f9076d5907b022c9d
timeCreated: 1754249219

View file

@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Core.Runtime;
using EventSystem.Runtime;
using Quests.Runtime;
using TMPro;
using UnityEngine;
using UnityEngine.Serialization;
namespace GameUI.Runtime
{
public class QuestsPanel : BaseMonobehaviour
{
#region Publics
//
#endregion
#region Unity API
private void Start()
{
QuestSignals.OnRefresh += QuestList;
QuestManager.OnQuestCompleted += QuestCompleted;
foreach (var txt in GetComponentsInChildren<TMP_Text>())
{
txt.text = LocalizationSystem.Instance.GetLocalizedText(txt.text);
}
QuestList();
}
#endregion
#region Utils
void QuestList()
{
foreach (Transform child in _panel.transform)
{
Destroy(child.gameObject);
}
if (FactExists<List<QuestClass>>("quests", out _))
{
List<QuestClass> questsFromSave = GetFact<List<QuestClass>>("quests");
List<QuestClass> quests = QuestManager.Instance.ResolveQuestsList(questsFromSave);
foreach (var quest in quests)
{
DisplayQuest(quest); //=> Key : L'id de la quête, Value : Le State
}
}
}
void DisplayQuest(QuestClass quest)
{
GameObject questGO = Instantiate(_questMiniPrefab, _panel.transform);
TMP_Text questNameLabel = questGO.GetComponentInChildren<TMP_Text>();
questNameLabel.text = LocalizationSystem.Instance.GetLocalizedText(quest.Name);
var questMini = questGO.GetComponent<QuestMini>();
if (questMini != null)
{
questMini.SetQuestName(quest.Name);
bool isCompleted = QuestManager.Instance?.IsQuestCompleted(quest.Name) == true;
questMini.m_check?.SetActive(isCompleted);
}
questGO.GetComponent<InteractionQuestCard>().SetQuest(quest);
}
void QuestCompleted(QuestClass quest)
{
CheckCompleted(quest);
}
void CheckCompleted(QuestClass quest)
{
foreach (Transform child in _panel.transform)
{
var questMini = child.GetComponent<QuestMini>();
if (questMini != null && questMini.MatchesQuest(quest.Name))
{
questMini.m_check?.SetActive(true);
}
}
}
#endregion
#region privates and protected
[SerializeField] GameObject _panel;
[SerializeField] GameObject _questMiniPrefab;
#endregion
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 811dd6c4c640425fba3403c129dc1def
timeCreated: 1753972450