KF2-YetAnotherScoreboard/ScoreboardExt/Classes/ScoreboardExtHUD.uc

111 lines
2.5 KiB
Ucode
Raw Normal View History

2021-05-16 03:37:39 +00:00
class ScoreboardExtHUD extends KFGFxHudWrapper
config(ScoreboardExtMut);
2020-01-10 13:14:11 +00:00
const HUDBorderSize = 3;
var float ScaledBorderSize;
var array<KFGUI_Base> HUDWidgets;
var class<KFScoreBoard> ScoreboardClass;
var KFScoreBoard Scoreboard;
2021-05-16 06:16:12 +00:00
var transient KF2GUIController GUIController;
var transient GUIStyleBase GUIStyle;
2020-01-10 13:14:11 +00:00
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
PlayerOwner.PlayerInput.OnReceivedNativeInputKey = NotifyInputKey;
PlayerOwner.PlayerInput.OnReceivedNativeInputAxis = NotifyInputAxis;
PlayerOwner.PlayerInput.OnReceivedNativeInputChar = NotifyInputChar;
RemoveMovies();
CreateHUDMovie();
2020-01-10 13:14:11 +00:00
}
function PostRender()
{
if( KFGRI == None )
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
if( GUIController!=None && PlayerOwner.PlayerInput==None )
GUIController.NotifyLevelChange();
if( GUIController==None || GUIController.bIsInvalid )
{
GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner);
if( GUIController!=None )
{
GUIStyle = GUIController.CurrentStyle;
GUIStyle.HUDOwner = self;
LaunchHUDMenus();
}
}
GUIStyle.Canvas = Canvas;
GUIStyle.PickDefaultFontSize(Canvas.ClipY);
if( !GUIController.bIsInMenuState )
GUIController.HandleDrawMenu();
2021-05-16 06:16:12 +00:00
ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f);
Super.PostRender();
2020-01-10 13:14:11 +00:00
}
function LaunchHUDMenus()
{
Scoreboard = KFScoreBoard(GUIController.InitializeHUDWidget(ScoreboardClass));
Scoreboard.SetVisibility(false);
2020-01-10 13:14:11 +00:00
}
function bool NotifyInputKey(int ControllerId, Name Key, EInputEvent Event, float AmountDepressed, bool bGamepad)
{
local int i;
for( i=(HUDWidgets.Length-1); i>=0; --i )
{
if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputKey(ControllerId, Key, Event, AmountDepressed, bGamepad) )
return true;
}
return false;
2020-01-10 13:14:11 +00:00
}
function bool NotifyInputAxis(int ControllerId, name Key, float Delta, float DeltaTime, optional bool bGamepad)
{
local int i;
for( i=(HUDWidgets.Length-1); i>=0; --i )
{
if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad) )
return true;
}
return false;
2020-01-10 13:14:11 +00:00
}
function bool NotifyInputChar(int ControllerId, string Unicode)
{
local int i;
for( i=(HUDWidgets.Length-1); i>=0; --i )
{
if( HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputChar(ControllerId, Unicode) )
return true;
}
return false;
2020-01-10 13:14:11 +00:00
}
2021-05-16 06:16:12 +00:00
exec function SetShowScores(bool bNewValue)
2021-05-16 04:40:47 +00:00
{
if (Scoreboard != None)
Scoreboard.SetVisibility(bNewValue);
2021-05-16 06:16:12 +00:00
else Super.SetShowScores(bNewValue);
2021-05-16 04:40:47 +00:00
}
2021-05-16 06:16:12 +00:00
defaultproperties
2021-05-16 04:40:47 +00:00
{
ScoreboardClass=class'KFScoreBoard'
2020-01-10 13:14:11 +00:00
}