KF2-Server-Extension/ServerExt/Classes/KF2GUINetwork.uc

64 lines
1.5 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
Class KF2GUINetwork extends ReplicationInfo
NotPlaceable;
var PlayerController PlayerOwner;
var transient KF2GUIController GUIController;
var bool bLocalClient;
2020-11-28 20:04:55 +00:00
static function OpenMenuForClient(PlayerController PC, class<KFGUI_Page> Page)
2017-10-20 02:00:49 +00:00
{
local KF2GUINetwork G;
foreach PC.ChildActors(class'KF2GUINetwork',G)
break;
2020-11-28 20:12:58 +00:00
if (G==None)
2017-10-20 02:00:49 +00:00
G = PC.Spawn(class'KF2GUINetwork',PC);
G.ClientOpenMenu(Page);
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
static function CloseMenuForClient(PlayerController PC, class<KFGUI_Page> Page, optional bool bCloseAll)
2017-10-20 02:00:49 +00:00
{
local KF2GUINetwork G;
foreach PC.ChildActors(class'KF2GUINetwork',G)
break;
2020-11-28 20:12:58 +00:00
if (G==None)
2017-10-20 02:00:49 +00:00
G = PC.Spawn(class'KF2GUINetwork',PC);
G.ClientCloseMenu(Page,bCloseAll);
}
2020-11-28 20:04:55 +00:00
simulated reliable client function ClientOpenMenu(class<KFGUI_Page> Page)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (!bLocalClient)
2017-10-20 02:00:49 +00:00
return;
2020-11-28 20:12:58 +00:00
if (GUIController==None)
2017-10-20 02:00:49 +00:00
GUIController = Class'KF2GUIController'.Static.GetGUIController(PlayerOwner);
GUIController.OpenMenu(Page);
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
simulated reliable client function ClientCloseMenu(class<KFGUI_Page> Page, bool bCloseAll)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (!bLocalClient)
2017-10-20 02:00:49 +00:00
return;
2020-11-28 20:12:58 +00:00
if (GUIController==None)
2017-10-20 02:00:49 +00:00
GUIController = Class'KF2GUIController'.Static.GetGUIController(PlayerOwner);
GUIController.CloseMenu(Page,bCloseAll);
}
simulated function PostBeginPlay()
{
PlayerOwner = PlayerController(Owner);
2020-11-28 20:12:58 +00:00
if (WorldInfo.NetMode==NM_Client || (PlayerOwner!=None && LocalPlayer(PlayerOwner.Player)!=None))
2017-10-20 02:00:49 +00:00
{
bLocalClient = true;
2020-11-28 20:12:58 +00:00
if (PlayerOwner==None)
2017-10-20 02:00:49 +00:00
PlayerOwner = GetALocalPlayerController();
}
}
defaultproperties
{
bAlwaysRelevant=false
bOnlyRelevantToOwner=true
}