Les Icônes se mettent correctement à jour durant la partie. Update de BaseMonoBehaviour, on peux maintenant ajouter une couleur a Info().
This commit is contained in:
parent
aac376670c
commit
2b5a227237
10 changed files with 142 additions and 1163 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using Core.Runtime.Interfaces;
|
||||
using UnityEditor.Graphs;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Core.Runtime
|
||||
|
|
@ -101,9 +102,14 @@ namespace Core.Runtime
|
|||
|
||||
#region DEBUG
|
||||
|
||||
protected void Info(string message)
|
||||
protected void Info(string message, Color color)
|
||||
{
|
||||
Debug.Log(message);
|
||||
if (color == null)
|
||||
{
|
||||
color = Color.aliceBlue;
|
||||
}
|
||||
|
||||
Debug.Log($"<color=#{ColorUtility.ToHtmlStringRGB(color)}>{message}</color>");
|
||||
}
|
||||
|
||||
protected void Error(string message)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ namespace Quests.Runtime
|
|||
public static event Action<QuestClass> OnEventFromQuest;
|
||||
public static event Action<List<QuestTemplate>> OnAvailableQuestsUpdated;
|
||||
|
||||
public static event Action<QuestClass> OnCheckStateQuest;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity API
|
||||
|
|
@ -77,6 +79,9 @@ namespace Quests.Runtime
|
|||
if (_activeQuests == null) _activeQuests = new List<QuestClass>();
|
||||
if (_completedQuests == null) _completedQuests = new List<QuestClass>();
|
||||
if (_disponibleQuests == null) _disponibleQuests = new List<QuestClass>();
|
||||
|
||||
// On Check L'état des quêtes avant toutes choses
|
||||
CheckStateQuest();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -174,12 +179,24 @@ namespace Quests.Runtime
|
|||
/// </summary>
|
||||
public void NotifyCompletedQuests()
|
||||
{
|
||||
foreach (var quest in _completedQuests)
|
||||
foreach (QuestClass quest in _completedQuests)
|
||||
{
|
||||
OnQuestCompleted?.Invoke(quest);
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckStateQuest()
|
||||
{
|
||||
List<QuestClass> quests = GetFact<List<QuestClass>>("accepted_quests");
|
||||
|
||||
if (quests == null) return;
|
||||
|
||||
foreach (QuestClass quest in quests)
|
||||
{
|
||||
OnCheckStateQuest?.Invoke(quest);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Récupère l'historique des events lié à une quête
|
||||
/// </summary>
|
||||
|
|
@ -334,10 +351,9 @@ namespace Quests.Runtime
|
|||
AdventurerClass adventurer = QuestClass.GetOneAdventurerFromId(adventurerId);
|
||||
if (adventurer == null)
|
||||
{
|
||||
Info($"<color=orange>Aventurer {adventurerId} introuvable</color>");
|
||||
continue;
|
||||
}
|
||||
Info($"<color=orange>{adventurer.Name} est dans la team avec le status dispo : {adventurer.IsAvailable}</color>");
|
||||
|
||||
if (adventurer != null && adventurer.IsAvailable == false)
|
||||
{
|
||||
adventurer.IsAvailable = true;
|
||||
|
|
@ -346,7 +362,7 @@ namespace Quests.Runtime
|
|||
}
|
||||
if (anyChanged)
|
||||
{
|
||||
Info("<color=cyan>Comme les données on changées, on les sauvegarde.</color>");
|
||||
|
||||
SaveFacts();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace TestFacts.Runtime
|
|||
{
|
||||
foreach (var fact in GetAllFacts())
|
||||
{
|
||||
Info($"Fact[{fact.Key}] = {fact.Value}");
|
||||
Info($"Fact[{fact.Key}] = {fact.Value}", Color.aliceBlue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace TestFacts.Runtime
|
|||
{
|
||||
PlayerClass profile = GetFact<PlayerClass>(GameManager.Instance.Profile);
|
||||
profile.Money = 99999;
|
||||
Info("➕99999 Gold added");
|
||||
Info("➕99999 Gold added", Color.green);
|
||||
SaveFacts();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ namespace GameUI.Runtime
|
|||
|
||||
IEnumerator OpenRoutine()
|
||||
{
|
||||
Info("On rentre dans la routine <OpenRoutine>");
|
||||
// Defer one frame to let Canvas/Scaler/Mask finish their activation cycle
|
||||
yield return null;
|
||||
|
||||
GenerateAdventurer(20);
|
||||
|
|
@ -104,12 +102,10 @@ namespace GameUI.Runtime
|
|||
_content = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
Info($"Génération de {nbAdventurers} aventuriers");
|
||||
|
||||
|
||||
for (int i = 0; i < nbAdventurers; i++)
|
||||
{
|
||||
AdventurerClass newRecruit = m_adventurersSO.CreateAdventurer();
|
||||
Info($"Aventurier n°{i}/{nbAdventurers}. Nom : {newRecruit.Name}");
|
||||
DisplayHeroCard(newRecruit);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ namespace GameUI.Runtime
|
|||
|
||||
void ConfigureUIForQuestState(QuestStateEnum state)
|
||||
{
|
||||
Info($"<color=orange>Etat de la quête : {state}</color>");
|
||||
switch (state)
|
||||
{
|
||||
case QuestStateEnum.Disponible:
|
||||
|
|
@ -139,7 +138,6 @@ namespace GameUI.Runtime
|
|||
quest = FindMatchingActiveQuest(quest);
|
||||
QuestManager.Instance.CurrentQuest = quest;
|
||||
|
||||
Info($"<color=green><InfoQuestPanel.cs:143></color><color=orange>{quest.Name}</color>");
|
||||
UpdateQuestInfoDisplay(quest);
|
||||
ConfigureUIForQuestState(quest.State);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ namespace GameUI.Runtime
|
|||
if (_quest != null)
|
||||
{
|
||||
QuestManager.Instance.CurrentQuest = _quest;
|
||||
Info($"⏱️MAJ de la current quest {QuestManager.Instance.CurrentQuest.Name}");
|
||||
QuestSignals.RaiseInfoQuestPanel(_quest);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,14 +18,21 @@ namespace GameUI.Runtime
|
|||
|
||||
#region Unity API
|
||||
|
||||
void Start()
|
||||
void OnEnable()
|
||||
{
|
||||
QuestManager.OnQuestCompleted += HandleQuestCompleted;
|
||||
QuestManager.OnQuestCompleted += HandleQuestState;
|
||||
QuestManager.OnCheckStateQuest += HandleQuestState;
|
||||
// Re-synchroniser l'état quand l'UI s'active
|
||||
if (QuestManager.Instance != null)
|
||||
{
|
||||
QuestManager.Instance.CheckStateQuest();
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
void OnDisable()
|
||||
{
|
||||
QuestManager.OnQuestCompleted -= HandleQuestCompleted;
|
||||
QuestManager.OnQuestCompleted -= HandleQuestState;
|
||||
QuestManager.OnCheckStateQuest -= HandleQuestState;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -49,9 +56,10 @@ namespace GameUI.Runtime
|
|||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
void HandleQuestCompleted(QuestClass quest)
|
||||
void HandleQuestState(QuestClass quest)
|
||||
{
|
||||
if (!MatchesQuest(quest.Name)) return;
|
||||
Info($"Etat de la quete {quest.Name} : {quest.State}", Color.burlywood);
|
||||
switch (quest.State)
|
||||
{
|
||||
case QuestStateEnum.Disponible:
|
||||
|
|
@ -63,6 +71,7 @@ namespace GameUI.Runtime
|
|||
m_hourglass.SetActive(true);
|
||||
break;
|
||||
case QuestStateEnum.Completed:
|
||||
Info("Completed !!", Color.green);
|
||||
m_check.SetActive(true);
|
||||
m_hourglass.SetActive(false);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ namespace GameUI.Runtime
|
|||
questMini.SetQuestName(quest.Name);
|
||||
bool isCompleted = QuestManager.Instance?.IsQuestCompleted(quest.Name) == true;
|
||||
questMini.m_check?.SetActive(isCompleted);
|
||||
questMini.m_hourglass?.SetActive(quest.State == QuestStateEnum.InProgress);
|
||||
}
|
||||
|
||||
questGO.GetComponent<InteractionQuestCard>().SetQuest(quest);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue