Merge branch 'skiptrader'

This commit is contained in:
GenZmeY 2020-06-30 15:56:06 +03:00
commit c5b585a84d

View File

@ -8,11 +8,11 @@ struct FPageInfo
var KFGUI_SwitchMenuBar PageSwitcher; var KFGUI_SwitchMenuBar PageSwitcher;
var() array<FPageInfo> Pages; var() array<FPageInfo> Pages;
var KFGUI_Button AdminButton,SpectateButton; var KFGUI_Button AdminButton,SpectateButton,SkipTraderButton;
var transient KFGUI_Button PrevButton; var transient KFGUI_Button PrevButton;
var transient int NumButtons,NumButtonRows; var transient int NumButtons,NumButtonRows;
var transient bool bInitSpectate,bOldSpectate; var transient bool bInitSpectate,bOldSpectate,bInitSkipTrader;
function InitMenu() function InitMenu()
{ {
@ -23,10 +23,11 @@ function InitMenu()
Super(KFGUI_Page).InitMenu(); Super(KFGUI_Page).InitMenu();
AddMenuButton('Mapvote',"Map Vote","Show mapvote menu"); AddMenuButton('Mapvote',"Map Vote","Show mapvote menu");
AddMenuButton('Settings',"Settings","Enter the game settings"); AddMenuButton('Settings',"Settings","Enter the game settings");
SkipTraderButton = AddMenuButton('SkipTrader',"Skip Trader","start voting for skip trader");
AddMenuButton('Disconnect',"Disconnect","Disconnect from this server"); AddMenuButton('Disconnect',"Disconnect","Disconnect from this server");
SpectateButton = AddMenuButton('Spectate',"",""); SpectateButton = AddMenuButton('Spectate',"","");
AddMenuButton('Close',"Close","Close this menu"); AddMenuButton('Close',"Close","Close this menu");
//AddMenuButton('Exit',"Exit","Exit this game"); AddMenuButton('Exit',"Exit","Exit this game");
for( i=0; i<Pages.Length; ++i ) for( i=0; i<Pages.Length; ++i )
{ {
@ -44,6 +45,7 @@ function Timer()
if( PRI==None ) if( PRI==None )
return; return;
AdminButton.SetDisabled(!PRI.bAdmin && PRI.WorldInfo.NetMode==NM_Client); AdminButton.SetDisabled(!PRI.bAdmin && PRI.WorldInfo.NetMode==NM_Client);
SkipTraderButton.SetDisabled(!SkipTraderIsAviable(PRI));
if( !bInitSpectate || bOldSpectate!=PRI.bOnlySpectator ) if( !bInitSpectate || bOldSpectate!=PRI.bOnlySpectator )
{ {
bInitSpectate = true; bInitSpectate = true;
@ -53,10 +55,32 @@ function Timer()
} }
} }
function bool SkipTraderIsAviable(PlayerReplicationInfo PRI)
{
local KFGameReplicationInfo KFGRI;
local KFPlayerReplicationInfo KFPRI;
KFPRI = KFPlayerReplicationInfo(PRI);
if (KFPRI == none)
return false;
KFGRI = KFGameReplicationInfo(KFPRI.WorldInfo.GRI);
if (KFGRI.bMatchHasBegun && KFGRI.bTraderIsOpen && KFPRI.bHasSpawnedIn)
{
return !bInitSkipTrader;
}
else
{
bInitSkipTrader=false;
return false;
}
}
function ShowMenu() function ShowMenu()
{ {
Super.ShowMenu(); Super.ShowMenu();
AdminButton.SetDisabled(true); AdminButton.SetDisabled(true);
SkipTraderButton.SetDisabled(false);
if( GetPlayer().WorldInfo.GRI!=None ) if( GetPlayer().WorldInfo.GRI!=None )
WindowTitle = GetPlayer().WorldInfo.GRI.ServerName; WindowTitle = GetPlayer().WorldInfo.GRI.ServerName;
//KFGFxHudWrapper(GetPlayer().MyHUD).SetVisible(false); //KFGFxHudWrapper(GetPlayer().MyHUD).SetVisible(false);
@ -94,6 +118,11 @@ function ButtonClicked( KFGUI_Button Sender )
ExtPlayerController(GetPlayer()).ChangeSpectateMode(!bOldSpectate); ExtPlayerController(GetPlayer()).ChangeSpectateMode(!bOldSpectate);
DoClose(); DoClose();
break; break;
case 'SkipTrader':
KFPlayerController(GetPlayer()).RequestSkipTrader();
bInitSkipTrader=true;
SkipTraderButton.SetDisabled(true);
break;
} }
} }
final function OpenUpMapvote() final function OpenUpMapvote()
@ -139,6 +168,8 @@ defaultproperties
XSize=0.8 XSize=0.8
YSize=0.8 YSize=0.8
bInitSkipTrader=false
Pages.Add((PageClass=Class'UIP_News',Caption="News",Hint="Server news page")) Pages.Add((PageClass=Class'UIP_News',Caption="News",Hint="Server news page"))
Pages.Add((PageClass=Class'UIP_PerkSelection',Caption="Perk",Hint="Select and upgrade your perks")) Pages.Add((PageClass=Class'UIP_PerkSelection',Caption="Perk",Hint="Select and upgrade your perks"))
Pages.Add((PageClass=Class'UIP_Settings',Caption="Settings",Hint="Show additional ServerExt settings")) Pages.Add((PageClass=Class'UIP_Settings',Caption="Settings",Hint="Show additional ServerExt settings"))