-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Базовая система сохранений #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
8b137e8
7f5401a
b654e6f
a26d5ba
ef9e60c
bb05c4f
a521840
ca226e7
b6ead43
09f706e
f3e577c
442542d
23047e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| #include "G2ISteamMovementInputInterface.h" | ||
| #include "G2ISteamShotInputInterface.h" | ||
| #include "G2IUIManager.h" | ||
| #include "G2ISavingGameplayManager.h" | ||
| #include "Kismet/KismetSystemLibrary.h" | ||
|
|
||
| void AG2IPlayerController::SetupInputComponent() | ||
|
|
@@ -77,6 +78,10 @@ void AG2IPlayerController::SetupInputComponent() | |
| EnhancedInputComponent->BindAction(PauseAction, ETriggerEvent::Started,this, &ThisClass::CallPause); | ||
|
|
||
| EnhancedInputComponent->BindAction(GlovePunchAction, ETriggerEvent::Started, this, &ThisClass::GlovePunchActivation); | ||
| #if WITH_EDITOR | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Думаю, может issue сделать
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. кстати можно!
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Конечно, будет) |
||
| EnhancedInputComponent->BindAction(SaveAction, ETriggerEvent::Triggered, this, &ThisClass::SaveGameplay); | ||
| EnhancedInputComponent->BindAction(LoadAction, ETriggerEvent::Triggered, this, &ThisClass::LoadGameplay); | ||
| #endif | ||
| } | ||
| else | ||
| { | ||
|
|
@@ -389,27 +394,18 @@ void AG2IPlayerController::Fly(int Direction) | |
| { | ||
| IG2IFlightInterface::Execute_Fly(FlightComponent, MovementComponent, Direction); | ||
| } | ||
| else | ||
| { | ||
| UE_LOG(LogG2I, Log, TEXT("Pawn doesn't have component with fly interface in %s"), *GetName()); | ||
| UE_LOG(LogG2I, Log, TEXT("Pawn doesn't have component with movement interface in %s"), *GetName()); | ||
| } | ||
| } | ||
|
|
||
| void AG2IPlayerController::Jump(const FInputActionValue& Value) | ||
| { | ||
| if (!FlightComponent) | ||
| { | ||
| UE_LOG(LogG2I, Log, TEXT("Pawn doesn't have component with fly interface in %s"), *GetName()); | ||
| } | ||
| else | ||
| if (FlightComponent) | ||
PosAlina marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| return; | ||
| } | ||
|
|
||
| if (!ensure(MovementComponent)) | ||
| { | ||
| UE_LOG(LogG2I, Warning, TEXT("Pawn doesn't have component with movement interface in %s"), *GetName()); | ||
| UE_LOG(LogG2I, Warning, TEXT("Pawn doesn't have movement component in %s"), *GetName()); | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -567,4 +563,40 @@ void AG2IPlayerController::ToggleFollowAIBehindPlayer(const FInputActionValue& V | |
| void AG2IPlayerController::GlovePunchActivation(const FInputActionInstance& Instance) | ||
| { | ||
| IG2IGlovePunchInterface::Execute_GlovePunchActivation(GlovePunchComponent); | ||
| } | ||
| } | ||
|
|
||
| #if WITH_EDITOR | ||
| void AG2IPlayerController::SaveGameplay(const FInputActionValue& Value) | ||
| { | ||
| if (auto* GameInstance = GetGameInstance()) | ||
| { | ||
|
|
||
| if (UG2ISavingGameplayManager* SavingGameplayManager = GameInstance->GetSubsystem<UG2ISavingGameplayManager>()) | ||
| { | ||
| SavingGameplayManager->SaveAllDataAndGameplay(true); | ||
| } | ||
| else | ||
| { | ||
| UE_LOG(LogG2I, Warning, TEXT("Couldn't get SavingGameplayManager subsystem from GameInstance in %s."), *GetName()); | ||
| return; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| void AG2IPlayerController::LoadGameplay(const FInputActionValue& Value) | ||
| { | ||
| if (auto* GameInstance = GetGameInstance()) | ||
| { | ||
| if (UG2ISavingGameplayManager* SavingGameplayManager = GameInstance->GetSubsystem<UG2ISavingGameplayManager>()) | ||
| { | ||
| SavingGameplayManager->LoadGameplay(false); | ||
| SavingGameplayManager->LoadAllData(); | ||
| } | ||
| else | ||
| { | ||
| UE_LOG(LogG2I, Warning, TEXT("Couldn't get SavingGameplayManager subsystem from GameInstance in %s."), *GetName()); | ||
| return; | ||
| } | ||
| } | ||
| } | ||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| #include "G2IGameInstance.h" | ||
| #include "G2I.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Либо проверить SaveGameRef на nullptr
Либо передавать в функцию ссылку, а не указатель
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GameInstance не будет вызывать эти функции, если SaveGame == nullptr.
но могу поменять на ссылку
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше проверку всё же сделать, или на ссылку поменять