KF2-YetAnotherScoreboard/ScoreboardExt/Classes/ScoreboardExtHUD.uc

114 lines
2.6 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
2021-06-12 20:11:37 +00:00
`include(Build.uci)
`include(Logger.uci)
2020-01-10 13:14:11 +00:00
const HUDBorderSize = 3;
var float ScaledBorderSize;
2021-06-13 02:53:33 +00:00
var array < KFGUI_Base> HUDWidgets;
2020-01-10 13:14:11 +00:00
2021-06-13 02:53:33 +00:00
var class < KFScoreBoard> ScoreboardClass;
2020-01-10 13:14:11 +00:00
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()
{
2021-06-13 02:53:33 +00:00
if (KFGRI == None)
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
2021-06-13 02:53:33 +00:00
if (GUIController != None && PlayerOwner.PlayerInput == None)
GUIController.NotifyLevelChange();
2021-06-13 02:53:33 +00:00
if (GUIController == None || GUIController.bIsInvalid)
{
GUIController = Class'ScoreboardExt.KF2GUIController'.Static.GetGUIController(PlayerOwner);
2021-06-13 02:53:33 +00:00
if (GUIController != None)
{
GUIStyle = GUIController.CurrentStyle;
GUIStyle.HUDOwner = self;
LaunchHUDMenus();
}
}
GUIStyle.Canvas = Canvas;
GUIStyle.PickDefaultFontSize(Canvas.ClipY);
2021-06-13 02:53:33 +00:00
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;
2021-06-13 02:53:33 +00:00
for (i=(HUDWidgets.Length-1); i >= 0; --i)
{
2021-06-13 02:53:33 +00:00
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;
2021-06-13 02:53:33 +00:00
for (i=(HUDWidgets.Length-1); i >= 0; --i)
{
2021-06-13 02:53:33 +00:00
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;
2021-06-13 02:53:33 +00:00
for (i=(HUDWidgets.Length-1); i >= 0; --i)
{
2021-06-13 02:53:33 +00:00
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
}