You've already forked LuckyWorld
Optimize some gameinstance codes
This commit is contained in:
@ -2,6 +2,42 @@
|
||||
|
||||
|
||||
#include "LuckyRobotsGameInstance.h"
|
||||
#include "LuckyRobotsGameState.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "GameUserWidget.h"
|
||||
|
||||
void ULuckyRobotsGameInstance::DoSendMessage(FString SendValue)
|
||||
{
|
||||
ALuckyRobotsGameState* LuckyRobotsGameState = Cast<ALuckyRobotsGameState>(UGameplayStatics::GetGameState(this));
|
||||
if (LuckyRobotsGameState)
|
||||
{
|
||||
LuckyRobotsGameState->DoSendMessage(SendValue);
|
||||
}
|
||||
|
||||
DoLogItemAdd("Receive", SendValue, 0);
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::DoLogItemAdd(FString Topic, FString MsgText, int Type)
|
||||
{
|
||||
if (GameUserWidget)
|
||||
{
|
||||
GameUserWidget->DoLogItemAdd(Topic, MsgText, Type);
|
||||
}
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::SwitchGamePaused()
|
||||
{
|
||||
UGameplayStatics::SetGamePaused(this, !UGameplayStatics::IsGamePaused(this));
|
||||
|
||||
if (UGameplayStatics::IsGamePaused(this))
|
||||
{
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(this, "r.SceneRendering 0");
|
||||
}
|
||||
else
|
||||
{
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(this, "r.SceneRendering 1");
|
||||
}
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::ClearTaskList()
|
||||
{
|
||||
@ -79,4 +115,21 @@ void ULuckyRobotsGameInstance::ReSetTaskList()
|
||||
TArray<FGoalsTaskData> ULuckyRobotsGameInstance::GetTaskList()
|
||||
{
|
||||
return TaskList;
|
||||
}
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool IsClear)
|
||||
{
|
||||
if (IsClear)
|
||||
{
|
||||
ClearTaskList();
|
||||
}
|
||||
else
|
||||
{
|
||||
AddTask(TempTask);
|
||||
}
|
||||
|
||||
if (GameUserWidget)
|
||||
{
|
||||
GameUserWidget->DoRefreshListView();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user