2017-10-20 02:00:49 +00:00
|
|
|
Class UI_MidGameMenu extends KFGUI_FloatingWindow;
|
2020-06-26 04:17:32 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
var KFGUI_SwitchMenuBar PageSwitcher;
|
2020-06-26 04:17:32 +00:00
|
|
|
var array< class<KFGUI_Base> > Pages;
|
2017-10-20 02:00:49 +00:00
|
|
|
|
2020-06-30 11:22:26 +00:00
|
|
|
var KFGUI_Button AdminButton,SpectateButton,SkipTraderButton;
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
var transient KFGUI_Button PrevButton;
|
|
|
|
var transient int NumButtons,NumButtonRows;
|
2020-06-30 12:53:29 +00:00
|
|
|
var transient bool bInitSpectate,bOldSpectate,bInitSkipTrader;
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
function InitMenu()
|
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
local KFGUI_Button B;
|
|
|
|
|
|
|
|
PageSwitcher = KFGUI_SwitchMenuBar(FindComponentID('Pager'));
|
|
|
|
Super(KFGUI_Page).InitMenu();
|
2020-06-26 06:32:40 +00:00
|
|
|
|
|
|
|
// TODO: localize
|
2017-10-20 02:00:49 +00:00
|
|
|
AddMenuButton('Mapvote',"Map Vote","Show mapvote menu");
|
|
|
|
AddMenuButton('Settings',"Settings","Enter the game settings");
|
2020-06-30 11:22:26 +00:00
|
|
|
SkipTraderButton = AddMenuButton('SkipTrader',"Skip Trader","start voting for skip trader");
|
2017-10-20 02:00:49 +00:00
|
|
|
SpectateButton = AddMenuButton('Spectate',"","");
|
|
|
|
AddMenuButton('Close',"Close","Close this menu");
|
2020-06-30 13:04:55 +00:00
|
|
|
AddMenuButton('Disconnect',"Disconnect","Disconnect from this server");
|
2020-06-26 04:52:58 +00:00
|
|
|
AddMenuButton('Exit',"Exit","Exit this game");
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
for( i=0; i<Pages.Length; ++i )
|
|
|
|
{
|
2020-06-26 04:17:32 +00:00
|
|
|
PageSwitcher.AddPage(Pages[i],B).InitMenu();
|
|
|
|
if( Pages[i]==Class'UIP_AdminMenu' )
|
2017-10-20 02:00:49 +00:00
|
|
|
AdminButton = B;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Timer()
|
|
|
|
{
|
|
|
|
local PlayerReplicationInfo PRI;
|
|
|
|
|
|
|
|
PRI = GetPlayer().PlayerReplicationInfo;
|
|
|
|
if( PRI==None )
|
|
|
|
return;
|
|
|
|
AdminButton.SetDisabled(!PRI.bAdmin && PRI.WorldInfo.NetMode==NM_Client);
|
2020-06-30 11:22:26 +00:00
|
|
|
SkipTraderButton.SetDisabled(!SkipTraderIsAviable(PRI));
|
2017-10-20 02:00:49 +00:00
|
|
|
if( !bInitSpectate || bOldSpectate!=PRI.bOnlySpectator )
|
|
|
|
{
|
|
|
|
bInitSpectate = true;
|
|
|
|
bOldSpectate = PRI.bOnlySpectator;
|
2020-06-26 06:32:40 +00:00
|
|
|
SpectateButton.ButtonText = (bOldSpectate ? "Join" : "Spectate"); // TODO: localize
|
|
|
|
SpectateButton.ChangeToolTip(bOldSpectate ? "Click to become an active player" : "Click to become a spectator"); // TODO: localize
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-30 11:22:26 +00:00
|
|
|
function bool SkipTraderIsAviable(PlayerReplicationInfo PRI)
|
|
|
|
{
|
|
|
|
local KFGameReplicationInfo KFGRI;
|
|
|
|
local KFPlayerReplicationInfo KFPRI;
|
|
|
|
|
|
|
|
KFPRI = KFPlayerReplicationInfo(PRI);
|
|
|
|
if (KFPRI == none)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
KFGRI = KFGameReplicationInfo(KFPRI.WorldInfo.GRI);
|
2020-06-30 12:53:29 +00:00
|
|
|
if (KFGRI.bMatchHasBegun && KFGRI.bTraderIsOpen && KFPRI.bHasSpawnedIn)
|
|
|
|
{
|
|
|
|
return !bInitSkipTrader;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bInitSkipTrader=false;
|
|
|
|
return false;
|
|
|
|
}
|
2020-06-30 11:22:26 +00:00
|
|
|
}
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function ShowMenu()
|
|
|
|
{
|
|
|
|
Super.ShowMenu();
|
|
|
|
AdminButton.SetDisabled(true);
|
2020-06-30 11:22:26 +00:00
|
|
|
SkipTraderButton.SetDisabled(false);
|
2017-10-20 02:00:49 +00:00
|
|
|
if( GetPlayer().WorldInfo.GRI!=None )
|
|
|
|
WindowTitle = GetPlayer().WorldInfo.GRI.ServerName;
|
|
|
|
//KFGFxHudWrapper(GetPlayer().MyHUD).SetVisible(false);
|
|
|
|
|
|
|
|
// Update spectate button info text.
|
|
|
|
Timer();
|
|
|
|
SetTimer(0.5,true);
|
|
|
|
}
|
|
|
|
function CloseMenu()
|
|
|
|
{
|
|
|
|
Super.CloseMenu();
|
|
|
|
//KFGFxHudWrapper(GetPlayer().MyHUD).SetVisible(true);
|
|
|
|
}
|
|
|
|
function ButtonClicked( KFGUI_Button Sender )
|
|
|
|
{
|
|
|
|
switch( Sender.ID )
|
|
|
|
{
|
|
|
|
case 'Mapvote':
|
|
|
|
OpenUpMapvote();
|
|
|
|
break;
|
|
|
|
case 'Settings':
|
|
|
|
DoClose();
|
|
|
|
KFPlayerController(GetPlayer()).MyGFxManager.OpenMenu(UI_OptionsSelection);
|
|
|
|
break;
|
|
|
|
case 'Disconnect':
|
|
|
|
GetPlayer().ConsoleCommand("DISCONNECT");
|
|
|
|
break;
|
|
|
|
case 'Close':
|
|
|
|
DoClose();
|
|
|
|
break;
|
|
|
|
case 'Exit':
|
|
|
|
GetPlayer().ConsoleCommand("EXIT");
|
|
|
|
break;
|
|
|
|
case 'Spectate':
|
|
|
|
ExtPlayerController(GetPlayer()).ChangeSpectateMode(!bOldSpectate);
|
|
|
|
DoClose();
|
|
|
|
break;
|
2020-06-26 04:52:58 +00:00
|
|
|
case 'SkipTrader':
|
|
|
|
KFPlayerController(GetPlayer()).RequestSkipTrader();
|
2020-06-30 12:53:29 +00:00
|
|
|
bInitSkipTrader=true;
|
|
|
|
SkipTraderButton.SetDisabled(true);
|
2020-06-26 04:52:58 +00:00
|
|
|
break;
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
final function OpenUpMapvote()
|
|
|
|
{
|
|
|
|
local xVotingReplication R;
|
|
|
|
|
|
|
|
foreach GetPlayer().DynamicActors(class'xVotingReplication',R)
|
|
|
|
R.ClientOpenMapvote();
|
|
|
|
}
|
|
|
|
|
|
|
|
final function KFGUI_Button AddMenuButton( name ButtonID, string Text, optional string ToolTipStr )
|
|
|
|
{
|
|
|
|
local KFGUI_Button B;
|
|
|
|
|
|
|
|
B = new (Self) class'KFGUI_Button';
|
|
|
|
B.ButtonText = Text;
|
|
|
|
B.ToolTip = ToolTipStr;
|
|
|
|
B.OnClickLeft = ButtonClicked;
|
|
|
|
B.OnClickRight = ButtonClicked;
|
|
|
|
B.ID = ButtonID;
|
|
|
|
B.XPosition = 0.05+NumButtons*0.1;
|
|
|
|
B.XSize = 0.099;
|
|
|
|
B.YPosition = 0.92+NumButtonRows*0.04;
|
|
|
|
B.YSize = 0.0399;
|
|
|
|
|
|
|
|
if( NumButtons>0 && PrevButton!=None )
|
|
|
|
PrevButton.ExtravDir = 1;
|
|
|
|
PrevButton = B;
|
|
|
|
if( ++NumButtons>8 )
|
|
|
|
{
|
|
|
|
++NumButtonRows;
|
|
|
|
NumButtons = 0;
|
|
|
|
}
|
|
|
|
AddComponent(B);
|
|
|
|
return B;
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
2020-06-26 06:32:40 +00:00
|
|
|
WindowTitle="Killing Floor 2 - Survival" // TODO: wtf?
|
2017-10-20 02:00:49 +00:00
|
|
|
XPosition=0.1
|
|
|
|
YPosition=0.1
|
|
|
|
XSize=0.8
|
|
|
|
YSize=0.8
|
|
|
|
|
2020-06-26 04:17:32 +00:00
|
|
|
Pages.Add(Class'UIP_News')
|
|
|
|
Pages.Add(Class'UIP_PerkSelection')
|
|
|
|
Pages.Add(Class'UIP_Settings')
|
|
|
|
Pages.Add(Class'UIP_PlayerSpecs')
|
|
|
|
Pages.Add(Class'UIP_AdminMenu')
|
|
|
|
Pages.Add(Class'UIP_About')
|
|
|
|
Pages.Add(Class'UIP_MiniGame')
|
2020-06-30 12:53:29 +00:00
|
|
|
bInitSkipTrader=false
|
2017-10-20 02:00:49 +00:00
|
|
|
|
|
|
|
Begin Object Class=KFGUI_SwitchMenuBar Name=MultiPager
|
|
|
|
ID="Pager"
|
|
|
|
XPosition=0.01
|
|
|
|
YPosition=0.08
|
|
|
|
XSize=0.98
|
|
|
|
YSize=0.775
|
|
|
|
BorderWidth=0.04
|
|
|
|
ButtonAxisSize=0.08
|
|
|
|
End Object
|
|
|
|
|
|
|
|
Components.Add(MultiPager)
|
|
|
|
}
|