Platform should be initialized in the Boot, before everything else. Got rid of the coroutines
This commit is contained in:
@@ -17,8 +17,8 @@ namespace Nox.Core {
|
||||
/// </summary>
|
||||
public class GameModeGameState : IGameState {
|
||||
private readonly GameDataState gameDataState;
|
||||
private readonly BootstrapReferences bootstrapReferences;
|
||||
private readonly PlatformSettings platformSettings;
|
||||
private readonly PlayModeSettings bootstrapSettings;
|
||||
private readonly ISaveSystem saveSystem;
|
||||
private readonly ISceneTransition sceneTransition;
|
||||
private readonly AdventureData adventureData;
|
||||
@@ -35,10 +35,9 @@ namespace Nox.Core {
|
||||
private bool stateEntered;
|
||||
private AsyncOperationHandle<AdventureSettings> advSettingsHandler;
|
||||
private AdventureSettings? adventureSettings;
|
||||
private PlayModeSettings? playModeSettings;
|
||||
|
||||
public bool IsGameStateInitialized {
|
||||
get => stateEntered && (playMode == null || playMode.IsGameModeInitialized);
|
||||
}
|
||||
public bool IsGameStateInitialized => stateEntered && (playMode == null || playMode.IsGameModeInitialized);
|
||||
|
||||
public GameModeGameState(GameDataState gameDataState,
|
||||
BootstrapReferences bootstrapReferences,
|
||||
@@ -48,19 +47,19 @@ namespace Nox.Core {
|
||||
AdventureData adventureData,
|
||||
IGameLogStore gameLogStore) {
|
||||
this.gameDataState = gameDataState;
|
||||
this.bootstrapReferences = bootstrapReferences;
|
||||
this.platformSettings = platformSettings;
|
||||
this.saveSystem = saveSystem;
|
||||
this.sceneTransition = sceneTransition;
|
||||
this.adventureData = adventureData;
|
||||
this.gameLogStore = gameLogStore;
|
||||
|
||||
bootstrapSettings = Addressables.LoadAssetAsync<PlayModeSettings>(bootstrapReferences.playModeSettings).WaitForCompletion();
|
||||
}
|
||||
|
||||
public void EnterGameState() {
|
||||
playModeSettings ??= Addressables.LoadAssetAsync<PlayModeSettings>(bootstrapReferences.playModeSettings).WaitForCompletion();
|
||||
if(gameDataState.ActivePlayMode == PlayMode.None) {
|
||||
var sceneReference = Object.FindFirstObjectByType<SceneReference>();
|
||||
if(bootstrapSettings.gameModeData.AsValueEnumerable().Any(g => g.playMode == sceneReference.playMode)) {
|
||||
if(playModeSettings.gameModeData.AsValueEnumerable().Any(g => g.playMode == sceneReference.playMode)) {
|
||||
gameDataState.ChangePlayMode(sceneReference.playMode);
|
||||
}
|
||||
}
|
||||
@@ -108,7 +107,7 @@ namespace Nox.Core {
|
||||
}
|
||||
|
||||
playMode = gameDataState.ActivePlayMode switch {
|
||||
PlayMode.Adventure => new AdventurePlayMode(platformSettings, activeParty, bootstrapSettings, gameDataState, saveSystem, adventureSettings, adventureData),
|
||||
PlayMode.Adventure => new AdventurePlayMode(platformSettings, activeParty, playModeSettings, gameDataState, saveSystem, adventureSettings, adventureData),
|
||||
PlayMode.PauseMenu => new PauseMenuPlayMode(platformSettings, gameDataState, pauseMenuView!),
|
||||
PlayMode.Town => new TownPlayMode(platformSettings, activeParty),
|
||||
PlayMode.Rest => new RestPlayMode(platformSettings, activeParty),
|
||||
|
||||
Reference in New Issue
Block a user