migration from new repo
This commit is contained in:
commit
423134a840
26930 changed files with 3458568 additions and 0 deletions
BIN
Assets/_/Features/UI/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/UI/.DS_Store
vendored
Normal file
Binary file not shown.
3
Assets/_/Features/UI/Runtime.meta
Normal file
3
Assets/_/Features/UI/Runtime.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 70056d884cd64fc182b3fb1051cf37f6
|
||||
timeCreated: 1753972353
|
||||
BIN
Assets/_/Features/UI/Runtime/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/UI/Runtime/.DS_Store
vendored
Normal file
Binary file not shown.
3
Assets/_/Features/UI/Runtime/Adventurers.meta
Normal file
3
Assets/_/Features/UI/Runtime/Adventurers.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2d3f76b5fab34eb4a7a72108fc94d9ff
|
||||
timeCreated: 1754227951
|
||||
BIN
Assets/_/Features/UI/Runtime/Adventurers/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/UI/Runtime/Adventurers/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -0,0 +1,91 @@
|
|||
using System;
|
||||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using EventSystem.Runtime;
|
||||
using Quests.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class AdventurerCardSelectionnable : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public Sprite m_selectedSprite;
|
||||
public Sprite m_unselectedSprite;
|
||||
public GameObject m_BGSprite;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
void Start()
|
||||
{
|
||||
_adventurer = GetComponent<AdventurerCardUI>().Adventurer;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (_isSelected)
|
||||
{
|
||||
m_BGSprite.GetComponent<Image>().sprite = m_selectedSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_BGSprite.GetComponent<Image>().sprite = m_unselectedSprite;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
if (!QuestManager.Instance.CanSelectedAdventurers())
|
||||
{
|
||||
gameObject.GetComponent<Button>().interactable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_isSelected = !_isSelected;
|
||||
if (_isSelected)
|
||||
AdventurerSignals.RaiseAdventurerSelected(_adventurer);
|
||||
else
|
||||
AdventurerSignals.RaiseAdventurerUnselected(_adventurer);
|
||||
}
|
||||
|
||||
public void OnPointerEnter()
|
||||
{
|
||||
if (!QuestManager.Instance.CanSelectedAdventurers()) return;
|
||||
transform.localScale = Vector3.one * 1.1f;
|
||||
}
|
||||
|
||||
public void OnPointerExit()
|
||||
{
|
||||
transform.localScale = Vector3.one;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
bool _isSelected;
|
||||
AdventurerClass _adventurer;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ab0eb1ff1f8649719673f40e0d46da0f
|
||||
timeCreated: 1754334060
|
||||
83
Assets/_/Features/UI/Runtime/Adventurers/AdventurerCardUI.cs
Normal file
83
Assets/_/Features/UI/Runtime/Adventurers/AdventurerCardUI.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using Adventurer.Runtime;
|
||||
using Quests.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class AdventurerCardUI : MonoBehaviour
|
||||
{
|
||||
#region Publics
|
||||
|
||||
[Header("UI References")]
|
||||
public GameObject m_hourglass;
|
||||
public TMPro.TextMeshProUGUI m_name;
|
||||
public TMPro.TextMeshProUGUI m_class;
|
||||
//public TMPro.TextMeshProUGUI m_traits;
|
||||
|
||||
//public TMPro.TextMeshProUGUI m_experience;
|
||||
public TMPro.TextMeshProUGUI m_level;
|
||||
|
||||
public TMPro.TextMeshProUGUI m_strength;
|
||||
public TMPro.TextMeshProUGUI m_defense;
|
||||
public TMPro.TextMeshProUGUI m_agility;
|
||||
public TMPro.TextMeshProUGUI m_intelligence;
|
||||
public Image m_portrait;
|
||||
|
||||
[Header("Only Shop")]
|
||||
public Button m_buyButton;
|
||||
public GameObject m_footer;
|
||||
public TMPro.TextMeshProUGUI m_price;
|
||||
|
||||
AdventurerClass _adventurer;
|
||||
|
||||
#endregion
|
||||
|
||||
public AdventurerClass Adventurer => _adventurer;
|
||||
|
||||
void Start()
|
||||
{
|
||||
QuestManager.OnQuestCompleted += ChangeAvailable;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
QuestManager.OnQuestCompleted -= ChangeAvailable;
|
||||
}
|
||||
|
||||
public void setup(AdventurerClass adventurerClass)
|
||||
{
|
||||
_adventurer = adventurerClass;
|
||||
m_name.text = adventurerClass.Name;
|
||||
m_class.text = adventurerClass.AdventurerClassEnum.ToString();
|
||||
m_level.text = adventurerClass.Level.ToString();
|
||||
m_strength.text = adventurerClass.Strength.ToString();
|
||||
m_defense.text = adventurerClass.Defense.ToString();
|
||||
m_agility.text = adventurerClass.Agility.ToString();
|
||||
m_intelligence.text = adventurerClass.Intelligence.ToString();
|
||||
|
||||
if(!adventurerClass.IsAvailable && m_hourglass != null)
|
||||
m_hourglass.gameObject.SetActive(true);
|
||||
|
||||
var interaction = GetComponent<InteractionAdventurerCard>();
|
||||
if (interaction != null)
|
||||
interaction.SetAdventurer(adventurerClass);
|
||||
}
|
||||
|
||||
public void SetPortrait(Sprite portrait)
|
||||
{
|
||||
if (m_portrait != null)
|
||||
m_portrait.sprite = portrait;
|
||||
}
|
||||
|
||||
void ChangeAvailable(QuestClass quest)
|
||||
{
|
||||
if (quest.State == QuestStateEnum.Completed && _adventurer.IsAvailable)
|
||||
{
|
||||
if (m_hourglass != null)
|
||||
m_hourglass.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ac33d10d3a201471d817d415fcde31b0
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace GameUI.Runtime
|
||||
{
|
||||
public enum AdventurerSortEnum
|
||||
{
|
||||
None,
|
||||
Available,
|
||||
NotAvailable,
|
||||
AssignedToQuest,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b2582e771c9405e93ced5bbc1a0003b
|
||||
timeCreated: 1754337102
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using EventSystem.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class AdventurerUIController : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
void Start()
|
||||
{
|
||||
AdventurerSignals.OnInfoAdventurerPanel += HandleInfoPanel;
|
||||
_uiManager = GetComponent<UIManager>();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
void HandleInfoPanel(AdventurerClass adventurer)
|
||||
{
|
||||
_uiManager.ShowPanel(_infoAdventurerPanel);
|
||||
_infoAdventurerPanel.GetComponent<InfoAdventurerPanel>().ShowInfo(adventurer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] private GameObject _infoAdventurerPanel;
|
||||
UIManager _uiManager;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c4d5cc7840ef451fa22f5d0c277d6aff
|
||||
timeCreated: 1754231469
|
||||
99
Assets/_/Features/UI/Runtime/Adventurers/AdventurersPanel.cs
Normal file
99
Assets/_/Features/UI/Runtime/Adventurers/AdventurersPanel.cs
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
using System.Collections.Generic;
|
||||
using EventSystem.Runtime;
|
||||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using Quests.Runtime;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class AdventurersPanel : BasePanel
|
||||
{
|
||||
#region Unity API
|
||||
|
||||
private void Start()
|
||||
{
|
||||
AdventurerSignals.OnPortraitCaptured += OnPortraitCapturedHandler;
|
||||
AdventurerSignals.OnRefresh += DisplayAdventurers;
|
||||
|
||||
foreach (var txt in GetComponentsInChildren<TMP_Text>())
|
||||
{
|
||||
txt.text = LocalizationSystem.Instance.GetLocalizedText(txt.text);
|
||||
}
|
||||
|
||||
DisplayAdventurers();
|
||||
}
|
||||
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
AdventurerSignals.OnPortraitCaptured -= OnPortraitCapturedHandler;
|
||||
AdventurerSignals.OnRefresh -= DisplayAdventurers;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
void OnPortraitCapturedHandler(AdventurerClass adventurer, Sprite portrait)
|
||||
{
|
||||
foreach (Transform child in _heroesPanel.transform)
|
||||
{
|
||||
AdventurerCardUI card = child.GetComponent<AdventurerCardUI>();
|
||||
if (card != null && card.Adventurer == adventurer)
|
||||
{
|
||||
card.SetPortrait(portrait);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayAdventurers()
|
||||
{
|
||||
foreach (Transform child in _heroesPanel.transform)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
|
||||
List<AdventurerClass> filtered = FilterAdventurers(_sort);
|
||||
|
||||
foreach (AdventurerClass adventurer in filtered)
|
||||
{
|
||||
GameObject cardAdventurerGO = Instantiate(_adventurerPrefab, _heroesPanel.transform);
|
||||
cardAdventurerGO.transform.SetAsLastSibling();
|
||||
AdventurerCardUI card = cardAdventurerGO.GetComponent<AdventurerCardUI>();
|
||||
card.setup(adventurer);
|
||||
}
|
||||
}
|
||||
|
||||
List<AdventurerClass> FilterAdventurers(AdventurerSortEnum sortType)
|
||||
{
|
||||
List<AdventurerClass> allAdventurers = GetFact<List<AdventurerClass>>("my_adventurers");
|
||||
switch (sortType)
|
||||
{
|
||||
case AdventurerSortEnum.Available:
|
||||
return allAdventurers.FindAll(a => a.IsAvailable);
|
||||
case AdventurerSortEnum.NotAvailable:
|
||||
return allAdventurers.FindAll(a => !a.IsAvailable);
|
||||
case AdventurerSortEnum.AssignedToQuest:
|
||||
return QuestClass.GetAdventurersFromId(QuestManager.Instance.AssignedAdventurers);
|
||||
case AdventurerSortEnum.None:
|
||||
return allAdventurers;
|
||||
default:
|
||||
return allAdventurers;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] GameObject _adventurerPrefab;
|
||||
[SerializeField] GameObject _heroesPanel;
|
||||
[SerializeField] AdventurerSortEnum _sort;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5104eaeccc974d829b1bc9298481c2df
|
||||
timeCreated: 1753910448
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 654fd5aae0624c529ff6147dbfb36890
|
||||
timeCreated: 1754078701
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Adventurer.Runtime;
|
||||
using UnityEngine;
|
||||
using Core.Runtime;
|
||||
using EventSystem.Runtime;
|
||||
using Random = UnityEngine.Random;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class RecruitementPanel: BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public AdventurerFactorySO m_adventurersSO;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (_content == null)
|
||||
{
|
||||
_content = GetComponent<RectTransform>();
|
||||
}
|
||||
StartCoroutine(OpenRoutine());
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
// Intentionally left empty during debug to validate first-open rendering.
|
||||
// (We avoid destroying children here to keep the list intact between toggles.)
|
||||
}
|
||||
|
||||
IEnumerator OpenRoutine()
|
||||
{
|
||||
// Defer one frame to let Canvas/Scaler/Mask finish their activation cycle
|
||||
yield return null;
|
||||
|
||||
// Generate only if empty (prevents duplicate spawns on reopen)
|
||||
if (_content != null && _content.childCount == 0)
|
||||
{
|
||||
Clear();
|
||||
GenerateAdventurer(20);
|
||||
}
|
||||
|
||||
// Wait until end of frame to ensure instantiated elements are present before forcing layout
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
||||
Canvas.ForceUpdateCanvases();
|
||||
if (_content != null)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(_content);
|
||||
// Also rebuild the parent (Viewport) if present to ensure mask/scroll region updates
|
||||
var parentRT = _content.parent as RectTransform;
|
||||
if (parentRT != null)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(parentRT);
|
||||
}
|
||||
}
|
||||
Canvas.ForceUpdateCanvases();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
[ContextMenu("Effacer le container")]
|
||||
public void Clear()
|
||||
{
|
||||
if (_content == null)
|
||||
{
|
||||
_content = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
if (_content == null) return;
|
||||
|
||||
foreach (Transform child in _content)
|
||||
{
|
||||
AdventurerCardUI card = child.GetComponent<AdventurerCardUI>();
|
||||
if (card != null)
|
||||
{
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ContextMenu("Générer un aventurier")]
|
||||
public void Generate()
|
||||
{
|
||||
GenerateAdventurer();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
public void GenerateAdventurer(int nbAdventurers = 1)
|
||||
{
|
||||
if (_content == null)
|
||||
{
|
||||
_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);
|
||||
}
|
||||
|
||||
// Ensure the first-time open displays items correctly
|
||||
StartCoroutine(RefreshLayoutNextFrame());
|
||||
}
|
||||
|
||||
void DisplayHeroCard(AdventurerClass newRecruit)
|
||||
{
|
||||
if (_content == null)
|
||||
{
|
||||
_content = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
GameObject adventurerGO = Instantiate(_adventurerPrefab, _content != null ? _content : transform);
|
||||
adventurerGO.transform.SetAsLastSibling();
|
||||
AdventurerCardUI card = adventurerGO.GetComponent<AdventurerCardUI>();
|
||||
|
||||
card.setup(newRecruit);
|
||||
|
||||
string price = ((newRecruit.Agility + newRecruit.Defense + newRecruit.Intelligence + newRecruit.Strength) / 4 * 50).ToString();
|
||||
card.m_price.text = price;
|
||||
card.m_footer.gameObject.SetActive(true);
|
||||
|
||||
card.m_buyButton.onClick.RemoveAllListeners();
|
||||
card.m_buyButton.onClick.AddListener(() => BuyHero(adventurerGO, newRecruit, int.Parse(price)));
|
||||
}
|
||||
|
||||
IEnumerator RefreshLayoutNextFrame()
|
||||
{
|
||||
yield return new WaitForEndOfFrame();
|
||||
Canvas.ForceUpdateCanvases();
|
||||
if (_content != null)
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(_content);
|
||||
}
|
||||
Canvas.ForceUpdateCanvases();
|
||||
}
|
||||
|
||||
void BuyHero(GameObject go, AdventurerClass newRecruit, int price = 0)
|
||||
{
|
||||
Player.Runtime.PlayerClass playerClass = GetFact<Player.Runtime.PlayerClass>(GameManager.Instance.Profile);
|
||||
if (playerClass.AdventurersCount == playerClass.AdventurersMax)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (playerClass.Money >= price)
|
||||
{
|
||||
playerClass.AdventurersCount += 1;
|
||||
playerClass.Money -= price;
|
||||
if (!FactExists<List<AdventurerClass>>("my_adventurers", out _))
|
||||
{
|
||||
SetFact<List<AdventurerClass>>("my_adventurers", new List<AdventurerClass>(), FactPersistence.Persistent);
|
||||
}
|
||||
List<AdventurerClass> myAdventurers = GetFact<List<AdventurerClass>>("my_adventurers");
|
||||
myAdventurers.Add(newRecruit);
|
||||
SaveFacts();
|
||||
_photoStudio.SetActive(true);
|
||||
AdventurerSignals.RaiseSpawnRequested(newRecruit);
|
||||
AdventurerSignals.RaiseRefreshAdventurers();
|
||||
Destroy(go);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[SerializeField] RectTransform _content; // Assign this to ScrollView/Viewport/Content in the inspector
|
||||
private int _nextId = 0;
|
||||
[SerializeField] GameObject _adventurerPrefab;
|
||||
[SerializeField] GameObject _photoStudio;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1e6344b00ba24272abc7c36ed57c87b0
|
||||
timeCreated: 1753477292
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class InfoAdventurerPanel : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public TextMeshProUGUI m_name;
|
||||
public TextMeshProUGUI m_level;
|
||||
public TextMeshProUGUI m_adventurerClass;
|
||||
public TextMeshProUGUI m_strenght;
|
||||
public TextMeshProUGUI m_defense;
|
||||
public TextMeshProUGUI m_agility;
|
||||
public TextMeshProUGUI m_intelligence;
|
||||
public TextMeshProUGUI m_isAvailable;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void ShowInfo(AdventurerClass adventurer)
|
||||
{
|
||||
m_name.text = adventurer.Name;
|
||||
m_level.text = $"Level {adventurer.Level.ToString()}";
|
||||
m_adventurerClass.text = adventurer.AdventurerClassEnum.ToString();
|
||||
m_strenght.text = adventurer.Strength.ToString();
|
||||
m_defense.text = adventurer.Defense.ToString();
|
||||
m_agility.text = adventurer.Agility.ToString();
|
||||
m_intelligence.text = adventurer.Intelligence.ToString();
|
||||
|
||||
if (adventurer.IsAvailable)
|
||||
{
|
||||
m_isAvailable.color = new Color(51, 171, 32);
|
||||
m_isAvailable.text = LocalizationSystem.Instance.GetLocalizedText("in_qg");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isAvailable.color = new Color(171, 32, 32);
|
||||
m_isAvailable.text = LocalizationSystem.Instance.GetLocalizedText("in_quest");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1651133be0a74e70899889b1ea3cacdc
|
||||
timeCreated: 1754230195
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using Adventurer.Runtime;
|
||||
using Core.Runtime;
|
||||
using EventSystem.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class InteractionAdventurerCard : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void SetAdventurer(AdventurerClass adventurer)
|
||||
{
|
||||
_adventurer = adventurer;
|
||||
}
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
AdventurerSignals.RaiseInfoAdventurerPanel(_adventurer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
AdventurerClass _adventurer;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 784c9e46540b4c5c8acb20a4605edb44
|
||||
timeCreated: 1754227974
|
||||
57
Assets/_/Features/UI/Runtime/BasePanel.cs
Normal file
57
Assets/_/Features/UI/Runtime/BasePanel.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using Core.Runtime;
|
||||
using EventSystem.Runtime;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class BasePanel : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
void Start()
|
||||
{
|
||||
PanelSignals.OnRefresh += Refresh;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
PanelSignals.OnRefresh -= Refresh;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
public void Refresh(string panelName)
|
||||
{
|
||||
// Debug supprimé
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
// Variables privées
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/UI/Runtime/BasePanel.cs.meta
Normal file
3
Assets/_/Features/UI/Runtime/BasePanel.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a305d0b47032411087c35e385549fc85
|
||||
timeCreated: 1754381537
|
||||
22
Assets/_/Features/UI/Runtime/GameUI.Runtime.asmdef
Normal file
22
Assets/_/Features/UI/Runtime/GameUI.Runtime.asmdef
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "GameUI.Runtime",
|
||||
"rootNamespace": "GameUI.Runtime",
|
||||
"references": [
|
||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:4a640bb60ad60478bba0cc41f9b80929",
|
||||
"GUID:d01b71ecbce444a299cc1623f29e9d35",
|
||||
"GUID:f5d0434d9e8c34eb1a16f4c57b172b85",
|
||||
"GUID:239153993e9574192a1980e14075369e",
|
||||
"GUID:7a6677577d78940c08105c0284857640"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/_/Features/UI/Runtime/GameUI.Runtime.asmdef.meta
Normal file
7
Assets/_/Features/UI/Runtime/GameUI.Runtime.asmdef.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1a94a7212ef6043ffa800654162c31d5
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
61
Assets/_/Features/UI/Runtime/InfoPanel.cs
Normal file
61
Assets/_/Features/UI/Runtime/InfoPanel.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using Core.Runtime;
|
||||
using Player.Runtime;
|
||||
using TMPro;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class InfoPanel : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
public TextMeshProUGUI m_guildName;
|
||||
public TextMeshProUGUI m_level;
|
||||
public TextMeshProUGUI m_golds;
|
||||
public TextMeshProUGUI m_adventurerCount;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
void Start()
|
||||
{
|
||||
_infoPlayerClass = GetFact<PlayerClass>(GameManager.Instance.Profile);
|
||||
LocalizationSystem.Instance.LocalizeAllTextsIn(gameObject.transform);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
m_guildName.text = _infoPlayerClass.GuildName;
|
||||
m_level.text = $"{_infoPlayerClass.GuildLevel.ToString()}";
|
||||
m_golds.text = _infoPlayerClass.Money.ToString();
|
||||
m_adventurerCount.text = $"{_infoPlayerClass.AdventurersCount.ToString()}/{_infoPlayerClass.AdventurersMax.ToString()}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
PlayerClass _infoPlayerClass;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/UI/Runtime/InfoPanel.cs.meta
Normal file
3
Assets/_/Features/UI/Runtime/InfoPanel.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ec6601b07756494b9e9fc4510c60c398
|
||||
timeCreated: 1754058454
|
||||
22
Assets/_/Features/UI/Runtime/InventoryPanel.cs
Normal file
22
Assets/_/Features/UI/Runtime/InventoryPanel.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Core.Runtime;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameUI.Runtime
|
||||
{
|
||||
public class InventoryPanel : BaseMonobehaviour
|
||||
{
|
||||
#region Unity API
|
||||
|
||||
private void Start()
|
||||
{
|
||||
foreach (var txt in GetComponentsInChildren<TMP_Text>())
|
||||
{
|
||||
txt.text = LocalizationSystem.Instance.GetLocalizedText(txt.text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
3
Assets/_/Features/UI/Runtime/InventoryPanel.cs.meta
Normal file
3
Assets/_/Features/UI/Runtime/InventoryPanel.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cf19bf1355c4475ba97030bd16379798
|
||||
timeCreated: 1753972477
|
||||
3
Assets/_/Features/UI/Runtime/Notifications.meta
Normal file
3
Assets/_/Features/UI/Runtime/Notifications.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6316a3aa107e4d8ba4cd0a842e60caa6
|
||||
timeCreated: 1754590062
|
||||
3
Assets/_/Features/UI/Runtime/Quests.meta
Normal file
3
Assets/_/Features/UI/Runtime/Quests.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aa5268813bd64e7b949a1a80ba5d8be7
|
||||
timeCreated: 1754249202
|
||||
BIN
Assets/_/Features/UI/Runtime/Quests/.DS_Store
vendored
Normal file
BIN
Assets/_/Features/UI/Runtime/Quests/.DS_Store
vendored
Normal file
Binary file not shown.
3
Assets/_/Features/UI/Runtime/Quests/Events.meta
Normal file
3
Assets/_/Features/UI/Runtime/Quests/Events.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a3a810e3a5f145b3aa9dd2eb4a74cd0f
|
||||
timeCreated: 1754590089
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5849cda3e5bb40ba805ebf198aa1465e
|
||||
timeCreated: 1754590246
|
||||
53
Assets/_/Features/UI/Runtime/Quests/Events/QuestLogUI.cs
Normal file
53
Assets/_/Features/UI/Runtime/Quests/Events/QuestLogUI.cs
Normal 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5eca0fd92d064a449b71fe52ae375cd8
|
||||
timeCreated: 1754762284
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 599b7d2c983c43beb15f0242026c5c98
|
||||
timeCreated: 1754762587
|
||||
210
Assets/_/Features/UI/Runtime/Quests/InfoQuestPanel.cs
Normal file
210
Assets/_/Features/UI/Runtime/Quests/InfoQuestPanel.cs
Normal 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
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c1f21a6ed56d470d9ce0bbe00914d159
|
||||
timeCreated: 1754316542
|
||||
32
Assets/_/Features/UI/Runtime/Quests/InteractionQuestCard.cs
Normal file
32
Assets/_/Features/UI/Runtime/Quests/InteractionQuestCard.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad2c11555d8e49929481d17c51562af9
|
||||
timeCreated: 1754315536
|
||||
88
Assets/_/Features/UI/Runtime/Quests/QuestCardUI.cs
Normal file
88
Assets/_/Features/UI/Runtime/Quests/QuestCardUI.cs
Normal 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
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/UI/Runtime/Quests/QuestCardUI.cs.meta
Normal file
3
Assets/_/Features/UI/Runtime/Quests/QuestCardUI.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c18e7bb0735f48db9cf238d0b0e23036
|
||||
timeCreated: 1754253737
|
||||
82
Assets/_/Features/UI/Runtime/Quests/QuestMini.cs
Normal file
82
Assets/_/Features/UI/Runtime/Quests/QuestMini.cs
Normal 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
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/UI/Runtime/Quests/QuestMini.cs.meta
Normal file
3
Assets/_/Features/UI/Runtime/Quests/QuestMini.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7d7dbf81dcf3411484f2b34e5e36775d
|
||||
timeCreated: 1754426707
|
||||
57
Assets/_/Features/UI/Runtime/Quests/QuestUIController.cs
Normal file
57
Assets/_/Features/UI/Runtime/Quests/QuestUIController.cs
Normal 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fc179d0d729745ac911b52434d5e5fb0
|
||||
timeCreated: 1754316815
|
||||
138
Assets/_/Features/UI/Runtime/Quests/QuestsBoardPanel.cs
Normal file
138
Assets/_/Features/UI/Runtime/Quests/QuestsBoardPanel.cs
Normal 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
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c74283006b49480f9076d5907b022c9d
|
||||
timeCreated: 1754249219
|
||||
103
Assets/_/Features/UI/Runtime/Quests/QuestsPanel.cs
Normal file
103
Assets/_/Features/UI/Runtime/Quests/QuestsPanel.cs
Normal 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
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/UI/Runtime/Quests/QuestsPanel.cs.meta
Normal file
3
Assets/_/Features/UI/Runtime/Quests/QuestsPanel.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 811dd6c4c640425fba3403c129dc1def
|
||||
timeCreated: 1753972450
|
||||
Loading…
Add table
Add a link
Reference in a new issue