forked from Shardstone/trail-into-darkness
connected the default test settings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Nox.Core;
|
||||
using Nox.Game;
|
||||
using Jovian.SaveSystem;
|
||||
using Nox.Game.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
@@ -9,7 +10,7 @@ namespace Nox.UI {
|
||||
/// <summary>
|
||||
/// Main menu interface class which is responsible for creating the main menu view and handling the main menu events
|
||||
/// </summary>
|
||||
public class MainMenuView : IGameLifecycle {
|
||||
public class MainMenuView : IGameLifecycle, IMenuView {
|
||||
private readonly MenuPrefabsContainer menuPrefabsContainer;
|
||||
private readonly MenuGameStateData menuGameStateData;
|
||||
private readonly ISaveSystem saveSystem;
|
||||
@@ -37,7 +38,7 @@ namespace Nox.UI {
|
||||
this.characterSystems = characterSystems;
|
||||
}
|
||||
public void Initialize() {
|
||||
if(mainMenuReference == null) {
|
||||
if(!mainMenuReference) {
|
||||
mainMenuReference = Addressables.InstantiateAsync(menuPrefabsContainer.mainMenuReference).WaitForCompletion().GetComponent<MainMenuReference>();
|
||||
}
|
||||
mainMenuReference.exitButton.onClick.AddListener(Application.Quit);
|
||||
@@ -49,18 +50,23 @@ namespace Nox.UI {
|
||||
if(hasSave) {
|
||||
mainMenuReference.continueButton.onClick.AddListener(() => menuGameStateData.continueGameRequest.Invoke());
|
||||
}
|
||||
Show();
|
||||
}
|
||||
|
||||
public void Show() {
|
||||
mainMenuReference.gameObject.SetActive(true);
|
||||
}
|
||||
public void Hide() {
|
||||
mainMenuReference.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
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, saveSystem, gameDataState, partySettings, characterSystems);
|
||||
characterCreationView.Show();
|
||||
});
|
||||
var result = charCreationHandle.WaitForCompletion();
|
||||
characterCreationReference =result.GetComponent<CharacterCreationReference>();
|
||||
characterCreationView = new CharacterCreationView(characterCreationReference, menuGameStateData, saveSystem, gameDataState, partySettings, characterSystems);
|
||||
characterCreationView.Initialize();
|
||||
characterCreationView.Show();
|
||||
}
|
||||
|
||||
public void Tick() {
|
||||
|
||||
Reference in New Issue
Block a user