forked from Shardstone/trail-into-darkness
Work on hooking the character system into the character creation
This commit is contained in:
@@ -4,7 +4,6 @@ using Jovian.SaveSystem;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using PlayMode = Nox.Core.PlayMode;
|
||||
|
||||
namespace Nox.UI {
|
||||
/// <summary>
|
||||
@@ -14,15 +13,28 @@ namespace Nox.UI {
|
||||
private readonly MenuPrefabsContainer menuPrefabsContainer;
|
||||
private readonly MenuGameStateData menuGameStateData;
|
||||
private readonly ISaveSystem saveSystem;
|
||||
private readonly GameDataState gameDataState;
|
||||
private readonly PartySettings partySettings;
|
||||
private readonly ICharacterSystems characterSystems;
|
||||
private MainMenuReference mainMenuReference;
|
||||
private CharacterCreationReference characterCreationReference;
|
||||
private CharacterCreationView characterCreationView;
|
||||
private AsyncOperationHandle<GameObject> charCreationHandle;
|
||||
|
||||
public MainMenuView(MenuPrefabsContainer menuPrefabsContainer, MenuGameStateData menuGameStateData, ISaveSystem saveSystem) {
|
||||
public MainMenuView(
|
||||
MenuPrefabsContainer menuPrefabsContainer,
|
||||
MenuGameStateData menuGameStateData,
|
||||
ISaveSystem saveSystem,
|
||||
GameDataState gameDataState,
|
||||
PartySettings partySettings,
|
||||
ICharacterSystems characterSystems
|
||||
) {
|
||||
this.menuPrefabsContainer = menuPrefabsContainer;
|
||||
this.menuGameStateData = menuGameStateData;
|
||||
this.saveSystem = saveSystem;
|
||||
this.gameDataState = gameDataState;
|
||||
this.partySettings = partySettings;
|
||||
this.characterSystems = characterSystems;
|
||||
}
|
||||
public void Initialize() {
|
||||
if(mainMenuReference == null) {
|
||||
@@ -39,14 +51,14 @@ namespace Nox.UI {
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeCharacterCreation() {
|
||||
private void InitializeCharacterCreation() {
|
||||
charCreationHandle = Addressables.InstantiateAsync(menuPrefabsContainer.characterCreationReference);
|
||||
charCreationHandle.Task.ContinueWith(t => {
|
||||
if(t.IsFaulted) {
|
||||
Debug.LogError(t.Exception);
|
||||
}
|
||||
characterCreationReference =t.Result.GetComponent<CharacterCreationReference>();
|
||||
characterCreationView = new CharacterCreationView(characterCreationReference, menuGameStateData);
|
||||
characterCreationView = new CharacterCreationView(characterCreationReference, menuGameStateData, saveSystem, gameDataState, partySettings, characterSystems);
|
||||
characterCreationView.Show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.ResourceLocations;
|
||||
|
||||
namespace Nox.UI {
|
||||
[CreateAssetMenu(fileName = "MenuPrefabsContainer", menuName = "Nox/Database/UI/MenuPrefabContainer")]
|
||||
|
||||
Reference in New Issue
Block a user