VocationLife/Source/VocationLife/Public/VocationGameInstance.h
pixachux 7cc715cad5 Keep multiplayer options in the start menu only; free M for the world map.
The menu no longer opens in-game and will not reappear after gameplay has started.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-22 19:09:34 +02:00

82 lines
2.6 KiB
C++

// Copyright VocationLife Project. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "VocationTypes.h"
#include "VocationGameInstance.generated.h"
class UVocationSaveGame;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnVocationDataReady);
UCLASS(Blueprintable)
class VOCATIONLIFE_API UVocationGameInstance : public UGameInstance
{
GENERATED_BODY()
public:
UVocationGameInstance();
virtual void Init() override;
UFUNCTION(BlueprintCallable, Category = "VocationLife|Save")
bool SaveGame(const FString& SlotName = TEXT("VocationSave"));
UFUNCTION(BlueprintCallable, Category = "VocationLife|Save")
bool LoadGame(const FString& SlotName = TEXT("VocationSave"));
UFUNCTION(BlueprintCallable, Category = "VocationLife|Save")
bool HasSaveGame(const FString& SlotName = TEXT("VocationSave")) const;
UFUNCTION(BlueprintCallable, Category = "VocationLife|Data")
const TMap<FName, FVocationItemDefinition>& GetItemDefinitions() const { return ItemDefinitions; }
UFUNCTION(BlueprintCallable, Category = "VocationLife|Data")
const TArray<FRecipeDefinition>& GetRecipeDefinitions() const { return RecipeDefinitions; }
UFUNCTION(BlueprintCallable, Category = "VocationLife|Data")
bool FindItemDefinition(FName ItemId, FVocationItemDefinition& OutDefinition) const;
UFUNCTION(BlueprintCallable, Category = "VocationLife|Graphics")
void SetGraphicsPreset(EVocationGraphicsPreset Preset, bool bEnableRayTracing);
UFUNCTION(BlueprintCallable, Category = "VocationLife|Graphics")
EVocationGraphicsPreset GetGraphicsPreset() const { return CurrentGraphicsPreset; }
UFUNCTION(BlueprintCallable, Category = "VocationLife|Graphics")
bool IsRayTracingEnabled() const { return bRayTracingEnabled; }
/** Once true, the start/multiplayer menu will not open again this session. */
UFUNCTION(BlueprintCallable, Category = "VocationLife|UI")
void MarkGameplayStarted();
UFUNCTION(BlueprintCallable, Category = "VocationLife|UI")
bool HasGameplayStarted() const { return bHasEnteredGameplay; }
UPROPERTY(BlueprintAssignable, Category = "VocationLife")
FOnVocationDataReady OnDataReady;
UPROPERTY(BlueprintReadOnly, Category = "VocationLife|Save")
TObjectPtr<UVocationSaveGame> CurrentSave;
protected:
void InitializeDefaultData();
UPROPERTY()
TMap<FName, FVocationItemDefinition> ItemDefinitions;
UPROPERTY()
TArray<FRecipeDefinition> RecipeDefinitions;
UPROPERTY()
EVocationGraphicsPreset CurrentGraphicsPreset = EVocationGraphicsPreset::High;
UPROPERTY()
bool bRayTracingEnabled = false;
UPROPERTY()
bool bHasEnteredGameplay = false;
};