45 lines
1011 B
C++
45 lines
1011 B
C++
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||
|
|
||
|
|
||
|
#include "OverheadWidget.h"
|
||
|
|
||
|
#include "Components/TextBlock.h"
|
||
|
|
||
|
void UOverheadWidget::SetDisplayText(FString TextToDisplay)
|
||
|
{
|
||
|
if (DisplayText)
|
||
|
{
|
||
|
DisplayText->SetText(FText::FromString(TextToDisplay));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void UOverheadWidget::ShowPlayerNetRole(APawn* InPawn)
|
||
|
{
|
||
|
ENetRole RemoveRole = InPawn->GetRemoteRole();
|
||
|
FString Role;
|
||
|
switch (RemoveRole)
|
||
|
{
|
||
|
case ENetRole::ROLE_Authority:
|
||
|
Role = FString("Authority");
|
||
|
break;
|
||
|
case ENetRole::ROLE_AutonomousProxy:
|
||
|
Role = FString("AutonomousProxy");
|
||
|
break;
|
||
|
case ENetRole::ROLE_SimulatedProxy:
|
||
|
Role = FString("SimulatedProxy");
|
||
|
break;
|
||
|
case ENetRole::ROLE_None:
|
||
|
Role = FString("None");
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
FString RemoteRoleString = FString::Printf(TEXT("Remote role: %s"), *Role);
|
||
|
SetDisplayText(RemoteRoleString);
|
||
|
}
|
||
|
|
||
|
void UOverheadWidget::OnLevelRemovedFromWorld(ULevel* InLevel, UWorld* InWorld)
|
||
|
{
|
||
|
RemoveFromParent();
|
||
|
Super::OnLevelRemovedFromWorld(InLevel, InWorld);
|
||
|
}
|