connected the default test settings

This commit is contained in:
Sebastian Bularca
2026-04-05 17:42:29 +02:00
parent 4d83483034
commit bb75524cd8
6 changed files with 67 additions and 27 deletions

View File

@@ -1,11 +1,13 @@
using Jovian.Logger;
using Jovian.SaveSystem;
using Nox.Core;
using Nox.Game;
using Nox.Game.UI;
using System;
using System.Collections.Generic;
namespace Nox.UI {
public class CharacterCreationView : IMenuView {
public class CharacterCreationView : IGameLifecycle, IMenuView {
public ISaveSystem SaveSystem { get; }
private readonly CharacterCreationReference characterCreationReference;
private readonly MenuGameStateData menuGameStateData;
@@ -28,11 +30,32 @@ namespace Nox.UI {
this.gameDataState = gameDataState;
this.partySettings = partySettings;
this.characterSystems = characterSystems;
}
public void Initialize() {
characterCreationReference.startGameButton.onClick.AddListener(() => menuGameStateData.startGameRequests?.Invoke(PlayMode.Adventure));
characterCreationReference.startGameButton.onClick.AddListener(() => {
if(characterCreationRequests == null || characterCreationRequests.Count == 0) {
GlobalLogger.LogException("No character creation requests available, cannot start game, starting with a semi-random default", LogCategory.GameLogic);
var randomIndex = UnityEngine.Random.Range(0, partySettings.testStarterCharacterSettings.Length-1);
characterCreationRequests = new List<CharacterCreationRequest> { new () {
Id = Guid.NewGuid(),
Name = partySettings.testStarterCharacterSettings[randomIndex].name,
Race = partySettings.testStarterCharacterSettings[randomIndex].race,
Class = partySettings.testStarterCharacterSettings[randomIndex].@class,
Role = CharacterRole.Protagonist,
Attributes = partySettings.testStarterCharacterSettings[randomIndex].defaultEntityAttributes,
Stats = partySettings.testStarterCharacterSettings[randomIndex].defaultEntityStats,
Perks = partySettings.testStarterCharacterSettings[randomIndex].defaultPerksData,
Modifiers = partySettings.testStarterCharacterSettings[randomIndex].defaultModifiersData
} };
return;
}
Hide();
menuGameStateData.startGameRequests?.Invoke(PlayMode.Adventure);
});
characterCreationReference.backButton.onClick.AddListener(Hide);
characterCreationReference.backButtonCenter.onClick.AddListener(Hide);
characterCreationReference.acceptButton.onClick.AddListener(CreateParty);
}
public void CreateParty() {
@@ -42,16 +65,14 @@ namespace Nox.UI {
}
public void Tick() {
throw new System.NotImplementedException();
return;
}
public void Show() {
throw new System.NotImplementedException();
characterCreationReference.gameObject.SetActive(true);
}
public void Hide() {
throw new System.NotImplementedException();
}
public void Dispose() {
throw new System.NotImplementedException();
characterCreationReference.gameObject.SetActive(false);
}
public void Dispose() { }
}
}