2022-09-03 17:26:40 +00:00
|
|
|
class YAS_HUD extends KFGFxHudWrapper;
|
2021-06-12 20:11:37 +00:00
|
|
|
|
2020-01-10 13:14:11 +00:00
|
|
|
const HUDBorderSize = 3;
|
|
|
|
|
|
|
|
var float ScaledBorderSize;
|
2021-06-13 03:17:40 +00:00
|
|
|
var array<KFGUI_Base> HUDWidgets;
|
2020-01-10 13:14:11 +00:00
|
|
|
|
2022-09-03 17:26:40 +00:00
|
|
|
var class<YAS_ScoreBoard> ScoreboardClass;
|
|
|
|
var YAS_ScoreBoard Scoreboard;
|
2020-01-10 13:14:11 +00:00
|
|
|
|
2021-05-16 06:16:12 +00:00
|
|
|
var transient KF2GUIController GUIController;
|
|
|
|
var transient GUIStyleBase GUIStyle;
|
2020-01-17 18:46:21 +00:00
|
|
|
|
2020-01-10 13:14:11 +00:00
|
|
|
simulated function PostBeginPlay()
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
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)
|
2021-05-16 09:40:02 +00:00
|
|
|
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (GUIController != None && PlayerOwner.PlayerInput == None)
|
2021-05-16 09:40:02 +00:00
|
|
|
GUIController.NotifyLevelChange();
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
if (GUIController == None || GUIController.bIsInvalid)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-20 05:04:22 +00:00
|
|
|
GUIController = Class'YAS.KF2GUIController'.Static.GetGUIController(PlayerOwner);
|
2021-06-13 02:53:33 +00:00
|
|
|
if (GUIController != None)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
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)
|
2021-05-16 09:40:02 +00:00
|
|
|
GUIController.HandleDrawMenu();
|
|
|
|
|
2021-05-16 06:16:12 +00:00
|
|
|
ScaledBorderSize = FMax(GUIStyle.ScreenScale(HUDBorderSize), 1.f);
|
2021-05-16 09:40:02 +00:00
|
|
|
|
|
|
|
Super.PostRender();
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function LaunchHUDMenus()
|
|
|
|
{
|
2022-09-03 17:26:40 +00:00
|
|
|
Scoreboard = YAS_ScoreBoard(GUIController.InitializeHUDWidget(ScoreboardClass));
|
2021-05-16 09:40:02 +00:00
|
|
|
Scoreboard.SetVisibility(false);
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function bool NotifyInputKey(int ControllerId, Name Key, EInputEvent Event, float AmountDepressed, bool bGamepad)
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local int i;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
for (i=(HUDWidgets.Length-1); i >= 0; --i)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputKey(ControllerId, Key, Event, AmountDepressed, bGamepad))
|
2021-05-16 09:40:02 +00:00
|
|
|
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)
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local int i;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
for (i=(HUDWidgets.Length-1); i >= 0; --i)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputAxis(ControllerId, Key, Delta, DeltaTime, bGamepad))
|
2021-05-16 09:40:02 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function bool NotifyInputChar(int ControllerId, string Unicode)
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
local int i;
|
|
|
|
|
2021-06-13 02:53:33 +00:00
|
|
|
for (i=(HUDWidgets.Length-1); i >= 0; --i)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (HUDWidgets[i].bVisible && HUDWidgets[i].NotifyInputChar(ControllerId, Unicode))
|
2021-05-16 09:40:02 +00:00
|
|
|
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
|
|
|
{
|
2021-05-16 09:40:02 +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
|
|
|
{
|
2022-09-03 17:26:40 +00:00
|
|
|
ScoreboardClass=class'YAS_ScoreBoard'
|
2023-05-02 19:15:42 +00:00
|
|
|
}
|