Skip to content

Commit 43a946b

Browse files
committed
Apply GUI changes when user is admin.
1 parent 21b0bfc commit 43a946b

4 files changed

Lines changed: 48 additions & 18 deletions

File tree

MVE2dev/Classes/MapVoteClientWindow.uc

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,6 @@ function Created ()
247247
KickVoteButton = UWindowSmallButton(CreateControl(Class'UWindowSmallButton',30.0 + 2 * MapListwidth,ListHeight + 46,PlayerListwidth,18.0));
248248
KickVoteButton.DownSound = Sound'Click';
249249

250-
if ( bKickVote || GetPlayerOwner().PlayerReplicationInfo.bAdmin )
251-
{
252-
KickVoteButton.Text = "Kick";
253-
KickVoteButton.bDisabled = True;
254-
}
255-
else
256-
{
257-
KickVoteButton.Text = "";
258-
KickVoteButton.bDisabled = False;
259-
}
260-
261250
lblKickVote1 = UMenuLabelControl(CreateControl(Class'UMenuLabelControl',10.0,217.0,60,60.0));
262251
lblKickVote1.SetText("Player Name");
263252
lblKickVote1.SetFont(0);
@@ -369,6 +358,29 @@ function Created ()
369358
SendButton.bDisabled = False;
370359
}
371360

361+
function UpdateIsAdmin(bool bAdmin)
362+
{
363+
if ( bAdmin )
364+
{
365+
VoteButton.Text = "Force Switch";
366+
}
367+
else
368+
{
369+
VoteButton.Text = "Vote";
370+
}
371+
372+
if ( bKickVote || bAdmin )
373+
{
374+
KickVoteButton.Text = "Kick";
375+
KickVoteButton.bDisabled = True;
376+
}
377+
else
378+
{
379+
KickVoteButton.Text = "";
380+
KickVoteButton.bDisabled = False;
381+
}
382+
}
383+
372384
function RestoreSelection()
373385
{
374386
ApplySelectionArgs(ClientConf.SelectedGameMode, ClientConf.SelectedGameRule, ClientConf.SelectedMap);

MVE2dev/Classes/MapVoteTabWindow.uc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ function Created ()
2727
ConfigWindow = ConfigWindow(PageControl.Page);
2828
PageControl = Pages.AddPage("Info",Class'ServerInfoWindow');
2929
InfoWindow = ServerInfoWindow(PageControl.Page);
30-
31-
if ( GetPlayerOwner().PlayerReplicationInfo.bAdmin )
32-
{
33-
PageControl = Pages.AddPage("Admin",Class'AdminTabWindow');
34-
AdminWindow = AdminTabWindow(PageControl.Page);
35-
}
3630
}
3731

3832
function AddMapName (int listNum, string MapName)
@@ -104,6 +98,19 @@ function ClearPlayerList ()
10498
MapWindow.PlayerListBox.Items.Clear();
10599
}
106100

101+
function UpdateIsAdmin(bool bAdmin)
102+
{
103+
local UWindowPageControlPage PageControl;
104+
105+
if ( bAdmin && AdminWindow == None )
106+
{
107+
PageControl = Pages.AddPage("Admin",Class'AdminTabWindow');
108+
AdminWindow = AdminTabWindow(PageControl.Page);
109+
}
110+
111+
MapWindow.UpdateIsAdmin(bAdmin);
112+
}
113+
107114
function RemovePlayerName (string PlayerID)
108115
{
109116
local UWindowList Item;

MVE2dev/Classes/MapVoteWRI.uc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class MapVoteWRI extends WRI;
66

77
var string ServerInfoURL;
88
var bool bFixNetNews;
9+
var bool bAdmin;
910
var string MapInfoURL;
1011
var string MapList[4096];
1112
var string RuleList[100];
@@ -87,7 +88,7 @@ replication
8788
reliable if ( Role == ROLE_Authority )
8889
SendBTRecord,SendReportText,UpdateKickVoteResults,UpdateMapVoteResults,UpdatePlayerVoted,RemovePlayerName,AddNewPlayer,
8990
PlayerName,bKickVote,MapVoteResults,KickVoteResults,GameTypes,OtherClass,VoteTimeLimit,KickPercent,bAutoOpen,
90-
ScoreBoardDelay,bCheckOtherGameTie,ServerInfoURL,bFixNetNews,MapInfoURL,Mode,RepeatLimit,MapVoteHistoryType,MidGameVotePercent,
91+
ScoreBoardDelay,bCheckOtherGameTie,ServerInfoURL,bFixNetNews,bAdmin,MapInfoURL,Mode,RepeatLimit,MapVoteHistoryType,MidGameVotePercent,
9192
MinMapCount,MapPreFixOverRide,PreFixSwap,OtherPreFix,HasStartWindow,bEntryWindows,bDebugMode,bRemoveCrashedMaps,
9293
ActGameClass,ActGamePrefix,MapVoteTitle,CustomGames,CustomGamesState,PrefixDictionary,LogoTexture;
9394
reliable if ( Role < ROLE_Authority )
@@ -226,6 +227,7 @@ simulated function bool SetupWindow()
226227
{
227228
SetTimer(Level.TimeDilation,False);
228229
CWindow = MapVoteTabWindow(MapVoteFramedWindow(TheWindow).ClientArea);
230+
UpdateIsAdmin(bAdmin);
229231
} else {
230232
Log("Super.SetupWindow() = false");
231233
}
@@ -657,6 +659,14 @@ simulated function RemovePlayerName (string OldPlayerName)
657659
}
658660
}
659661

662+
simulated function UpdateIsAdmin(bool bAdmin)
663+
{
664+
if ( TheWindow != None )
665+
{
666+
CWindow.UpdateIsAdmin(bAdmin);
667+
}
668+
}
669+
660670
simulated function UpdatePlayerVoted (string PlayerID)
661671
{
662672
if ( TheWindow != None )

MVES/Classes/MV_SubExtension.uc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function Info SpawnVoteWRIActor( PlayerPawn Victim)
3030

3131
Mutator = MapVote(Outer);
3232
MVWRI = Victim.Spawn( class'MapVoteWRI', Victim,,vect(0,0,0));
33+
MVWRI.bAdmin = Victim.bAdmin;
3334
MVWRI.bFixNetNews = Mutator.bFixNetNewsForPlayers;
3435

3536
for ( i = 0 ; i < Mutator.iMapVotes ; i ++ )

0 commit comments

Comments
 (0)