Prepare fixtures
This commit is contained in:
parent
797e5ea192
commit
9c94356263
6021 changed files with 722805 additions and 22 deletions
199
kf_sources/XVoting/Classes/DefaultMapListLoader.uc
Normal file
199
kf_sources/XVoting/Classes/DefaultMapListLoader.uc
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.DefaultMapListLoader
|
||||
//
|
||||
// The DefaultMapListLoader is used by the VotingHandler to
|
||||
// load the list of map names.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class DefaultMapListLoader extends MapListLoader;
|
||||
|
||||
var() config bool bUseMapList;
|
||||
var() config array<string> MapListTypeList;
|
||||
var() config string MapNamePrefixes;
|
||||
|
||||
var localized string UseMapListPropsDisplayText;
|
||||
var localized string UserMapListPropDescription;
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadMapList(xVotingHandler VotingHandler)
|
||||
{
|
||||
local int p, i;
|
||||
local array<string> PrefixList;
|
||||
local class<GameInfo> GameClass;
|
||||
|
||||
if(bUseMapList)
|
||||
{
|
||||
log("Loading Maps from the following MapLists",'MapVote');
|
||||
if(MapListTypeList.Length == 0)
|
||||
{
|
||||
// Use default MapLists from each of MapVotes GameConfig settings
|
||||
for(i=0; i < VotingHandler.GameConfig.Length; i++)
|
||||
{
|
||||
GameClass = class<GameInfo>(DynamicLoadObject(VotingHandler.GameConfig[i].GameClass, class'Class'));
|
||||
if(GameClass != none)
|
||||
{
|
||||
log(GameClass.default.MapListType,'MapVote');
|
||||
LoadFromMapList(GameClass.default.MapListType, VotingHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the listed MapList classes
|
||||
for(i=0; i<MapListTypeList.Length; i++)
|
||||
{
|
||||
log(MapListTypeList[i],'MapVote');
|
||||
LoadFromMapList(MapListTypeList[i], VotingHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log("Loading Maps from Maps dir. " $ MapNamePrefixes,'MapVote');
|
||||
|
||||
// Use the MapNamePrefixes to load all maps in maps directory
|
||||
if( MapNamePrefixes == "" ) // get map prefixes from GameConfig
|
||||
{
|
||||
for(i=0; i < VotingHandler.GameConfig.Length; i++)
|
||||
{
|
||||
MapNamePrefixes $= VotingHandler.GameConfig[i].Prefix;
|
||||
if( i < VotingHandler.GameConfig.Length - 1 )
|
||||
MapNamePrefixes $= ",";
|
||||
}
|
||||
}
|
||||
|
||||
PrefixList.Length = 0;
|
||||
p = Split(MapNamePrefixes, ",", PrefixList);
|
||||
if(p > 0)
|
||||
{
|
||||
for(i=0; i < PrefixList.Length; i++)
|
||||
LoadFromPrefix(PrefixList[i],VotingHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadFromPreFix(string Prefix, xVotingHandler VotingHandler)
|
||||
{
|
||||
local string FirstMap,NextMap,MapName,TestMap;
|
||||
local int z;
|
||||
|
||||
FirstMap = Level.GetMapName(PreFix, "", 0);
|
||||
NextMap = FirstMap;
|
||||
while(!(FirstMap ~= TestMap))
|
||||
{
|
||||
MapName = NextMap;
|
||||
z = InStr(Caps(MapName), ".UT2");
|
||||
if(z != -1)
|
||||
MapName = Left(MapName, z); // remove ".UT2"
|
||||
|
||||
VotingHandler.AddMap(MapName, "", "");
|
||||
|
||||
NextMap = Level.GetMapName(PreFix, NextMap, 1);
|
||||
TestMap = NextMap;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadFromMapList(string MapListType, xVotingHandler VotingHandler)
|
||||
{
|
||||
local string Mutators,GameOptions;
|
||||
local class<MapList> MapListClass;
|
||||
local string MapName;
|
||||
local array<string> Parts;
|
||||
local array<string> Maps;
|
||||
local int z,x,p,i;
|
||||
|
||||
MapListClass = class<MapList>(DynamicLoadObject(MapListType, class'Class'));
|
||||
if(MapListClass == none)
|
||||
{
|
||||
Log("___Couldn't load maplist type:"$MaplistType,'MapVote');
|
||||
return;
|
||||
}
|
||||
|
||||
Maps = MapListClass.static.StaticGetMaps();
|
||||
for(i=0;i<Maps.Length;i++)
|
||||
{
|
||||
Mutators = "";
|
||||
GameOptions = "";
|
||||
|
||||
MapName = Maps[i];
|
||||
|
||||
// Parse map string incase there are mutator and game options in it
|
||||
// DOM-Aztec?Game=XGame.xDoubleDom?mutator=XGame.MutVampire,UTSecure.MutUTSecure?WeaponStay=True?Translocator=True?TimeLimit=15
|
||||
// p0 | p1 | p2 | p3 | p4 | p5
|
||||
Parts.Length = 0;
|
||||
p = Split(MapName, "?", Parts);
|
||||
if(p > 1)
|
||||
{
|
||||
MapName = Parts[0];
|
||||
for(x=1;x<Parts.Length;x++)
|
||||
{
|
||||
if(left(Parts[x],8) ~= "mutator=")
|
||||
{
|
||||
Mutators = Mid(Parts[x],8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ignore the "game" option but add all others to GameOptions
|
||||
if(!(left(Parts[x],5) ~= "Game="))
|
||||
{
|
||||
if(GameOptions == "")
|
||||
GameOptions = Parts[x];
|
||||
else
|
||||
GameOptions = GameOptions $ "?" $ Parts[x];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
z = InStr(Caps(MapName), ".UT2");
|
||||
if(z != -1)
|
||||
MapName = Left(MapName, z); // remove ".UT2"
|
||||
|
||||
VotingHandler.AddMap(MapName, Mutators, GameOptions);
|
||||
}
|
||||
}
|
||||
//================================================================================================
|
||||
// Configuration
|
||||
//================================================================================================
|
||||
static function FillPlayInfo(PlayInfo PlayInfo)
|
||||
{
|
||||
Super.FillPlayInfo(PlayInfo);
|
||||
|
||||
PlayInfo.AddSetting(default.MapVoteGroup,"bUseMapList",default.UseMapListPropsDisplayText,0,1,"Check",,,True,True);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static event bool AcceptPlayInfoProperty(string PropertyName)
|
||||
{
|
||||
// if _RO_
|
||||
// if ( class'LevelInfo'.static.IsDemoBuild() )
|
||||
// return false;
|
||||
|
||||
switch ( PropertyName )
|
||||
{
|
||||
case "bUserMapList":
|
||||
return true;
|
||||
}
|
||||
return Super.AcceptPlayInfoProperty(PropertyName);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static event string GetDescriptionText(string PropName)
|
||||
{
|
||||
switch (PropName)
|
||||
{
|
||||
case "bUseMapList":
|
||||
return default.UserMapListPropDescription;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
bUseMapList=False;
|
||||
MapNamePrefixes=""
|
||||
UseMapListPropsDisplayText="Use MapLists"
|
||||
UserMapListPropDescription="If enabled, the map lists are used instead of showing all map names."
|
||||
}
|
||||
175
kf_sources/XVoting/Classes/KickInfoPage.uc
Normal file
175
kf_sources/XVoting/Classes/KickInfoPage.uc
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
//====================================================================
|
||||
// xVoting.KickInfoPage
|
||||
// Player Information Page.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class KickInfoPage extends LargeWindow;
|
||||
|
||||
var automated GUIButton b_ReturnButton;
|
||||
var automated GUIImage i_PlayerPortrait;
|
||||
var automated GUILabel l_PlayerName;
|
||||
var automated PlayerInfoMultiColumnListBox lb_PlayerInfoBox;
|
||||
|
||||
var localized string PlayerText, PingText, ScoreText, IDText, IPText, KillsText,
|
||||
DeathsText, SuicidesText, MultiKillsText, SpreesText;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
Super.Initcomponent(MyController, MyOwner);
|
||||
b_ReturnButton.OnClick=ReturnButtonOnClick;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function HandleParameters(string Param1, string Param2)
|
||||
{
|
||||
LoadInfo(Param1);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadInfo(string PlayerName)
|
||||
{
|
||||
local int i/*, MultiKills, Sprees*/;
|
||||
local Material Portrait;
|
||||
local PlayerReplicationInfo PRI;
|
||||
|
||||
if(PlayerName == "")
|
||||
return;
|
||||
|
||||
if (!Controller.bCurMenuInitialized)
|
||||
return;
|
||||
|
||||
for( i=0; i<PlayerOwner().GameReplicationInfo.PRIArray.Length; i++ )
|
||||
{
|
||||
if( PlayerOwner().GameReplicationInfo.PRIArray[i].PlayerName == PlayerName )
|
||||
{
|
||||
PRI = PlayerOwner().GameReplicationInfo.PRIArray[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if _RO_
|
||||
Portrait = PRI.getRolePortrait();
|
||||
// else
|
||||
// Portrait = PRI.GetPortrait();
|
||||
// end if _RO_
|
||||
|
||||
// ifdef _RO_
|
||||
if(Portrait == None)
|
||||
Portrait = Material(DynamicLoadObject("Engine.BlackTexture", class'Material'));
|
||||
//else
|
||||
//if(Portrait == None)
|
||||
// Portrait = Material(DynamicLoadObject("PlayerPictures.cDefault", class'Material'));
|
||||
|
||||
i_PlayerPortrait.Image = Portrait;
|
||||
l_PlayerName.Caption = PlayerName;
|
||||
|
||||
lb_PlayerInfoBox.Add(PingText,string(PRI.Ping));
|
||||
lb_PlayerInfoBox.Add(ScoreText,string(PRI.Score));
|
||||
lb_PlayerInfoBox.Add(KillsText,string(PRI.Kills));
|
||||
lb_PlayerInfoBox.Add(DeathsText,string(PRI.Deaths));
|
||||
|
||||
if( TeamPlayerReplicationInfo(PRI) != none )
|
||||
{
|
||||
lb_PlayerInfoBox.Add(SuicidesText,string(TeamPlayerReplicationInfo(PRI).Suicides));
|
||||
// if _RO_
|
||||
/*
|
||||
// end if _RO_
|
||||
for (i = 0; i < 7; i++)
|
||||
MultiKills += TeamPlayerReplicationInfo(PRI).MultiKills[i];
|
||||
lb_PlayerInfoBox.Add(MultiKillsText,string(MultiKills));
|
||||
for (i = 0; i < 6; i++)
|
||||
Sprees += TeamPlayerReplicationInfo(PRI).Spree[i];
|
||||
lb_PlayerInfoBox.Add(SpreesText,string(Sprees));
|
||||
// if _RO_
|
||||
*/
|
||||
// end if _RO_
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool ReturnButtonOnClick(GUIComponent Sender)
|
||||
{
|
||||
Controller.CloseMenu(true);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object class=GUIImage Name=KickImagePlayerPortrait
|
||||
WinWidth=0.155814
|
||||
WinHeight=0.358525
|
||||
WinLeft=0.206924
|
||||
WinTop=0.193199
|
||||
Image=Texture'InterfaceArt_tex.Menu.changeme_texture' //Material'2K4Menus.Controls.buttonThick_b'
|
||||
ImageColor=(R=255,G=255,B=255,A=255);
|
||||
ImageRenderStyle=MSTY_Normal
|
||||
// if _RO_
|
||||
ImageStyle=ISTY_Justified
|
||||
ImageAlign=IMGA_Center
|
||||
// else
|
||||
// ImageStyle=ISTY_Scaled
|
||||
// end if _RO_
|
||||
End Object
|
||||
i_PlayerPortrait = KickImagePlayerPortrait
|
||||
|
||||
Begin Object class=GUIButton Name=ExitButton
|
||||
Caption="Close"
|
||||
StyleName="SquareButton"
|
||||
WinWidth=0.120000
|
||||
WinHeight=0.033203
|
||||
WinLeft=0.670934
|
||||
WinTop=0.531692
|
||||
TabOrder=2
|
||||
RenderWeight=1.0
|
||||
End Object
|
||||
b_ReturnButton = ExitButton
|
||||
|
||||
Begin Object Class=PlayerInfoMultiColumnListBox Name=PlayerInfoBoxControl
|
||||
WinWidth=0.422477
|
||||
WinHeight=0.299483
|
||||
WinLeft=0.366960
|
||||
WinTop=0.234286
|
||||
bVisibleWhenEmpty=True
|
||||
bVisible=True
|
||||
StyleName="ServerBrowserGrid"
|
||||
End Object
|
||||
lb_PlayerInfoBox = PlayerInfoBoxControl
|
||||
|
||||
Begin Object class=GUILabel Name=PlayerNameLabel
|
||||
Caption="PlayerName"
|
||||
TextAlign=TXTA_Center
|
||||
TextFont="UT2SmallHeaderFont"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
WinWidth=0.425371
|
||||
WinHeight=0.038297
|
||||
WinLeft=0.365679
|
||||
WinTop=0.195429
|
||||
RenderWeight=0.3
|
||||
End Object
|
||||
l_PlayerName=PlayerNameLabel
|
||||
|
||||
Background=None
|
||||
|
||||
bAcceptsInput=false
|
||||
bRequire640x480=false
|
||||
bAllowedAsLast=true
|
||||
bRenderWorld=true
|
||||
bMoveAllowed=False
|
||||
//bPersistent=True
|
||||
|
||||
WinWidth=0.622502
|
||||
WinHeight=0.440703
|
||||
WinLeft=0.188743
|
||||
WinTop=0.151276
|
||||
|
||||
PingText="Ping"
|
||||
ScoreText="Score"
|
||||
IDText="Player ID"
|
||||
IPText="IP Address"
|
||||
KillsText="Kills"
|
||||
DeathsText="Deaths"
|
||||
SuicidesText="Suicides"
|
||||
MultiKillsText="MultiKills"
|
||||
SpreesText="Sprees"
|
||||
}
|
||||
|
||||
294
kf_sources/XVoting/Classes/KickVoteMultiColumnList.uc
Normal file
294
kf_sources/XVoting/Classes/KickVoteMultiColumnList.uc
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.KickVoteMultiColumnList
|
||||
//
|
||||
// Multi-Column list box used to display players.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class KickVoteMultiColumnList extends GUIMultiColumnList;
|
||||
|
||||
var VotingReplicationInfo VRI;
|
||||
var array<VotingHandler.KickVoteScore> KickVoteData;
|
||||
var array<string> PlayerName;
|
||||
var int PrevSortColumn;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadPlayerList(VotingReplicationInfo LoadVRI)
|
||||
{
|
||||
local GameReplicationInfo GRI;
|
||||
local int i,x;
|
||||
|
||||
if( LoadVRI == none )
|
||||
return;
|
||||
else
|
||||
VRI = LoadVRI;
|
||||
|
||||
GRI = PlayerOwner().GameReplicationInfo;
|
||||
|
||||
KickVoteData.Remove(0,KickVoteData.Length);
|
||||
for(i=0; i<GRI.PRIArray.Length; i++)
|
||||
{
|
||||
if(!( (GRI.PRIArray[i].PlayerName ~= "WebAdmin" || GRI.PRIArray[i].PlayerName ~= "DemoRecSpectator") &&
|
||||
GRI.PRIArray[i].bIsSpectator &&
|
||||
GRI.PRIArray[i].bOnlySpectator &&
|
||||
GRI.PRIArray[i].bOutOfLives) // dont show web admin or DemoRec spectators
|
||||
&&
|
||||
!GRI.PRIArray[i].bBot && // dont show bots
|
||||
!GRI.PRIArray[i].bAdmin) // Dont show admins they can't be kicked anyway
|
||||
{
|
||||
KickVoteData.Insert(KickVoteData.Length,1);
|
||||
PlayerName.Insert(KickVoteData.Length-1,1);
|
||||
PlayerName[KickVoteData.Length-1] = GRI.PRIArray[i].PlayerName;
|
||||
KickVoteData[KickVoteData.Length-1].PlayerID = GRI.PRIArray[i].PlayerID;
|
||||
if( GRI.PRIArray[i].Team != none)
|
||||
KickVoteData[KickVoteData.Length-1].Team = GRI.PRIArray[i].Team.TeamIndex;
|
||||
else
|
||||
KickVoteData[KickVoteData.Length-1].Team = 255;
|
||||
|
||||
KickVoteData[KickVoteData.Length-1].KickVoteCount = 0;
|
||||
// find and retrieve the vote count from VRI
|
||||
for( x=0; x<VRI.KickVoteCount.Length; x++ )
|
||||
{
|
||||
if( KickVoteData[KickVoteData.Length-1].PlayerID == VRI.KickVoteCount[x].PlayerID )
|
||||
{
|
||||
KickVoteData[KickVoteData.Length-1].KickVoteCount = VRI.KickVoteCount[x].KickVoteCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
AddedItem();
|
||||
}
|
||||
}
|
||||
setTimer(4, true); // check for updates to player list every 4 seconds
|
||||
OnDrawItem = DrawItem;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function UpdatedVoteCount(int PlayerID, int VoteCount)
|
||||
{
|
||||
local int i;
|
||||
|
||||
for( i=0; i<KickVoteData.Length; i++ )
|
||||
{
|
||||
if( KickVoteData[i].PlayerID == PlayerID )
|
||||
{
|
||||
KickVoteData[i].KickVoteCount = VoteCount;
|
||||
UpdatedItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
OnSortChanged();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Clear()
|
||||
{
|
||||
KickVoteData.Remove(0,KickVoteData.Length);
|
||||
ItemCount = 0;
|
||||
Super.Clear();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function int GetSelectedPlayerID()
|
||||
{
|
||||
if( Index > -1 )
|
||||
return KickVoteData[SortData[Index].SortItem].PlayerID;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function string GetSelectedPlayerName()
|
||||
{
|
||||
if( Index > -1 )
|
||||
return PlayerName[Index];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function int GetSelectedTeam()
|
||||
{
|
||||
return KickVoteData[SortData[Index].SortItem].Team;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function timer()
|
||||
{
|
||||
local GameReplicationInfo GRI;
|
||||
local int i,x,TeamIndex;
|
||||
local int PlayerID;
|
||||
local bool bFound;
|
||||
|
||||
Super.timer();
|
||||
|
||||
GRI = PlayerOwner().GameReplicationInfo;
|
||||
|
||||
// Add new players to list
|
||||
for(i=0; i<GRI.PRIArray.Length; i++)
|
||||
{
|
||||
PlayerID = GRI.PRIArray[i].PlayerID;
|
||||
if( GRI.PRIArray[i].Team != none)
|
||||
TeamIndex = GRI.PRIArray[i].Team.TeamIndex;
|
||||
else
|
||||
TeamIndex = 255;
|
||||
|
||||
if(!( (GRI.PRIArray[i].PlayerName ~= "WebAdmin" || GRI.PRIArray[i].PlayerName ~= "DemoRecSpectator") &&
|
||||
GRI.PRIArray[i].bIsSpectator &&
|
||||
GRI.PRIArray[i].bOnlySpectator &&
|
||||
GRI.PRIArray[i].bOutOfLives) // dont show web admin or DemoRec spectators
|
||||
&&
|
||||
!GRI.PRIArray[i].bBot && // dont show bots
|
||||
!GRI.PRIArray[i].bAdmin) // Dont show admins they can't be kicked anyway
|
||||
{
|
||||
bFound = false;
|
||||
for(x=0;x < KickVoteData.Length; x++)
|
||||
{
|
||||
if( KickVoteData[x].PlayerID == PlayerID )
|
||||
{
|
||||
bFound = true;
|
||||
// check for name change
|
||||
if( PlayerName[x] != GRI.PRIArray[i].PlayerName )
|
||||
PlayerName[x] = GRI.PRIArray[i].PlayerName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound)
|
||||
{
|
||||
KickVoteData.Insert(KickVoteData.Length,1);
|
||||
PlayerName.Insert(KickVoteData.Length-1,1);
|
||||
PlayerName[KickVoteData.Length-1] = GRI.PRIArray[i].PlayerName;
|
||||
KickVoteData[KickVoteData.Length-1].PlayerID = PlayerID;
|
||||
KickVoteData[KickVoteData.Length-1].Team = TeamIndex;
|
||||
KickVoteData[KickVoteData.Length-1].KickVoteCount = 0;
|
||||
// find and retrieve the vote count from VRI
|
||||
for( x=0; x<VRI.KickVoteCount.Length; x++ )
|
||||
{
|
||||
if( KickVoteData[KickVoteData.Length-1].PlayerID == VRI.KickVoteCount[x].PlayerID )
|
||||
{
|
||||
KickVoteData[KickVoteData.Length-1].KickVoteCount = VRI.KickVoteCount[x].KickVoteCount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
AddedItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove missing players from list
|
||||
for(i=0;i < KickVoteData.Length; i++)
|
||||
{
|
||||
PlayerID = KickVoteData[i].PlayerID;
|
||||
bFound = false;
|
||||
for(x=0; x<GRI.PRIArray.Length; x++)
|
||||
{
|
||||
if( PlayerID == GRI.PRIArray[x].PlayerID )
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound)
|
||||
{
|
||||
PlayerName.Remove(i,1);
|
||||
KickVoteData.Remove(i,1);
|
||||
for( x=0; x<SortData.Length; x++ )
|
||||
{
|
||||
if( SortData[x].SortItem == i )
|
||||
{
|
||||
SortData.Remove(x,1);
|
||||
InvSortData.Remove(x,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ItemCount--;
|
||||
OnSortChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function DrawItem(Canvas Canvas, int i, float X, float Y, float W, float H, bool bSelected, bool bPending)
|
||||
{
|
||||
local float CellLeft, CellWidth;
|
||||
local string TeamName;
|
||||
local GUIStyles DrawStyle;
|
||||
|
||||
if( i >= SortData.Length || SortData[i].SortItem >= KickVoteData.Length )
|
||||
return;
|
||||
|
||||
// Draw the selection border
|
||||
if( bSelected )
|
||||
{
|
||||
SelectedStyle.Draw(Canvas,MenuState, X, Y-2, W, H+2 );
|
||||
DrawStyle = SelectedStyle;
|
||||
}
|
||||
else
|
||||
DrawStyle = Style;
|
||||
|
||||
GetCellLeftWidth( 0, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
PlayerName[SortData[i].SortItem], FontScale );
|
||||
|
||||
if( PlayerOwner().GameReplicationInfo.bTeamGame && (KickVoteData[SortData[i].SortItem].Team < 4) )
|
||||
TeamName = class'Engine.TeamInfo'.default.ColorNames[KickVoteData[SortData[i].SortItem].Team];
|
||||
else
|
||||
TeamName = "";
|
||||
|
||||
GetCellLeftWidth( 1, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
TeamName, FontScale );
|
||||
|
||||
GetCellLeftWidth( 2, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
string(KickVoteData[SortData[i].SortItem].PlayerID), FontScale );
|
||||
|
||||
GetCellLeftWidth( 3, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
string(KickVoteData[SortData[i].SortItem].KickVoteCount), FontScale );
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function string GetSortString( int i )
|
||||
{
|
||||
local string ColumnData[4];
|
||||
|
||||
ColumnData[0] = left(Caps(PlayerName[i]),20);
|
||||
ColumnData[1] = left(Caps(KickVoteData[i].Team),5);
|
||||
ColumnData[2] = right("0000" $ KickVoteData[i].PlayerID,4);
|
||||
ColumnData[3] = right("0000" $ KickVoteData[i].KickVoteCount,4);
|
||||
|
||||
return ColumnData[SortColumn] $ ColumnData[PrevSortColumn];
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
event OnSortChanged()
|
||||
{
|
||||
Super.OnSortChanged();
|
||||
PrevSortColumn = SortColumn;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Free()
|
||||
{
|
||||
VRI = none;
|
||||
super.Free();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
ColumnHeadings(0)="Player Name"
|
||||
ColumnHeadings(1)="Team"
|
||||
ColumnHeadings(2)="ID"
|
||||
ColumnHeadings(3)="Votes"
|
||||
|
||||
InitColumnPerc(0)=0.55
|
||||
InitColumnPerc(1)=0.15
|
||||
InitColumnPerc(2)=0.15
|
||||
InitColumnPerc(3)=0.15
|
||||
|
||||
SortColumn=2
|
||||
SortDescending=True
|
||||
PrevSortColumn=0
|
||||
|
||||
ColumnHeadingHints(0)="Player Name"
|
||||
ColumnHeadingHints(1)="Player's Team"
|
||||
ColumnHeadingHints(2)="Player's ID number"
|
||||
ColumnHeadingHints(3)="Number of kick votes registered against this player."
|
||||
|
||||
StyleName="ServerBrowserGrid"
|
||||
SelectedStyleName="BrowserListSelection"
|
||||
}
|
||||
|
||||
90
kf_sources/XVoting/Classes/KickVoteMultiColumnListBox.uc
Normal file
90
kf_sources/XVoting/Classes/KickVoteMultiColumnListBox.uc
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.KickVoteMultiColumnListBox
|
||||
//
|
||||
// Multi-Column list box used to display Players.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class KickVoteMultiColumnListBox extends GUIMultiColumnListBox;
|
||||
|
||||
var string KickInfoPage;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
super.InitComponent(MyController, MyOwner);
|
||||
if( !PlayerOwner().PlayerReplicationInfo.bAdmin )
|
||||
ContextMenu.ContextItems.Remove(2,2);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnClick(GUIContextMenu Sender, int Index)
|
||||
{
|
||||
local string PlayerName;
|
||||
|
||||
if (Sender != None)
|
||||
{
|
||||
if ( NotifyContextSelect(Sender, Index) )
|
||||
return;
|
||||
|
||||
switch (Index)
|
||||
{
|
||||
case 0:
|
||||
if( KickVotingPage(MenuOwner) != none )
|
||||
KickVotingPage(MenuOwner).SendKickVote();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
PlayerName = KickVoteMultiColumnList(List).GetSelectedPlayerName();
|
||||
Controller.OpenMenu( KickInfoPage, PlayerName );
|
||||
if( PlayerOwner().PlayerReplicationInfo.bAdmin )
|
||||
KickVoteMultiColumnList(List).VRI.RequestPlayerIP( PlayerName );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if( PlayerOwner().PlayerReplicationInfo.bAdmin )
|
||||
{
|
||||
PlayerName = KickVoteMultiColumnList(List).GetSelectedPlayerName();
|
||||
PlayerOwner().ConsoleCommand("ADMIN KICK " $ PlayerName);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if( PlayerOwner().PlayerReplicationInfo.bAdmin )
|
||||
{
|
||||
PlayerName = KickVoteMultiColumnList(List).GetSelectedPlayerName();
|
||||
PlayerOwner().ConsoleCommand("ADMIN KICKBAN " $ PlayerName);
|
||||
PlayerOwner().ConsoleCommand("ADMIN KICK BAN " $ PlayerName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool InternalOnRightClick(GUIComponent Sender)
|
||||
{
|
||||
local int NewIndex;
|
||||
|
||||
NewIndex = List.Top + ( (Controller.MouseY - List.ClientBounds[1]) / List.ItemHeight);
|
||||
if( NewIndex >= List.ItemCount )
|
||||
NewIndex = List.ItemCount - 1;
|
||||
List.SetIndex(NewIndex);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object Class=GUIContextMenu Name=RCMenu
|
||||
ContextItems(0)="Vote to Kick this Player"
|
||||
ContextItems(1)="View Player Details"
|
||||
ContextItems(2)="[Admin] Kick from Server"
|
||||
ContextItems(3)="[Admin] Ban from Server"
|
||||
OnSelect=InternalOnClick
|
||||
StyleName="ServerListContextMenu"
|
||||
End Object
|
||||
ContextMenu=RCMenu
|
||||
|
||||
OnRightClick=InternalOnRightClick
|
||||
KickInfoPage="xVoting.KickInfoPage"
|
||||
DefaultListClass="xVoting.KickVoteMultiColumnList"
|
||||
}
|
||||
|
||||
161
kf_sources/XVoting/Classes/KickVotingPage.uc
Normal file
161
kf_sources/XVoting/Classes/KickVotingPage.uc
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
//====================================================================
|
||||
// xVoting.KickVotingPage
|
||||
// Kick Voting page.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class KickVotingPage extends VotingPage;
|
||||
|
||||
var automated GUISectionBackground sb_List;
|
||||
var automated KickVoteMultiColumnListBox lb_PlayerListBox;
|
||||
var automated GUILabel l_PlayerListTitle;
|
||||
var automated GUIButton b_Info, b_Kick;
|
||||
|
||||
// Localization
|
||||
var localized string lmsgKickVotingDisabled;
|
||||
|
||||
|
||||
function InitComponent(GUIController InController, GUIComponent InOwner)
|
||||
{
|
||||
Super.InitComponent(InController, InOwner);
|
||||
sb_List.ManageComponent(lb_PlayerListBox);
|
||||
sb_List.ImageOffset[1]=8;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnOpen()
|
||||
{
|
||||
if( MVRI == none || (MVRI != none && !MVRI.bKickVote) )
|
||||
{
|
||||
Controller.OpenMenu("GUI2K4.GUI2K4QuestionPage");
|
||||
GUIQuestionPage(Controller.TopPage()).SetupQuestion(lmsgKickVotingDisabled, QBTN_Ok, QBTN_Ok);
|
||||
GUIQuestionPage(Controller.TopPage()).OnButtonClick = OnOkButtonClick;
|
||||
return;
|
||||
}
|
||||
lb_PlayerListBox.List.OnDblClick = PlayerListDblClick;
|
||||
KickVoteMultiColumnList(lb_PlayerListBox.List).LoadPlayerList(MVRI);
|
||||
f_Chat.OnSubmit = SendKickVote;
|
||||
|
||||
f_Chat.WinTop = 0.561457;
|
||||
f_Chat.WinHeight=0.432031;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function OnOkButtonClick(byte bButton) // triggered by th GUIQuestionPage Ok Button
|
||||
{
|
||||
Controller.CloseAll(true,true);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function UpdateKickVoteCount(VotingHandler.KickVoteScore KVCData)
|
||||
{
|
||||
KickVoteMultiColumnList(lb_PlayerListBox.List).UpdatedVoteCount(KVCData.PlayerID, KVCData.KickVoteCount);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool PlayerListDblClick(GUIComponent Sender)
|
||||
{
|
||||
SendKickVote();
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SendKickVote()
|
||||
{
|
||||
local int PlayerID;
|
||||
|
||||
PlayerID = KickVoteMultiColumnList(lb_PlayerListBox.List).GetSelectedPlayerID();
|
||||
if( PlayerID > -1 )
|
||||
MVRI.SendKickVote(PlayerID);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
function bool InfoClick(GUIComponent Sender)
|
||||
{
|
||||
lb_PlayerListBox.InternalOnClick(lb_PlayerListBox.ContextMenu,1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function bool KickClick(GUIComponent Sender)
|
||||
{
|
||||
lb_PlayerListBox.InternalOnClick(lb_PlayerListBox.ContextMenu,0);
|
||||
return true;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
OnOpen=InternalOnOpen;
|
||||
|
||||
Begin Object Class=KickVoteMultiColumnListBox Name=PlayerListBoxControl
|
||||
WinWidth=0.473047
|
||||
WinHeight=0.481758
|
||||
WinLeft=0.254141
|
||||
WinTop=0.162239
|
||||
bVisibleWhenEmpty=true
|
||||
StyleName="ServerBrowserGrid"
|
||||
End Object
|
||||
lb_PlayerListBox = PlayerListBoxControl
|
||||
|
||||
Begin Object Class=AltSectionBackground Name=ListBackground
|
||||
Caption=""
|
||||
WinWidth=0.953125
|
||||
// if _RO_
|
||||
WinHeight=0.5
|
||||
// else
|
||||
// WinHeight=0.461357
|
||||
// end if _RO_
|
||||
WinLeft=0.023438
|
||||
WinTop=0.052083
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
bFillClient=true
|
||||
|
||||
// if _RO_
|
||||
LeftPadding=0.01
|
||||
RightPadding=0.01
|
||||
BottomPadding=0.1
|
||||
TopPadding=0.1
|
||||
// end if _RO_
|
||||
End Object
|
||||
sb_List=ListBackground
|
||||
|
||||
Begin Object Class=GUIButton Name=InfoButton
|
||||
Caption="Info"
|
||||
WinWidth=0.160075
|
||||
WinHeight=0.040000
|
||||
WinLeft=0.550634
|
||||
// if _RO_
|
||||
WinTop=0.489482
|
||||
// else
|
||||
// WinTop=0.511082
|
||||
// end if _RO_
|
||||
OnClick=InfoClick
|
||||
TabOrder=1
|
||||
bStandardized=true
|
||||
bBoundToParent=false
|
||||
bScaleToParent=false
|
||||
End Object
|
||||
b_Info=InfoButton
|
||||
|
||||
Begin Object class=GUIButton Name=KickButton
|
||||
Caption="Kick"
|
||||
WinWidth=0.137744
|
||||
WinHeight=0.040000
|
||||
WinLeft=0.715411
|
||||
// if _RO_
|
||||
WinTop=0.489482
|
||||
// else
|
||||
// WinTop=0.511082
|
||||
// end if _RO_
|
||||
OnClick=KickClick
|
||||
bStandardized=true
|
||||
TabOrder=1
|
||||
bBoundToParent=false
|
||||
bScaleToParent=false
|
||||
End Object
|
||||
b_Kick=KickButton
|
||||
|
||||
|
||||
|
||||
lmsgKickVotingDisabled="Sorry, Kick Voting has been disabled by the server administrator."
|
||||
WindowName="Kick Voting"
|
||||
}
|
||||
|
||||
252
kf_sources/XVoting/Classes/MapInfoPage.uc
Normal file
252
kf_sources/XVoting/Classes/MapInfoPage.uc
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
//====================================================================
|
||||
// xVoting.MapInfoPage
|
||||
// Map Information Page
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MapInfoPage extends LockedFloatingWindow;
|
||||
|
||||
var automated GUISectionBackground sb_Info;
|
||||
var automated GUIScrollTextBox lb_MapDesc;
|
||||
var automated GUIImage i_MapImage;
|
||||
var automated GUILabel l_MapAuthor, l_MapPlayers, l_NoPreview;
|
||||
|
||||
var array<CacheManager.MapRecord> Maps;
|
||||
|
||||
var localized string MessageNoInfo, AuthorText, PlayerText, lmsgLevelPreviewUnavailable;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
Super.Initcomponent(MyController, MyOwner);
|
||||
|
||||
b_Cancel.SetVisibility(false);
|
||||
sb_Main.SetPosition(0.042302,0.043286,0.917083,0.451979);
|
||||
sb_Main.bBoundToParent=true;
|
||||
sb_Main.bScaletoParent=true;
|
||||
sb_Main.ManageComponent(i_MapImage);
|
||||
sb_Info.Managecomponent(lb_MapDesc);
|
||||
sb_Info.bBoundToParent=true;
|
||||
sb_Info.bScaletoParent=true;
|
||||
|
||||
class'CacheManager'.static.GetMapList( Maps );
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function HandleParameters(string Param1, string Param2)
|
||||
{
|
||||
ReadMapInfo(Param1);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function ReadMapInfo(string MapName)
|
||||
{
|
||||
local DecoText DText;
|
||||
local string mDesc;
|
||||
local int Index, i;
|
||||
local Material Screenie;
|
||||
local string Package, Item;
|
||||
|
||||
if(MapName == "")
|
||||
return;
|
||||
|
||||
if (!Controller.bCurMenuInitialized)
|
||||
return;
|
||||
|
||||
MapName = StripMapName(MapName);
|
||||
Index = FindCacheRecordIndex(MapName);
|
||||
|
||||
if (Maps[Index].FriendlyName != "")
|
||||
sb_Main.Caption = Maps[Index].FriendlyName;
|
||||
else
|
||||
sb_Main.Caption = MapName;
|
||||
|
||||
if ( Maps[Index].ScreenshotRef != "" )
|
||||
Screenie = Material(DynamicLoadObject(Maps[Index].ScreenshotRef, class'Material'));
|
||||
i_MapImage.Image = Screenie;
|
||||
|
||||
l_NoPreview.SetVisibility( Screenie == None );
|
||||
i_MapImage.SetVisibility( Screenie != None );
|
||||
|
||||
l_MapPlayers.Caption = Maps[Index].PlayerCountMin@"-"@Maps[Index].PlayerCountMax@PlayerText;
|
||||
|
||||
if ( class'CacheManager'.static.Is2003Content(Maps[Index].MapName) )
|
||||
{
|
||||
if ( Maps[i].TextName != "" )
|
||||
{
|
||||
if ( !Divide(Maps[Index].TextName, ".", Package, Item) )
|
||||
{
|
||||
Package = "XMaps";
|
||||
Item = Maps[Index].TextName;
|
||||
}
|
||||
DText = class'xUtil'.static.LoadDecoText( Package, Item );
|
||||
}
|
||||
}
|
||||
|
||||
if (DText != None)
|
||||
{
|
||||
for (i = 0; i < DText.Rows.Length; i++)
|
||||
{
|
||||
if (mDesc != "")
|
||||
mDesc $= "|";
|
||||
mDesc $= DText.Rows[i];
|
||||
}
|
||||
}
|
||||
|
||||
else mDesc = Maps[Index].Description;
|
||||
|
||||
if (mDesc == "")
|
||||
mDesc = MessageNoInfo;
|
||||
|
||||
lb_MapDesc.SetContent( mDesc );
|
||||
if (Maps[Index].Author != "")
|
||||
l_MapAuthor.Caption = AuthorText$":"@Maps[Index].Author;
|
||||
else l_MapAuthor.Caption = "";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Remove any additional text from the map's name
|
||||
// Used for getting just the mapname
|
||||
function string StripMapName( string FullMapName )
|
||||
{
|
||||
local int pos;
|
||||
|
||||
pos = InStr(FullMapName, " ");
|
||||
if ( pos != -1 )
|
||||
FullMapName = Left(FullMapName, pos);
|
||||
|
||||
return FullMapName;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function int FindCacheRecordIndex(string MapName)
|
||||
{
|
||||
local int i;
|
||||
|
||||
for (i = 0; i < Maps.Length; i++)
|
||||
if (Maps[i].MapName == MapName)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool ReturnButtonOnClick(GUIComponent Sender)
|
||||
{
|
||||
Controller.CloseMenu(true);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SetVisibility(bool bIsVisible)
|
||||
{
|
||||
Super.SetVisibility(bIsVisible);
|
||||
|
||||
l_NoPreview.SetVisibility( i_MapImage.Image == None );
|
||||
i_MapImage.SetVisibility( i_MapImage.Image != None );
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
Begin Object Class=GUISectionBackground Name=sbInfo
|
||||
WinWidth=0.918322
|
||||
WinHeight=0.374167
|
||||
WinLeft=0.045305
|
||||
WinTop=0.514698
|
||||
bFillClient=true
|
||||
End Object
|
||||
sb_Info=sbInfo
|
||||
|
||||
Begin Object Class=GUIImage Name=MapImage
|
||||
WinWidth=0.917083
|
||||
WinHeight=0.451979
|
||||
WinLeft=0.281885
|
||||
WinTop=0.173177
|
||||
ImageColor=(R=255,G=255,B=255,A=255)
|
||||
ImageStyle=ISTY_Scaled
|
||||
ImageRenderStyle=MSTY_Normal
|
||||
RenderWeight=0.2
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
i_MapImage=MapImage
|
||||
|
||||
Begin Object Class=GUILabel Name=NoPreview
|
||||
WinWidth=0.917083
|
||||
WinHeight=0.451979
|
||||
WinLeft=0.281885
|
||||
WinTop=0.173177
|
||||
TextFont="UT2HeaderFont"
|
||||
TextAlign=TXTA_Center
|
||||
VertAlign=TXTA_Center
|
||||
bMultiline=True
|
||||
bTransparent=False
|
||||
TextColor=(R=247,G=255,B=0,A=255)
|
||||
Caption="No Preview Available"
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
l_NoPreview=NoPreview
|
||||
|
||||
Begin Object class=GUILabel Name=MapAuthorLabel
|
||||
Caption="MapAuthor"
|
||||
TextAlign=TXTA_Center
|
||||
TextFont="UT2ServerListFont"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
WinWidth=0.915313
|
||||
WinHeight=0.049359
|
||||
WinLeft=0.042804
|
||||
WinTop=0.366257
|
||||
RenderWeight=0.3
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
l_MapAuthor=MapAuthorLabel
|
||||
|
||||
Begin Object class=GUILabel Name=MapPlayersLabel
|
||||
Caption="Players"
|
||||
TextAlign=TXTA_Center
|
||||
TextFont="UT2ServerListFont"
|
||||
TextColor=(R=255,G=255,B=255,A=255)
|
||||
WinWidth=0.915313
|
||||
WinHeight=0.049359
|
||||
WinLeft=0.042804
|
||||
WinTop=0.397652
|
||||
RenderWeight=0.3
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
l_MapPlayers=MapPlayersLabel
|
||||
|
||||
Begin Object Class=GUIScrollTextBox Name=MapInfoList
|
||||
WinWidth=0.918322
|
||||
WinHeight=0.207500
|
||||
WinLeft=0.284888
|
||||
WinTop=0.620235
|
||||
CharDelay=0.0025
|
||||
EOLDelay=0.5
|
||||
bNeverFocus=true
|
||||
StyleName="NoBackground"
|
||||
bTabStop=False
|
||||
bBoundToParent=false
|
||||
bVisibleWhenEmpty=true
|
||||
bNoTeletype=false
|
||||
bStripColors=false
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
lb_MapDesc = MapInfoList
|
||||
|
||||
Background=None
|
||||
|
||||
WinWidth=0.468750
|
||||
WinHeight=0.801954
|
||||
WinLeft=0.264063
|
||||
WinTop=0.077213
|
||||
|
||||
DefaultWidth=0.468750
|
||||
DefaultHeight=0.801954
|
||||
DefaultLeft=0.264063
|
||||
DefaultTop=0.077213
|
||||
|
||||
|
||||
bRenderWorld=true
|
||||
bRequire640x480=false
|
||||
bAllowedAsLast=true
|
||||
|
||||
MessageNoInfo="No information available!"
|
||||
AuthorText="Author"
|
||||
PlayerText="players"
|
||||
lmsgLevelPreviewUnavailable="Level Preview Unavailable"
|
||||
}
|
||||
|
||||
17
kf_sources/XVoting/Classes/MapListLoader.uc
Normal file
17
kf_sources/XVoting/Classes/MapListLoader.uc
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapListLoader
|
||||
//
|
||||
// MapListLoader is an interface to the object/class that is responsible
|
||||
// for loading the list of map names into the VotingHandler.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class MapListLoader extends Info;
|
||||
|
||||
|
||||
function LoadMapList(xVotingHandler VotingHandler);
|
||||
function Reset();
|
||||
|
||||
|
||||
172
kf_sources/XVoting/Classes/MapVoteCountMultiColumnList.uc
Normal file
172
kf_sources/XVoting/Classes/MapVoteCountMultiColumnList.uc
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteCountMultiColumnList
|
||||
//
|
||||
// Multi-Column list box used to display maps and game types.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class MapVoteCountMultiColumnList extends GUIMultiColumnList;
|
||||
|
||||
var VotingReplicationInfo VRI;
|
||||
var int PrevSortColumn;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadList(VotingReplicationInfo LoadVRI)
|
||||
{
|
||||
local int i;
|
||||
|
||||
VRI = LoadVRI;
|
||||
|
||||
for( i=0; i<VRI.MapVoteCount.Length; i++)
|
||||
AddedItem();
|
||||
|
||||
OnDrawItem = DrawItem;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function UpdatedVoteCount(int UpdatedIndex, bool bRemoved)
|
||||
{
|
||||
if( bRemoved )
|
||||
RemovedItem(UpdatedIndex);
|
||||
else
|
||||
{
|
||||
if( UpdatedIndex >= ItemCount )
|
||||
AddedItem();
|
||||
else
|
||||
UpdatedItem(UpdatedIndex);
|
||||
|
||||
}
|
||||
OnSortChanged();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// TODO: move up to GUIMultiColumnList
|
||||
/*
|
||||
function RemovedItem(int RemovedIndex)
|
||||
{
|
||||
local int i;
|
||||
|
||||
if( RemovedIndex >= 0 )
|
||||
{
|
||||
for( i=0; i<SortData.Length; i++ )
|
||||
{
|
||||
if( SortData[i].SortItem == RemovedIndex )
|
||||
{
|
||||
SortData.Remove(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for( i=0; i<InvSortData.Length; i++ )
|
||||
{
|
||||
if( InvSortData[i] == RemovedIndex )
|
||||
{
|
||||
InvSortData.Remove(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ItemCount--;
|
||||
// Force updating of sort data
|
||||
OnSortChanged();
|
||||
if( Index == RemovedIndex )
|
||||
Index = -1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function int GetSelectedMapIndex()
|
||||
{
|
||||
return VRI.MapVoteCount[SortData[Index].SortItem].MapIndex;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function int GetSelectedGameConfigIndex()
|
||||
{
|
||||
return VRI.MapVoteCount[SortData[Index].SortItem].GameConfigIndex;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function string GetSelectedMapName()
|
||||
{
|
||||
if( Index > -1 )
|
||||
return VRI.MapList[VRI.MapVoteCount[SortData[Index].SortItem].MapIndex].MapName;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function DrawItem(Canvas Canvas, int i, float X, float Y, float W, float H, bool bSelected, bool bPending)
|
||||
{
|
||||
local float CellLeft, CellWidth;
|
||||
local GUIStyles DrawStyle;
|
||||
|
||||
if( VRI == none )
|
||||
return;
|
||||
|
||||
// Draw the selection border
|
||||
if( bSelected )
|
||||
{
|
||||
SelectedStyle.Draw(Canvas,MenuState, X, Y-2, W, H+2 );
|
||||
DrawStyle = SelectedStyle;
|
||||
}
|
||||
else
|
||||
DrawStyle = Style;
|
||||
|
||||
GetCellLeftWidth( 0, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
VRI.GameConfig[VRI.MapVoteCount[SortData[i].SortItem].GameConfigIndex].GameName, FontScale );
|
||||
|
||||
GetCellLeftWidth( 1, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
VRI.MapList[VRI.MapVoteCount[SortData[i].SortItem].MapIndex].MapName, FontScale );
|
||||
|
||||
GetCellLeftWidth( 2, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
string(VRI.MapVoteCount[SortData[i].SortItem].VoteCount), FontScale );
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function string GetSortString( int i )
|
||||
{
|
||||
local string ColumnData[5];
|
||||
|
||||
ColumnData[0] = left(Caps(VRI.GameConfig[VRI.MapVoteCount[i].GameConfigIndex].GameName),15);
|
||||
ColumnData[1] = left(Caps(VRI.MapList[VRI.MapVoteCount[i].MapIndex].MapName),20);
|
||||
ColumnData[2] = right("0000" $ VRI.MapVoteCount[i].VoteCount,4);
|
||||
|
||||
return ColumnData[SortColumn] $ ColumnData[PrevSortColumn];
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
event OnSortChanged()
|
||||
{
|
||||
Super.OnSortChanged();
|
||||
PrevSortColumn = SortColumn;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Free()
|
||||
{
|
||||
VRI = none;
|
||||
super.Free();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool InternalOnDragDrop(GUIComponent Sender)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
ColumnHeadings(0)="GameType"
|
||||
ColumnHeadings(1)="MapName"
|
||||
ColumnHeadings(2)="Votes"
|
||||
|
||||
InitColumnPerc(0)=0.3
|
||||
InitColumnPerc(1)=0.4
|
||||
InitColumnPerc(2)=0.3
|
||||
|
||||
SortColumn=2
|
||||
SortDescending=True
|
||||
PrevSortColumn=0
|
||||
|
||||
ColumnHeadingHints(0)="Game Type"
|
||||
ColumnHeadingHints(1)="Map Name"
|
||||
ColumnHeadingHints(2)="Number of votes registered for this map."
|
||||
|
||||
StyleName="ServerBrowserGrid"
|
||||
SelectedStyleName="BrowserListSelection"
|
||||
}
|
||||
|
||||
62
kf_sources/XVoting/Classes/MapVoteCountMultiColumnListBox.uc
Normal file
62
kf_sources/XVoting/Classes/MapVoteCountMultiColumnListBox.uc
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteCountMultiColumnListBox
|
||||
//
|
||||
// Multi-Column list box used to display maps with vote counts.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MapVoteCountMultiColumnListBox extends GUIMultiColumnListBox;
|
||||
|
||||
var string MapInfoPage;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnClick(GUIContextMenu Sender, int Index)
|
||||
{
|
||||
local string MapName;
|
||||
|
||||
if (Sender != None)
|
||||
{
|
||||
if ( NotifyContextSelect(Sender, Index) )
|
||||
return;
|
||||
|
||||
switch (Index)
|
||||
{
|
||||
case 0:
|
||||
if( MapVotingPage(MenuOwner) != none )
|
||||
MapVotingPage(MenuOwner).SendVote(self);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
MapName = MapVoteCountMultiColumnList(List).GetSelectedMapName();
|
||||
Controller.OpenMenu( MapInfoPage, MapName );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool InternalOnRightClick(GUIComponent Sender)
|
||||
{
|
||||
local int NewIndex;
|
||||
|
||||
NewIndex = List.Top + ( (Controller.MouseY - List.ClientBounds[1]) / List.ItemHeight);
|
||||
if( NewIndex >= List.ItemCount )
|
||||
NewIndex = List.ItemCount - 1;
|
||||
List.SetIndex(NewIndex);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object Class=GUIContextMenu Name=RCMenu
|
||||
ContextItems(0)="Vote for this Map"
|
||||
ContextItems(1)="View Screenshot and Description"
|
||||
OnSelect=InternalOnClick
|
||||
StyleName="ServerListContextMenu"
|
||||
End Object
|
||||
ContextMenu=RCMenu
|
||||
|
||||
OnRightClick=InternalOnRightClick
|
||||
MapInfoPage="xVoting.MapInfoPage"
|
||||
DefaultListClass="xVoting.MapVoteCountMultiColumnList"
|
||||
}
|
||||
|
||||
280
kf_sources/XVoting/Classes/MapVoteFooter.uc
Normal file
280
kf_sources/XVoting/Classes/MapVoteFooter.uc
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
//==============================================================================
|
||||
// Created on: 01/02/2004
|
||||
// Contains controls for participating in chat while mapvote menus are open
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class MapVoteFooter extends GUIFooter;
|
||||
|
||||
var() noexport array<string> RecallQueue;
|
||||
var() noexport int RecallIdx;
|
||||
var() noexport int idxLastChatMsg;
|
||||
var() noexport float LastMsgTime;
|
||||
|
||||
var automated GUISectionBackground sb_Background;
|
||||
var automated GUIScrollTextBox lb_Chat;
|
||||
var automated moEditBox ed_Chat;
|
||||
var automated GUIButton b_Accept, b_Submit, b_Close;
|
||||
|
||||
delegate OnSubmit();
|
||||
delegate OnAccept();
|
||||
delegate bool OnSendChat( string Text )
|
||||
{
|
||||
if ( Text != "" )
|
||||
{
|
||||
if ( RecallQueue.Length == 0 || RecallQueue[RecallQueue.Length - 1] != Text )
|
||||
{
|
||||
RecallIdx = RecallQueue.Length;
|
||||
RecallQueue[RecallIdx] = Text;
|
||||
}
|
||||
|
||||
if ( Left(Text,4) ~= "cmd " )
|
||||
PlayerOwner().ConsoleCommand( Mid(Text, 4) );
|
||||
else
|
||||
{
|
||||
if ( Left(Text,1) == "." )
|
||||
PlayerOwner().TeamSay( Mid(Text,1) );
|
||||
else PlayerOwner().Say( Text );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function InitComponent(GUIController InController, GUIComponent InOwner)
|
||||
{
|
||||
local string str;
|
||||
local ExtendedConsole C;
|
||||
|
||||
Super.InitComponent(InController, InOwner);
|
||||
|
||||
lb_Chat.MyScrollText.SetContent("");
|
||||
lb_Chat.MyScrollText.FontScale=FNS_Small;
|
||||
|
||||
C = ExtendedConsole(Controller.ViewportOwner.Console);
|
||||
if ( C != None )
|
||||
{
|
||||
C.OnChatMessage = ReceiveChat;
|
||||
if ( C.bTyping )
|
||||
{
|
||||
str = C.TypedStr;
|
||||
C.TypingClose();
|
||||
|
||||
if ( Left(str,4) ~= "say " )
|
||||
str = Mid(str, 5);
|
||||
|
||||
else if ( Left(str,8) ~= "teamsay " )
|
||||
str = Mid(str, 9);
|
||||
|
||||
ed_Chat.SetText(str);
|
||||
}
|
||||
}
|
||||
|
||||
sb_Background.Managecomponent(lb_Chat);
|
||||
|
||||
|
||||
OnDraw=MyOnDraw;
|
||||
|
||||
}
|
||||
|
||||
function bool MyOnDraw(canvas C)
|
||||
{
|
||||
local float l,t,w,xl,yl;
|
||||
local eFontScale fs;
|
||||
// Reposition everything
|
||||
|
||||
t = sb_Background.ActualTop() + sb_Background.ActualHeight();
|
||||
l = sb_Background.ActualLeft() + sb_Background.ActualWidth() - sb_Background.ImageOffset[3];
|
||||
|
||||
b_Close.Style.TextSize(C,MSAT_Blurry,b_Close.Caption, XL,YL,FS);
|
||||
w = XL;
|
||||
b_Submit.Style.TextSize(C,MSAT_Blurry,b_Close.Caption, XL,YL,FS);
|
||||
if (XL>w)
|
||||
w = XL;
|
||||
b_Accept.Style.TextSize(C,MSAT_Blurry,b_Close.Caption, XL,YL,FS);
|
||||
if (XL>w)
|
||||
w = XL;
|
||||
|
||||
w = w*3;
|
||||
w = ActualWidth(w);
|
||||
|
||||
l -= w;
|
||||
b_Close.WinWidth = w;
|
||||
b_Close.WinTop = t;
|
||||
b_Close.WinLeft = l;
|
||||
|
||||
l -= w;
|
||||
b_Submit.WinWidth = w;
|
||||
b_Submit.WinTop = t;
|
||||
b_Submit.WinLeft = l;
|
||||
|
||||
l -= w;
|
||||
b_Accept.WinWidth = w;
|
||||
b_Accept.WinTop = t;
|
||||
b_Accept.WinLeft = l;
|
||||
|
||||
|
||||
ed_Chat.WinLeft = sb_Background.ActualLeft() + sb_Background.ImageOffset[0];
|
||||
ed_Chat.WinWidth = L - ed_Chat.WinLeft;
|
||||
ed_Chat.WinHeight = 25;
|
||||
ed_Chat.WinTop = t;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function ReceiveChat(string Msg)
|
||||
{
|
||||
lb_Chat.AddText(Msg);
|
||||
lb_Chat.MyScrollText.End();
|
||||
|
||||
// remove top messages from list if there are more than 10
|
||||
if( lb_Chat.MyScrollText.ItemCount > 10 )
|
||||
lb_Chat.MyScrollText.Remove(0,lb_Chat.MyScrollText.ItemCount - 10);
|
||||
}
|
||||
|
||||
function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
|
||||
{
|
||||
if ( State == 3 && Key == 0x0D ) // enter
|
||||
{
|
||||
if ( OnSendChat(ed_Chat.GetText()) )
|
||||
ed_Chat.SetComponentValue("", True);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else if ( State == 1 && RecallQueue.Length > 0 )
|
||||
{
|
||||
if ( Key == 0x26 ) // up
|
||||
{
|
||||
ed_Chat.SetText(RecallQueue[RecallIdx]);
|
||||
RecallIdx = Max(0, RecallIdx - 1);
|
||||
return true;
|
||||
}
|
||||
else if ( Key == 0x28 ) // down
|
||||
{
|
||||
ed_Chat.SetText(RecallQueue[RecallIdx]);
|
||||
RecallIdx = Min(RecallQueue.Length - 1, RecallIdx + 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function bool InternalOnClick(GUIComponent Sender)
|
||||
{
|
||||
if (Sender == b_Close )
|
||||
{
|
||||
Controller.CloseMenu(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Sender == b_Submit )
|
||||
{
|
||||
OnSubmit();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Sender == b_Accept )
|
||||
{
|
||||
OnAccept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
bNeverFocus=false
|
||||
Begin Object Class=AltSectionBackground Name=MapvoteFooterBackground
|
||||
Caption="Chat"
|
||||
WinWidth=1
|
||||
WinHeight=0.82
|
||||
WinLeft=0
|
||||
WinTop=0
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
bFillClient=true
|
||||
LeftPadding=0.01
|
||||
RightPadding=0.01
|
||||
End Object
|
||||
sb_Background=MapvoteFooterBackground
|
||||
|
||||
Begin Object Class=GUIScrollTextBox Name=ChatScrollBox
|
||||
WinWidth=0.918970
|
||||
WinHeight=0.582534
|
||||
WinLeft=0.043845
|
||||
WinTop=0.223580
|
||||
CharDelay=0.0025
|
||||
EOLDelay=0
|
||||
bBoundToParent=true
|
||||
bScaleToParent=true
|
||||
bVisibleWhenEmpty=true
|
||||
bNoTeletype=true
|
||||
bNeverFocus=true
|
||||
bStripColors=false
|
||||
// StyleName="NoBackground"
|
||||
StyleName="ServerBrowserGrid"
|
||||
TabOrder=2
|
||||
End Object
|
||||
lb_Chat=ChatScrollBox
|
||||
|
||||
Begin Object class=moEditBox Name=ChatEditbox
|
||||
WinWidth=0.700243
|
||||
WinHeight=0.106609
|
||||
WinLeft=0.007235
|
||||
WinTop=0.868598
|
||||
Caption="Say"
|
||||
CaptionWidth=0.15
|
||||
OnKeyEvent=InternalOnKeyEvent
|
||||
TabOrder=0
|
||||
bStandardized=true
|
||||
End Object
|
||||
ed_Chat=ChatEditbox
|
||||
|
||||
Begin Object Class=GUIButton Name=AcceptButton
|
||||
Caption="Accept"
|
||||
Hint="Click once you are satisfied with all settings and wish to offer no further modifications"
|
||||
WinWidth=0.191554
|
||||
WinHeight=0.071145
|
||||
WinLeft=0.562577
|
||||
WinTop=0.906173
|
||||
OnClick=InternalOnClick
|
||||
TabOrder=1
|
||||
bRepeatClick=False
|
||||
bStandardized=true
|
||||
bBoundToParent=false
|
||||
bScaleToParent=false
|
||||
bVisible=false
|
||||
End Object
|
||||
b_Accept=AcceptButton
|
||||
Begin Object Class=GUIButton Name=SubmitButton
|
||||
Caption="Submit"
|
||||
WinWidth=0.160075
|
||||
WinHeight=0.165403
|
||||
WinLeft=0.704931
|
||||
WinTop=0.849625
|
||||
OnClick=InternalOnClick
|
||||
TabOrder=1
|
||||
bStandardized=true
|
||||
bBoundToParent=false
|
||||
bScaleToParent=false
|
||||
End Object
|
||||
b_Submit=SubmitButton
|
||||
|
||||
Begin Object class=GUIButton Name=CloseButton
|
||||
Caption="Close"
|
||||
WinWidth=0.137744
|
||||
WinHeight=0.165403
|
||||
WinLeft=0.861895
|
||||
WinTop=0.849625
|
||||
OnClick=InternalOnClick
|
||||
bStandardized=true
|
||||
TabOrder=1
|
||||
bBoundToParent=false
|
||||
bScaleToParent=false
|
||||
End Object
|
||||
b_Close=CloseButton
|
||||
StyleName="BindBox"
|
||||
}
|
||||
525
kf_sources/XVoting/Classes/MapVoteGameConfigPage.uc
Normal file
525
kf_sources/XVoting/Classes/MapVoteGameConfigPage.uc
Normal file
|
|
@ -0,0 +1,525 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteGameConfigPage
|
||||
//
|
||||
// this page allows modification of the xVotingHandler GameConfig
|
||||
// configuration variables.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MapVoteGameConfigPage extends GUICustomPropertyPage DependsOn(VotingHandler);
|
||||
|
||||
var automated GUISectionBackground sb_List, sb_List2;
|
||||
var automated GUIListBox lb_GameConfigList;
|
||||
var automated moComboBox co_GameClass;
|
||||
var automated moEditBox ed_GameTitle;
|
||||
var automated moEditBox ed_Acronym;
|
||||
var automated moEditBox ed_Prefix;
|
||||
var automated MultiSelectListBox lb_Mutator;
|
||||
var automated moEditBox ed_Parameter;
|
||||
var automated GUIButton b_New;
|
||||
var automated GUIButton b_Delete;
|
||||
var automated moCheckBox ch_Default;
|
||||
|
||||
var array<CacheManager.GameRecord> GameTypes;
|
||||
var array<CacheManager.MutatorRecord> Mutators;
|
||||
|
||||
var() editconst noexport CacheManager.GameRecord CurrentGame;
|
||||
|
||||
// autosave
|
||||
var() int SaveIndex, ListIndex;
|
||||
var bool bChanged;
|
||||
|
||||
// localization
|
||||
var localized string lmsgNew;
|
||||
var localized string lmsgAdd;
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
local int i;
|
||||
|
||||
Super.Initcomponent(MyController, MyOwner);
|
||||
|
||||
// load existing configuration
|
||||
for(i=0; i<class'xVoting.xVotingHandler'.default.GameConfig.Length; i++)
|
||||
lb_GameConfigList.List.Add( class'xVoting.xVotingHandler'.default.GameConfig[i].GameName, none, string(i));
|
||||
|
||||
if (lb_GameConfigList.List.ItemCount==0)
|
||||
DisableComponent(b_Delete);
|
||||
|
||||
// load game types
|
||||
class'CacheManager'.static.GetGameTypeList(GameTypes);
|
||||
for(i=0; i<GameTypes.Length; i++)
|
||||
co_GameClass.AddItem( GameTypes[i].GameName, none, GameTypes[i].ClassName);
|
||||
|
||||
class'CacheManager'.static.GetMutatorList(Mutators);
|
||||
LoadMutators();
|
||||
|
||||
sb_Main.SetPosition(0.483359,0.064678,0.451250,0.716991);
|
||||
lb_GameConfigList.List.AddLinkObject(co_GameClass);
|
||||
lb_GameConfigList.List.AddLinkObject(ed_GameTitle);
|
||||
lb_GameConfigList.List.AddLinkObject(ed_Acronym);
|
||||
lb_GameConfigList.List.AddLinkObject(ed_Prefix);
|
||||
lb_GameConfigList.List.AddLinkObject(ed_Parameter);
|
||||
lb_GameConfigList.List.AddLinkObject(lb_Mutator);
|
||||
lb_GameConfigList.List.AddLinkObject(ch_Default);
|
||||
lb_GameConfigList.List.AddLinkObject(b_Delete);
|
||||
|
||||
lb_GameConfigList.OnChange=GameConfigList_Changed;
|
||||
bChanged = False;
|
||||
|
||||
sb_Main.TopPadding=0.0.5;
|
||||
sb_Main.BottomPadding=0.4;
|
||||
sb_Main.Caption="Options";
|
||||
|
||||
sb_List.ManageComponent(lb_GameConfigList);
|
||||
sb_List.LeftPadding=0.005;
|
||||
sb_List.RightPadding=0.005;
|
||||
|
||||
sb_Main.ManageComponent(ch_Default);
|
||||
sb_Main.ManageComponent(co_GameClass);
|
||||
sb_Main.ManageComponent(ed_GameTitle);
|
||||
sb_Main.ManageComponent(ed_Acronym);
|
||||
sb_Main.ManageComponent(ed_Prefix);
|
||||
sb_Main.ManageComponent(ed_Parameter);
|
||||
|
||||
sb_List2.ManageComponent(lb_Mutator);
|
||||
|
||||
if (lb_GameConfigList.List.ItemCount==0)
|
||||
DisableComponent(b_Delete);
|
||||
else
|
||||
lb_GameConfigList.List.SetIndex(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function bool InternalOnClick(GUIComponent Sender)
|
||||
{
|
||||
if ( Sender == b_OK )
|
||||
{
|
||||
SaveChange();
|
||||
Controller.CloseMenu(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Sender == b_Cancel )
|
||||
{
|
||||
Controller.CloseMenu(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnOpen()
|
||||
{
|
||||
lb_GameConfigList.List.SetIndex(0);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadMutators()
|
||||
{
|
||||
local int i;
|
||||
|
||||
lb_Mutator.List.Clear();
|
||||
for(i=0; i<Mutators.Length; i++)
|
||||
lb_Mutator.List.Add( Mutators[i].FriendlyName, none, Mutators[i].ClassName);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function GameConfigList_Changed(GUIComponent Sender)
|
||||
{
|
||||
local int i;
|
||||
local array<string> MutatorArray;
|
||||
|
||||
if (lb_GameConfigList.List.ItemCount==0 || lb_GameConfigList.List.Index == ListIndex)
|
||||
return;
|
||||
|
||||
SaveChange();
|
||||
|
||||
SaveIndex = int(lb_GameConfigList.List.GetExtra());
|
||||
ListIndex = lb_GameConfigList.List.Index;
|
||||
|
||||
LoadMutators();
|
||||
|
||||
co_GameClass.Find(class'xVoting.xVotingHandler'.default.GameConfig[SaveIndex].GameClass, true, True);
|
||||
ed_GameTitle.SetComponentValue(class'xVoting.xVotingHandler'.default.GameConfig[SaveIndex].GameName, True);
|
||||
ed_Acronym.SetComponentValue(class'xVoting.xVotingHandler'.default.GameConfig[SaveIndex].Acronym, True);
|
||||
ed_Prefix.SetComponentValue(class'xVoting.xVotingHandler'.default.GameConfig[SaveIndex].Prefix, True);
|
||||
ed_Parameter.SetComponentValue(class'xVoting.xVotingHandler'.default.GameConfig[SaveIndex].Options, True);
|
||||
ch_Default.SetComponentValue(string(class'xVoting.xVotingHandler'.default.DefaultGameConfig == SaveIndex), True);
|
||||
|
||||
Split(class'xVoting.xVotingHandler'.default.GameConfig[SaveIndex].Mutators, ",", MutatorArray);
|
||||
for(i=0; i<MutatorArray.Length; i++)
|
||||
lb_Mutator.List.Find(MutatorArray[i],False,True); // bExtra
|
||||
|
||||
bChanged = False;
|
||||
|
||||
}
|
||||
|
||||
function int GameIndex()
|
||||
{
|
||||
local string GameClass;
|
||||
local int i;
|
||||
|
||||
GameClass = co_GameClass.GetExtra();
|
||||
for(i=0; i<GameTypes.Length; i++)
|
||||
if(GameTypes[i].ClassName == GameClass)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function FieldChange(GUIComponent Sender)
|
||||
{
|
||||
local int i,j;
|
||||
|
||||
bChanged=True;
|
||||
|
||||
if(Sender == co_GameClass)
|
||||
{
|
||||
i = GameIndex();
|
||||
|
||||
for (j=0;j<GameTypes.Length;j++)
|
||||
if ( GameTypes[j].GameName == ed_GameTitle.GetText() )
|
||||
{
|
||||
ed_GameTitle.SetComponentValue(GameTypes[i].GameName, True);
|
||||
lb_GameConfigList.List.SetItemAtIndex(ListIndex,GameTypes[i].GameName);
|
||||
}
|
||||
|
||||
ed_Acronym.SetComponentValue(GameTypes[i].GameAcronym, True);
|
||||
ed_Prefix.SetComponentValue(GameTypes[i].MapPrefix, True);
|
||||
|
||||
}
|
||||
else if (Sender == ed_GameTitle)
|
||||
{
|
||||
if (ListIndex!=-1)
|
||||
lb_GameConfigList.List.SetItemAtIndex(ListIndex,ed_GameTitle.GetText());
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool SaveChange()
|
||||
{
|
||||
local int i;
|
||||
|
||||
if (!bChanged)
|
||||
return true;
|
||||
|
||||
if( SaveIndex == -1 ) // Adding new record
|
||||
{
|
||||
i = class'xVoting.xVotingHandler'.default.GameConfig.Length;
|
||||
class'xVoting.xVotingHandler'.default.GameConfig.Length = i + 1;
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].GameClass = co_GameClass.GetExtra();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].GameName = ed_GameTitle.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Acronym = ed_Acronym.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Prefix = ed_Prefix.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Options = ed_Parameter.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Mutators = lb_Mutator.List.GetExtra();
|
||||
if( bool(ch_Default.GetComponentValue()) )
|
||||
class'xVoting.xVotingHandler'.default.DefaultGameConfig = i;
|
||||
class'xVoting.xVotingHandler'.static.StaticSaveConfig();
|
||||
SaveIndex = i;
|
||||
lb_GameconfigList.List.SetExtraAtIndex(ListIndex,""$SaveIndex);
|
||||
}
|
||||
else // modification of existing record
|
||||
{
|
||||
i = SaveIndex;
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].GameClass = co_GameClass.GetExtra();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].GameName = ed_GameTitle.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Acronym = ed_Acronym.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Prefix = ed_Prefix.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Options = ed_Parameter.GetComponentValue();
|
||||
class'xVoting.xVotingHandler'.default.GameConfig[i].Mutators = lb_Mutator.List.GetExtra();
|
||||
if( bool(ch_Default.GetComponentValue()) )
|
||||
class'xVoting.xVotingHandler'.default.DefaultGameConfig = i;
|
||||
class'xVoting.xVotingHandler'.static.StaticSaveConfig();
|
||||
}
|
||||
bChanged=False;
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool NewButtonClick(GUIComponent Sender)
|
||||
{
|
||||
local int i;
|
||||
|
||||
SaveChange();
|
||||
|
||||
i = GameIndex();
|
||||
|
||||
lb_GameConfigList.List.bNotify = false;
|
||||
lb_GameConfigList.List.Insert(0,"** New **",,"-1",true);
|
||||
lb_GameConfigList.List.bNotify = true;
|
||||
ed_GameTitle.SetComponentValue("** New **", True);
|
||||
ed_Acronym.SetComponentValue(GameTypes[i].GameAcronym, True);
|
||||
ed_Prefix.SetComponentValue(GameTypes[i].MapPrefix, True);
|
||||
ed_Parameter.SetComponentValue("", True);
|
||||
ch_Default.SetComponentValue("False", True);
|
||||
LoadMutators();
|
||||
|
||||
ListIndex = 0;
|
||||
SaveIndex = -1;
|
||||
|
||||
bChanged = true;
|
||||
|
||||
EnableComponent(co_GameClass);
|
||||
EnableComponent(ed_GameTitle);
|
||||
EnableComponent(ed_Acronym);
|
||||
EnableComponent(ed_Prefix);
|
||||
EnableComponent(ed_Parameter);
|
||||
EnableComponent(lb_Mutator);
|
||||
EnableComponent(ch_Default);
|
||||
EnableComponent(b_Delete);
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool DeleteButtonClick(GUIComponent Sender)
|
||||
{
|
||||
local int i,x;
|
||||
|
||||
if (SaveIndex>=0)
|
||||
{
|
||||
class'xVoting.xVotingHandler'.default.GameConfig.Remove(SaveIndex,1);
|
||||
class'xVoting.xVotingHandler'.static.StaticSaveConfig();
|
||||
}
|
||||
|
||||
if (ListIndex>=0)
|
||||
{
|
||||
|
||||
for (i=0;i<lb_GameConfigList.List.ItemCount;i++)
|
||||
{
|
||||
x = int (lb_GameConfigList.List.GetExtraAtIndex(i));
|
||||
if ( x > SaveIndex )
|
||||
lb_GameconfigList.List.SetExtraAtIndex(i,""$(x-1));
|
||||
}
|
||||
|
||||
lb_GameConfigList.List.Remove(ListIndex,1);
|
||||
}
|
||||
|
||||
SaveIndex = -1;
|
||||
ListIndex = -1;
|
||||
|
||||
if (lb_GameConfigList.List.ItemCount==0)
|
||||
{
|
||||
DisableComponent(b_Delete);
|
||||
co_GameClass.SetIndex(-1);
|
||||
ed_GameTitle.SetComponentValue("", True);
|
||||
ed_Acronym.SetComponentValue("", True);
|
||||
ed_Prefix.SetComponentValue("", True);
|
||||
ed_Parameter.SetComponentValue("", True);
|
||||
ch_Default.SetComponentValue("False", True);
|
||||
|
||||
DisableComponent(co_GameClass);
|
||||
DisableComponent(ed_GameTitle);
|
||||
DisableComponent(ed_Acronym);
|
||||
DisableComponent(ed_Prefix);
|
||||
DisableComponent(ed_Parameter);
|
||||
DisableComponent(lb_Mutator);
|
||||
DisableComponent(ch_Default);
|
||||
bChanged=false;
|
||||
}
|
||||
else
|
||||
lb_GameConfigList.List.SetIndex(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
OnOpen=InternalOnOpen
|
||||
|
||||
Begin Object class=AltSectionBackground name=SBList
|
||||
Caption="GameTypes"
|
||||
WinWidth=0.377929
|
||||
WinHeight=0.753907
|
||||
WinLeft=0.042969
|
||||
WinTop=0.044272
|
||||
bFillClient=true
|
||||
End Object
|
||||
sb_List=SBList
|
||||
|
||||
Begin Object class=ALtSectionBackground name=SBList2
|
||||
Caption="Mutators"
|
||||
//HeaderBase=Texture'InterfaceArt_tex.Menu.changeme_texture' //material'2K4Menus.NewControls.Display2'
|
||||
WinWidth=0.451250
|
||||
WinHeight=0.295899
|
||||
WinLeft=0.483359
|
||||
WinTop=0.540159
|
||||
TopPadding=0.1
|
||||
BottomPadding=0.1
|
||||
LeftPadding=0.0
|
||||
RightPadding=0.0
|
||||
RenderWeight=0.49;
|
||||
End Object
|
||||
sb_List2=SBList2
|
||||
|
||||
Begin Object Class=GUIListBox Name=GameConfigListBox
|
||||
Hint="Select a game configuration to edit or delete."
|
||||
WinWidth=0.344087
|
||||
WinHeight=0.727759
|
||||
WinLeft=0.626758
|
||||
WinTop=0.160775
|
||||
TabOrder=0
|
||||
bVisibleWhenEmpty=true
|
||||
End Object
|
||||
lb_GameConfigList = GameConfigListBox
|
||||
|
||||
Begin Object class=GUIButton Name=NewButton
|
||||
Caption="New"
|
||||
Hint="Create a new game configuration."
|
||||
StyleName="SquareButton"
|
||||
TabOrder=1
|
||||
OnClick=NewButtonClick
|
||||
WinWidth=0.158281
|
||||
WinLeft=0.060047
|
||||
WinTop=0.913925
|
||||
End Object
|
||||
b_New=NewButton
|
||||
|
||||
Begin Object class=GUIButton Name=DeleteButton
|
||||
Caption="Delete"
|
||||
Hint="Delete the selected game configuration."
|
||||
StyleName="SquareButton"
|
||||
TabOrder=2
|
||||
OnClick=DeleteButtonClick
|
||||
WinWidth=0.159531
|
||||
WinLeft=0.268403
|
||||
WinTop=0.913925
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
b_Delete=DeleteButton
|
||||
|
||||
Begin Object Class=moEditBox Name=GameTitleEditBox
|
||||
Caption = "Game Title"
|
||||
Hint="Enter a custom game configuration title."
|
||||
TabOrder=3
|
||||
WinWidth=0.592970
|
||||
WinHeight=0.074249
|
||||
WinLeft=0.028955
|
||||
WinTop=0.223844
|
||||
CaptionWidth=0.4
|
||||
ComponentWidth=0.6
|
||||
OnChange=FieldChange
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
ed_GameTitle = GameTitleEditBox
|
||||
|
||||
|
||||
Begin Object Class=moComboBox Name=GameClassComboBox
|
||||
Caption = "Game Class"
|
||||
Hint="Select a game type for the select game configuration."
|
||||
TabOrder=4
|
||||
WinWidth=0.592970
|
||||
WinHeight=0.076855
|
||||
WinLeft=0.028955
|
||||
WinTop=0.136135
|
||||
CaptionWidth=0.4
|
||||
ComponentWidth=0.6
|
||||
OnChange=FieldChange
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
co_GameClass = GameClassComboBox
|
||||
|
||||
Begin Object Class=moEditBox Name=AcronymEditBox
|
||||
//Caption = "Acronym"
|
||||
Caption = "Abbreviation"
|
||||
Hint="A short abbreviation, description, or acronym that identifies the game configuration. This will be appended to the map name in vote messages."
|
||||
TabOrder=5
|
||||
WinWidth=0.592970
|
||||
WinHeight=0.076855
|
||||
WinLeft=0.028955
|
||||
WinTop=0.306343
|
||||
CaptionWidth=0.4
|
||||
ComponentWidth=0.6
|
||||
OnChange=FieldChange
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
ed_Acronym = AcronymEditBox
|
||||
|
||||
Begin Object Class=moEditBox Name=PrefixEditBox
|
||||
Caption = "Map Prefixes"
|
||||
Hint="List of map name prefixes. Separate each with commas."
|
||||
WinWidth=0.592970
|
||||
WinHeight=0.074249
|
||||
WinLeft=0.028955
|
||||
WinTop=0.393185
|
||||
TabOrder=6
|
||||
CaptionWidth=0.4
|
||||
ComponentWidth=0.6
|
||||
OnChange=FieldChange
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
ed_Prefix = PrefixEditBox
|
||||
|
||||
Begin Object Class=moEditBox Name=ParameterEditBox
|
||||
Caption = "Parameters"
|
||||
Hint="(Advanced) List of game parameters with values. Separated each with a comma. (ex. GoalScore=4,MinPlayers=4)"
|
||||
WinWidth=0.490431
|
||||
WinHeight=0.030000
|
||||
WinLeft=0.077783
|
||||
WinTop=0.826949
|
||||
CaptionWidth=0.4
|
||||
TabOrder=7
|
||||
ComponentWidth=0.6
|
||||
OnChange=FieldChange
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
ed_Parameter = ParameterEditBox
|
||||
|
||||
Begin Object class=moCheckbox Name=DefaultCheckBox
|
||||
Caption="Default"
|
||||
Hint="The selected game configuration will be the default if all the players leave the server"
|
||||
CaptionWidth=0.8
|
||||
ComponentWidth=0.2
|
||||
OnChange=FieldChange
|
||||
TabOrder=8
|
||||
WinWidth=0.194922
|
||||
WinHeight=0.030000
|
||||
WinLeft=0.659814
|
||||
WinTop=0.826949
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
ch_Default = DefaultCheckBox
|
||||
|
||||
|
||||
Begin Object Class=MultiSelectListBox Name=MutatorListBox
|
||||
Hint="Select each mutator that should be loaded with this game configuration."
|
||||
WinWidth=0.396485
|
||||
WinHeight=0.315234
|
||||
WinLeft=0.224267
|
||||
WinTop=0.484369
|
||||
TabOrder=9
|
||||
bVisibleWhenEmpty=true
|
||||
OnChange=FieldChange
|
||||
MenuState=MSAT_Disabled
|
||||
End Object
|
||||
lb_Mutator = MutatorListBox
|
||||
|
||||
Background=None
|
||||
|
||||
bAcceptsInput=false
|
||||
|
||||
WinWidth=0.917187
|
||||
WinHeight=0.885075
|
||||
WinLeft=0.041015
|
||||
WinTop=0.031510
|
||||
|
||||
DefaultWidth=0.917187
|
||||
DefaultHeight=0.885075
|
||||
DefaultLeft=0.041015
|
||||
DefaultTop=0.031510
|
||||
|
||||
WindowName="Map Voting Game Configuration"
|
||||
|
||||
lmsgNew="New"
|
||||
lmsgAdd="Add"
|
||||
|
||||
ListIndex=-1;
|
||||
SaveIndex=-1;
|
||||
|
||||
}
|
||||
|
||||
44
kf_sources/XVoting/Classes/MapVoteHistory.uc
Normal file
44
kf_sources/XVoting/Classes/MapVoteHistory.uc
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteHistory
|
||||
//
|
||||
// Interface class used for saving map voting stats/history data.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
//class MapVoteHistory extends Info DependsOn(VotingHandler);
|
||||
class MapVoteHistory extends Object DependsOn(VotingHandler);
|
||||
|
||||
// This class is used by the VotingHandler to keep track of stats about maps
|
||||
// that have been played on the server. The MapHistoryInfo data structure is
|
||||
// used to copy data in/out of this class.
|
||||
//struct MapHistoryInfo
|
||||
//{
|
||||
// var string M; // MapName - Used short/single character var names to keep ini file smaller
|
||||
// var int P; // Play count. Number of times map has been played
|
||||
// var int S; // Sequence. The order in which the map was played
|
||||
// var string G; // per map game options
|
||||
// var string U; // per map mutators
|
||||
//};
|
||||
|
||||
// This class is meant to be inherited and functions implemented in the subclass.
|
||||
// You can create subclasses in separate packages and then
|
||||
// "plug-in" your subclass using the MapVoteHistoryType ini config setting in the VotingHandler.
|
||||
// Examples: MapVoteHistoryType=Engine.MapVoteHistoryA // default
|
||||
// MapVoteHistoryType=MyPackage.MapVoteHistory_ODBC
|
||||
// MapVoteHistoryType=MyOtherPackage.MapVoteHistory_XML
|
||||
|
||||
function AddMap(VotingHandler.MapHistoryInfo MapInfo); // add (or update if already exists) map to
|
||||
// the history data store.
|
||||
function RemoveMap(string MapName); // remove a map from the history data store
|
||||
|
||||
function VotingHandler.MapHistoryInfo GetMapHistory(string MapName); // retrieve map info by MapName
|
||||
function VotingHandler.MapHistoryInfo GetMapBySeq(int SeqNum); // retrieve map info by Sequence number
|
||||
function VotingHandler.MapHistoryInfo GetLeastPlayedMap(); // retrieve least played map info
|
||||
function VotingHandler.MapHistoryInfo GetMostPlayedMap(); // retrieve most played map info
|
||||
|
||||
function VotingHandler.MapHistoryInfo PlayMap(string MapName); // increment maps playcount and set sequence to 1
|
||||
// also returns map info to caller
|
||||
function Save(); // save data changes to history data store
|
||||
|
||||
266
kf_sources/XVoting/Classes/MapVoteHistory_INI.uc
Normal file
266
kf_sources/XVoting/Classes/MapVoteHistory_INI.uc
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteHistory_INI
|
||||
//
|
||||
// Used to save map stats/history data to an ini file. Subclasses
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2002, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class MapVoteHistory_INI extends MapVoteHistory DependsOn(VotingHandler)
|
||||
Config(MapVoteHistory) PerObjectConfig;
|
||||
|
||||
var config array<VotingHandler.MapHistoryInfo> H; // array used to store map data
|
||||
var config int LastMapIndex;
|
||||
var bool bUpdated;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddMap(VotingHandler.MapHistoryInfo MapInfo)
|
||||
{
|
||||
local int x;
|
||||
|
||||
if(MapInfo.M == "")
|
||||
return;
|
||||
|
||||
bUpdated = true;
|
||||
|
||||
if(LastMapIndex == -1) // brand new list
|
||||
{
|
||||
H.Insert(0,1);
|
||||
H[0].M = MapInfo.M; // add new map
|
||||
H[0].P = 0;
|
||||
H[0].S = 0;
|
||||
H[0].G = MapInfo.G;
|
||||
H[0].U = MapInfo.U;
|
||||
LastMapIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// search list for map
|
||||
for(x=0; x<=LastMapIndex; x++)
|
||||
{
|
||||
if(MapInfo.M ~= H[x].M) // found map
|
||||
{
|
||||
H[x].G = MapInfo.G;
|
||||
H[x].U = MapInfo.U;
|
||||
return;
|
||||
}
|
||||
|
||||
if(Caps(H[x].M) > Caps(MapInfo.M)) // MapName is not in array and should be inserted here
|
||||
{
|
||||
H.Insert(x,1);
|
||||
LastMapIndex++;
|
||||
H[x].M = MapInfo.M;
|
||||
H[x].P = 0;
|
||||
H[x].S = 0;
|
||||
H[x].G = MapInfo.G;
|
||||
H[x].U = MapInfo.U;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// didnt find insertion point so add at end
|
||||
LastMapIndex++;
|
||||
H.Insert(LastMapIndex,1);
|
||||
H[LastMapIndex].M = MapInfo.M;
|
||||
H[LastMapIndex].P = 0;
|
||||
H[LastMapIndex].S = 0;
|
||||
H[LastMapIndex].G = MapInfo.G;
|
||||
H[LastMapIndex].U = MapInfo.U;
|
||||
return;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function VotingHandler.MapHistoryInfo PlayMap(string MapName)
|
||||
{
|
||||
local int x,y;
|
||||
local bool bFound;
|
||||
local VotingHandler.MapHistoryInfo MapInfo;
|
||||
|
||||
if(MapName == "")
|
||||
return MapInfo;
|
||||
|
||||
bUpdated = true;
|
||||
|
||||
if(LastMapIndex > H.Length - 1)
|
||||
LastMapIndex = H.Length - 1;
|
||||
|
||||
if(LastMapIndex == -1) // brand new list
|
||||
{
|
||||
H.Insert(0,1);
|
||||
H[0].M = MapName; // add new map
|
||||
H[0].P = 1;
|
||||
H[0].S = 1;
|
||||
H[0].G = "";
|
||||
H[0].U = "";
|
||||
LastMapIndex = 0;
|
||||
MapInfo = H[0];
|
||||
return MapInfo;
|
||||
}
|
||||
|
||||
bFound = false;
|
||||
for(x=0; x<=LastMapIndex; x++)
|
||||
{
|
||||
if(MapName ~= H[x].M) // found map
|
||||
{
|
||||
H[x].S=1; // Set sequence (last 1 map played)
|
||||
H[x].P++; // increment Play count
|
||||
MapInfo = H[x]; // save data to return to caller
|
||||
bFound=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(H[x].S > 0) // -1 indicates not to every play this map, 0 is a map that has never been played
|
||||
H[x].S++; // increment the sequence of all maps to make room for # 1
|
||||
}
|
||||
|
||||
if(Caps(H[x].M) > Caps(MapName) && !bFound) // MapName is not in array and should be inserted here
|
||||
{
|
||||
H.Insert(x,1);
|
||||
LastMapIndex++;
|
||||
for(y=LastMapIndex; y>x; y--)
|
||||
{
|
||||
if(H[y].S > 0)
|
||||
H[y].S++;
|
||||
}
|
||||
H[x].M = MapName; // add new map
|
||||
H[x].P = 1;
|
||||
H[x].S = 1;
|
||||
H[x].G = "";
|
||||
H[x].U = "";
|
||||
MapInfo = H[x];
|
||||
return MapInfo;
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound) // didnt find insertion point so add at end
|
||||
{
|
||||
LastMapIndex++;
|
||||
H.Insert(LastMapIndex,1);
|
||||
H[LastMapIndex].M = MapName;
|
||||
H[LastMapIndex].P = 1;
|
||||
H[LastMapIndex].S = 1;
|
||||
H[LastMapIndex].G = "";
|
||||
H[LastMapIndex].U = "";
|
||||
MapInfo = H[LastMapIndex];
|
||||
}
|
||||
return MapInfo;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function VotingHandler.MapHistoryInfo GetMapHistory(string MapName)
|
||||
{
|
||||
local int Index;
|
||||
local VotingHandler.MapHistoryInfo MapInfo;
|
||||
|
||||
Index = FindIndex(MapName);
|
||||
if(Index > -1 && Index < H.Length)
|
||||
{
|
||||
MapInfo = H[Index];
|
||||
}
|
||||
return MapInfo;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Save()
|
||||
{
|
||||
if(bUpdated)
|
||||
SaveConfig();
|
||||
bUpdated = false;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function RemoveOldestMap()
|
||||
{
|
||||
local int x,Lowest;
|
||||
|
||||
bUpdated = true;
|
||||
|
||||
// scan the list for the oldest played map
|
||||
Lowest = 1;
|
||||
for(x=2; x<=LastMapIndex; x++)
|
||||
{
|
||||
if(H[x].S < H[Lowest].S)
|
||||
Lowest = x;
|
||||
}
|
||||
RemoveMapByIndex(Lowest);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function RemoveMap(string MapName)
|
||||
{
|
||||
local int Index;
|
||||
|
||||
bUpdated = true;
|
||||
|
||||
Index = FindIndex(MapName);
|
||||
if(Index > 0)
|
||||
RemoveMapByIndex(Index);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function RemoveMapByIndex(int Index)
|
||||
{
|
||||
bUpdated = true;
|
||||
|
||||
H.Remove(Index,1);
|
||||
LastMapIndex--;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function int FindIndex(string MapName)
|
||||
{
|
||||
local int a,b,i;
|
||||
|
||||
// speedy way to find the map if it alread exists
|
||||
//a 7 b
|
||||
//12345678901234568901234567890123456789012345
|
||||
//|----------|----------|----------|----------|
|
||||
//1 < too high
|
||||
//2---------------------b b = ((b - a)/2) + a
|
||||
//3 > too low
|
||||
//4 a----------b a = ((b - a)/2) + a
|
||||
//7 < too high
|
||||
//8 a----b b = ((b - a)/2) + a
|
||||
//9 > too low
|
||||
//10 a--b a = ((b - a)/2) + a
|
||||
//11 > too low
|
||||
//12 a-b
|
||||
//13 > too low
|
||||
//14 ab
|
||||
//15 > too low
|
||||
//16 b a==b
|
||||
|
||||
if(LastMapIndex == -1)
|
||||
return(-1);
|
||||
|
||||
a = 1;
|
||||
b = LastMapIndex+1;
|
||||
|
||||
while(true)
|
||||
{
|
||||
i = ((b-a)/2)+a;
|
||||
if(H[i-1].M ~= MapName) // check for a match
|
||||
return(i-1); // found
|
||||
|
||||
if(a == b) // Not found
|
||||
return(-1);
|
||||
|
||||
if(Caps(H[i-1].M) > Caps(MapName)) //check mid-way
|
||||
b = i; // too high
|
||||
else
|
||||
{
|
||||
if(a == i)
|
||||
a = b;
|
||||
else
|
||||
a = i; // too low
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Swap(int a,int b)
|
||||
{
|
||||
local VotingHandler.MapHistoryInfo MapInfo;
|
||||
|
||||
MapInfo = H[a];
|
||||
H[a] = H[b];
|
||||
H[b] = MapInfo;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
LastMapIndex=-1
|
||||
}
|
||||
|
||||
184
kf_sources/XVoting/Classes/MapVoteMapListConfigPage.uc
Normal file
184
kf_sources/XVoting/Classes/MapVoteMapListConfigPage.uc
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteMapListConfigPage
|
||||
//
|
||||
// this page allows modification of the DefaultMapListLoader
|
||||
// configuration variables that could not be
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MapVoteMapListConfigPage extends GUICustomPropertyPage DependsOn(VotingHandler);
|
||||
|
||||
var automated GUIButton b_Return;
|
||||
var automated moCheckBox ch_UseMapList;
|
||||
var automated moEditBox ed_MapListPrefix;
|
||||
var automated MultiSelectListBox lb_MapList;
|
||||
var localized string sbCaption;
|
||||
var array<CacheManager.GameRecord> GameTypes;
|
||||
// autosave
|
||||
var bool bChanged;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
local int i;
|
||||
|
||||
Super.Initcomponent(MyController, MyOwner);
|
||||
|
||||
// load game types
|
||||
class'CacheManager'.static.GetGameTypeList(GameTypes);
|
||||
|
||||
ch_UseMapList.SetComponentValue(string(class'xVoting.DefaultMapListLoader'.default.bUseMapList));
|
||||
if( class'xVoting.DefaultMapListLoader'.default.bUseMapList )
|
||||
{
|
||||
DisableComponent(ed_MapListPrefix);
|
||||
EnableComponent(lb_MapList);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableComponent(ed_MapListPrefix);
|
||||
DisableComponent(lb_MapList);
|
||||
}
|
||||
ed_MapListPrefix.SetComponentValue(class'xVoting.DefaultMapListLoader'.default.MapNamePrefixes);
|
||||
LoadMapLists();
|
||||
|
||||
for(i=0; i<class'xVoting.DefaultMapListLoader'.default.MapListTypeList.Length; i++)
|
||||
lb_MapList.List.Find(class'xVoting.DefaultMapListLoader'.default.MapListTypeList[i],False,True);
|
||||
|
||||
sb_Main.SetPosition(0.040000,0.146615,0.553789,0.507031);
|
||||
|
||||
sb_Main.ManageComponent(lb_MapList);
|
||||
sb_Main.bFillClient=true;
|
||||
sb_Main.Caption = sbCaption;
|
||||
b_Ok.OnClick=OkClick;
|
||||
|
||||
bChanged = False;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//function InternalOnOpen()
|
||||
//{
|
||||
//}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadMapLists()
|
||||
{
|
||||
local int i;
|
||||
|
||||
lb_MapList.List.Clear();
|
||||
for(i=0; i<GameTypes.Length; i++)
|
||||
lb_MapList.List.Add(GameTypes[i].GameName $ " MapList", none, GameTypes[i].MapListClassName);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function UseMapList_Change(GUIComponent Sender)
|
||||
{
|
||||
bChanged=True;
|
||||
if( bool(ch_UseMapList.GetComponentValue()) )
|
||||
{
|
||||
DisableComponent(ed_MapListPrefix);
|
||||
EnableComponent(lb_MapList);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableComponent(ed_MapListPrefix);
|
||||
DisableComponent(lb_MapList);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function MapListChange(GUIComponent Sender)
|
||||
{
|
||||
bChanged=True;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SaveChange()
|
||||
{
|
||||
local int i;
|
||||
local string SelectedMapLists;
|
||||
local array<string> MapListArray;
|
||||
|
||||
if( bChanged )
|
||||
{
|
||||
SelectedMapLists = lb_MapList.List.GetExtra();
|
||||
Split(SelectedMapLists, ",", MapListArray);
|
||||
class'xVoting.DefaultMapListLoader'.default.MapListTypeList.Length = MapListArray.Length;
|
||||
for(i=0; i<MapListArray.Length; i++)
|
||||
class'xVoting.DefaultMapListLoader'.default.MapListTypeList[i] = MapListArray[i];
|
||||
class'xVoting.DefaultMapListLoader'.default.bUseMapList = bool(ch_UseMapList.GetComponentValue());
|
||||
class'xVoting.DefaultMapListLoader'.default.MapNamePrefixes = ed_MapListPrefix.GetComponentValue();
|
||||
class'xVoting.DefaultMapListLoader'.static.StaticSaveConfig();
|
||||
bChanged=False;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool OkClick(GUIComponent Sender)
|
||||
{
|
||||
SaveChange();
|
||||
Controller.CloseMenu(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object class=moCheckbox Name=MapListCheckBox
|
||||
Caption="Use Map Cycle List"
|
||||
Hint="Load map names from the specified maps lists or using the prefix."
|
||||
TabOrder=0
|
||||
CaptionWidth=0.8
|
||||
ComponentWidth=0.2
|
||||
//LabelStyleName="DarkTextLabel"
|
||||
OnChange=UseMapList_Change
|
||||
WinWidth=0.543576
|
||||
WinHeight=0.037500
|
||||
WinLeft=0.227792
|
||||
WinTop=0.087519
|
||||
bScaleToParent=true
|
||||
bBoundToParent=True
|
||||
End Object
|
||||
ch_UseMapList = MapListCheckBox
|
||||
|
||||
Begin Object Class=MultiSelectListBox Name=MapListListBox
|
||||
Hint="Select each maplist type to load map names from."
|
||||
WinWidth=0.553789
|
||||
WinHeight=0.507031
|
||||
WinLeft=0.040000
|
||||
WinTop=0.146615
|
||||
TabOrder=1
|
||||
bVisibleWhenEmpty=true
|
||||
OnChange=MapListChange
|
||||
bScaleToParent=true
|
||||
bBoundToParent=True
|
||||
End Object
|
||||
lb_MapList = MapListListBox
|
||||
|
||||
Begin Object Class=moEditBox Name=MapListLoaderPrefixEditBox
|
||||
Caption = "Map Prefixes"
|
||||
Hint="List of map name prefixes. If more than one separate each with commas."
|
||||
TabOrder=2
|
||||
WinWidth=0.787323
|
||||
WinHeight=0.037500
|
||||
WinLeft=0.108671
|
||||
WinTop=0.812161
|
||||
CaptionWidth=0.4
|
||||
ComponentWidth=0.6
|
||||
//LabelStyleName = "DarkTextLabel"
|
||||
OnChange=MapListChange
|
||||
bScaleToParent=true
|
||||
bBoundToParent=True
|
||||
End Object
|
||||
ed_MapListPrefix = MapListLoaderPrefixEditBox
|
||||
|
||||
Background=None
|
||||
|
||||
WindowName="Map Voting List Configuration"
|
||||
|
||||
bAcceptsInput=false
|
||||
WinWidth=0.6
|
||||
WinHeight=0.8
|
||||
WinLeft=0.2
|
||||
WinTop=0.1
|
||||
|
||||
DefaultWidth=0.6
|
||||
DefaultHeight=0.8
|
||||
DefaultLeft=0.2
|
||||
DefaultTop=0.1
|
||||
|
||||
sbCaption="Map Cycle List"
|
||||
}
|
||||
|
||||
170
kf_sources/XVoting/Classes/MapVoteMultiColumnList.uc
Normal file
170
kf_sources/XVoting/Classes/MapVoteMultiColumnList.uc
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteMultiColumnList
|
||||
//
|
||||
// Multi-Column list box used to display maps and game types.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class MapVoteMultiColumnList extends GUIMultiColumnList;
|
||||
|
||||
var VotingReplicationInfo VRI;
|
||||
var array<int> MapVoteData;
|
||||
var int PrevSortColumn;
|
||||
var GUIStyles SelStyle;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
Super.InitComponent(MyController, MyOwner);
|
||||
|
||||
SelStyle = Controller.GetStyle("SquareButton",FontScale);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadList(VotingReplicationInfo LoadVRI, int GameTypeIndex)
|
||||
{
|
||||
local int m,p,l;
|
||||
local array<string> PrefixList;
|
||||
|
||||
VRI = LoadVRI;
|
||||
|
||||
Split(VRI.GameConfig[GameTypeIndex].Prefix, ",", PrefixList);
|
||||
for( m=0; m<VRI.MapList.Length; m++)
|
||||
{
|
||||
for( p=0; p<PreFixList.Length; p++)
|
||||
{
|
||||
if( left(VRI.MapList[m].MapName, len(PrefixList[p])) ~= PrefixList[p] )
|
||||
{
|
||||
l = MapVoteData.Length;
|
||||
MapVoteData.Insert(l,1);
|
||||
MapVoteData[l] = m;
|
||||
AddedItem();
|
||||
break;
|
||||
}
|
||||
} //p
|
||||
} //m
|
||||
OnDrawItem = DrawItem;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Clear()
|
||||
{
|
||||
MapVoteData.Remove(0,MapVoteData.Length);
|
||||
ItemCount = 0;
|
||||
Super.Clear();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function int GetSelectedMapIndex()
|
||||
{
|
||||
return MapVoteData[SortData[Index].SortItem];
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function string GetSelectedMapName()
|
||||
{
|
||||
if( Index > -1 )
|
||||
return VRI.MapList[MapVoteData[SortData[Index].SortItem]].MapName;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function DrawItem(Canvas Canvas, int i, float X, float Y, float W, float H, bool bSelected, bool bPending)
|
||||
{
|
||||
local float CellLeft, CellWidth;
|
||||
local eMenuState MState;
|
||||
local GUIStyles DrawStyle;
|
||||
|
||||
if( VRI == none )
|
||||
return;
|
||||
|
||||
// Draw the drag-n-drop outline
|
||||
if (bPending && OutlineStyle != None && (bDropSource || bDropTarget) )
|
||||
{
|
||||
if ( OutlineStyle.Images[MenuState] != None )
|
||||
{
|
||||
OutlineStyle.Draw(Canvas, MenuState, ClientBounds[0], Y, ClientBounds[2] - ClientBounds[0], ItemHeight);
|
||||
if (DropState == DRP_Source && i != DropIndex)
|
||||
OutlineStyle.Draw(Canvas, MenuState, Controller.MouseX - MouseOffset[0], Controller.MouseY - MouseOffset[1] + Y - ClientBounds[1], MouseOffset[2] + MouseOffset[0], ItemHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the selection border
|
||||
if( bSelected )
|
||||
{
|
||||
SelectedStyle.Draw(Canvas,MenuState, X, Y-2, W, H+2 );
|
||||
DrawStyle = SelectedStyle;
|
||||
}
|
||||
else
|
||||
DrawStyle = Style;
|
||||
|
||||
if( !VRI.MapList[MapVoteData[SortData[i].SortItem]].bEnabled )
|
||||
MState = MSAT_Disabled;
|
||||
else
|
||||
MState = MenuState;
|
||||
|
||||
GetCellLeftWidth( 0, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
VRI.MapList[MapVoteData[SortData[i].SortItem]].MapName, FontScale );
|
||||
|
||||
GetCellLeftWidth( 1, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
string(VRI.MapList[MapVoteData[SortData[i].SortItem]].PlayCount), FontScale );
|
||||
|
||||
GetCellLeftWidth( 2, CellLeft, CellWidth );
|
||||
DrawStyle.DrawText( Canvas, MState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
string(VRI.MapList[MapVoteData[SortData[i].SortItem]].Sequence), FontScale );
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function string GetSortString( int i )
|
||||
{
|
||||
local string ColumnData[5];
|
||||
|
||||
ColumnData[0] = left(Caps(VRI.MapList[MapVoteData[i]].MapName),20);
|
||||
ColumnData[1] = right("000000" $ VRI.MapList[MapVoteData[i]].PlayCount,6);
|
||||
ColumnData[2] = right("000000" $ VRI.MapList[MapVoteData[i]].Sequence,6);
|
||||
|
||||
return ColumnData[SortColumn] $ ColumnData[PrevSortColumn];
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
event OnSortChanged()
|
||||
{
|
||||
Super.OnSortChanged();
|
||||
PrevSortColumn = SortColumn;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Free()
|
||||
{
|
||||
VRI = none;
|
||||
super.Free();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnEndDrag(GUIComponent Accepting, bool bAccepted)
|
||||
{
|
||||
if (bAccepted && Accepting != None)
|
||||
OnDblClick(Self);
|
||||
|
||||
SetOutlineAlpha(255);
|
||||
if ( bNotify )
|
||||
CheckLinkedObjects(Self);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
ColumnHeadings(0)="Map Name"
|
||||
ColumnHeadings(1)="Played"
|
||||
ColumnHeadings(2)="Seq"
|
||||
|
||||
InitColumnPerc(0)=0.6
|
||||
InitColumnPerc(1)=0.2
|
||||
InitColumnPerc(2)=0.2
|
||||
|
||||
SortColumn=0
|
||||
SortDescending=False
|
||||
PrevSortColumn=0
|
||||
|
||||
ColumnHeadingHints(0)="Map Name"
|
||||
ColumnHeadingHints(1)="Number of times the map has been played."
|
||||
ColumnHeadingHints(2)="Sequence, The number of games that have been played since this map was last played."
|
||||
|
||||
StyleName="ServerBrowserGrid"
|
||||
SelectedStyleName="BrowserListSelection"
|
||||
}
|
||||
|
||||
121
kf_sources/XVoting/Classes/MapVoteMultiColumnListBox.uc
Normal file
121
kf_sources/XVoting/Classes/MapVoteMultiColumnListBox.uc
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MapVoteMultiColumnListBox
|
||||
//
|
||||
// Multi-Column list box used to display maps and game types.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MapVoteMultiColumnListBox extends GUIMultiColumnListBox;
|
||||
|
||||
var string MapInfoPage;
|
||||
var array<MapVoteMultiColumnList> ListArray;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnClick(GUIContextMenu Sender, int Index)
|
||||
{
|
||||
local string MapName;
|
||||
|
||||
if (Sender != None)
|
||||
{
|
||||
if ( NotifyContextSelect(Sender, Index) )
|
||||
return;
|
||||
|
||||
switch (Index)
|
||||
{
|
||||
case 0:
|
||||
if( MapVotingPage(MenuOwner) != none )
|
||||
MapVotingPage(MenuOwner).SendVote(self);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
MapName = MapVoteMultiColumnList(List).GetSelectedMapName();
|
||||
Controller.OpenMenu( MapInfoPage, MapName );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadList(VotingReplicationInfo LoadVRI)
|
||||
{
|
||||
local int i,g;
|
||||
|
||||
ListArray.Length = LoadVRI.GameConfig.Length;
|
||||
for( i=0; i<LoadVRI.GameConfig.Length; i++)
|
||||
{
|
||||
ListArray[i] = new class'MapVoteMultiColumnList';
|
||||
ListArray[i].LoadList(LoadVRI,i);
|
||||
if( LoadVRI.GameConfig[i].GameClass ~= PlayerOwner().GameReplicationInfo.GameClass )
|
||||
g = i;
|
||||
}
|
||||
ChangeGameType(g);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function ChangeGameType( int GameTypeIndex )
|
||||
{
|
||||
InitBaseList( ListArray[GameTypeIndex] );
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitBaseList(GUIListBase LocalList)
|
||||
{
|
||||
local GUIMultiColumnList L;
|
||||
|
||||
L = GUIMultiColumnList(LocalList);
|
||||
|
||||
if (L == none)
|
||||
return;
|
||||
|
||||
if( List == LocalList )
|
||||
{
|
||||
Header.MyList = List;
|
||||
return;
|
||||
}
|
||||
|
||||
if (List != None)
|
||||
{
|
||||
List.SetTimer(0.0, False);
|
||||
RemoveComponent(List,true);
|
||||
AppendComponent(L,false);
|
||||
List = L;
|
||||
}
|
||||
else
|
||||
{
|
||||
List = L;
|
||||
AppendComponent(L,false);
|
||||
}
|
||||
Header.MyList = List;
|
||||
Super(GUIListBoxBase).InitBaseList(LocalList);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool InternalOnRightClick(GUIComponent Sender)
|
||||
{
|
||||
local int NewIndex;
|
||||
|
||||
NewIndex = List.Top + ( (Controller.MouseY - List.ClientBounds[1]) / List.ItemHeight);
|
||||
if( NewIndex >= List.ItemCount )
|
||||
NewIndex = List.ItemCount - 1;
|
||||
List.SetIndex(NewIndex);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Free()
|
||||
{
|
||||
local int i;
|
||||
for( i=0; i < ListArray.Length; i++ )
|
||||
ListArray[i].VRI = none;
|
||||
super.Free();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object Class=GUIContextMenu Name=RCMenu
|
||||
ContextItems(0)="Vote for this Map"
|
||||
ContextItems(1)="View Screenshot and Description"
|
||||
OnSelect=InternalOnClick
|
||||
End Object
|
||||
ContextMenu=RCMenu
|
||||
|
||||
OnRightClick=InternalOnRightClick
|
||||
MapInfoPage="xVoting.MapInfoPage"
|
||||
DefaultListClass="xVoting.MapVoteMultiColumnList"
|
||||
//DefaultListClass="XInterface.GUIMultiColumnList"
|
||||
}
|
||||
255
kf_sources/XVoting/Classes/MapVotingPage.uc
Normal file
255
kf_sources/XVoting/Classes/MapVotingPage.uc
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
//====================================================================
|
||||
// xVoting.MapVotingPage
|
||||
// Map Voting page.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MapVotingPage extends VotingPage;
|
||||
|
||||
var automated MapVoteMultiColumnListBox lb_MapListBox;
|
||||
var automated MapVoteCountMultiColumnListBox lb_VoteCountListBox;
|
||||
var automated moComboBox co_GameType;
|
||||
var automated GUILabel l_Mode;
|
||||
var automated GUIImage i_MapListBackground, i_MapCountListBackground;
|
||||
|
||||
//if _RO_
|
||||
var GUIComponent LastClickedList;
|
||||
//end _RO_
|
||||
|
||||
// Localization
|
||||
var localized string lmsgMapVotingDisabled, lmsgReplicationNotFinished, lmsgMapDisabled,
|
||||
lmsgTotalMaps, lmsgMode[8];
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnOpen()
|
||||
{
|
||||
local int i, d;
|
||||
|
||||
if( MVRI == none || (MVRI != none && !MVRI.bMapVote) )
|
||||
{
|
||||
Controller.OpenMenu("GUI2K4.GUI2K4QuestionPage");
|
||||
GUIQuestionPage(Controller.TopPage()).SetupQuestion(lmsgMapVotingDisabled, QBTN_Ok, QBTN_Ok);
|
||||
GUIQuestionPage(Controller.TopPage()).OnButtonClick = OnOkButtonClick;
|
||||
return;
|
||||
}
|
||||
|
||||
// check if all maps and gametypes have replicated
|
||||
if( MVRI.GameConfig.Length < MVRI.GameConfigCount || MVRI.MapList.Length < MVRI.MapCount )
|
||||
{
|
||||
Controller.OpenMenu("GUI2K4.GUI2K4QuestionPage");
|
||||
GUIQuestionPage(Controller.TopPage()).SetupQuestion(lmsgReplicationNotFinished, QBTN_Ok, QBTN_Ok);
|
||||
GUIQuestionPage(Controller.TopPage()).OnButtonClick = OnOkButtonClick;
|
||||
return;
|
||||
}
|
||||
|
||||
for( i=0; i<MVRI.GameConfig.Length; i++ )
|
||||
co_GameType.AddItem( MVRI.GameConfig[i].GameName, none, string(i));
|
||||
co_GameType.MyComboBox.List.SortList();
|
||||
|
||||
t_WindowTitle.Caption = t_WindowTitle.Caption@"("$lmsgMode[MVRI.Mode]$")";
|
||||
|
||||
lb_MapListBox.LoadList(MVRI);
|
||||
MapVoteCountMultiColumnList(lb_VoteCountListBox.List).LoadList(MVRI);
|
||||
|
||||
lb_VoteCountListBox.List.OnDblClick = MapListDblClick;
|
||||
lb_VoteCountListBox.List.bDropTarget = True;
|
||||
|
||||
lb_MapListBox.List.OnDblClick = MapListDblClick;
|
||||
lb_MaplistBox.List.bDropSource = True;
|
||||
|
||||
//if _RO_
|
||||
lb_VoteCountListBox.List.OnClick = MapListClick;
|
||||
lb_MapListBox.List.OnClick = MapListClick;
|
||||
//end _RO_
|
||||
|
||||
co_GameType.OnChange = GameTypeChanged;
|
||||
f_Chat.OnSubmit = Submit;
|
||||
|
||||
// set starting gametype to current
|
||||
d = co_GameType.MyComboBox.List.FindExtra(string(MVRI.CurrentGameConfig));
|
||||
if( d > -1 )
|
||||
co_GameType.SetIndex(d);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Submit()
|
||||
{
|
||||
//if _RO_
|
||||
SendVote(LastClickedList);
|
||||
//else
|
||||
// SendVote(none);
|
||||
//end _RO_
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function GameTypeChanged(GUIComponent Sender)
|
||||
{
|
||||
local int GameTypeIndex;
|
||||
|
||||
GameTypeIndex = int(co_GameType.GetExtra());
|
||||
if( GameTypeIndex > -1 )
|
||||
{
|
||||
lb_MapListBox.ChangeGameType( GameTypeIndex );
|
||||
lb_MapListBox.List.OnDblClick = MapListDblClick;
|
||||
|
||||
//if _RO_
|
||||
lb_MapListBox.List.OnClick = MapListClick;
|
||||
//end _RO_
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function OnOkButtonClick(byte bButton) // triggered by th GUIQuestionPage Ok Button
|
||||
{
|
||||
Controller.CloseMenu(true);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function UpdateMapVoteCount(int UpdatedIndex, bool bRemoved)
|
||||
{
|
||||
MapVoteCountMultiColumnList(lb_VoteCountListBox.List).UpdatedVoteCount(UpdatedIndex, bRemoved);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//if _RO_
|
||||
function bool MapListClick(GUIComponent Sender)
|
||||
{
|
||||
LastClickedList = Sender;
|
||||
return GUIVertList(Sender).InternalOnClick(Sender);
|
||||
}
|
||||
//end _RO_
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool MapListDblClick(GUIComponent Sender)
|
||||
{
|
||||
SendVote(Sender);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SendVote(GUIComponent Sender)
|
||||
{
|
||||
local int MapIndex,GameConfigIndex;
|
||||
|
||||
if( Sender == lb_VoteCountListBox.List )
|
||||
{
|
||||
MapIndex = MapVoteCountMultiColumnList(lb_VoteCountListBox.List).GetSelectedMapIndex();
|
||||
if( MapIndex > -1)
|
||||
{
|
||||
GameConfigIndex = MapVoteCountMultiColumnList(lb_VoteCountListBox.List).GetSelectedGameConfigIndex();
|
||||
if(MVRI.MapList[MapIndex].bEnabled || PlayerOwner().PlayerReplicationInfo.bAdmin)
|
||||
MVRI.SendMapVote(MapIndex,GameConfigIndex);
|
||||
else
|
||||
PlayerOwner().ClientMessage(lmsgMapDisabled);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MapIndex = MapVoteMultiColumnList(lb_MapListBox.List).GetSelectedMapIndex();
|
||||
if( MapIndex > -1)
|
||||
{
|
||||
GameConfigIndex = int(co_GameType.GetExtra());
|
||||
if(MVRI.MapList[MapIndex].bEnabled || PlayerOwner().PlayerReplicationInfo.bAdmin)
|
||||
MVRI.SendMapVote(MapIndex,GameConfigIndex);
|
||||
else
|
||||
PlayerOwner().ClientMessage(lmsgMapDisabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bool AlignBK(Canvas C)
|
||||
{
|
||||
|
||||
i_MapCountListBackground.WinWidth = lb_VoteCountListbox.MyList.ActualWidth();
|
||||
i_MapCountListBackground.WinHeight = lb_VoteCountListbox.MyList.ActualHeight();
|
||||
i_MapCountListBackground.WinLeft = lb_VoteCountListbox.MyList.ActualLeft();
|
||||
i_MapCountListBackground.WinTop = lb_VoteCountListbox.MyList.ActualTop();
|
||||
|
||||
i_MapListBackground.WinWidth = lb_MapListBox.MyList.ActualWidth();
|
||||
i_MapListBackground.WinHeight = lb_MapListBox.MyList.ActualHeight();
|
||||
i_MapListBackground.WinLeft = lb_MapListBox.MyList.ActualLeft();
|
||||
i_MapListBackground.WinTop = lb_MapListBox.MyList.ActualTop();
|
||||
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object Class=MapVoteCountMultiColumnListBox Name=VoteCountListBox
|
||||
WinWidth=0.96
|
||||
WinHeight=0.223770
|
||||
WinLeft=0.02
|
||||
WinTop=0.052930
|
||||
bVisibleWhenEmpty=true
|
||||
bScaleToParent=True
|
||||
bBoundToParent=True
|
||||
FontScale=FNS_Small
|
||||
HeaderColumnPerc(0)=0.40
|
||||
HeaderColumnPerc(1)=0.40
|
||||
HeaderColumnPerc(2)=0.20
|
||||
End Object
|
||||
lb_VoteCountListBox = VoteCountListBox
|
||||
|
||||
Begin Object class=moComboBox Name=GameTypeCombo
|
||||
WinWidth=0.757809
|
||||
WinHeight=0.037500
|
||||
WinLeft=0.199219
|
||||
WinTop=0.334309
|
||||
Caption="Filter Game Type:"
|
||||
CaptionWidth=0.35
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
co_GameType = GameTypeCombo
|
||||
|
||||
Begin Object Class=MapVoteMultiColumnListBox Name=MapListBox
|
||||
WinWidth=0.96
|
||||
WinHeight=0.293104
|
||||
WinLeft=0.02
|
||||
WinTop=0.371020
|
||||
bVisibleWhenEmpty=true
|
||||
StyleName="ServerBrowserGrid"
|
||||
bScaleToParent=True
|
||||
bBoundToParent=True
|
||||
FontScale=FNS_Small
|
||||
HeaderColumnPerc(0)=0.60
|
||||
HeaderColumnPerc(1)=0.20
|
||||
HeaderColumnPerc(2)=0.20
|
||||
End Object
|
||||
lb_MapListBox = MapListBox
|
||||
|
||||
Begin Object Class=GUIImage Name=MapCountListBackground
|
||||
WinWidth=0.98
|
||||
WinHeight=0.223770
|
||||
WinLeft=0.01
|
||||
WinTop=0.052930
|
||||
Image=material'KF_InterfaceArt_tex.Menu.thin_border_SlightTransparent'//Material'2K4Menus.NewControls.NewFooter'
|
||||
ImageStyle=ISTY_Stretched
|
||||
OnDraw=AlignBK
|
||||
End Object
|
||||
i_MapCountListBackground=MapCountListBackground
|
||||
|
||||
Begin Object Class=GUIImage Name=MapListBackground
|
||||
WinWidth=0.98
|
||||
WinHeight=0.316542
|
||||
WinLeft=0.01
|
||||
WinTop=0.371020
|
||||
Image=material'KF_InterfaceArt_tex.Menu.thin_border_SlightTransparent' //Material'2K4Menus.NewControls.NewFooter'
|
||||
ImageStyle=ISTY_Stretched
|
||||
End Object
|
||||
i_MapListBackground=MapListBackground
|
||||
|
||||
|
||||
|
||||
OnOpen=InternalOnOpen;
|
||||
|
||||
lmsgMapVotingDisabled="Sorry, Map Voting has been disabled by the server administrator."
|
||||
lmsgReplicationNotFinished="Map data download in progress. Please try again later."
|
||||
lmsgMapDisabled="The selected Map is disabled."
|
||||
lmsgTotalMaps="%mapcount% Total Maps"
|
||||
lmsgMode(0)="Majority Mode"
|
||||
lmsgMode(1)="Majority & Elimination Mode"
|
||||
lmsgMode(2)="Score Mode"
|
||||
lmsgMode(3)="Score & Elimination Mode"
|
||||
lmsgMode(4)="Majority & Accumulation Mode"
|
||||
lmsgMode(5)="Majority & Accumulation & Elimination Mode"
|
||||
lmsgMode(6)="Score & Accumulation Mode"
|
||||
lmsgMode(7)="Score & Accumulation & Elimination Mode"
|
||||
WindowName="Map Voting"
|
||||
}
|
||||
|
||||
679
kf_sources/XVoting/Classes/MatchConfig.uc
Normal file
679
kf_sources/XVoting/Classes/MatchConfig.uc
Normal file
|
|
@ -0,0 +1,679 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.MatchConfig
|
||||
//
|
||||
// MatchConfig is used to store/save the default server configuration
|
||||
// settings. When the Match is over this is used to restore the original
|
||||
// server settings.
|
||||
//
|
||||
// Written by Bruce Bickar (Uses some code from Ron Prestenback's Ladder mod)
|
||||
// (c) 2003 Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MatchConfig extends Object
|
||||
Config(MatchConfig)
|
||||
PerObjectConfig;
|
||||
|
||||
// used to save configuration settings from PlayInfo
|
||||
struct ProfileSetting
|
||||
{
|
||||
var string SettingName;
|
||||
var string SettingValue;
|
||||
};
|
||||
|
||||
// config
|
||||
var config array<ProfileSetting> Settings;
|
||||
var config string DefaultGameClassString;
|
||||
var config string DefaultMutatorsString;
|
||||
var config string DefaultParameters;
|
||||
var config bool DefaultTournamentMode;
|
||||
var config string DefaultDemoRecFileName;
|
||||
|
||||
var string GameClassString;
|
||||
var string MapIndexList;
|
||||
var string MutatorIndexList;
|
||||
var string Parameters;
|
||||
var bool bTournamentMode;
|
||||
var string DemoRecFileName;
|
||||
|
||||
var MaplistManager MapHandler;
|
||||
var PlayInfo PInfo;
|
||||
var LevelInfo Level;
|
||||
var array<CacheManager.GameRecord> GameTypes;
|
||||
var array<CacheManager.MapRecord> Maps;
|
||||
var array<CacheManager.MutatorRecord> Mutators;
|
||||
|
||||
var transient int GameIndex, RecordIndex;
|
||||
|
||||
// Localization
|
||||
var localized string lmsgLoadingMatchProfile, lmsgRestoringDefaultProfile, lmsgDefaultNotAvailable;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Init(LevelInfo Lv)
|
||||
{
|
||||
if (Lv==None)
|
||||
return;
|
||||
|
||||
Level = Lv;
|
||||
PInfo = new(None) class'Engine.PlayInfo';
|
||||
MapHandler = MaplistManager(Level.Game.MaplistHandler);
|
||||
|
||||
class'CacheManager'.static.GetGameTypeList(GameTypes);
|
||||
class'CacheManager'.static.GetMutatorList(Mutators);
|
||||
|
||||
LoadDefaults();
|
||||
}
|
||||
|
||||
function LoadDefaults()
|
||||
{
|
||||
// hack for defaults
|
||||
SetGameClassString(DefaultGameClassString);
|
||||
Parameters = DefaultParameters;
|
||||
bTournamentMode = DefaultTournamentMode;
|
||||
DemoRecFileName = DefaultDemoRecFileName;
|
||||
|
||||
LoadDefaultMutators();
|
||||
LoadDefaultMaps();
|
||||
}
|
||||
|
||||
function LoadDefaultMutators()
|
||||
{
|
||||
local array<string> Classes;
|
||||
local int i, idx;
|
||||
|
||||
MutatorIndexList = "";
|
||||
|
||||
if ( Mutators.Length == 0 )
|
||||
class'CacheManager'.static.GetMutatorList(Mutators);
|
||||
|
||||
Split(DefaultMutatorsString, ",", Classes);
|
||||
for ( i = 0; i < Classes.Length; i++ )
|
||||
{
|
||||
idx = GetMutatorCacheIndex(Classes[i]);
|
||||
if ( idx != -1 )
|
||||
{
|
||||
if ( MutatorIndexList != "" )
|
||||
MutatorIndexList $= ",";
|
||||
|
||||
MutatorIndexList $= idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function LoadCurrentMutators()
|
||||
{
|
||||
local int idx;
|
||||
local Mutator M;
|
||||
|
||||
MutatorIndexList = "";
|
||||
|
||||
if ( Mutators.Length == 0 )
|
||||
class'CacheManager'.static.GetMutatorList(Mutators);
|
||||
|
||||
for(M = Level.Game.BaseMutator.NextMutator; M != None; M = M.NextMutator)
|
||||
{
|
||||
idx = GetMutatorCacheIndex(M.Class);
|
||||
if ( idx != -1 )
|
||||
{
|
||||
if ( MutatorIndexList != "" )
|
||||
MutatorIndexList $= ",";
|
||||
|
||||
MutatorIndexList $= idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function LoadDefaultMaps()
|
||||
{
|
||||
local int i, MapIndex;
|
||||
local array<string> MapArr;
|
||||
|
||||
MapIndexList = "";
|
||||
UpdateRecordIndex();
|
||||
if ( RecordIndex != -1 )
|
||||
{
|
||||
MapArr = MapHandler.GetMapList( GameIndex, RecordIndex );
|
||||
for ( i = 0; i < MapArr.Length; i++ )
|
||||
{
|
||||
MapIndex = GetMapCacheIndex(MapArr[i]);
|
||||
if ( MapIndex != -1 )
|
||||
{
|
||||
if ( MapIndexList != "" )
|
||||
MapIndexList $= ",";
|
||||
|
||||
MapIndexList $= MapIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SetGameClassString( string NewString )
|
||||
{
|
||||
local int idx;
|
||||
|
||||
if ( NewString == "" )
|
||||
return;
|
||||
|
||||
idx = MapHandler.GetGameIndex(NewString);
|
||||
if ( idx != -1 )
|
||||
{
|
||||
GameClassString = NewString;
|
||||
GameIndex = idx;
|
||||
UpdateRecordIndex();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadCurrentSettings()
|
||||
{
|
||||
local array<string> ParamArray;
|
||||
local string URL,LeftPart,RightPart;
|
||||
local int x;
|
||||
|
||||
SetGameClassString(string(Level.Game.Class));
|
||||
|
||||
LoadCurrentMutators();
|
||||
URL = Caps(Level.GetLocalURL());
|
||||
//Log("URL = " $ URL, 'MapVoteDebug');
|
||||
// 0.0.0.0/DM-Morpheus3?Name=BDB?Class=Engine.Pawn?Character=Ophelia?team=255?Game=XGame.xDeathMatch?
|
||||
// ADMINNAME=BDB?ADMINPASSWORD=XXXX?mutator=?TOURNAMENT=1
|
||||
Split(URL, "?", ParamArray);
|
||||
Parameters="";
|
||||
for( x=1; x<ParamArray.Length; x++)
|
||||
{
|
||||
if ( !Divide(ParamArray[x],"=",LeftPart,RightPart) )
|
||||
LeftPart = ParamArray[x];
|
||||
|
||||
if ( LeftPart ~= "Tournament" )
|
||||
bTournamentMode = bool(RightPart);
|
||||
|
||||
else if ( LeftPart ~= "DemoRec" )
|
||||
DemoRecFileName = RightPart;
|
||||
|
||||
else if ( IncludeParam(LeftPart) )
|
||||
{
|
||||
if ( Parameters != "" )
|
||||
Parameters $= ";";
|
||||
|
||||
Parameters $= ParamArray[x];
|
||||
}
|
||||
}
|
||||
|
||||
LoadPlayInfo();
|
||||
LoadMapList();
|
||||
}
|
||||
|
||||
function bool IncludeParam( string ParamName )
|
||||
{
|
||||
switch ( Caps(ParamName) )
|
||||
{
|
||||
case "NAME":
|
||||
case "CHARACTER":
|
||||
case "TEAM":
|
||||
case "GAME":
|
||||
case "ADMINNAME":
|
||||
case "ADMINPASSWORD":
|
||||
case "MUTATOR":
|
||||
case "CLASS":
|
||||
case "TOURNAMENT":
|
||||
case "NUMBOTS":
|
||||
case "BAUTONUMBOTS":
|
||||
case "DEMOREC":
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadPlayInfo() // copied from UT2K4MultiPlayerHostPage and modified
|
||||
{
|
||||
local int i,j;
|
||||
local class<GameInfo> GameClass;
|
||||
local class<AccessControl> ACClass;
|
||||
local array<class<Info> > PIClasses;
|
||||
local class<Mutator> MutClass;
|
||||
local array<string> MutClassNames;
|
||||
|
||||
PInfo.Clear();
|
||||
GameClass = class<GameInfo>(DynamicLoadObject( GameClassString, class'Class'));
|
||||
if(GameClass != None)
|
||||
{
|
||||
PIClasses[i++] = GameClass;
|
||||
ACClass = class<AccessControl>(DynamicLoadObject(GameClass.default.AccessControlClass, class'Class'));
|
||||
if (ACClass != None)
|
||||
PIClasses[i++] = ACClass;
|
||||
|
||||
MutClassNames = GetCurrentMutatorArray();
|
||||
MutClassNames.Insert(0,1);
|
||||
MutClassNames[0] = GameClass.default.MutatorClass;
|
||||
|
||||
for (j = 0; j < MutClassNames.Length; j++)
|
||||
{
|
||||
if ( MutClassNames[j] != "" )
|
||||
MutClass = class<Mutator>(DynamicLoadObject(MutClassNames[j], class'Class'));
|
||||
|
||||
if (MutClass != None)
|
||||
PIClasses[i++] = MutClass;
|
||||
}
|
||||
|
||||
PInfo.Init(PIClasses);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function LoadMapList()
|
||||
{
|
||||
local int i, MapIndex;
|
||||
local array<string> MapArr;
|
||||
|
||||
MapIndexList = "";
|
||||
UpdateRecordIndex();
|
||||
|
||||
if ( RecordIndex != -1 )
|
||||
{
|
||||
MapArr = MapHandler.GetMapList( GameIndex, RecordIndex );
|
||||
|
||||
for ( i = 0; i < MapArr.Length; i++ )
|
||||
{
|
||||
MapIndex = GetMapCacheIndex(MapArr[i]);
|
||||
if ( MapIndexList != "" )
|
||||
MapIndexList $= ",";
|
||||
|
||||
MapIndexList $= MapIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool ChangeSetting(string SettingName, string NewValue)
|
||||
{
|
||||
local xVotingHandler VH;
|
||||
local int i;
|
||||
local bool bFound;
|
||||
|
||||
log("____ChangeSetting(" $ SettingName $ ", " $ NewValue $ ")",'MapVoteDebug');
|
||||
|
||||
VH = xVotingHandler(Level.Game.VotingHandler);
|
||||
|
||||
switch( SettingName )
|
||||
{
|
||||
case class'VotingReplicationInfo'.default.GameTypeID:
|
||||
if( !(NewValue ~= GameClassString) )
|
||||
{
|
||||
// validate new GameType
|
||||
bFound = false;
|
||||
for (i = 0; i < GameTypes.Length; i++)
|
||||
{
|
||||
if( GameTypes[i].ClassName ~= NewValue )
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !bFound )
|
||||
return false;
|
||||
|
||||
SetGameClassString(NewValue);
|
||||
|
||||
// Reload all since gametype changed
|
||||
ReLoad(true);
|
||||
VH.ReloadMatchConfig(true,false);
|
||||
}
|
||||
return true;
|
||||
|
||||
case class'VotingReplicationInfo'.default.MapID:
|
||||
MapIndexList = NewValue;
|
||||
return true;
|
||||
|
||||
case class'VotingReplicationInfo'.default.MutatorID:
|
||||
if( MutatorIndexList != NewValue )
|
||||
{
|
||||
MutatorIndexList = NewValue;
|
||||
|
||||
// Reload to pick up any new mutator settings
|
||||
ReLoad(false);
|
||||
VH.ReloadMatchConfig(false,false);
|
||||
}
|
||||
return true;
|
||||
|
||||
case class'VotingReplicationInfo'.default.OptionID:
|
||||
Parameters = NewValue;
|
||||
return true;
|
||||
|
||||
case class'VotingReplicationInfo'.default.TournamentID:
|
||||
bTournamentMode = bool(NewValue);
|
||||
return true;
|
||||
|
||||
case class'VotingReplicationInfo'.default.DemoRecID:
|
||||
DemoRecFileName = NewValue;
|
||||
return true;
|
||||
|
||||
default:
|
||||
i = PInfo.FindIndex(SettingName);
|
||||
if( i > -1 )
|
||||
{
|
||||
PInfo.StoreSetting(i, NewValue);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function ReLoad(bool bReloadMapList) // call when GameClassString has been changed.
|
||||
{
|
||||
LoadPlayInfo();
|
||||
if( bReloadMapList )
|
||||
LoadMapList();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SaveDefault()
|
||||
{
|
||||
local int i;
|
||||
|
||||
Log("Saving Default settings to MatchConfig.ini - [" $ Name $ "]");
|
||||
|
||||
DefaultGameClassString = GameClassString;
|
||||
DefaultMutatorsString = ConvertMutatorIndexes();
|
||||
DefaultParameters = Parameters;
|
||||
DefaultTournamentMode = bTournamentMode;
|
||||
DefaultDemoRecFileName = DemoRecFileName;
|
||||
// log("DefaultMapNameList = " $ DefaultMapNameList, 'MapVoteDebug');
|
||||
|
||||
// copy all the PlayInfo setting to the Config Settings array
|
||||
// so that they can be saved to the ini file.
|
||||
Settings.Length = PInfo.Settings.Length;
|
||||
for(i = 0; i < PInfo.Settings.Length; i++)
|
||||
{
|
||||
if(ArrayProperty(PInfo.Settings[i].ThisProp) == None)
|
||||
{
|
||||
Settings[i].SettingName = PInfo.Settings[i].SettingName;
|
||||
Settings[i].SettingValue = PInfo.Settings[i].Value;
|
||||
}
|
||||
}
|
||||
|
||||
SaveMaplist();
|
||||
SaveConfig();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function RestoreDefault(Actor Requestor)
|
||||
{
|
||||
local int i,j;
|
||||
local xVotingHandler VH;
|
||||
|
||||
log("___RestoreDefault()", 'MapVoteDebug');
|
||||
|
||||
if( PlayerController(Requestor) == none )
|
||||
return;
|
||||
|
||||
LoadDefaults();
|
||||
|
||||
log("MapIndexList = " $ MapIndexList, 'MapVoteDebug');
|
||||
if( GameClassString == "" || MapIndexList == "" )
|
||||
{
|
||||
PlayerController(Requestor).ClientMessage(lmsgDefaultNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
LoadPlayInfo();
|
||||
for(i = 0; i < Settings.Length; i++)
|
||||
{
|
||||
for(j = 0; j < PInfo.Settings.Length; j++)
|
||||
{
|
||||
if(ArrayProperty(PInfo.Settings[i].ThisProp) == None)
|
||||
{
|
||||
if(Settings[i].SettingName ~= PInfo.Settings[j].SettingName)
|
||||
{
|
||||
PInfo.StoreSetting(j, Settings[i].SettingValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//PInfo.SaveSettings();
|
||||
Level.Game.Broadcast(Level.Game.VotingHandler,lmsgRestoringDefaultProfile);
|
||||
|
||||
// force all match setup users to reload settings
|
||||
VH = xVotingHandler(Level.Game.VotingHandler);
|
||||
if ( VH != None )
|
||||
VH.ReloadMatchConfig(true,true);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function StartMatch()
|
||||
{
|
||||
local string ServerTravelString, mutstring;
|
||||
local class<GameInfo> GameClass;
|
||||
local int i;
|
||||
|
||||
SaveDefault();
|
||||
|
||||
PInfo.SaveSettings();
|
||||
Level.Game.Broadcast(Level.Game.VotingHandler,lmsgLoadingMatchProfile);
|
||||
xVotingHandler(Level.Game.VotingHandler).CloseAllVoteWindows();
|
||||
|
||||
mutstring = ConvertMutatorIndexes();
|
||||
if ( mutstring != "" )
|
||||
mutstring = "?mutator=" $ mutstring;
|
||||
|
||||
ServerTravelString = MapHandler.GetActiveMapName(GameIndex,RecordIndex) $ "?Game=" $ GameClassString $ mutstring;
|
||||
ServerTravelString $= "?" $ Eval(bTournamentMode, "TOURNAMENT=1", "TOURNAMENT=0");
|
||||
if( DemoRecFileName != "" )
|
||||
ServerTravelString $= "?DemoRec=" $ DemoRecFileName;
|
||||
if( Parameters != "" )
|
||||
ServerTravelString $= "?" $ Repl(Repl(Parameters,",","?")," ","");
|
||||
|
||||
// Append bot options
|
||||
// Note: this doesn't work anymore because bot options were disabled on servers. :(
|
||||
switch (class'UnrealMPGameInfo'.default.BotMode)
|
||||
{
|
||||
case 0:
|
||||
i = PInfo.FindIndex("MinPlayers");
|
||||
if ( i >= 0 )
|
||||
ServerTravelString $= "?NumBots="$PInfo.Settings[i].Value;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ServerTravelString $= "?bAutoNumBots=True";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if( GameClass.default.bTeamGame )
|
||||
{
|
||||
if( class'XGame.TeamRedConfigured'.default.Characters.Length > 0 )
|
||||
ServerTravelString $= "?RedTeam=XGame.TeamRedConfigured";
|
||||
|
||||
if( class'XGame.TeamBlueConfigured'.default.Characters.Length > 0 )
|
||||
ServerTravelString $= "?BlueTeam=XGame.TeamBlueConfigured";
|
||||
}
|
||||
else
|
||||
{
|
||||
if( class'XGame.DMRosterConfigured'.default.Characters.Length > 0 )
|
||||
ServerTravelString $= "?DMTeam=XGame.DMRosterConfigured";
|
||||
}
|
||||
break;
|
||||
}
|
||||
Level.ServerTravel(ServerTravelString, false); // change the map
|
||||
}
|
||||
|
||||
function SaveMaplist()
|
||||
{
|
||||
local int i;
|
||||
local array<string> OldMaps, NewMaps;
|
||||
|
||||
if ( MapHandler != None )
|
||||
{
|
||||
OldMaps = MapHandler.GetMapList(GameIndex, RecordIndex);
|
||||
NewMaps = GetCurrentMapArray();
|
||||
|
||||
for ( i = 0; i < OldMaps.Length; i++ )
|
||||
MapHandler.RemoveMap(GameIndex, RecordIndex, OldMaps[i]);
|
||||
|
||||
for ( i = 0; i < NewMaps.Length; i++ )
|
||||
MapHandler.AddMap(GameIndex, RecordIndex, NewMaps[i]);
|
||||
|
||||
MapHandler.ApplyMapList(GameIndex, RecordIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
function UpdateRecordIndex()
|
||||
{
|
||||
local array<string> Dummy;
|
||||
|
||||
if ( Level == None || Level.Game == None || MapHandler == None )
|
||||
return;
|
||||
|
||||
if ( GameIndex != -1 )
|
||||
{
|
||||
RecordIndex = MapHandler.GetRecordIndex(GameIndex, string(Name));
|
||||
if ( RecordIndex == -1 )
|
||||
RecordIndex = MapHandler.AddList(GameClassString, string(Name), Dummy);
|
||||
}
|
||||
}
|
||||
|
||||
function int GetGameCacheIndex( coerce string ClassName )
|
||||
{
|
||||
local int i;
|
||||
|
||||
if ( ClassName == "" )
|
||||
return -1;
|
||||
|
||||
if ( GameTypes.Length == 0 )
|
||||
class'CacheManager'.static.GetGameTypeList(GameTypes);
|
||||
|
||||
for ( i = 0; i < GameTypes.Length; i++ )
|
||||
{
|
||||
if ( GameTypes[i].ClassName ~= ClassName )
|
||||
return i;
|
||||
}
|
||||
|
||||
log(Name@"GetGameCacheIndex() didn't find index for game class '"$ClassName$"'",'MapVoteDebug');
|
||||
return -1;
|
||||
}
|
||||
|
||||
function int GetMutatorCacheIndex( coerce string ClassName )
|
||||
{
|
||||
local int i;
|
||||
|
||||
if ( ClassName == "" )
|
||||
return -1;
|
||||
|
||||
if ( Mutators.Length == 0 )
|
||||
class'CacheManager'.static.GetMutatorList(Mutators);
|
||||
|
||||
for ( i = 0; i < Mutators.Length; i++ )
|
||||
{
|
||||
if ( Mutators[i].ClassName ~= ClassName )
|
||||
return i;
|
||||
}
|
||||
|
||||
log(Name@"GetMutatorCacheIndex() didn't find index for mutator class '"$ClassName$"'",'MapVoteDebug');
|
||||
return -1;
|
||||
}
|
||||
|
||||
function int GetMapCacheIndex(string MapName)
|
||||
{
|
||||
local int i;
|
||||
|
||||
if ( MapName == "" )
|
||||
return -1;
|
||||
|
||||
if ( Maps.Length == 0 )
|
||||
class'CacheManager'.static.GetMaplist( Maps, GetPrefix() );
|
||||
|
||||
i = InStr(MapName, "?");
|
||||
if ( i != -1 )
|
||||
MapName = Left(MapName,i);
|
||||
|
||||
for ( i = 0; i < Maps.Length; i++ )
|
||||
{
|
||||
if ( MapName ~= Maps[i].MapName )
|
||||
return i;
|
||||
}
|
||||
|
||||
log(Name@"GetMapCacheIndex() didn't find index for map '"$MapName$"'",'MapVoteDebug');
|
||||
return -1;
|
||||
}
|
||||
|
||||
function string GetPrefix()
|
||||
{
|
||||
local int i;
|
||||
|
||||
if ( GameClassString == "" )
|
||||
SetGameClassString(string(Level.Game.Class));
|
||||
|
||||
i = GetGameCacheIndex(GameClassString);
|
||||
if ( i != -1 )
|
||||
return GameTypes[i].MapPrefix;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function array<string> GetCurrentMutatorArray()
|
||||
{
|
||||
local string s;
|
||||
local array<string> Arr;
|
||||
|
||||
s = ConvertMutatorIndexes();
|
||||
Split(s, ",", Arr);
|
||||
return Arr;
|
||||
}
|
||||
|
||||
function array<string> GetCurrentMapArray()
|
||||
{
|
||||
local string s;
|
||||
local array<string> Arr;
|
||||
|
||||
s = ConvertMapIndexes();
|
||||
Split(s, ",", Arr);
|
||||
return Arr;
|
||||
}
|
||||
|
||||
function string ConvertMutatorIndexes()
|
||||
{
|
||||
local int i, idx;
|
||||
local string str;
|
||||
local array<string> Indexes;
|
||||
|
||||
Split(MutatorIndexList, ",", Indexes);
|
||||
for ( i = 0; i < Indexes.Length; i++ )
|
||||
{
|
||||
idx = int(Indexes[i]);
|
||||
if ( idx >= 0 && idx < Mutators.Length )
|
||||
{
|
||||
if ( str != "" )
|
||||
str $= ",";
|
||||
|
||||
str $= Mutators[idx].ClassName;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// translate the comma separated string of map indexes into a comma separated string of mapnames for storing
|
||||
function string ConvertMapIndexes()
|
||||
{
|
||||
local int i, idx;
|
||||
local string str;
|
||||
local array<string> Indexes;
|
||||
|
||||
Split(MapIndexList, ",", Indexes);
|
||||
for ( i = 0; i < Indexes.Length; i++ )
|
||||
{
|
||||
idx = int(Indexes[i]);
|
||||
if ( idx >= 0 && idx < Maps.Length )
|
||||
{
|
||||
if ( str != "" )
|
||||
str $= ",";
|
||||
|
||||
str $= Maps[idx].MapName;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
lmsgLoadingMatchProfile="Match settings are being loaded now."
|
||||
lmsgRestoringDefaultProfile="Restoring default server profile."
|
||||
lmsgDefaultNotAvailable="Default Profile Not available."
|
||||
}
|
||||
221
kf_sources/XVoting/Classes/MatchConfigPage.uc
Normal file
221
kf_sources/XVoting/Classes/MatchConfigPage.uc
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
//==============================================================================
|
||||
// Created on: 12/30/2003
|
||||
// Description
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class MatchConfigPage extends VotingPage;
|
||||
|
||||
var automated GUITabControl c_Groups;
|
||||
var array<MatchSetupPanelBase> Panels;
|
||||
var() config array<string> PanelClass, PanelHint;
|
||||
|
||||
var() bool bDirty;
|
||||
|
||||
function InitComponent(GUIController InController, GUIComponent InOwner)
|
||||
{
|
||||
local int i;
|
||||
local MatchSetupPanelBase Panel;
|
||||
|
||||
Super.InitComponent(InController, InOwner);
|
||||
|
||||
f_Chat.OnAccept = AcceptAndSave;
|
||||
f_Chat.OnSubmit = SubmitActive;
|
||||
c_Groups.MyFooter = f_Chat;
|
||||
|
||||
MVRI.ProcessResponse = OnResponse;
|
||||
for ( i = 0; i < PanelClass.Length && i < PanelHint.Length; i++ )
|
||||
{
|
||||
Panel = MatchSetupPanelBase(c_Groups.AddTab("", PanelClass[i],,PanelHint[i]));
|
||||
if ( Panel != None )
|
||||
{
|
||||
Panels[Panels.Length] = Panel;
|
||||
Panel.VRI = MVRI;
|
||||
Panel.SendCommand = SendCommand;
|
||||
Panel.OnChange = PanelChanged;
|
||||
|
||||
if ( Panel.IsLoggedIn() )
|
||||
Panel.OnLogIn();
|
||||
else Panel.OnLogOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function InternalOnChange( GUIComponent Sender )
|
||||
{
|
||||
if ( MatchSetupPanelBase(Sender) != None )
|
||||
bDirty = true;
|
||||
}
|
||||
|
||||
function SendCommand( string Command )
|
||||
{
|
||||
if ( MVRI != None )
|
||||
MVRI.SendCommand(Command);
|
||||
}
|
||||
|
||||
function OnResponse( string Response )
|
||||
{
|
||||
local int i;
|
||||
local string Type, Info, Data;
|
||||
|
||||
// log("Received response from MVRI:"@Response);
|
||||
|
||||
DecodeResponse(Response, Type, Info, Data);
|
||||
if ( HandleResponse(Type, Info, Data) )
|
||||
return;
|
||||
|
||||
for ( i = 0; i < Panels.Length; i++ )
|
||||
if ( Panels[i].HandleResponse(Type, Info, Data) )
|
||||
return;
|
||||
}
|
||||
|
||||
function bool HandleResponse(string Type, string Info, string Data)
|
||||
{
|
||||
local int i;
|
||||
|
||||
if ( Type ~= "login" )
|
||||
{
|
||||
if ( Info == "" )
|
||||
{
|
||||
for ( i = 0; i < Panels.Length; i++ )
|
||||
{
|
||||
if ( MatchSetupLoginPanel(Panels[i]) != None )
|
||||
MatchSetupLoginPanel(Panels[i]).LoginFailed();
|
||||
else
|
||||
Panels[i].OnLogout();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
for ( i = 0; i < Panels.Length; i++ )
|
||||
{
|
||||
if ( Panels[i] != None )
|
||||
Panels[i].OnLogIn();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Type ~= "logout" )
|
||||
{
|
||||
for ( i = 0; i < Panels.Length; i++ )
|
||||
if ( Panels[i] != None )
|
||||
Panels[i].OnLogOut();
|
||||
}
|
||||
|
||||
if ( Type ~= class'VotingReplicationInfo'.default.StatusID )
|
||||
{
|
||||
if ( Info ~= class'VotingReplicationInfo'.default.CompleteID )
|
||||
{
|
||||
for ( i = 0; i < Panels.Length; i++ )
|
||||
Panels[i].ReceiveComplete();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static function DecodeResponse( string Response, out string Type, out string Info, out string Data )
|
||||
{
|
||||
local string str;
|
||||
|
||||
Type = "";
|
||||
Info = "";
|
||||
Data = "";
|
||||
|
||||
if ( Response == "" )
|
||||
return;
|
||||
|
||||
if ( Divide(Response, ":", Type, str) )
|
||||
{
|
||||
if ( !Divide(str, ";", Info, Data) )
|
||||
Info = str;
|
||||
}
|
||||
else Type = Response;
|
||||
}
|
||||
|
||||
event bool NotifyLevelChange()
|
||||
{
|
||||
bPersistent = false;
|
||||
LevelChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
function PanelChanged( GUIComponent Sender )
|
||||
{
|
||||
bDirty = true;
|
||||
}
|
||||
|
||||
function SubmitActive()
|
||||
{
|
||||
local int i;
|
||||
|
||||
if ( c_Groups.ActiveTab != None && c_Groups.ActiveTab.MyPanel != None )
|
||||
{
|
||||
for ( i = 0; i < Panels.Length; i++ )
|
||||
{
|
||||
if ( Panels[i] == c_Groups.ActiveTab.MyPanel )
|
||||
{
|
||||
if ( Panels[i].bDirty == true )
|
||||
Panels[i].SubmitChanges();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AcceptAndSave()
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < Panels.Length; i++ )
|
||||
{
|
||||
if ( Panels[i].bDirty )
|
||||
Panels[i].SubmitChanges();
|
||||
}
|
||||
|
||||
MVRI.MatchSettingsSubmit();
|
||||
|
||||
bDirty = false;
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
PanelClass(0)="xVoting.MatchSetupLoginPanel"
|
||||
PanelClass(1)="xVoting.MatchSetupMain"
|
||||
PanelClass(2)="xVoting.MatchSetupMaps"
|
||||
PanelClass(3)="xVoting.MatchSetupMutator"
|
||||
PanelClass(4)="xVoting.MatchSetupRules"
|
||||
|
||||
PanelHint(0)="Enter your match setup username and password"
|
||||
PanelHint(1)="General match parameters"
|
||||
PanelHint(2)="Select the maps that should be played during the match"
|
||||
PanelHint(3)="Select the mutators that should be active during the match"
|
||||
PanelHint(4)="Select the rules that will be used in the match"
|
||||
|
||||
Begin Object Class=GUITabControl Name=MatchSetupTabControl
|
||||
WinWidth=0.971875
|
||||
WinHeight=0.718125
|
||||
WinLeft=0.014062
|
||||
WinTop=0.020833
|
||||
TabHeight=0.04
|
||||
TabOrder=0
|
||||
RenderWeight=0.5
|
||||
bFillSpace=False
|
||||
bAcceptsInput=True
|
||||
bDockPanels=True
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
StyleName="TabBackground"
|
||||
End Object
|
||||
c_Groups=MatchSetupTabControl
|
||||
|
||||
bAllowedAsLast=True
|
||||
bPersistent=True
|
||||
OpenSound=sound'KF_MenuSnd.msfxEdit'
|
||||
}
|
||||
176
kf_sources/XVoting/Classes/MatchSetupLoginPage.uc
Normal file
176
kf_sources/XVoting/Classes/MatchSetupLoginPage.uc
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
class MatchSetupLoginPage extends LargeWindow;
|
||||
|
||||
var automated GUILabel l_Title;
|
||||
var automated moEditBox ed_UserID;
|
||||
var automated moEditBox ed_Password;
|
||||
var automated GUIButton b_LogIn;
|
||||
var automated GUIButton b_Cancel;
|
||||
|
||||
var VotingReplicationInfo VRI;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
local VotingReplicationInfo RI;
|
||||
Super.InitComponent(Mycontroller, MyOwner);
|
||||
|
||||
ed_Password.MyEditBox.bConvertSpaces = true;
|
||||
|
||||
// find the VotingReplicationInfo
|
||||
foreach AllObjects(class 'VotingReplicationInfo', RI)
|
||||
{
|
||||
if( RI.PlayerOwner != None && RI.PlayerOwner == PlayerOwner())
|
||||
{
|
||||
VRI = RI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(VRI == None)
|
||||
Controller.CloseAll(false);
|
||||
|
||||
ed_Password.MyEditBox.bMaskText=true;
|
||||
ed_UserID.SetComponentValue(PlayerOwner().PlayerReplicationInfo.PlayerName);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool InternalOnClick(GUIComponent Sender)
|
||||
{
|
||||
if(Sender==b_Login && Len(ed_UserID.GetText())>0 && len(ed_Password.GetText())>0 )
|
||||
{
|
||||
VRI.MatchSetupLogin(ed_UserID.GetText(), ed_Password.GetText());
|
||||
setTimer(1, true);
|
||||
}
|
||||
|
||||
if(Sender==b_Cancel)
|
||||
Controller.CloseAll(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function timer()
|
||||
{
|
||||
Super.timer();
|
||||
|
||||
if(VRI != None && VRI.bMatchSetupPermitted)
|
||||
Controller.CloseMenu(false);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool UserIDKeyPress(out byte Key, out byte State, float delta)
|
||||
{
|
||||
if((Key == 13) && (State==1)) // Enter Key
|
||||
{
|
||||
ed_Password.SetFocus(none);
|
||||
return true;
|
||||
}
|
||||
|
||||
if((Key == 40) && (State==1)) // Up Down
|
||||
{
|
||||
ed_Password.SetFocus(none);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool PasswordKeyPress(out byte Key, out byte State, float delta)
|
||||
{
|
||||
if((Key == 13) && (State==1)) // Enter Key
|
||||
{
|
||||
if(Len(ed_UserID.GetText())>0 && len(ed_Password.GetText())>0 )
|
||||
{
|
||||
VRI.MatchSetupLogin(ed_UserID.GetText(), ed_Password.GetText());
|
||||
setTimer(1, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if((Key == 38) && (State==1)) // Up Key
|
||||
{
|
||||
ed_UserID.SetFocus(none);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Closed(GUIComponent Sender, bool bCancelled)
|
||||
{
|
||||
VRI = None;
|
||||
Super.Closed(Sender, bCancelled);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
event bool NotifyLevelChange()
|
||||
{
|
||||
VRI = None;
|
||||
return Super.NotifyLevelChange();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object class=GUILabel Name=TitleLabel
|
||||
WinWidth=0.382813
|
||||
WinHeight=0.053125
|
||||
WinLeft=0.302813
|
||||
WinTop=0.287500
|
||||
Caption="Match Setup Login"
|
||||
TextALign=TXTA_Center
|
||||
TextFont="UT2SmallFont"
|
||||
TextColor=(R=0,G=0,B=255,A=255)
|
||||
RenderWeight=1
|
||||
End Object
|
||||
l_Title=TitleLabel
|
||||
|
||||
Begin Object class=moEditBox Name=UserIDEditBox
|
||||
WinWidth=0.381250
|
||||
WinHeight=0.033750
|
||||
WinLeft=0.301250
|
||||
WinTop=0.366667
|
||||
Caption="UserID"
|
||||
TabOrder=1
|
||||
CaptionWidth=0.5
|
||||
OnKeyEvent=UserIDKeyPress
|
||||
End Object
|
||||
ed_UserID=UserIDEditBox
|
||||
|
||||
Begin Object class=moEditBox Name=PasswordEditBox
|
||||
WinWidth=0.382500
|
||||
WinHeight=0.031250
|
||||
WinLeft=0.300000
|
||||
WinTop=0.431667
|
||||
Caption="Password"
|
||||
TabOrder=2
|
||||
CaptionWidth=0.5
|
||||
OnKeyEvent=PasswordKeyPress
|
||||
End Object
|
||||
ed_Password=PasswordEditBox
|
||||
|
||||
Begin Object class=GUIButton Name=LoginButton
|
||||
Caption="Login"
|
||||
StyleName="SquareButton"
|
||||
WinWidth=0.120000
|
||||
WinHeight=0.033203
|
||||
WinLeft=0.330000
|
||||
WinTop=0.526667
|
||||
OnClick=InternalOnClick
|
||||
TabOrder=3
|
||||
RenderWeight=1.0
|
||||
End Object
|
||||
b_Login=LoginButton
|
||||
|
||||
Begin Object class=GUIButton Name=CancelButton
|
||||
Caption="Cancel"
|
||||
StyleName="SquareButton"
|
||||
WinWidth=0.120000
|
||||
WinHeight=0.033203
|
||||
WinLeft=0.536249
|
||||
WinTop=0.526667
|
||||
OnClick=InternalOnClick
|
||||
TabOrder=4
|
||||
RenderWeight=1.0
|
||||
End Object
|
||||
b_Cancel=CancelButton
|
||||
|
||||
OpenSound=sound'KF_MenuSnd.msfxEdit'
|
||||
|
||||
bAllowedAsLast=true
|
||||
WinTop=0.248697
|
||||
WinHeight=0.352864
|
||||
WinWidth=1.0;
|
||||
WinLeft=0.0;
|
||||
}
|
||||
371
kf_sources/XVoting/Classes/MatchSetupLoginPanel.uc
Normal file
371
kf_sources/XVoting/Classes/MatchSetupLoginPanel.uc
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
//==============================================================================
|
||||
// Created on: 01/02/2004
|
||||
// Login panel for Match Setup
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class MatchSetupLoginPanel extends MatchSetupPanelBase
|
||||
config(LoginCache);
|
||||
|
||||
var() config bool bAutoLogin, bKeepHistory;
|
||||
var() config array<AutoLoginInfo> LoginHistory;
|
||||
|
||||
var() editconst noexport string CurrentIP, CurrentPort;
|
||||
|
||||
var automated GUILabel l_Title, l_Status;
|
||||
var automated moEditBox ed_LoginName;
|
||||
var automated moEditBox ed_LoginPassword;
|
||||
var automated GUIButton b_Submit, b_Cancel;
|
||||
|
||||
var() localized string NoUsernameSpecified, NoPasswordSpecified, InvalidLoginText, WaitingForLoginText,
|
||||
LoggedText, ButtonLoginText, ButtonLogoutText, PleaseWaitText;
|
||||
|
||||
function InitComponent( GUIController C, GUIComponent O )
|
||||
{
|
||||
local PlayerController PC;
|
||||
local string str;
|
||||
local int i;
|
||||
|
||||
Super.InitComponent(C, O);
|
||||
|
||||
PC = PlayerOwner();
|
||||
|
||||
ed_LoginPassword.MyEditBox.bConvertSpaces = True;
|
||||
str = PC.GetServerNetworkAddress();
|
||||
|
||||
if ( str != "" )
|
||||
{
|
||||
if ( !Divide(str, ":", CurrentIP, CurrentPort) )
|
||||
{
|
||||
CurrentIP = str;
|
||||
CurrentPort = "7777";
|
||||
}
|
||||
}
|
||||
|
||||
i = FindCredentials(CurrentIP, CurrentPort);
|
||||
if ( i != -1 )
|
||||
{
|
||||
ed_Loginname.SetText(LoginHistory[i].Username);
|
||||
ed_LoginPassword.SetText(LoginHistory[i].Password);
|
||||
|
||||
if ( LoginHistory[i].bAutoLogin )
|
||||
InternalOnClick(b_Submit);
|
||||
}
|
||||
else if ( PC.PlayerReplicationInfo != None )
|
||||
ed_LoginName.SetText(PC.PlayerReplicationInfo.PlayerName);
|
||||
}
|
||||
|
||||
function Opened(GUIComponent Sender)
|
||||
{
|
||||
Super.Opened(Sender);
|
||||
UpdateSubmitButton();
|
||||
}
|
||||
|
||||
function bool InternalOnClick(GUIComponent Sender)
|
||||
{
|
||||
local string uname, upass;
|
||||
|
||||
if ( VRI == None )
|
||||
return true;
|
||||
|
||||
if ( Sender == b_Submit )
|
||||
{
|
||||
if ( b_Submit.Caption == ButtonLoginText )
|
||||
{
|
||||
uname = ed_LoginName.GetText();
|
||||
upass = ed_LoginPassword.GetText();
|
||||
|
||||
if ( uname == "" )
|
||||
{
|
||||
SetFocus(ed_LoginName);
|
||||
UpdateStatus(NoUsernameSpecified);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( upass == "" )
|
||||
{
|
||||
SetFocus(ed_LoginPassword);
|
||||
UpdateStatus(NoPasswordSpecified);
|
||||
return true;
|
||||
}
|
||||
|
||||
SendLogin(uname,upass);
|
||||
}
|
||||
|
||||
else if ( b_Submit.Caption == ButtonLogoutText )
|
||||
{
|
||||
SendLogout();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Sender == b_Cancel )
|
||||
{
|
||||
Controller.CloseMenu(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function bool UserNameKeyEvent( out byte Key, out byte State, float Delta )
|
||||
{
|
||||
if ( State == 3 && (Key == 0x0D || Key == 0x28) ) // enter or down
|
||||
{
|
||||
ed_LoginPassword.SetFocus(none);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function bool PasswordKeyEvent( out byte Key, out byte State, float Delta )
|
||||
{
|
||||
if ( State == 3 )
|
||||
{
|
||||
if ( Key == 0x0D ) // enter
|
||||
return InternalOnClick(b_Submit);
|
||||
|
||||
else if ( Key == 0x26 ) // up
|
||||
{
|
||||
ed_LoginName.SetFocus(none);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function UpdateStatus(string NewStatusMsg )
|
||||
{
|
||||
l_Status.Caption = NewStatusMsg;
|
||||
UpdateSubmitButton();
|
||||
}
|
||||
|
||||
protected function int FindCredentials( coerce string IP, coerce string Port )
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < LoginHistory.Length; i++ )
|
||||
if ( LoginHistory[i].IP == IP && LoginHistory[i].Port == Port )
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected function SaveCredentials()
|
||||
{
|
||||
local AutoLoginInfo NewInfo;
|
||||
local int i;
|
||||
|
||||
if ( !bKeepHistory )
|
||||
return;
|
||||
|
||||
NewInfo.UserName = ed_LoginName.GetText();
|
||||
NewInfo.Password = ed_LoginPassword.GetText();
|
||||
if ( NewInfo.Password == "" )
|
||||
return;
|
||||
|
||||
NewInfo.IP = CurrentIP;
|
||||
NewInfo.Port = CurrentPort;
|
||||
|
||||
i = FindCredentials(NewInfo.IP, NewInfo.Port);
|
||||
if ( i == -1 )
|
||||
i = LoginHistory.Length;
|
||||
|
||||
LoginHistory[i] = NewInfo;
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
function UpdateSubmitButton()
|
||||
{
|
||||
switch( l_Status.Caption )
|
||||
{
|
||||
case WaitingForLoginText:
|
||||
b_Submit.Caption = ButtonLogoutText;
|
||||
DisableComponent(b_Submit);
|
||||
break;
|
||||
|
||||
case LoggedText:
|
||||
b_Submit.Caption = ButtonLogoutText;
|
||||
EnableComponent(b_Submit);
|
||||
break;
|
||||
|
||||
case LoggedText @ PleaseWaitText:
|
||||
b_Submit.Caption = ButtonLogoutText;
|
||||
DisableComponent(b_Submit);
|
||||
break;
|
||||
|
||||
default:
|
||||
EnableComponent(b_Submit);
|
||||
b_Submit.Caption = ButtonLoginText;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function SendLogin( string UserName, string Password )
|
||||
{
|
||||
DisableComponent(ed_LoginName);
|
||||
DisableComponent(ed_LoginPassword);
|
||||
EnableComponent(b_Cancel);
|
||||
|
||||
UpdateStatus(WaitingForLoginText);
|
||||
VRI.MatchSetupLogin(UserName, Password);
|
||||
}
|
||||
|
||||
function SendLogout();
|
||||
|
||||
function LoggedIn()
|
||||
{
|
||||
Super.LoggedIn();
|
||||
DisableComponent(b_Cancel);
|
||||
|
||||
UpdateStatus(LoggedText @ PleaseWaitText);
|
||||
SaveCredentials();
|
||||
VRI.RequestMatchSettings(True,True);
|
||||
}
|
||||
|
||||
function LoggedOut()
|
||||
{
|
||||
Super.LoggedOut();
|
||||
EnableComponent(b_Submit);
|
||||
EnableComponent(ed_LoginName);
|
||||
EnableComponent(ed_LoginPassword);
|
||||
|
||||
UpdateStatus("");
|
||||
}
|
||||
|
||||
function LoginFailed()
|
||||
{
|
||||
EnableComponent(b_Submit);
|
||||
EnableComponent(ed_LoginName);
|
||||
EnableComponent(ed_LoginPassword);
|
||||
|
||||
DisableComponent(b_Cancel);
|
||||
UpdateStatus(InvalidLoginText);
|
||||
SetFocus(ed_LoginPassword);
|
||||
}
|
||||
|
||||
function ReceiveComplete()
|
||||
{
|
||||
Super.ReceiveComplete();
|
||||
UpdateStatus(LoggedText);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
PanelCaption="Login"
|
||||
OnLogIn=LoggedIn
|
||||
OnLogout=LoggedOut
|
||||
|
||||
WaitingForLoginText="Please wait while your login credentials are verified..."
|
||||
NoUsernameSpecified="In order to login to match setup, you must supply a username."
|
||||
NoPasswordSpecified="In order to login to match setup, you must supply a password."
|
||||
InvalidLoginText="Login attempt failed - invalid username or password."
|
||||
LoggedText="Successfully logged into match setup!"
|
||||
PleaseWaitText="Complete data transfer will take a few seconds..."
|
||||
|
||||
ButtonLoginText="Login"
|
||||
ButtonLogoutText="Logout"
|
||||
|
||||
Begin Object class=GUILabel Name=TitleLabel
|
||||
WinWidth=0.521077
|
||||
WinHeight=0.152803
|
||||
WinLeft=0.244935
|
||||
WinTop=0.012808
|
||||
Caption="Match Setup Login"
|
||||
TextAlign=TXTA_Center
|
||||
RenderWeight=1
|
||||
StyleName="TextLabel"
|
||||
FontScale=FNS_Large
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
// l_Title=TitleLabel
|
||||
|
||||
Begin Object class=GUILabel Name=StatusLabel
|
||||
TextAlign=TXTA_Center
|
||||
bMultiLine=True
|
||||
VertAlign=TXTA_Center
|
||||
FontScale=FNS_Large
|
||||
StyleName="TextLabel"
|
||||
WinTop=0.571450
|
||||
WinLeft=0.167765
|
||||
WinWidth=0.670595
|
||||
WinHeight=0.413253
|
||||
RenderWeight=1.000000
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
l_Status=StatusLabel
|
||||
|
||||
Begin Object class=moEditBox Name=UserIDEditBox
|
||||
WinWidth=0.659385
|
||||
WinHeight=0.081981
|
||||
WinLeft=0.174240
|
||||
WinTop=0.209260
|
||||
Caption="UserID"
|
||||
TabOrder=1
|
||||
CaptionWidth=0.1
|
||||
OnKeyEvent=UserNameKeyEvent
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
ed_LoginName=UserIDEditBox
|
||||
|
||||
Begin Object class=moEditBox Name=PasswordEditBox
|
||||
WinWidth=0.659385
|
||||
WinHeight=0.081981
|
||||
WinLeft=0.174240
|
||||
WinTop=0.326729
|
||||
Caption="Password"
|
||||
TabOrder=2
|
||||
CaptionWidth=0.1
|
||||
OnKeyEvent=PasswordKeyEvent
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
bMaskText=True
|
||||
End Object
|
||||
ed_LoginPassword=PasswordEditBox
|
||||
|
||||
Begin Object class=GUIButton Name=LoginButton
|
||||
Caption="Login"
|
||||
WinWidth=0.137685
|
||||
WinHeight=0.070180
|
||||
WinLeft=0.680482
|
||||
WinTop=0.477284
|
||||
OnClick=InternalOnClick
|
||||
TabOrder=3
|
||||
RenderWeight=1.0
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
b_Submit=LoginButton
|
||||
|
||||
Begin Object class=GUIButton Name=CancelButton
|
||||
Caption="Cancel"
|
||||
WinWidth=0.139293
|
||||
WinHeight=0.076611
|
||||
WinLeft=0.513741
|
||||
WinTop=0.474198
|
||||
OnClick=InternalOnClick
|
||||
TabOrder=4
|
||||
RenderWeight=1.0
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
b_Cancel=CancelButton
|
||||
|
||||
WinTop=0.248697
|
||||
WinHeight=0.352864
|
||||
WinWidth=1.0
|
||||
WinLeft=0.0
|
||||
|
||||
bKeepHistory=True
|
||||
}
|
||||
241
kf_sources/XVoting/Classes/MatchSetupMain.uc
Normal file
241
kf_sources/XVoting/Classes/MatchSetupMain.uc
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
//==============================================================================
|
||||
// Created on: 01/02/2004
|
||||
// Configure general match setup options
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class MatchSetupMain extends MatchSetupPanelBase;
|
||||
|
||||
var automated moComboBox co_GameType;
|
||||
var automated moEditBox ed_Params, ed_DemoRec;
|
||||
var automated moCheckbox ch_DemoRec, ch_Tournament;
|
||||
|
||||
var bool bDemoRec, bTournament;
|
||||
var string GameClass, DemoFilename, Params;
|
||||
|
||||
function InitPanel()
|
||||
{
|
||||
Super.InitPanel();
|
||||
|
||||
Group = class'VotingReplicationInfo'.default.GeneralID;
|
||||
}
|
||||
|
||||
function bool HandleResponse(string Type, string Info, string Data)
|
||||
{
|
||||
local string InfoStr, SubType;
|
||||
|
||||
if ( Type ~= Group )
|
||||
{
|
||||
log("MAIN HandleResponse Info '"$Info$"' Data '"$Data$"'",'MapVoteDebug');
|
||||
if ( !Divide(Info, Chr(27), InfoStr, SubType) )
|
||||
{
|
||||
log("received unknown general token");
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( InfoStr ~= class'VotingReplicationInfo'.default.AddID )
|
||||
{
|
||||
switch ( SubType )
|
||||
{
|
||||
case class'VotingReplicationInfo'.default.TournamentID:
|
||||
bTournament = bool(Data);
|
||||
ch_Tournament.SetComponentValue(bTournament,True);
|
||||
break;
|
||||
|
||||
case class'VotingReplicationInfo'.default.DemoRecID:
|
||||
bDemoRec = bool(Data);
|
||||
ch_DemoRec.SetComponentValue(bDemoRec,true);
|
||||
if ( bDemoRec )
|
||||
EnableComponent(ed_DemoRec);
|
||||
else DisableComponent(ed_DemoRec);
|
||||
break;
|
||||
|
||||
case class'VotingReplicationInfo'.default.GameTypeID:
|
||||
GameClass = Data;
|
||||
if ( GameClass != "" )
|
||||
{
|
||||
co_GameType.MyComboBox.List.bNotify = false;
|
||||
co_GameType.Find(Data, ,true);
|
||||
co_Gametype.MyComboBox.List.bNotify = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case class'VotingReplicationInfo'.default.URLID:
|
||||
Params = Data;
|
||||
ed_Params.SetComponentValue(Params,true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if ( InfoStr ~= class'VotingReplicationInfo'.default.UpdateID )
|
||||
{
|
||||
// this setting was changed by someone else
|
||||
switch ( SubType )
|
||||
{
|
||||
case class'VotingReplicationInfo'.default.TournamentID:
|
||||
bTournament = bool(Data);
|
||||
ch_Tournament.SetComponentValue(bTournament,True);
|
||||
break;
|
||||
|
||||
case class'VotingReplicationInfo'.default.DemoRecID:
|
||||
bDemoRec = bool(Data);
|
||||
ch_DemoRec.SetComponentValue(bDemoRec,true);
|
||||
if ( bDemoRec )
|
||||
EnableComponent(ed_DemoRec);
|
||||
else DisableComponent(ed_DemoRec);
|
||||
break;
|
||||
|
||||
case class'VotingReplicationInfo'.default.GameTypeID:
|
||||
GameClass = Data;
|
||||
if ( GameClass != "" )
|
||||
{
|
||||
co_GameType.MyComboBox.List.bNotify = false;
|
||||
co_GameType.Find(Data, ,true);
|
||||
co_Gametype.MyComboBox.List.bNotify = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case class'VotingReplicationInfo'.default.URLID:
|
||||
Params = Data;
|
||||
ed_Params.SetComponentValue(Params,true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function InternalOnChange( GUIComponent Sender )
|
||||
{
|
||||
if ( Sender == ch_DemoRec )
|
||||
{
|
||||
if ( ch_DemoRec.IsChecked() )
|
||||
EnableComponent(ed_DemoRec);
|
||||
else DisableComponent(ed_DemoRec);
|
||||
}
|
||||
|
||||
Super.InternalOnChange(Sender);
|
||||
}
|
||||
|
||||
function SubmitChanges()
|
||||
{
|
||||
if ( GameClass != co_GameType.GetExtra() )
|
||||
SendCommand( GetCommandString(co_GameType) );
|
||||
|
||||
if ( bTournament != ch_Tournament.IsChecked() )
|
||||
SendCommand( GetCommandString(ch_Tournament) );
|
||||
|
||||
if ( bDemoRec != ch_DemoRec.IsChecked() )
|
||||
SendCommand( GetCommandString(ch_DemoRec) );
|
||||
|
||||
if ( Params != ed_Params.GetText() )
|
||||
SendCommand( GetCommandString(ed_Params) );
|
||||
|
||||
Super.SubmitChanges();
|
||||
}
|
||||
|
||||
function string GetCommandString( GUIComponent Comp )
|
||||
{
|
||||
local string str;
|
||||
|
||||
if ( Comp == None )
|
||||
return "";
|
||||
|
||||
str = Group;
|
||||
|
||||
switch ( Comp )
|
||||
{
|
||||
case co_Gametype:
|
||||
str $= ":" $ class'VotingReplicationInfo'.default.GametypeID $ ";" $ co_GameType.GetExtra();
|
||||
break;
|
||||
|
||||
case ch_Tournament:
|
||||
str $= ":" $ class'VotingReplicationInfo'.default.TournamentID $ ";" $ ch_Tournament.IsChecked();
|
||||
break;
|
||||
|
||||
case ch_DemoRec:
|
||||
str $= ":" $ class'VotingReplicationInfo'.default.DemoRecID;
|
||||
if ( ch_DemoRec.IsChecked() )
|
||||
str $= ";" $ ed_DemoRec.GetText();
|
||||
break;
|
||||
|
||||
case ed_Params:
|
||||
str $= ":" $ class'VotingReplicationInfo'.default.URLID;
|
||||
if ( ed_Params.GetText() != "" )
|
||||
str $= ";" $ ed_Params.GetText();
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
PanelCaption="General"
|
||||
|
||||
Begin Object Class=moComboBox Name=GameTypeCombo
|
||||
Caption="Game Type"
|
||||
Hint="Select the gametype to use in the current match"
|
||||
WinWidth=0.622588
|
||||
WinHeight=0.1
|
||||
WinLeft=0.014282
|
||||
WinTop=0.132839
|
||||
TabOrder=0
|
||||
End Object
|
||||
co_GameType=GameTypeCombo
|
||||
|
||||
Begin Object Class=moCheckbox Name=TournamentCheckbox
|
||||
Caption="Tournament Mode"
|
||||
Hint="All players must be connected to the server before the match can start"
|
||||
WinWidth=0.353296
|
||||
WinHeight=0.100000
|
||||
WinLeft=0.012272
|
||||
WinTop=0.295934
|
||||
TabOrder=1
|
||||
End Object
|
||||
ch_Tournament=TournamentCheckBox
|
||||
|
||||
Begin Object Class=moEditBox Name=CommandLineParamsBox
|
||||
Caption="Additional Command Line Parameters"
|
||||
Hint="Specify any additional command line parameters (optional)"
|
||||
bVerticalLayout=True
|
||||
LabelJustification=TXTA_Center
|
||||
WinWidth=0.986084
|
||||
WinHeight=0.2
|
||||
WinLeft=0.008252
|
||||
WinTop=0.734349
|
||||
TabOrder=2
|
||||
End Object
|
||||
ed_Params=CommandLineParamsBox
|
||||
|
||||
Begin Object Class=moCheckBox Name=DemoRecCheckbox
|
||||
Caption="Record Demo"
|
||||
Hint="Record a server-side demo of this match"
|
||||
WinWidth=0.353046
|
||||
WinHeight=0.100000
|
||||
WinLeft=0.011267
|
||||
WinTop=0.459699
|
||||
OnChange=InternalOnChange
|
||||
TabOrder=3
|
||||
End Object
|
||||
ch_DemoRec=DemoRecCheckBox
|
||||
|
||||
Begin Object Class=moEditBox Name=DemoRecBox
|
||||
Caption="Filename"
|
||||
CaptionWidth=0.1
|
||||
Hint="Enter the name of the demo you'd like to record for this match"
|
||||
WinWidth=0.591943
|
||||
WinHeight=0.100000
|
||||
WinLeft=0.391845
|
||||
WinTop=0.457450
|
||||
MenuState=MSAT_Disabled
|
||||
TabOrder=4
|
||||
End Object
|
||||
ed_DemoRec=DemoRecBox
|
||||
|
||||
}
|
||||
558
kf_sources/XVoting/Classes/MatchSetupMaps.uc
Normal file
558
kf_sources/XVoting/Classes/MatchSetupMaps.uc
Normal file
|
|
@ -0,0 +1,558 @@
|
|||
//==============================================================================
|
||||
// Created on: 01/02/2004
|
||||
// Configures maplist for match setup
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class MatchSetupMaps extends MatchSetupPanelBase;
|
||||
|
||||
var automated GUISectionBackground sb_Avail, sb_Active;
|
||||
var automated GUIListBox lb_Avail, lb_Active;
|
||||
var() editconst noexport GUIList li_Active, li_Avail;
|
||||
var automated GUIButton b_Add, b_AddAll, b_Remove, b_RemoveAll, b_MoveUp, b_MoveDown;
|
||||
|
||||
struct MapInfo
|
||||
{
|
||||
var string FriendlyName, Params, URL;
|
||||
var int Index;
|
||||
};
|
||||
|
||||
var() array<MapInfo> TrackedMaps;
|
||||
|
||||
function InitPanel()
|
||||
{
|
||||
Super.InitPanel();
|
||||
Group = class'VotingReplicationInfo'.default.MapID;
|
||||
}
|
||||
|
||||
function LoggedOut()
|
||||
{
|
||||
Super.LoggedOut();
|
||||
|
||||
li_Avail.Clear();
|
||||
li_Active.Clear();
|
||||
}
|
||||
|
||||
function bool HandleResponse(string Type, string Info, string Data)
|
||||
{
|
||||
local int i;
|
||||
local array<string> Indexes;
|
||||
|
||||
if ( Type ~= Group )
|
||||
{
|
||||
log("MAPS HandleResponse Info '"$Info$"' Data '"$Data$"'",'MapVoteDebug');
|
||||
if ( Info ~= class'VotingReplicationInfo'.default.AddID )
|
||||
{
|
||||
ReceiveNewMap(Data);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Info ~= class'VotingReplicationInfo'.default.UpdateID )
|
||||
{
|
||||
Split(Data, ",", Indexes);
|
||||
for ( i = 0; i < Indexes.Length; i++ )
|
||||
AddMapByIndex(int(Indexes[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function ReceiveNewMap( string Data )
|
||||
{
|
||||
local int Index, pos;
|
||||
local string MapName;
|
||||
|
||||
pos = InStr(Data, ",");
|
||||
if ( pos != -1 )
|
||||
{
|
||||
Index = int(Left(Data,pos));
|
||||
MapName = Mid(Data, pos+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
log("HandleResponse received weird mapname:"@Data);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
TrackMapInfo( StripMapName(MapName), "", Index );
|
||||
li_Avail.Add(MapName);
|
||||
}
|
||||
|
||||
function TrackMapInfo( string FriendlyName, string URL, int Index )
|
||||
{
|
||||
local int i;
|
||||
|
||||
i = FindTrackingIndex(FriendlyName $ URL);
|
||||
if ( i == -1 )
|
||||
{
|
||||
i = TrackedMaps.Length;
|
||||
TrackedMaps.Length = TrackedMaps.Length + 1;
|
||||
}
|
||||
|
||||
TrackedMaps[i].FriendlyName = FriendlyName;
|
||||
TrackedMaps[i].Params = URL;
|
||||
TrackedMaps[i].URL = FriendlyName $ URL;
|
||||
TrackedMaps[i].Index = Index;
|
||||
}
|
||||
|
||||
function int FindTrackingIndex( string MapURL )
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < TrackedMaps.Length; i++ )
|
||||
{
|
||||
if ( TrackedMaps[i].URL ~= MapURL )
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function InitComponent(GUIController InController, GUIComponent InOwner)
|
||||
{
|
||||
Super.InitComponent(InController, InOwner);
|
||||
|
||||
li_Avail = lb_Avail.List;
|
||||
li_Active = lb_Active.List;
|
||||
|
||||
if (li_Avail != None)
|
||||
{
|
||||
li_Avail.bDropSource = True;
|
||||
li_Avail.bDropTarget = True;
|
||||
li_Avail.OnDblClick = ModifyMapList;
|
||||
li_Avail.AddLinkObject( b_Add, True );
|
||||
li_Avail.CheckLinkedObjects = InternalCheckLinkedObj;
|
||||
li_Avail.bInitializeList = False;
|
||||
}
|
||||
|
||||
if (li_Active != None)
|
||||
{
|
||||
li_Active.bDropSource = True;
|
||||
li_Active.bDropTarget = True;
|
||||
li_Active.OnDblClick = ModifyMapList;
|
||||
li_Active.AddLinkObject( b_Remove, True );
|
||||
li_Active.AddLinkObject( b_MoveUp, True );
|
||||
li_Active.AddLinkObject( b_MoveDown, True );
|
||||
li_Active.CheckLinkedObjects = InternalCheckLinkedObj;
|
||||
li_Active.bInitializeList = False;
|
||||
}
|
||||
|
||||
sb_Avail.ManageComponent(lb_Avail);
|
||||
sb_Active.ManageComponent(lb_Active);
|
||||
|
||||
}
|
||||
|
||||
// Mapname has value only when initializing list
|
||||
function bool AddMap()
|
||||
{
|
||||
local int i;
|
||||
local array<GUIListElem> PendingElements;
|
||||
|
||||
if ( !li_Avail.IsValid() )
|
||||
return false;
|
||||
|
||||
li_Avail.bNotify = False;
|
||||
PendingElements = li_Avail.GetPendingElements(True);
|
||||
for ( i = 0; i < PendingElements.Length; i++ )
|
||||
{
|
||||
li_Avail.RemoveElement(PendingElements[i],,True);
|
||||
li_Active.AddElement(PendingElements[i]);
|
||||
}
|
||||
|
||||
li_Avail.bNotify = True;
|
||||
li_Avail.ClearPendingElements();
|
||||
li_Avail.SetIndex(li_Avail.Index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function bool RemoveMap()
|
||||
{
|
||||
local int i;
|
||||
local array<GUIListElem> PendingElements;
|
||||
|
||||
if ( !li_Active.IsValid() )
|
||||
return false;
|
||||
|
||||
li_Active.bNotify = False;
|
||||
PendingElements = li_Active.GetPendingElements( True );
|
||||
for ( i = 0; i < PendingElements.Length; i++ )
|
||||
{
|
||||
li_Active.RemoveElement( PendingElements[i],,True );
|
||||
li_Avail.AddElement( PendingElements[i] );
|
||||
}
|
||||
|
||||
li_Active.bNotify = True;
|
||||
li_Active.ClearPendingElements();
|
||||
li_Active.SetIndex(li_Active.Index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function AddMapByIndex( int Index )
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < TrackedMaps.Length; i++ )
|
||||
{
|
||||
if ( TrackedMaps[i].Index == Index )
|
||||
{
|
||||
li_Avail.RemoveItem(TrackedMaps[i].URL);
|
||||
if ( li_Active.FindIndex(TrackedMaps[i].URL) == -1 )
|
||||
li_Active.Add(TrackedMaps[i].URL);
|
||||
|
||||
li_Avail.ClearPendingElements();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function RemoveMapByIndex( int Index )
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < TrackedMaps.Length; i++ )
|
||||
{
|
||||
if ( TrackedMaps[i].Index == Index )
|
||||
{
|
||||
li_Active.RemoveItem(TrackedMaps[i].URL);
|
||||
|
||||
if ( li_Avail.FindIndex(TrackedMaps[i].URL) == -1 )
|
||||
li_Avail.Add(TrackedMaps[i].URL);
|
||||
|
||||
li_Active.ClearPendingElements();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SubmitChanges()
|
||||
{
|
||||
local int i, idx;
|
||||
local string str;
|
||||
|
||||
for ( i = 0; i < li_Active.ItemCount; i++ )
|
||||
{
|
||||
idx = FindTrackingIndex(li_Active.GetItemAtIndex(i));
|
||||
if ( idx != -1 )
|
||||
{
|
||||
if ( str != "" )
|
||||
str $= ",";
|
||||
|
||||
str $= idx;
|
||||
}
|
||||
}
|
||||
|
||||
SendCommand( Group $ ":" $ str );
|
||||
Super.SubmitChanges();
|
||||
}
|
||||
|
||||
// Called when one of the buttons between the maplists are clicked on
|
||||
singular function bool ModifyMapList(GUIComponent Sender)
|
||||
{
|
||||
local int Index;
|
||||
local string Str;
|
||||
|
||||
if ( Sender == lb_Avail )
|
||||
{
|
||||
AddMap();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Sender == lb_Active )
|
||||
{
|
||||
RemoveMap();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( GUIButton(Sender) == None )
|
||||
return false;
|
||||
|
||||
switch ( GUIButton(Sender).Caption )
|
||||
{
|
||||
case b_Add.Caption:
|
||||
return AddMap();
|
||||
|
||||
case b_AddAll.Caption:
|
||||
if (lb_Avail.ItemCount()==0)
|
||||
return true;
|
||||
|
||||
// for ( Index = 0; Index < li_Avail.ItemCount; Index++ )
|
||||
// MapHandler.AddMap( GameIndex, RecordIndex, li_Avail.GetItemAtIndex(Index) );
|
||||
|
||||
li_Active.LoadFrom(li_Avail);
|
||||
li_Avail.Clear();
|
||||
|
||||
return true;
|
||||
|
||||
case b_Remove.Caption:
|
||||
return RemoveMap();
|
||||
|
||||
case b_RemoveAll.Caption:
|
||||
if ( lb_Active.ItemCount()==0 )
|
||||
return true;
|
||||
|
||||
// for ( Index = 0; Index < li_Active.ItemCount; Index++ )
|
||||
// MapHandler.RemoveMap( GameIndex, RecordIndex, li_Active.GetItemAtIndex(Index) );
|
||||
|
||||
li_Avail.LoadFrom(li_Active,false);
|
||||
li_Active.Clear();
|
||||
|
||||
return true;
|
||||
|
||||
case b_MoveUp.Caption:
|
||||
if ( !li_Active.IsValid() )
|
||||
return true;
|
||||
|
||||
Index = li_Active.Index;
|
||||
Str = GetMapURL(li_Active, -1);
|
||||
if (index>0)
|
||||
{
|
||||
li_Active.Swap(index,index-1);
|
||||
li_Active.SetIndex(Index - 1);
|
||||
}
|
||||
|
||||
// MapHandler.ShiftMap(GameIndex, RecordIndex, Str, -1);
|
||||
|
||||
return true;
|
||||
|
||||
case b_MoveDown.Caption:
|
||||
if ( !li_Active.IsValid() )
|
||||
return true;
|
||||
|
||||
Index = li_Active.Index;
|
||||
Str = GetMapURL(li_Active, -1);
|
||||
|
||||
if (index<lb_Active.ItemCount()-1)
|
||||
{
|
||||
li_Active.Swap(index,index+1);
|
||||
li_Active.SetIndex(Index + 1);
|
||||
}
|
||||
|
||||
// MapHandler.ShiftMap(GameIndex, RecordIndex, Str, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This function overrides GUIList default behavior because we only want to disable the AddAll and RemoveAll
|
||||
// if those lists are empty
|
||||
function InternalCheckLinkedObj( GUIListBase List )
|
||||
{
|
||||
if ( List.IsValid() )
|
||||
List.EnableLinkedObjects();
|
||||
else List.DisableLinkedObjects();
|
||||
|
||||
if ( li_Avail.ItemCount > 0 )
|
||||
EnableComponent(b_AddAll);
|
||||
else DisableComponent(b_AddAll);
|
||||
|
||||
if ( li_Active.ItemCount > 0 )
|
||||
{
|
||||
EnableComponent(b_RemoveAll);
|
||||
if ( li_Active.IsValid() )
|
||||
{
|
||||
if ( li_Active.Index == 0 )
|
||||
DisableComponent(b_MoveUp);
|
||||
else
|
||||
{
|
||||
EnableComponent(b_MoveUp);
|
||||
if ( li_Active.Index == li_Active.ItemCount -1 )
|
||||
DisableComponent(b_MoveDown);
|
||||
else EnableComponent(b_MoveDown);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableComponent(b_MoveUp);
|
||||
DisableComponent(b_MoveDown);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableComponent(b_RemoveAll);
|
||||
DisableComponent(b_MoveUp);
|
||||
DisableComponent(b_MoveDown);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any additional text from the map's name
|
||||
// Used for getting just the mapname
|
||||
static function string StripMapName( string FullMapName )
|
||||
{
|
||||
local int pos;
|
||||
|
||||
pos = InStr(FullMapName, " ");
|
||||
if ( pos != -1 )
|
||||
FullMapName = Left(FullMapName, pos);
|
||||
|
||||
pos = InStr(FullMapName, "?");
|
||||
if ( pos != -1 )
|
||||
FullMapName = Left(FullMapName, pos);
|
||||
|
||||
return FullMapName;
|
||||
}
|
||||
|
||||
// Remove the additional text, and append the extra string data from the list
|
||||
// Used when passing in a URL for the selected map
|
||||
static function string GetMapURL( GUIList List, int Index )
|
||||
{
|
||||
local int pos;
|
||||
local string s;
|
||||
|
||||
if ( Index == -1 )
|
||||
Index = List.Index;
|
||||
|
||||
s = List.GetItemAtIndex(Index);
|
||||
pos = InStr(s, " ");
|
||||
|
||||
// extra text in the mapname - get additional parameters from extra info
|
||||
if ( pos != -1 )
|
||||
s = Left(s, pos) $ List.GetExtraAtIndex(Index);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
PanelCaption="Maplist"
|
||||
OnLogOut=LoggedOut
|
||||
|
||||
Begin Object Class=GUISectionBackground Name=InactiveBackground
|
||||
Caption="Inactive Maps"
|
||||
WinWidth=0.483107
|
||||
WinHeight=0.965313
|
||||
WinLeft=0.013880
|
||||
WinTop=0.030053
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
BottomPadding=0.11
|
||||
bFillClient=True
|
||||
End Object
|
||||
sb_Avail=InactiveBackground
|
||||
|
||||
Begin Object Class=GUISectionBackground Name=ActiveBackground
|
||||
Caption="Active Maps"
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
WinWidth=0.474194
|
||||
WinHeight=0.965313
|
||||
WinLeft=0.511243
|
||||
WinTop=0.030053
|
||||
BottomPadding=0.215
|
||||
bFillClient=True
|
||||
End Object
|
||||
sb_Active=ActiveBackground
|
||||
|
||||
Begin Object Class=GUIListBox Name=InactiveList
|
||||
WinWidth=0.380394
|
||||
WinHeight=0.662671
|
||||
WinLeft=0.113794
|
||||
WinTop=0.138078
|
||||
bVisibleWhenEmpty=true
|
||||
bSorted=True
|
||||
TabOrder=0
|
||||
End Object
|
||||
lb_Avail=InactiveList
|
||||
|
||||
Begin Object Class=GUIListBox Name=ActiveList
|
||||
WinWidth=0.368359
|
||||
WinHeight=0.662671
|
||||
WinLeft=0.605861
|
||||
WinTop=0.108021
|
||||
bVisibleWhenEmpty=true
|
||||
TabOrder=1
|
||||
End Object
|
||||
lb_Active=ActiveList
|
||||
|
||||
|
||||
Begin Object Class=GUIButton Name=AddAllButton
|
||||
Caption="Add All"
|
||||
Hint="Add all maps to your map list"
|
||||
WinWidth=0.190232
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.045006
|
||||
WinTop=0.902198
|
||||
OnClick=ModifyMapList
|
||||
OnClickSound=CS_Up
|
||||
TabOrder=5
|
||||
End Object
|
||||
b_AddAll=AddAllButton
|
||||
|
||||
Begin Object Class=GUIButton Name=AddButton
|
||||
Caption="Add"
|
||||
Hint="Add the selected maps to your map list"
|
||||
WinWidth=0.203807
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.263743
|
||||
WinTop=0.902198
|
||||
OnClick=ModifyMapList
|
||||
OnClickSound=CS_Up
|
||||
TabOrder=6
|
||||
bRepeatClick=True
|
||||
End Object
|
||||
b_Add=AddButton
|
||||
|
||||
Begin Object Class=GUIButton Name=MoveDownButton
|
||||
Caption="Down"
|
||||
Hint="Move this map lower down in the list"
|
||||
WinWidth=0.191554
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.543747
|
||||
WinTop=0.815376
|
||||
OnClick=ModifyMapList
|
||||
OnClickSound=CS_Down
|
||||
TabOrder=8
|
||||
bRepeatClick=True
|
||||
End Object
|
||||
b_MoveDown=MoveDownButton
|
||||
|
||||
Begin Object Class=GUIButton Name=MoveUpButton
|
||||
Caption="Up"
|
||||
Hint="Move this map higher up in the list"
|
||||
WinWidth=0.191554
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.772577
|
||||
WinTop=0.815376
|
||||
OnClick=ModifyMapList
|
||||
OnClickSound=CS_Up
|
||||
TabOrder=9
|
||||
bRepeatClick=True
|
||||
End Object
|
||||
b_MoveUp=MoveUpButton
|
||||
|
||||
Begin Object Class=GUIButton Name=RemoveButton
|
||||
Caption="Remove"
|
||||
Hint="Remove the selected maps from your map list"
|
||||
WinWidth=0.191554
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.543747
|
||||
WinTop=0.902198
|
||||
OnClick=ModifyMapList
|
||||
OnClickSound=CS_Down
|
||||
TabOrder=10
|
||||
AutoSizePadding=(HorzPerc=0.5,VertPerc=0.0)
|
||||
bRepeatClick=True
|
||||
End Object
|
||||
b_Remove=RemoveButton
|
||||
|
||||
Begin Object Class=GUIButton Name=RemoveAllButton
|
||||
Caption="Remove All"
|
||||
Hint="Remove all maps from your map list"
|
||||
WinWidth=0.191554
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.772577
|
||||
WinTop=0.902198
|
||||
OnClick=ModifyMapList
|
||||
OnClickSound=CS_Down
|
||||
TabOrder=11
|
||||
End Object
|
||||
b_RemoveAll=RemoveAllButton
|
||||
}
|
||||
434
kf_sources/XVoting/Classes/MatchSetupMutator.uc
Normal file
434
kf_sources/XVoting/Classes/MatchSetupMutator.uc
Normal file
|
|
@ -0,0 +1,434 @@
|
|||
//==============================================================================
|
||||
// Created on: 01/03/2004
|
||||
// Configure mutators in match setup
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class MatchSetupMutator extends MatchSetupPanelBase;
|
||||
|
||||
var automated GUISectionBackground sb_Avail, sb_Active;
|
||||
var automated GUIListBox lb_Avail, lb_Active;
|
||||
var() editconst noexport GUIList li_Active, li_Avail;
|
||||
var automated GUIButton b_Add, b_AddAll, b_Remove, b_RemoveAll;
|
||||
|
||||
struct MutatorInfo
|
||||
{
|
||||
var string ClassName, FriendlyName;
|
||||
var int Index;
|
||||
};
|
||||
|
||||
var() array<MutatorInfo> TrackedMutators;
|
||||
|
||||
function InitPanel()
|
||||
{
|
||||
Super.InitPanel();
|
||||
Group = class'VotingReplicationInfo'.default.MutatorID;
|
||||
}
|
||||
|
||||
function bool HandleResponse(string Type, string Info, string Data)
|
||||
{
|
||||
local int i;
|
||||
local array<string> Indexes;
|
||||
|
||||
if ( Type ~= Group )
|
||||
{
|
||||
log("MUTATORS HandleResponse Info '"$Info$"' Data '"$Data$"'",'MapVoteDebug');
|
||||
if ( Info ~= class'VotingReplicationInfo'.default.AddID )
|
||||
{
|
||||
ReceiveNewMutator(Data);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Info ~= class'VotingReplicationInfo'.default.UpdateID && Data != "" )
|
||||
{
|
||||
Split(Data, ",", Indexes);
|
||||
for ( i = 0; i < Indexes.Length; i++ )
|
||||
AddMutatorByIndex(int(Indexes[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//MutatorID, AddID, Index $ "," $ M.ClassName $ Chr(27) $ M.FriendlyName
|
||||
function ReceiveNewMutator( string Data )
|
||||
{
|
||||
local int Index, pos;
|
||||
local string ClassName, FriendlyName;
|
||||
|
||||
pos = InStr(Data, ",");
|
||||
if ( pos != -1 )
|
||||
{
|
||||
Index = int(Left(Data,pos));
|
||||
Data = Mid(Data, pos+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
log("HandleResponse received weird mutator:"@Data);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if ( !Divide(Data, Chr(27), ClassName, FriendlyName) )
|
||||
{
|
||||
log("HandleResponse received invalid mutator string:"$Data);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
TrackMutatorInfo(Index, ClassName, FriendlyName);
|
||||
li_Avail.Add(FriendlyName,,ClassName);
|
||||
}
|
||||
|
||||
function TrackMutatorInfo( int Index, string ClassName, string FriendlyName )
|
||||
{
|
||||
local int i;
|
||||
|
||||
i = FindTrackingIndex(ClassName);
|
||||
if ( i == -1 )
|
||||
{
|
||||
i = TrackedMutators.Length;
|
||||
TrackedMutators.Length = TrackedMutators.Length + 1;
|
||||
}
|
||||
|
||||
TrackedMutators[i].Index = Index;
|
||||
TrackedMutators[i].ClassName = ClassName;
|
||||
TrackedMutators[i].FriendlyName = FriendlyName;
|
||||
}
|
||||
|
||||
function int FindTrackingIndex( string ClassName )
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < TrackedMutators.Length; i++ )
|
||||
{
|
||||
if ( TrackedMutators[i].ClassName ~= ClassName )
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function LoggedOut()
|
||||
{
|
||||
Super.LoggedOut();
|
||||
|
||||
li_Avail.Clear();
|
||||
li_Active.Clear();
|
||||
}
|
||||
|
||||
function InitComponent(GUIController InController, GUIComponent InOwner)
|
||||
{
|
||||
Super.InitComponent(InController, InOwner);
|
||||
|
||||
li_Avail = lb_Avail.List;
|
||||
li_Active = lb_Active.List;
|
||||
|
||||
if (li_Avail != None)
|
||||
{
|
||||
li_Avail.bDropSource = True;
|
||||
li_Avail.bDropTarget = True;
|
||||
li_Avail.OnDblClick = ModifyMutatorList;
|
||||
li_Avail.AddLinkObject( b_Add, True );
|
||||
li_Avail.CheckLinkedObjects = InternalCheckLinkedObj;
|
||||
li_Avail.bInitializeList = False;
|
||||
}
|
||||
|
||||
if (li_Active != None)
|
||||
{
|
||||
li_Active.bDropSource = True;
|
||||
li_Active.bDropTarget = True;
|
||||
li_Active.OnDblClick = ModifyMutatorList;
|
||||
li_Active.AddLinkObject( b_Remove, True );
|
||||
li_Active.CheckLinkedObjects = InternalCheckLinkedObj;
|
||||
li_Active.bInitializeList = False;
|
||||
}
|
||||
|
||||
sb_Avail.ManageComponent(lb_Avail);
|
||||
sb_Active.ManageComponent(lb_Active);
|
||||
|
||||
}
|
||||
|
||||
// Mapname has value only when initializing list
|
||||
function bool AddMutator()
|
||||
{
|
||||
local int i;
|
||||
local array<GUIListElem> PendingElements;
|
||||
|
||||
if ( !li_Avail.IsValid() )
|
||||
return false;
|
||||
|
||||
li_Avail.bNotify = False;
|
||||
PendingElements = li_Avail.GetPendingElements(True);
|
||||
for ( i = 0; i < PendingElements.Length; i++ )
|
||||
{
|
||||
li_Avail.RemoveElement(PendingElements[i],,True);
|
||||
li_Active.AddElement(PendingElements[i]);
|
||||
}
|
||||
|
||||
li_Avail.bNotify = True;
|
||||
li_Avail.ClearPendingElements();
|
||||
li_Avail.SetIndex(li_Avail.Index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function bool RemoveMutator()
|
||||
{
|
||||
local int i;
|
||||
local array<GUIListElem> PendingElements;
|
||||
|
||||
if ( !li_Active.IsValid() )
|
||||
return false;
|
||||
|
||||
li_Active.bNotify = False;
|
||||
PendingElements = li_Active.GetPendingElements( True );
|
||||
for ( i = 0; i < PendingElements.Length; i++ )
|
||||
{
|
||||
li_Active.RemoveElement( PendingElements[i],,True );
|
||||
li_Avail.AddElement( PendingElements[i] );
|
||||
}
|
||||
|
||||
li_Active.bNotify = True;
|
||||
li_Active.ClearPendingElements();
|
||||
li_Active.SetIndex(li_Active.Index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function AddMutatorByIndex( int Index )
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < TrackedMutators.Length; i++ )
|
||||
{
|
||||
if ( TrackedMutators[i].Index == Index )
|
||||
{
|
||||
li_Avail.RemoveExtra(TrackedMutators[i].ClassName);
|
||||
if ( li_Active.FindIndex(TrackedMutators[i].ClassName,,True) == -1 )
|
||||
li_Active.Add(TrackedMutators[i].FriendlyName,,TrackedMutators[i].ClassName);
|
||||
|
||||
li_Avail.ClearPendingElements();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function RemoveMapByIndex( int Index )
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < TrackedMutators.Length; i++ )
|
||||
{
|
||||
if ( TrackedMutators[i].Index == Index )
|
||||
{
|
||||
li_Active.RemoveExtra(TrackedMutators[i].ClassName);
|
||||
|
||||
if ( li_Avail.FindIndex(TrackedMutators[i].ClassName,,True) == -1 )
|
||||
li_Avail.Add(TrackedMutators[i].FriendlyName,,TrackedMutators[i].ClassName);
|
||||
|
||||
li_Active.ClearPendingElements();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when one of the buttons between the maplists are clicked on
|
||||
singular function bool ModifyMutatorList(GUIComponent Sender)
|
||||
{
|
||||
if ( Sender == lb_Avail )
|
||||
{
|
||||
AddMutator();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Sender == lb_Active )
|
||||
{
|
||||
RemoveMutator();
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( GUIButton(Sender) == None )
|
||||
return false;
|
||||
|
||||
switch ( GUIButton(Sender).Caption )
|
||||
{
|
||||
case b_Add.Caption:
|
||||
return AddMutator();
|
||||
|
||||
case b_AddAll.Caption:
|
||||
if (lb_Avail.ItemCount()==0)
|
||||
return true;
|
||||
|
||||
li_Active.LoadFrom(li_Avail);
|
||||
li_Avail.Clear();
|
||||
|
||||
return true;
|
||||
|
||||
case b_Remove.Caption:
|
||||
return RemoveMutator();
|
||||
|
||||
case b_RemoveAll.Caption:
|
||||
if ( lb_Active.ItemCount()==0 )
|
||||
return true;
|
||||
|
||||
li_Avail.LoadFrom(li_Active);
|
||||
li_Active.Clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This function overrides GUIList default behavior because we only want to disable the AddAll and RemoveAll
|
||||
// if those lists are empty
|
||||
function InternalCheckLinkedObj( GUIListBase List )
|
||||
{
|
||||
if ( List.IsValid() )
|
||||
List.EnableLinkedObjects();
|
||||
else List.DisableLinkedObjects();
|
||||
|
||||
if ( li_Avail.ItemCount > 0 )
|
||||
EnableComponent(b_AddAll);
|
||||
else DisableComponent(b_AddAll);
|
||||
|
||||
if ( li_Active.ItemCount > 0 )
|
||||
EnableComponent(b_RemoveAll);
|
||||
else DisableComponent(b_RemoveAll);
|
||||
}
|
||||
|
||||
function SubmitChanges()
|
||||
{
|
||||
local int i, idx;
|
||||
local string str;
|
||||
|
||||
if ( bDirty )
|
||||
{
|
||||
for ( i = 0; i < li_Active.ItemCount; i++ )
|
||||
{
|
||||
idx = FindTrackingIndex(li_Active.GetExtraAtIndex(i));
|
||||
if ( idx != -1 )
|
||||
{
|
||||
if ( str != "" )
|
||||
str $= ",";
|
||||
|
||||
str $= idx;
|
||||
}
|
||||
}
|
||||
|
||||
SendCommand( Group $ ":" $ str );
|
||||
}
|
||||
|
||||
Super.SubmitChanges();
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
PanelCaption="Mutators"
|
||||
|
||||
Begin Object Class=GUISectionBackground Name=InactiveBackground
|
||||
Caption="Inactive Mutators"
|
||||
WinWidth=0.483107
|
||||
WinHeight=0.965313
|
||||
WinLeft=0.013880
|
||||
WinTop=0.030053
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
BottomPadding=0.11
|
||||
bFillClient=True
|
||||
End Object
|
||||
sb_Avail=InactiveBackground
|
||||
|
||||
Begin Object Class=GUISectionBackground Name=ActiveBackground
|
||||
Caption="Active Mutators"
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
WinWidth=0.474194
|
||||
WinHeight=0.965313
|
||||
WinLeft=0.511243
|
||||
WinTop=0.030053
|
||||
BottomPadding=0.11
|
||||
bFillClient=True
|
||||
End Object
|
||||
sb_Active=ActiveBackground
|
||||
|
||||
Begin Object Class=GUIListBox Name=MutInactiveList
|
||||
WinWidth=0.380394
|
||||
WinHeight=0.662671
|
||||
WinLeft=0.113794
|
||||
WinTop=0.138078
|
||||
bVisibleWhenEmpty=true
|
||||
bSorted=True
|
||||
TabOrder=0
|
||||
End Object
|
||||
lb_Avail=MutInactiveList
|
||||
|
||||
Begin Object Class=GUIListBox Name=MutActiveList
|
||||
WinWidth=0.368359
|
||||
WinHeight=0.662671
|
||||
WinLeft=0.605861
|
||||
WinTop=0.108021
|
||||
bVisibleWhenEmpty=true
|
||||
bSorted=True
|
||||
TabOrder=1
|
||||
End Object
|
||||
lb_Active=MutActiveList
|
||||
|
||||
|
||||
Begin Object Class=GUIButton Name=MutAddAllButton
|
||||
Caption="Add All"
|
||||
Hint="Add all mutators to the list"
|
||||
WinWidth=0.190232
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.045006
|
||||
WinTop=0.902198
|
||||
OnClick=ModifyMutatorList
|
||||
OnClickSound=CS_Up
|
||||
TabOrder=5
|
||||
End Object
|
||||
b_AddAll=MutAddAllButton
|
||||
|
||||
Begin Object Class=GUIButton Name=MutAddButton
|
||||
Caption="Add"
|
||||
Hint="Add the selected mutators to the list"
|
||||
WinWidth=0.203807
|
||||
WinHeight=0.079184
|
||||
WinLeft=0.263743
|
||||
WinTop=0.902198
|
||||
OnClick=ModifyMutatorList
|
||||
OnClickSound=CS_Up
|
||||
TabOrder=6
|
||||
bRepeatClick=True
|
||||
End Object
|
||||
b_Add=MutAddButton
|
||||
|
||||
Begin Object Class=GUIButton Name=MutRemoveButton
|
||||
Caption="Remove"
|
||||
Hint="Remove the selected mutators from the list"
|
||||
WinWidth=0.191554
|
||||
WinHeight=0.055068
|
||||
WinLeft=0.543747
|
||||
WinTop=0.799682
|
||||
OnClick=ModifyMutatorList
|
||||
OnClickSound=CS_Down
|
||||
TabOrder=10
|
||||
AutoSizePadding=(HorzPerc=0.5,VertPerc=0.0)
|
||||
bRepeatClick=True
|
||||
End Object
|
||||
b_Remove=MutRemoveButton
|
||||
|
||||
Begin Object Class=GUIButton Name=MutRemoveAllButton
|
||||
Caption="Remove All"
|
||||
Hint="Remove all mutators from the list"
|
||||
WinWidth=0.191554
|
||||
WinHeight=0.055068
|
||||
WinLeft=0.772577
|
||||
WinTop=0.799682
|
||||
OnClick=ModifyMutatorList
|
||||
OnClickSound=CS_Down
|
||||
TabOrder=11
|
||||
End Object
|
||||
b_RemoveAll=MutRemoveAllButton
|
||||
}
|
||||
882
kf_sources/XVoting/Classes/MatchSetupPage.uc
Normal file
882
kf_sources/XVoting/Classes/MatchSetupPage.uc
Normal file
|
|
@ -0,0 +1,882 @@
|
|||
//====================================================================
|
||||
// xVoting.MatchSetupPage
|
||||
// MatchSetup page.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class MatchSetupPage extends VotingPage;
|
||||
/*
|
||||
var automated GUITreeListBox lb_TreeListBox;
|
||||
var automated GUIButton b_SaveButton;
|
||||
var automated GUIButton b_SubmitButton;
|
||||
var automated GUIButton b_SaveAsDefault;
|
||||
var automated GUIButton b_RestoreDefault;
|
||||
var automated GUILabel l_OptionLabel;
|
||||
var automated GUILabel l_Title;
|
||||
var automated GUILabel l_AvailableMaps;
|
||||
|
||||
// Generic controls (initially hidden)
|
||||
var automated GUIListBox lb_ListBoxA;
|
||||
var automated GUIListBox lb_ListBoxB;
|
||||
var automated MultiSelectListBox lb_MSListBox;
|
||||
var automated moCheckbox ch_CheckBox;
|
||||
var automated moComboBox co_ComboBox;
|
||||
var automated moFloatEdit fl_FloatEdit;
|
||||
var automated moNumericEdit nu_NumericEdit;
|
||||
var automated moEditBox ed_EditBox;
|
||||
|
||||
var array<CacheManager.GameRecord> GameTypes;
|
||||
//var array<CacheManager.MapRecord> Maps;
|
||||
var array<string> Maps;
|
||||
//var array<CacheManager.MutatorRecord> Mutators;
|
||||
var array<VotingReplicationInfo.MutatorData> Mutators;
|
||||
|
||||
var int SelectedGameTypeIdx;
|
||||
var string SelectedMapName;
|
||||
var string SelectedMutators;
|
||||
var string Parameters;
|
||||
var bool bTournamentMode;
|
||||
var string DemoRecFileName;
|
||||
|
||||
var PlayInfo PInfo;
|
||||
var string SelectedOption;
|
||||
var bool bCurrentSettingChanged;
|
||||
var bool bInitialized;
|
||||
|
||||
// Localization
|
||||
var localized string GameTypesCaption, MapNameCaption, MutatorsCaption,
|
||||
lmsgMustBeAdmin, lmsgMatchSetupDisabled, ParametersCaption,
|
||||
TournamentModeCaption, DemoRecCaption, MiscCaption, lmsgNotPermitted, lmsgMutator;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InternalOnOpen()
|
||||
{
|
||||
if( MVRI == none || (MVRI != none && !MVRI.bMatchSetup) )
|
||||
{
|
||||
Controller.OpenMenu("GUI2K4.GUI2K4QuestionPage");
|
||||
GUIQuestionPage(Controller.TopPage()).SetupQuestion(lmsgMatchSetupDisabled, QBTN_Ok, QBTN_Ok);
|
||||
GUIQuestionPage(Controller.TopPage()).OnButtonClick = OnOkButtonClick;
|
||||
return;
|
||||
}
|
||||
|
||||
if(MVRI != none && !MVRI.bMatchSetupPermitted)
|
||||
{
|
||||
if( PlayerOwner().PlayerReplicationInfo.bAdmin )
|
||||
MVRI.MatchSetupLogin("Admin", ""); // UserId and Password not checked for admins
|
||||
else
|
||||
Controller.OpenMenu("xVoting.MatchSetupLoginPage");
|
||||
}
|
||||
|
||||
class'CacheManager'.static.GetGameTypeList(GameTypes);
|
||||
//class'CacheManager'.static.GetMutatorList(Mutators);
|
||||
setTimer(1,true); // wait for login validation
|
||||
PInfo = new(None) class'Engine.PlayInfo';
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function OnOkButtonClick(byte bButton) // triggered by th GUIQuestionPage Ok Button
|
||||
{
|
||||
Controller.CloseAll(true);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Timer()
|
||||
{
|
||||
if( !bInitialized && MVRI != None && MVRI.bMatchSetupPermitted )
|
||||
{
|
||||
bInitialized = true;
|
||||
MVRI.RequestMatchSettings(True);
|
||||
}
|
||||
|
||||
if( !MVRI.bMatchSetupAccepted && !b_SubmitButton.bVisible)
|
||||
b_SubmitButton.Show();
|
||||
|
||||
if( MVRI.bMatchSetupAccepted && b_SubmitButton.bVisible)
|
||||
b_SubmitButton.Hide();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddGameType(string GameClassString)
|
||||
{
|
||||
local int i;
|
||||
|
||||
//log("____AddGameType", 'MapVoteDebug');
|
||||
lb_TreeListBox.List.OnChange = None;
|
||||
lb_TreeListBox.List.Clear(); // reload required when game type changed
|
||||
PInfo.Clear();
|
||||
|
||||
for(i = 0; i < GameTypes.Length; i++)
|
||||
{
|
||||
if(GameTypes[i].ClassName ~= GameClassString)
|
||||
{
|
||||
SelectedGameTypeIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
lb_TreeListBox.List.OnChange = OptionSelected;
|
||||
bCurrentSettingChanged=false;
|
||||
SelectedOption = "";
|
||||
lb_TreeListBox.List.AddItem(GameTypesCaption, "GameType", "");
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddMapName(string MapName)
|
||||
{
|
||||
//log("____AddMapName", 'MapVoteDebug');
|
||||
lb_TreeListBox.List.OnChange = None;
|
||||
lb_TreeListBox.List.AddItem(MapNameCaption, "MapName", "");
|
||||
SelectedMapName = MapName;
|
||||
lb_TreeListBox.List.OnChange = OptionSelected;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddMutators(string MutatorsString)
|
||||
{
|
||||
//log("____AddMutators", 'MapVoteDebug');
|
||||
lb_TreeListBox.List.OnChange = None;
|
||||
lb_TreeListBox.List.AddItem(MutatorsCaption, "Mutators", "");
|
||||
SelectedMutators = MutatorsString;
|
||||
lb_TreeListBox.List.OnChange = OptionSelected;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddParameters(string Value)
|
||||
{
|
||||
//log("____AddParameters", 'MapVoteDebug');
|
||||
lb_TreeListBox.List.OnChange = None;
|
||||
//lb_TreeListBox.List.AddItem(ParametersCaption, "", "");
|
||||
lb_TreeListBox.List.AddItem(MiscCaption, "GameOptions", ParametersCaption);
|
||||
lb_TreeListBox.List.OnChange = OptionSelected;
|
||||
Parameters = Value;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddTournamentMode(string Value)
|
||||
{
|
||||
//log("____AddTournamentMode", 'MapVoteDebug');
|
||||
lb_TreeListBox.List.OnChange = None;
|
||||
lb_TreeListBox.List.AddItem(TournamentModeCaption, "Tournament", ParametersCaption);
|
||||
lb_TreeListBox.List.OnChange = OptionSelected;
|
||||
bTournamentMode = bool(Value);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddDemoRecFileName(string Value)
|
||||
{
|
||||
//log("____AddDemoRecFileName", 'MapVoteDebug');
|
||||
lb_TreeListBox.List.OnChange = None;
|
||||
lb_TreeListBox.List.AddItem(DemoRecCaption, "DemoRec", ParametersCaption);
|
||||
lb_TreeListBox.List.OnChange = OptionSelected;
|
||||
DemoRecFileName = Value;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddSetting(string SettingName, string ClassFrom, string Value)
|
||||
{
|
||||
local int i;
|
||||
local class<Info> InfoClass;
|
||||
|
||||
Log("___AddSetting " $ SettingName $ ", " $ ClassFrom $ ", " $ Value, 'MapVoteDebug');
|
||||
|
||||
i = PInfo.FindIndex(SettingName);
|
||||
if( i == -1 ) // setting not found, need to load it
|
||||
{
|
||||
InfoClass = class<Info>(DynamicLoadObject(ClassFrom,class'Class'));
|
||||
if (InfoClass != None)
|
||||
{
|
||||
PInfo.AddClass(InfoClass);
|
||||
InfoClass.static.FillPlayInfo(PInfo);
|
||||
i = PInfo.FindIndex(SettingName);
|
||||
if( i == -1 )
|
||||
{
|
||||
log("Failed to find PlayInfo Setting " $ SettingName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Failed to load " $ ClassFrom);
|
||||
return;
|
||||
}
|
||||
}
|
||||
PInfo.StoreSetting( i, Value);
|
||||
lb_TreeListBox.List.OnChange = None;
|
||||
|
||||
if( class<Mutator>(InfoClass) != none)
|
||||
lb_TreeListBox.List.AddItem(PInfo.Settings[i].DisplayName, PInfo.Settings[i].SettingName, lmsgMutator);
|
||||
else
|
||||
lb_TreeListBox.List.AddItem(PInfo.Settings[i].DisplayName, PInfo.Settings[i].SettingName, PInfo.Settings[i].Grouping);
|
||||
lb_TreeListBox.List.OnChange = OptionSelected;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function UpdateSetting(string SettingName, string NewSetting)
|
||||
{
|
||||
local int i,x;
|
||||
|
||||
//log("____UpdateSetting", 'MapVoteDebug');
|
||||
|
||||
switch( SettingName )
|
||||
{
|
||||
case "MapName":
|
||||
SelectedMapName = NewSetting;
|
||||
break;
|
||||
case "Mutators":
|
||||
SelectedMutators = NewSetting;
|
||||
break;
|
||||
case "GameOptions":
|
||||
Parameters = NewSetting;
|
||||
break;
|
||||
case "Tournament":
|
||||
bTournamentMode = bool(NewSetting);
|
||||
break;
|
||||
case "DemoRec":
|
||||
DemoRecFileName = NewSetting;
|
||||
break;
|
||||
default:
|
||||
x = PInfo.FindIndex(SettingName);
|
||||
if( x > -1)
|
||||
PInfo.StoreSetting(x, NewSetting);
|
||||
}
|
||||
i = lb_TreeListBox.List.FindIndexByValue(SettingName);
|
||||
if( i > -1)
|
||||
lb_TreeListBox.List.SetIndex(i);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function OptionSelected(GUIComponent Sender)
|
||||
{
|
||||
local int i,x,Idx,pos;
|
||||
local array<string> Range;
|
||||
local string Width, Op;
|
||||
local array<string> MutatorArray;
|
||||
local array<string> MapArray;
|
||||
local bool bFound;
|
||||
|
||||
if( SelectedOption != lb_TreeListBox.List.GetValue() && bCurrentSettingChanged )
|
||||
SaveOption(SelectedOption); // save the previously changed setting
|
||||
SelectedOption = lb_TreeListBox.List.GetValue();
|
||||
|
||||
// Hide all generic controls
|
||||
lb_ListBoxA.Hide();
|
||||
lb_ListBoxB.Hide();
|
||||
lb_MSListBox.Hide();
|
||||
ch_CheckBox.Hide();
|
||||
co_ComboBox.Hide();
|
||||
fl_FloatEdit.Hide();
|
||||
nu_NumericEdit.Hide();
|
||||
ed_EditBox.Hide();
|
||||
l_AvailableMaps.Hide();
|
||||
|
||||
// disable change notification
|
||||
lb_ListBoxA.OnChange=None;
|
||||
lb_ListBoxB.OnChange=None;
|
||||
lb_MSListBox.OnChange=None;
|
||||
ch_CheckBox.OnChange=None;
|
||||
co_ComboBox.OnChange=None;
|
||||
fl_FloatEdit.OnChange=None;
|
||||
nu_NumericEdit.OnChange=None;
|
||||
ed_EditBox.OnChange=None;
|
||||
bCurrentSettingChanged=False;
|
||||
b_SaveButton.Hide();
|
||||
|
||||
l_OptionLabel.Caption=lb_TreeListBox.List.GetCaption();
|
||||
switch( SelectedOption )
|
||||
{
|
||||
case "GameType":
|
||||
lb_ListBoxA.SetHint("");
|
||||
lb_ListBoxA.List.Clear();
|
||||
for (i = 0; i < GameTypes.Length; i++)
|
||||
lb_ListBoxA.List.Add(GameTypes[i].GameName,none,GameTypes[i].ClassName);
|
||||
lb_ListBoxA.List.SetIndex(SelectedGameTypeIdx);
|
||||
lb_ListBoxA.Show();
|
||||
lb_ListBoxA.SetFocus(None);
|
||||
lb_ListBoxA.OnChange=SettingChanged;
|
||||
break;
|
||||
|
||||
case "MapName":
|
||||
lb_ListBoxA.SetHint("");
|
||||
ReadMapList();
|
||||
lb_ListBoxA.List.Clear();
|
||||
Split(SelectedMapName, ",", MapArray);
|
||||
for(i=0; i<MapArray.Length; i++)
|
||||
{
|
||||
bFound = false;
|
||||
for(x=0; x<Maps.Length; x++)
|
||||
{
|
||||
if( Maps[x] ~= MapArray[i] )
|
||||
{
|
||||
lb_ListBoxA.List.Add(Maps[x]);
|
||||
lb_ListBoxB.List.RemoveItem(Maps[x]);
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !bFound )
|
||||
lb_ListBoxA.List.Add(MapArray[i]);
|
||||
}
|
||||
lb_ListBoxA.Show();
|
||||
lb_ListBoxB.Show();
|
||||
l_AvailableMaps.Show();
|
||||
lb_ListBoxA.OnChange=MapSelected;
|
||||
lb_ListBoxB.OnChange=MapSelected;
|
||||
break;
|
||||
|
||||
case "Mutators":
|
||||
lb_MSListBox.SetHint("");
|
||||
lb_MSListBox.List.Clear();
|
||||
for (i = 0; i < Mutators.Length; i++)
|
||||
lb_MSListBox.List.Add(Mutators[i].FriendlyName,none,Mutators[i].ClassName);
|
||||
lb_MSListBox.List.Sort();
|
||||
lb_MSListBox.Show();
|
||||
Split(SelectedMutators, ",", MutatorArray);
|
||||
for(i=0; i<MutatorArray.Length; i++)
|
||||
lb_MSListBox.List.Find(MutatorArray[i],False,True); // bExtra
|
||||
|
||||
lb_MSListBox.SetFocus(None);
|
||||
lb_MSListBox.OnChange=SettingChanged;
|
||||
break;
|
||||
|
||||
case "Tournament":
|
||||
ch_CheckBox.SetHint("");
|
||||
ch_CheckBox.Show();
|
||||
ch_CheckBox.Caption = TournamentModeCaption;
|
||||
ch_CheckBox.SetComponentValue(String(bTournamentMode));
|
||||
ch_CheckBox.SetFocus(None);
|
||||
ch_CheckBox.OnChange=SettingChanged;
|
||||
break;
|
||||
|
||||
case "DemoRec":
|
||||
ed_EditBox.SetHint("");
|
||||
ed_EditBox.Show();
|
||||
ed_EditBox.MyEditBox.MaxWidth = 30;
|
||||
ed_EditBox.SetComponentValue(DemoRecFileName);
|
||||
ed_EditBox.SetFocus(None);
|
||||
ed_EditBox.OnChange=SettingChanged;
|
||||
break;
|
||||
|
||||
case "GameOptions":
|
||||
ed_EditBox.SetHint("");
|
||||
ed_EditBox.Show();
|
||||
ed_EditBox.MyEditBox.MaxWidth = 255;
|
||||
ed_EditBox.SetComponentValue(Parameters);
|
||||
ed_EditBox.SetFocus(None);
|
||||
ed_EditBox.OnChange=SettingChanged;
|
||||
break;
|
||||
|
||||
Default:
|
||||
if( SelectedOption != "" )
|
||||
{
|
||||
Idx = PInfo.FindIndex(SelectedOption);
|
||||
if( PInfo.Settings[Idx].SecLevel <= MVRI.SecurityLevel )
|
||||
{
|
||||
switch(PInfo.Settings[Idx].RenderType)
|
||||
{
|
||||
case PIT_Check:
|
||||
ch_CheckBox.Show();
|
||||
ch_CheckBox.Caption = PInfo.Settings[Idx].DisplayName;
|
||||
ch_CheckBox.SetComponentValue(PInfo.Settings[Idx].Value);
|
||||
ch_CheckBox.SetFocus(None);
|
||||
ch_CheckBox.OnChange=SettingChanged;
|
||||
ch_CheckBox.SetHint(PInfo.Settings[Idx].Description);
|
||||
break;
|
||||
|
||||
case PIT_Select:
|
||||
co_ComboBox.SetHint(PInfo.Settings[Idx].Description);
|
||||
co_ComboBox.MyComboBox.List.Clear();
|
||||
co_ComboBox.Show();
|
||||
co_ComboBox.ReadOnly(True);
|
||||
Split(PInfo.Settings[Idx].Data, ";", Range);
|
||||
for (i = 0; i+1 < Range.Length; i += 2)
|
||||
co_ComboBox.AddItem(Range[i+1],,Range[i]);
|
||||
co_ComboBox.SetComponentValue(PInfo.Settings[Idx].Value);
|
||||
co_ComboBox.SetFocus(None);
|
||||
co_ComboBox.OnChange=SettingChanged;
|
||||
break;
|
||||
|
||||
case PIT_Text:
|
||||
Divide(PInfo.Settings[Idx].Data, ";", Width, Op);
|
||||
pos = InStr(Width, ",");
|
||||
if (pos != -1)
|
||||
Width = Left(Width, pos);
|
||||
|
||||
if (Width != "")
|
||||
i = int(Width);
|
||||
else i = -1;
|
||||
Split(Op, ":", Range);
|
||||
if (Range.Length > 1)
|
||||
{
|
||||
// Ranged data
|
||||
if (InStr(Range[0], ".") != -1)
|
||||
{
|
||||
// float edit
|
||||
fl_FloatEdit.Show();
|
||||
if (i != -1)
|
||||
fl_FloatEdit.Setup( float(Range[0]), float(Range[1]), fl_FloatEdit.MyNumericEdit.Step);
|
||||
fl_FloatEdit.SetComponentValue(PInfo.Settings[Idx].Value);
|
||||
fl_FloatEdit.SetFocus(None);
|
||||
fl_FloatEdit.SetHint(PInfo.Settings[Idx].Description);
|
||||
fl_FloatEdit.OnChange=SettingChanged;
|
||||
}
|
||||
else
|
||||
{
|
||||
nu_NumericEdit.SetHint(PInfo.Settings[Idx].Description);
|
||||
nu_NumericEdit.Show();
|
||||
if (i != -1)
|
||||
nu_NumericEdit.Setup( int(Range[0]), int(Range[1]), nu_NumericEdit.MyNumericEdit.Step);
|
||||
nu_NumericEdit.SetComponentValue(PInfo.Settings[Idx].Value);
|
||||
nu_NumericEdit.SetFocus(None);
|
||||
nu_NumericEdit.OnChange=SettingChanged;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ed_EditBox.SetHint(PInfo.Settings[Idx].Description);
|
||||
ed_EditBox.Show();
|
||||
if (i != -1)
|
||||
ed_EditBox.MyEditBox.MaxWidth = i;
|
||||
ed_EditBox.SetComponentValue(PInfo.Settings[Idx].Value);
|
||||
ed_EditBox.SetFocus(None);
|
||||
ed_EditBox.OnChange=SettingChanged;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
l_OptionLabel.Caption = lmsgNotPermitted;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SettingChanged(GUIComponent Sender)
|
||||
{
|
||||
bCurrentSettingChanged=true; // set to auto-save
|
||||
b_SaveButton.Show();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function MapSelected(GUIComponent Sender)
|
||||
{
|
||||
local string MapName;
|
||||
|
||||
lb_ListBoxA.OnChange=none;
|
||||
lb_ListBoxB.OnChange=none;
|
||||
|
||||
if( Sender == lb_ListBoxA)
|
||||
{
|
||||
MapName = lb_ListBoxA.List.Get();
|
||||
lb_ListBoxB.List.Add(MapName);
|
||||
lb_ListBoxA.List.RemoveItem(MapName);
|
||||
}
|
||||
|
||||
if( Sender == lb_ListBoxB)
|
||||
{
|
||||
MapName = lb_ListBoxB.List.Get();
|
||||
lb_ListBoxA.List.Add(MapName);
|
||||
lb_ListBoxB.List.RemoveItem(MapName);
|
||||
}
|
||||
|
||||
bCurrentSettingChanged=true; // set to auto-save
|
||||
b_SaveButton.Show();
|
||||
|
||||
lb_ListBoxA.OnChange=MapSelected;
|
||||
lb_ListBoxB.OnChange=MapSelected;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool SaveButtonClick(GUIComponent Sender)
|
||||
{
|
||||
SaveOption(lb_TreeListBox.List.GetValue());
|
||||
b_SaveButton.Hide();
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool SaveAsDefaultButtonClick(GUIComponent Sender)
|
||||
{
|
||||
if( bCurrentSettingChanged ) // make sure last change was saved
|
||||
{
|
||||
SaveOption(lb_TreeListBox.List.GetValue());
|
||||
b_SaveButton.Hide();
|
||||
}
|
||||
|
||||
if( !PlayerOwner().PlayerReplicationInfo.bAdmin )
|
||||
{
|
||||
Controller.OpenMenu("GUI2K4.GUI2K4QuestionPage");
|
||||
GUI2K4QuestionPage(Controller.ActivePage).SetupQuestion(lmsgMustBeAdmin, QBTN_Ok, QBTN_Ok);
|
||||
}
|
||||
else
|
||||
MVRI.SaveAsDefault();
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool RestoreDefaultButtonClick(GUIComponent Sender)
|
||||
{
|
||||
b_SaveButton.Hide();
|
||||
MVRI.RestoreDefaultProfile();
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SaveOption(string SettingName)
|
||||
{
|
||||
local int i,pos,Idx;
|
||||
local array<string> Range;
|
||||
local string Width, Op;
|
||||
|
||||
switch( SettingName )
|
||||
{
|
||||
case "GameType":
|
||||
SelectedGameTypeIdx = lb_ListBoxA.List.Index;
|
||||
MVRI.SendMatchSettingChange(SettingName,GameTypes[SelectedGameTypeIdx].ClassName);
|
||||
break;
|
||||
|
||||
case "MapName":
|
||||
SelectedMapName = "";
|
||||
for( i=0; i<lb_ListBoxA.ItemCount(); i++)
|
||||
{
|
||||
SelectedMapName $= lb_ListBoxA.List.GetItemAtIndex(i);
|
||||
if( i < lb_ListBoxA.ItemCount() - 1 )
|
||||
SelectedMapName $= ",";
|
||||
}
|
||||
MVRI.SendMatchSettingChange(SettingName,SelectedMapName);
|
||||
break;
|
||||
|
||||
case "Mutators":
|
||||
SelectedMutators= lb_MSListBox.List.GetExtra();
|
||||
MVRI.SendMatchSettingChange(SettingName,SelectedMutators);
|
||||
break;
|
||||
|
||||
case "GameOptions":
|
||||
Parameters = ed_EditBox.GetComponentValue();
|
||||
MVRI.SendMatchSettingChange(SettingName,Parameters);
|
||||
break;
|
||||
case "Tournament":
|
||||
bTournamentMode = bool(ch_CheckBox.GetComponentValue());
|
||||
MVRI.SendMatchSettingChange(SettingName,String(bTournamentMode));
|
||||
break;
|
||||
case "DemoRec":
|
||||
DemoRecFileName = ed_EditBox.GetComponentValue();
|
||||
MVRI.SendMatchSettingChange(SettingName,DemoRecFileName);
|
||||
break;
|
||||
|
||||
default:
|
||||
Idx = PInfo.FindIndex(SettingName);
|
||||
switch(PInfo.Settings[Idx].RenderType)
|
||||
{
|
||||
case PIT_Check:
|
||||
PInfo.StoreSetting(Idx, ch_CheckBox.GetComponentValue());
|
||||
break;
|
||||
|
||||
case PIT_Select:
|
||||
PInfo.StoreSetting(Idx, co_ComboBox.GetComponentValue());
|
||||
break;
|
||||
|
||||
case PIT_Text:
|
||||
Divide(PInfo.Settings[Idx].Data, ";", Width, Op);
|
||||
pos = InStr(Width, ",");
|
||||
if (pos != -1)
|
||||
Width = Left(Width, pos);
|
||||
|
||||
if (Width != "")
|
||||
i = int(Width);
|
||||
else i = -1;
|
||||
Split(Op, ":", Range);
|
||||
if (Range.Length > 1)
|
||||
{
|
||||
// Ranged data
|
||||
if (InStr(Range[0], ".") != -1)
|
||||
{
|
||||
// float edit
|
||||
PInfo.StoreSetting(Idx, fl_FloatEdit.GetComponentValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
// numeric edit
|
||||
PInfo.StoreSetting(Idx, nu_NumericEdit.GetComponentValue());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// text edit
|
||||
PInfo.StoreSetting(Idx, ed_EditBox.GetComponentValue());
|
||||
}
|
||||
break;
|
||||
} //switch(PInfo.Settings[Idx].RenderType)
|
||||
MVRI.SendMatchSettingChange(SettingName, PInfo.Settings[Idx].Value);
|
||||
} //switch
|
||||
bCurrentSettingChanged = false;
|
||||
return;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function bool SubmitButtonClick(GUIComponent Sender)
|
||||
{
|
||||
if( MVRI != none )
|
||||
MVRI.MatchSettingsSubmit();
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function ReadMapList()
|
||||
{
|
||||
local int i;
|
||||
local bool bTemp;
|
||||
|
||||
bTemp = Controller.bCurMenuInitialized;
|
||||
Controller.bCurMenuInitialized = False;
|
||||
|
||||
lb_ListBoxB.List.Clear();
|
||||
for (i = 0; i < Maps.Length; i++)
|
||||
lb_ListBoxB.List.Add(Maps[i]);
|
||||
|
||||
lb_ListBoxB.List.Sort();
|
||||
Controller.bCurMenuInitialized = bTemp;
|
||||
lb_ListBoxB.List.SetIndex(0);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddServerMaps(string MapName, int Index)
|
||||
{
|
||||
local int i;
|
||||
|
||||
if( Index == 0 )
|
||||
{
|
||||
if( SelectedOption == "MapName" )
|
||||
{
|
||||
Maps.Remove(0,Maps.Length);
|
||||
lb_ListBoxB.List.Clear();
|
||||
}
|
||||
}
|
||||
Maps[Maps.Length] = MapName;
|
||||
|
||||
if( SelectedOption == "MapName" )
|
||||
{
|
||||
i = lb_ListBoxA.List.FindIndex(MapName);
|
||||
if( i > -1 )
|
||||
{
|
||||
// replace uppercase mapnames from maplist
|
||||
lb_ListBoxA.OnChange=None;
|
||||
lb_ListBoxA.List.Remove(i);
|
||||
lb_ListBoxA.List.Add(MapName);
|
||||
lb_ListBoxA.List.Sort();
|
||||
lb_ListBoxA.OnChange=MapSelected;
|
||||
}
|
||||
else
|
||||
{
|
||||
lb_ListBoxB.OnChange=None;
|
||||
lb_ListBoxB.List.Add(MapName);
|
||||
lb_ListBoxB.List.Sort();
|
||||
lb_ListBoxB.OnChange=MapSelected;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddServerMutators(VotingReplicationInfo.MutatorData M, int Index)
|
||||
{
|
||||
if( Index == 0 )
|
||||
Mutators.Remove(0, Mutators.Length);
|
||||
Mutators[Mutators.Length] = M;
|
||||
|
||||
if( SelectedOption == "Mutators" )
|
||||
{
|
||||
lb_MSListBox.List.Add(M.FriendlyName,none,M.ClassName);
|
||||
lb_MSListBox.List.Sort();
|
||||
if( InStr("," $ Caps(SelectedMutators) $ ",", "," $ Caps(M.ClassName) $ ",") > -1 )
|
||||
lb_MSListBox.List.Find(M.ClassName,False,True); // bExtra
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Closed(GUIComponent Sender, bool bCancelled)
|
||||
{
|
||||
if( MVRI != none )
|
||||
MVRI.MatchSetupLogout();
|
||||
Super.Closed(Sender, bCancelled);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Begin Object class=GUILabel Name=TitleLabel
|
||||
Caption="Match Setup"
|
||||
TextALign=TXTA_Center
|
||||
TextFont="UT2LargeFont"
|
||||
TextColor=(R=0,G=0,B=255,A=255)
|
||||
WinWidth=0.554921
|
||||
WinHeight=0.048632
|
||||
WinLeft=0.223438
|
||||
WinTop=0.107084
|
||||
End Object
|
||||
l_Title=TitleLabel
|
||||
|
||||
Begin Object Class=GUITreeListBox Name=TreeControl
|
||||
WinWidth=0.393437
|
||||
WinHeight=0.487810
|
||||
WinLeft=0.108204
|
||||
WinTop=0.161405
|
||||
bVisibleWhenEmpty=true
|
||||
Hint="Select a configuration option to modify."
|
||||
End Object
|
||||
lb_TreeListBox = TreeControl
|
||||
|
||||
Begin Object class=GUILabel Name=OptionLabel
|
||||
Caption=""
|
||||
TextALign=TXTA_Center
|
||||
TextFont="UT2SmallFont"
|
||||
TextColor=(R=0,G=0,B=255,A=255)
|
||||
WinWidth=0.386170
|
||||
WinHeight=0.032069
|
||||
WinLeft=0.505509
|
||||
WinTop=0.161823
|
||||
End Object
|
||||
l_OptionLabel=OptionLabel
|
||||
|
||||
Begin Object Class=GUIListBox Name=ListBoxA
|
||||
WinWidth=0.315269
|
||||
WinHeight=0.213349
|
||||
WinLeft=0.537139
|
||||
WinTop=0.193488
|
||||
bVisibleWhenEmpty=true
|
||||
bVisible=false
|
||||
bSorted=false
|
||||
End Object
|
||||
lb_ListBoxA = ListBoxA
|
||||
|
||||
Begin Object Class=GUIListBox Name=ListBoxB
|
||||
WinWidth=0.315269
|
||||
WinHeight=0.200848
|
||||
WinLeft=0.537139
|
||||
WinTop=0.443750
|
||||
bVisibleWhenEmpty=true
|
||||
bVisible=false
|
||||
bSorted=true
|
||||
Hint="Selecting a map name in this list will move it to the Map Cycle List."
|
||||
End Object
|
||||
lb_ListBoxB = ListBoxB
|
||||
|
||||
Begin Object class=GUILabel Name=AvailableMapsLabel
|
||||
Caption="Available Maps"
|
||||
TextALign=TXTA_Center
|
||||
TextFont="UT2SmallFont"
|
||||
TextColor=(R=0,G=0,B=255,A=255)
|
||||
WinWidth=0.315234
|
||||
WinHeight=0.032382
|
||||
WinLeft=0.536759
|
||||
WinTop=0.412239
|
||||
bVisible=False
|
||||
End Object
|
||||
l_AvailableMaps=AvailableMapsLabel
|
||||
|
||||
Begin Object Class=MultiSelectListBox Name=MSListBox
|
||||
WinWidth=0.342769
|
||||
WinHeight=0.329599
|
||||
WinLeft=0.525890
|
||||
WinTop=0.195155
|
||||
bVisibleWhenEmpty=true
|
||||
bVisible=false
|
||||
End Object
|
||||
lb_MSListBox = MSListBox
|
||||
|
||||
Begin Object class=GUIButton Name=SaveAsDefaultButton
|
||||
Caption="Save As Default"
|
||||
Hint="Save this profile as the default profile."
|
||||
StyleName="SquareButton"
|
||||
OnClick=SaveAsDefaultButtonClick
|
||||
WinWidth=0.188855
|
||||
WinHeight=0.034616
|
||||
WinLeft=0.108749
|
||||
WinTop=0.655141
|
||||
bVisible=true
|
||||
End Object
|
||||
b_SaveAsDefault=SaveAsDefaultButton
|
||||
|
||||
Begin Object class=GUIButton Name=RestoreDefaultButton
|
||||
Caption="Load Default"
|
||||
Hint="Restore the default profile."
|
||||
StyleName="SquareButton"
|
||||
OnClick=RestoreDefaultButtonClick
|
||||
WinWidth=0.169772
|
||||
WinHeight=0.034616
|
||||
WinLeft=0.332629
|
||||
WinTop=0.655141
|
||||
End Object
|
||||
b_RestoreDefault=RestoreDefaultButton
|
||||
|
||||
Begin Object class=GUIButton Name=SubmitButton
|
||||
Caption="Finish/Accept"
|
||||
Hint="Accept current settings and implement changes."
|
||||
StyleName="SquareButton"
|
||||
OnClick=SubmitButtonClick
|
||||
WinWidth=0.176277
|
||||
WinHeight=0.034616
|
||||
WinLeft=0.712919
|
||||
WinTop=0.655141
|
||||
bVisible=false
|
||||
End Object
|
||||
b_SubmitButton=SubmitButton
|
||||
|
||||
Begin Object class=GUIButton Name=SaveButton
|
||||
Caption="Save/Send"
|
||||
Hint="Click to save the changes to the selected option and send the new setting to the server."
|
||||
StyleName="SquareButton"
|
||||
OnClick=SaveButtonClick
|
||||
WinWidth=0.178750
|
||||
WinHeight=0.034565
|
||||
WinLeft=0.517007
|
||||
WinTop=0.655055
|
||||
End Object
|
||||
b_SaveButton=SaveButton
|
||||
|
||||
Begin Object Class=moCheckbox Name=CheckBox
|
||||
WinWidth=0.037733
|
||||
WinHeight=0.048437
|
||||
WinLeft=0.671131
|
||||
WinTop=0.212656
|
||||
bVisible=false
|
||||
CaptionWidth=0
|
||||
ComponentWidth=1
|
||||
//Hint="This is a checkbox"
|
||||
End Object
|
||||
ch_CheckBox = CheckBox
|
||||
|
||||
Begin Object Class=moComboBox Name=ComboBox
|
||||
WinWidth=0.313359
|
||||
WinHeight=0.038750
|
||||
WinLeft=0.539885
|
||||
WinTop=0.196822
|
||||
bAutoSizeCaption=True
|
||||
bVisible=false
|
||||
CaptionWidth=0
|
||||
ComponentWidth=1
|
||||
End Object
|
||||
co_ComboBox = ComboBox
|
||||
|
||||
Begin Object Class=moFloatEdit Name=FloatEdit
|
||||
WinWidth=0.120545
|
||||
WinHeight=0.043750
|
||||
WinLeft=0.636444
|
||||
WinTop=0.200155
|
||||
bVisible=false
|
||||
CaptionWidth=0
|
||||
ComponentWidth=1
|
||||
End Object
|
||||
fl_FloatEdit = FloatEdit
|
||||
|
||||
Begin Object Class=moNumericEdit Name=NumericEdit
|
||||
WinWidth=0.120545
|
||||
WinHeight=0.043750
|
||||
WinLeft=0.636444
|
||||
WinTop=0.200155
|
||||
bVisible=false
|
||||
CaptionWidth=0
|
||||
ComponentWidth=1
|
||||
End Object
|
||||
nu_NumericEdit = NumericEdit
|
||||
|
||||
Begin Object Class=moEditBox Name=EditBox
|
||||
WinWidth=0.358984
|
||||
WinHeight=0.037500
|
||||
WinLeft=0.518946
|
||||
WinTop=0.198488
|
||||
bVisible=false
|
||||
CaptionWidth=0
|
||||
ComponentWidth=1
|
||||
End Object
|
||||
ed_EditBox = EditBox
|
||||
|
||||
OnOpen=InternalOnOpen;
|
||||
|
||||
GameTypesCaption="Game Type"
|
||||
MapNameCaption="Map Cycle List"
|
||||
MutatorsCaption="Mutators"
|
||||
ParametersCaption="Parameters"
|
||||
TournamentModeCaption="Tournament Mode"
|
||||
DemoRecCaption="Record Demo(FileName)"
|
||||
MiscCaption="Miscellaneous"
|
||||
lmsgMustBeAdmin="You must be logged in as an Admin to perform this."
|
||||
lmsgMatchSetupDisabled="Match Setup has been disabled by the server administrator."
|
||||
lmsgNotPermitted="Not Permitted"
|
||||
lmsgMutator="Mutator"
|
||||
}
|
||||
*/
|
||||
73
kf_sources/XVoting/Classes/MatchSetupPanelBase.uc
Normal file
73
kf_sources/XVoting/Classes/MatchSetupPanelBase.uc
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
//==============================================================================
|
||||
// Created on: 01/02/2004
|
||||
// Base class for all match setup panels
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
// TODO: CONFLICTS!!! someone updates a setting that you've already changed...their change is replicated down
|
||||
// what to do about this?
|
||||
//==============================================================================
|
||||
|
||||
class MatchSetupPanelBase extends UT2K4TabPanel
|
||||
abstract;
|
||||
|
||||
var() string Group;
|
||||
var() editconst noexport VotingReplicationInfo VRI;
|
||||
var() bool bDirty;
|
||||
|
||||
function InitPanel()
|
||||
{
|
||||
local int i;
|
||||
|
||||
for ( i = 0; i < Controls.Length; i++ )
|
||||
Controls[i].OnChange = InternalOnChange;
|
||||
}
|
||||
|
||||
function bool IsAdmin()
|
||||
{
|
||||
local PlayerController PC;
|
||||
|
||||
PC = PlayerOwner();
|
||||
return PC != None && PC.PlayerReplicationInfo != None && PC.PlayerReplicationInfo.bAdmin;
|
||||
}
|
||||
|
||||
function bool IsLoggedIn()
|
||||
{
|
||||
return IsAdmin() || VRI != None && VRI.bMatchSetupPermitted;
|
||||
}
|
||||
|
||||
// Called when the player logs in, or when the voting replication info requests a full refresh
|
||||
delegate OnLogIn();
|
||||
// Called when the player logs out
|
||||
delegate OnLogOut();
|
||||
// Called by panels to send info the server
|
||||
delegate SendCommand( string Cmd );
|
||||
|
||||
function LoggedIn() { EnableComponent(MyButton); }
|
||||
function LoggedOut() { DisableComponent(MyButton); }
|
||||
|
||||
// Called on the active panel when 'Submit' is clicked
|
||||
function SubmitChanges() { bDirty = false; }
|
||||
// Called when information is received from the server
|
||||
function bool HandleResponse(string Type, string Info, string Data) { return false; }
|
||||
// Called when data transfer from the server is completed
|
||||
function ReceiveComplete();
|
||||
// Called when something has been changed on the panel
|
||||
function InternalOnChange(GUIComponent Sender)
|
||||
{
|
||||
bDirty = true;
|
||||
OnChange(Self);
|
||||
}
|
||||
|
||||
|
||||
event Free()
|
||||
{
|
||||
VRI = None;
|
||||
Super.Free();
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
OnLogin=LoggedIn
|
||||
OnLogout=LoggedOut
|
||||
}
|
||||
78
kf_sources/XVoting/Classes/MatchSetupRules.uc
Normal file
78
kf_sources/XVoting/Classes/MatchSetupRules.uc
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
//==============================================================================
|
||||
// Created on: 01/02/2004
|
||||
// Configures match rules for match setup
|
||||
//
|
||||
// Written by Ron Prestenback
|
||||
// © 2003, Epic Games, Inc. All Rights Reserved
|
||||
//==============================================================================
|
||||
|
||||
class MatchSetupRules extends MatchSetupPanelBase;
|
||||
|
||||
var automated RemotePlayInfoPanel p_Rules;
|
||||
|
||||
function InitPanel()
|
||||
{
|
||||
Super.InitPanel();
|
||||
Group = class'VotingReplicationInfo'.default.OptionID;
|
||||
}
|
||||
|
||||
function bool HandleResponse(string Type, string Info, string Data)
|
||||
{
|
||||
local array<string> Parts;
|
||||
local string str1, str2;
|
||||
|
||||
if ( Type ~= Group )
|
||||
{
|
||||
log("RULES HandleResponse Info '"$Info$"' Data '"$Data$"'",'MapVoteDebug');
|
||||
if ( Info == class'VotingReplicationInfo'.default.AddID )
|
||||
{
|
||||
Split(Data, Chr(27),Parts);
|
||||
Parts.Length = 3;
|
||||
p_Rules.ReceivedRule( Parts[0], Parts[1], Parts[2] );
|
||||
p_Rules.bUpdate = True;
|
||||
}
|
||||
|
||||
if ( Info == class'VotingReplicationInfo'.default.UpdateID && Divide(Data, Chr(27), str1, str2) )
|
||||
ReceiveValue( str1, str2 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function ReceiveValue( string SettingName, string NewValue )
|
||||
{
|
||||
p_Rules.ReceivedValue( SettingName, NewValue );
|
||||
}
|
||||
|
||||
function SendValue( string SettingName, string NewValue )
|
||||
{
|
||||
SendCommand( Group $ ":" $ SettingName $ ";" $ NewValue );
|
||||
}
|
||||
|
||||
function LoggedIn()
|
||||
{
|
||||
Super.LoggedIn();
|
||||
p_Rules.ClearRules();
|
||||
p_Rules.bRefresh = true;
|
||||
}
|
||||
|
||||
function ReceiveComplete()
|
||||
{
|
||||
p_Rules.bUpdate = true;
|
||||
p_Rules.Refresh();
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
{
|
||||
PanelCaption="Rules"
|
||||
Begin Object Class=RemotePlayInfoPanel Name=PIPanel
|
||||
SettingChanged=SendValue
|
||||
WinWidth=1.0
|
||||
WinHeight=1.0
|
||||
WinLeft=0.0
|
||||
WinTop=0.0
|
||||
End Object
|
||||
p_Rules=PIPanel
|
||||
}
|
||||
66
kf_sources/XVoting/Classes/PlayerInfoMultiColumnList.uc
Normal file
66
kf_sources/XVoting/Classes/PlayerInfoMultiColumnList.uc
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.PlayerInfoMultiColumnList
|
||||
//
|
||||
// Multi-Column list box used to display player info.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class PlayerInfoMultiColumnList extends GUIMultiColumnList;
|
||||
|
||||
struct PlayerInfoData
|
||||
{
|
||||
var string Label;
|
||||
var string Value;
|
||||
};
|
||||
|
||||
var array<PlayerInfoData> ListData;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Add(string Label, string Value)
|
||||
{
|
||||
ListData.Insert(ListData.Length,1);
|
||||
ListData[ListData.Length-1].Label = Label;
|
||||
ListData[ListData.Length-1].Value = Value;
|
||||
AddedItem();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function DrawItem(Canvas Canvas, int i, float X, float Y, float W, float H, bool bSelected, bool bPending)
|
||||
{
|
||||
local float CellLeft, CellWidth;
|
||||
|
||||
if( i >= SortData.Length || SortData[i].SortItem >= ListData.Length )
|
||||
return;
|
||||
|
||||
GetCellLeftWidth( 0, CellLeft, CellWidth );
|
||||
Style.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
ListData[SortData[i].SortItem].Label, FontScale );
|
||||
|
||||
GetCellLeftWidth( 1, CellLeft, CellWidth );
|
||||
Style.DrawText( Canvas, MenuState, CellLeft, Y, CellWidth, H, TXTA_Left,
|
||||
ListData[SortData[i].SortItem].Value, FontScale );
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function string GetSortString( int i )
|
||||
{
|
||||
return ListData[0].Label;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
OnDrawItem=DrawItem;
|
||||
ColumnHeadings(0)="-"
|
||||
ColumnHeadings(1)="-"
|
||||
|
||||
InitColumnPerc(0)=0.35
|
||||
InitColumnPerc(1)=0.65
|
||||
|
||||
SortColumn=0
|
||||
SortDescending=True
|
||||
|
||||
ColumnHeadingHints(0)=""
|
||||
ColumnHeadingHints(1)=""
|
||||
|
||||
StyleName="ServerBrowserGrid"
|
||||
SelectedStyleName="BrowserListSelection"
|
||||
}
|
||||
|
||||
27
kf_sources/XVoting/Classes/PlayerInfoMultiColumnListBox.uc
Normal file
27
kf_sources/XVoting/Classes/PlayerInfoMultiColumnListBox.uc
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.PlayerInfoMultiColumnListBox
|
||||
//
|
||||
// Multi-Column list box used to display Player Info.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
class PlayerInfoMultiColumnListBox extends GUIMultiColumnListBox;
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
super.InitComponent(MyController, MyOwner);
|
||||
// Header.Hide();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Add(string Label, string Value)
|
||||
{
|
||||
PlayerInfoMultiColumnList(List).Add(Label,Value);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
DefaultListClass="xVoting.PlayerInfoMultiColumnList"
|
||||
}
|
||||
|
||||
65
kf_sources/XVoting/Classes/VotingPage.uc
Normal file
65
kf_sources/XVoting/Classes/VotingPage.uc
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
//====================================================================
|
||||
// xVoting.VotingPage
|
||||
// Voting page is the base for MapVoting and KickVoting pages.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class VotingPage extends LargeWindow DependsOn(VotingHandler);
|
||||
|
||||
var automated MapVoteFooter f_Chat;
|
||||
var() editconst noexport VotingReplicationInfo MVRI;
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function InitComponent(GUIController MyController, GUIComponent MyOwner)
|
||||
{
|
||||
local PlayerController PC;
|
||||
|
||||
Super.Initcomponent(MyController, MyOwner);
|
||||
|
||||
PC = PlayerOwner();
|
||||
MVRI = VotingReplicationInfo(PC.VoteReplicationInfo);
|
||||
|
||||
// Turn pause off if currently paused (stops replication)
|
||||
if(PlayerOwner() != None && PlayerOwner().Level.Pauser != None)
|
||||
PlayerOwner().SetPause(false);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function Free()
|
||||
{
|
||||
MVRI = None;
|
||||
Super.Free();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
defaultproperties
|
||||
{
|
||||
Background=None
|
||||
|
||||
bAcceptsInput=false
|
||||
bPauseIfPossible=false
|
||||
|
||||
WinLeft=0.1
|
||||
WinTop=0.1
|
||||
WinWidth=0.8
|
||||
WinHeight=0.8
|
||||
|
||||
Begin Object Class=MapVoteFooter Name=MatchSetupFooter
|
||||
WinWidth=0.962109
|
||||
WinHeight=0.291406
|
||||
WinLeft=0.019921
|
||||
WinTop=0.686457
|
||||
TabOrder=10
|
||||
RenderWeight=0.5
|
||||
bBoundToParent=True
|
||||
bScaleToParent=True
|
||||
End Object
|
||||
f_Chat=MatchSetupFooter
|
||||
|
||||
bRenderWorld=true
|
||||
bRequire640x480=false
|
||||
bAllowedAsLast=true
|
||||
bMoveAllowed=False
|
||||
//bPersistent=True -- Note: this causes problems because free is called when closed
|
||||
}
|
||||
|
||||
821
kf_sources/XVoting/Classes/VotingReplicationInfo.uc
Normal file
821
kf_sources/XVoting/Classes/VotingReplicationInfo.uc
Normal file
|
|
@ -0,0 +1,821 @@
|
|||
// ====================================================================
|
||||
// Class: xVoting.VotingReplicationInfo
|
||||
//
|
||||
// The VotingReplicationInfo is responsible for voting related network
|
||||
// communications between the server and the player.
|
||||
//
|
||||
// Written by Bruce Bickar
|
||||
// (c) 2003, Epic Games, Inc. All Rights Reserved
|
||||
// ====================================================================
|
||||
|
||||
class VotingReplicationInfo extends VotingReplicationInfoBase DependsOn(VotingHandler);
|
||||
|
||||
enum RepDataType
|
||||
{
|
||||
REPDATATYPE_GameConfig,
|
||||
REPDATATYPE_MapList,
|
||||
REPDATATYPE_MapVoteCount,
|
||||
REPDATATYPE_KickVoteCount,
|
||||
REPDATATYPE_MatchConfig,
|
||||
REPDATATYPE_Maps,
|
||||
REPDATATYPE_Mutators
|
||||
};
|
||||
|
||||
struct TickedReplicationQueueItem
|
||||
{
|
||||
var RepDataType DataType;
|
||||
var int Index;
|
||||
var int Last;
|
||||
};
|
||||
|
||||
struct MutatorData
|
||||
{
|
||||
var string ClassName;
|
||||
var string FriendlyName;
|
||||
};
|
||||
|
||||
var array<TickedReplicationQueueItem> TickedReplicationQueue;
|
||||
var array<VotingHandler.MapVoteMapList> MapList;
|
||||
var int MapCount; // total count of maps
|
||||
|
||||
var array<VotingHandler.MapVoteGameConfigLite> GameConfig; // game types
|
||||
var int GameConfigCount; // total count of game types
|
||||
var int CurrentGameConfig;
|
||||
var bool bWaitingForReply; // used in replication
|
||||
|
||||
var array<VotingHandler.MapVoteScore> MapVoteCount; // holds vote counts
|
||||
var array<VotingHandler.KickVoteScore> KickVoteCount; // holds vote counts
|
||||
|
||||
var int MapVote; // Index of the map that the owner has voted for
|
||||
var int VoteCount;
|
||||
var int GameVote; // Index of the Game type that the owner has voted for
|
||||
var int KickVote; // PlayerID of the that the owner has voted against to kick
|
||||
var PlayerController PlayerOwner; // player this RI belongs too
|
||||
var int PlayerID; // PlayerID of the owner. Needed to match up when player disconnects and owner == none
|
||||
var byte Mode; // voting mode enum
|
||||
|
||||
var bool bMapVote; // Map voting enabled
|
||||
var bool bKickVote; // Kick voting enabled
|
||||
var bool bMatchSetup; // MatchSetup enabled
|
||||
var bool bMatchSetupPermitted; // owner is logged in as a MatchSetup user.
|
||||
var bool bMatchSetupAccepted; // owner has accept the current match settings
|
||||
|
||||
var bool bSendingMatchSetup; // currently sending match setup stuff to client
|
||||
var int SecurityLevel; // matchsetup users security level
|
||||
var config bool bDebugLog;
|
||||
var() name CountDownSounds[60];
|
||||
var int CountDown;
|
||||
|
||||
var xVotingHandler VH;
|
||||
|
||||
// localization
|
||||
var localized string lmsgSavedAsDefaultSuccess, lmsgNotAllAccepted;
|
||||
|
||||
// Client Response Identifiers
|
||||
var string MapID, MutatorID, OptionID, GeneralID;
|
||||
var string URLID, StatusID, MatchSetupID, LoginID, CompleteID;
|
||||
var string AddID, RemoveID, UpdateID, FailedID, TournamentID, DemoRecID, GameTypeID;
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
replication
|
||||
{
|
||||
// Variables the server should send to the client only initially
|
||||
reliable if( Role==ROLE_Authority && bNetInitial)
|
||||
PlayerOwner,
|
||||
MapCount,
|
||||
GameConfigCount,
|
||||
bKickVote,
|
||||
bMapVote,
|
||||
bMatchSetup,
|
||||
CurrentGameConfig;
|
||||
//bIsSpectator;
|
||||
|
||||
// Variables or Functions the server should send to the client and keep updated if MapVoting enabled
|
||||
reliable if( Role==ROLE_Authority && bMapVote)
|
||||
ReceiveGameConfig,
|
||||
ReceiveMapInfo,
|
||||
CloseWindow,
|
||||
OpenWindow,
|
||||
ReceiveMapVoteCount,
|
||||
ReceiveKickVoteCount,
|
||||
Mode,
|
||||
PlayCountDown;
|
||||
|
||||
// Functions the server should send to the client if KickVoting enabled
|
||||
reliable if( Role==ROLE_Authority && bKickVote)
|
||||
SendPlayerID;
|
||||
|
||||
// Variables or Functions the server should send to the client
|
||||
// and keep updated if MatchSetup is enabled
|
||||
reliable if( Role==ROLE_Authority && bMatchSetup )
|
||||
bMatchSetupPermitted,
|
||||
bMatchSetupAccepted,
|
||||
SecurityLevel;
|
||||
|
||||
// functions the client calls on the server
|
||||
reliable if( Role < ROLE_Authority )
|
||||
ReplicationReply,
|
||||
SendMapVote,
|
||||
SendKickVote,
|
||||
MatchSetupLogin,
|
||||
RequestMatchSettings,
|
||||
MatchSettingsSubmit,
|
||||
SaveAsDefault,
|
||||
RestoreDefaultProfile,
|
||||
MatchSetupLogout,
|
||||
RequestPlayerIP;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
event PostBeginPlay()
|
||||
{
|
||||
Super.PostBeginPlay();
|
||||
|
||||
PlayerOwner = PlayerController(Owner);
|
||||
VH = xVotingHandler(Level.Game.VotingHandler);
|
||||
}
|
||||
|
||||
simulated event PostNetBeginPlay()
|
||||
{
|
||||
DebugLog("____VotingReplicationInfo.PostNetBeginPlay");
|
||||
Super.PostNetBeginPlay();
|
||||
GetServerData();
|
||||
}
|
||||
simulated event PostNetReceive()
|
||||
{
|
||||
bNetNotify = NeedNetNotify();
|
||||
if ( !bNetNotify && Owner == None )
|
||||
SetOwner(PlayerOwner);
|
||||
}
|
||||
|
||||
simulated function bool NeedNetNotify()
|
||||
{
|
||||
return PlayerOwner == None;
|
||||
}
|
||||
simulated function GUIController GetController()
|
||||
{
|
||||
if ( Level.NetMode == NM_ListenServer || Level.NetMode == NM_Client )
|
||||
{
|
||||
if ( PlayerOwner != None && PlayerOwner.Player != None )
|
||||
return GUIController(PlayerOwner.Player.GUIController);
|
||||
}
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function GetServerData()
|
||||
{
|
||||
// grab data from VotingHandler on server side
|
||||
if( Level.NetMode != NM_Client )
|
||||
{
|
||||
bKickVote = VH.bKickVote;
|
||||
bMapVote = VH.bMapVote;
|
||||
bMatchSetup = VH.bMatchSetup;
|
||||
MapCount = VH.MapCount;
|
||||
GameConfigCount = VH.GameConfig.Length;
|
||||
|
||||
if( bMapVote )
|
||||
{
|
||||
Mode = byte(VH.bEliminationMode);
|
||||
Mode += byte(VH.bScoreMode) * 2;
|
||||
Mode += byte(VH.bAccumulationMode) * 4;
|
||||
|
||||
CurrentGameConfig = VH.CurrentGameConfig;
|
||||
|
||||
AddToTickedReplicationQueue(REPDATATYPE_GameConfig, GameConfigCount-1);
|
||||
AddToTickedReplicationQueue(REPDATATYPE_MapList, MapCount-1);
|
||||
if( VH.MapVoteCount.Length > 0 )
|
||||
AddToTickedReplicationQueue(REPDATATYPE_MapVoteCount, VH.MapVoteCount.Length-1);
|
||||
}
|
||||
|
||||
if( bKickVote && VH.KickVoteCount.Length > 0 )
|
||||
AddToTickedReplicationQueue(REPDATATYPE_KickVoteCount, VH.KickVoteCount.Length-1);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function Tick(float DeltaTime)
|
||||
{
|
||||
local int i;
|
||||
local bool bDedicated, bListening;
|
||||
|
||||
if( TickedReplicationQueue.Length == 0 || bWaitingForReply)
|
||||
return;
|
||||
|
||||
bDedicated = Level.NetMode == NM_DedicatedServer ||
|
||||
(Level.NetMode == NM_ListenServer && PlayerOwner != none &&
|
||||
PlayerOwner.Player.Console == none );
|
||||
|
||||
bListening = Level.NetMode == NM_ListenServer && PlayerOwner != none &&
|
||||
PlayerOwner.Player.Console != none;
|
||||
|
||||
if( !bDedicated && !bListening )
|
||||
return;
|
||||
|
||||
i = TickedReplicationQueue.Length - 1;
|
||||
|
||||
switch( TickedReplicationQueue[i].DataType )
|
||||
{
|
||||
case REPDATATYPE_GameConfig:
|
||||
TickedReplication_GameConfig(TickedReplicationQueue[i].Index, bDedicated);
|
||||
break;
|
||||
case REPDATATYPE_MapList:
|
||||
TickedReplication_MapList(TickedReplicationQueue[i].Index, bDedicated);
|
||||
break;
|
||||
case REPDATATYPE_MapVoteCount:
|
||||
TickedReplication_MapVoteCount(TickedReplicationQueue[i].Index, bDedicated);
|
||||
break;
|
||||
case REPDATATYPE_KickVoteCount:
|
||||
TickedReplication_KickVoteCount(TickedReplicationQueue[i].Index, bDedicated);
|
||||
break;
|
||||
case REPDATATYPE_MatchConfig:
|
||||
TickedReplication_MatchConfig(TickedReplicationQueue[i].Index, bDedicated);
|
||||
break;
|
||||
case REPDATATYPE_Maps:
|
||||
TickedReplication_Maps(TickedReplicationQueue[i].Index, bDedicated);
|
||||
break;
|
||||
case REPDATATYPE_Mutators:
|
||||
TickedReplication_Mutators(TickedReplicationQueue[i].Index, bDedicated);
|
||||
break;
|
||||
}
|
||||
TickedReplicationQueue[i].Index++;
|
||||
if( TickedReplicationQueue[i].Index > TickedReplicationQueue[i].Last )
|
||||
TickedReplicationQueue.Remove(i,1);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function AddToTickedReplicationQueue(RepDataType Type, int Last)
|
||||
{
|
||||
if( Last > -1 )
|
||||
{
|
||||
TickedReplicationQueue.Insert(0,1);
|
||||
TickedReplicationQueue[0].DataType = Type;
|
||||
TickedReplicationQueue[0].Index = 0;
|
||||
TickedReplicationQueue[0].Last = Last;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function TickedReplication_GameConfig(int Index, bool bDedicated)
|
||||
{
|
||||
local VotingHandler.MapVoteGameConfigLite GameConfigItem;
|
||||
|
||||
GameConfigItem = VH.GetGameConfig(Index);
|
||||
DebugLog("___Sending " $ Index $ " - " $ GameConfigItem.GameName);
|
||||
if( bDedicated )
|
||||
{
|
||||
ReceiveGameConfig(GameConfigItem); // replicate one GameConfig each tick
|
||||
bWaitingForReply = True;
|
||||
}
|
||||
else
|
||||
GameConfig[GameConfig.Length] = GameConfigItem;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function TickedReplication_MapList(int Index, bool bDedicated)
|
||||
{
|
||||
local VotingHandler.MapVoteMapList MapInfo;
|
||||
|
||||
MapInfo = VH.GetMapList(Index);
|
||||
DebugLog("___Sending " $ Index $ " - " $ MapInfo.MapName);
|
||||
|
||||
if( bDedicated )
|
||||
{
|
||||
ReceiveMapInfo(MapInfo); // replicate one map each tick until all maps are replicated.
|
||||
bWaitingForReply = True;
|
||||
}
|
||||
else
|
||||
MapList[MapList.Length] = MapInfo;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function TickedReplication_MatchConfig(int Index, bool bDedicated)
|
||||
{
|
||||
local MatchConfig MatchProfile;
|
||||
local PlayInfo.PlayInfoData PIData;
|
||||
|
||||
if( Index < 6 )
|
||||
{
|
||||
MatchProfile = VH.MatchProfile;
|
||||
switch( Index )
|
||||
{
|
||||
case 0:
|
||||
SendClientResponse( GeneralID, UpdateID $ Chr(27) $ GameTypeID, MatchProfile.GameClassString);
|
||||
break;
|
||||
case 1:
|
||||
SendClientResponse( MapID, UpdateID, MatchProfile.MapIndexList );
|
||||
break;
|
||||
case 2:
|
||||
SendClientResponse( MutatorID, UpdateID, MatchProfile.MutatorIndexList );
|
||||
break;
|
||||
case 3:
|
||||
SendClientResponse( GeneralID, UpdateId $ Chr(27) $ URLID, MatchProfile.Parameters );
|
||||
break;
|
||||
case 4:
|
||||
SendClientResponse( GeneralID, UpdateId $ Chr(27) $ TournamentID, string(MatchProfile.bTournamentMode) );
|
||||
break;
|
||||
case 5:
|
||||
SendClientResponse( GeneralID, UpdateID $ Chr(27) $ DemoRecID, MatchProfile.DemoRecFileName );
|
||||
break;
|
||||
}
|
||||
bWaitingForReply = bDedicated;
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog("___Sending " $ VH.MatchProfile.PInfo.Settings[Index-6].SettingName);
|
||||
PIData = VH.MatchProfile.PInfo.Settings[Index-6];
|
||||
if( PIData.ArrayDim == -1) // no array properties (cant handle them)
|
||||
{
|
||||
SendClientResponse( OptionID, AddID, PIData.SettingName $ Chr(27) $ PIData.ClassFrom $ Chr(27) $ PIData.Value );
|
||||
bWaitingForReply = bDedicated;
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function TickedReplication_MapVoteCount(int Index, bool bDedicated)
|
||||
{
|
||||
DebugLog("___Sending MapVoteCountIndex " $ Index);
|
||||
if( bDedicated )
|
||||
{
|
||||
ReceiveMapVoteCount(VH.MapVoteCount[Index], True);
|
||||
bWaitingForReply = True;
|
||||
}
|
||||
else
|
||||
MapVoteCount[MapVoteCount.Length] = VH.MapVoteCount[Index];
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function TickedReplication_KickVoteCount(int Index, bool bDedicated)
|
||||
{
|
||||
DebugLog("___Sending KickVoteCountIndex " $ Index);
|
||||
if( bDedicated )
|
||||
{
|
||||
ReceiveKickVoteCount(VH.KickVoteCount[Index], True);
|
||||
bWaitingForReply = True;
|
||||
}
|
||||
else
|
||||
KickVoteCount[KickVoteCount.Length] = VH.KickVoteCount[Index];
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function TickedReplication_Maps(int Index, bool bDedicated)
|
||||
{
|
||||
DebugLog("TickedReplication_Maps " $ Index $ ", " $ VH.MatchProfile.Maps[Index].MapName);
|
||||
|
||||
SendClientResponse(MapID, AddID, Index $ "," $ VH.MatchProfile.Maps[Index].MapName);
|
||||
bWaitingForReply = bDedicated;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function TickedReplication_Mutators(int Index, bool bDedicated)
|
||||
{
|
||||
local MatchConfig MatchProfile;
|
||||
local MutatorData M;
|
||||
|
||||
MatchProfile = VH.MatchProfile;
|
||||
DebugLog("TickedReplication_Mutators " $ Index $ ", " $ MatchProfile.Mutators[Index].ClassName);
|
||||
|
||||
M.ClassName = MatchProfile.Mutators[Index].ClassName;
|
||||
M.FriendlyName = MatchProfile.Mutators[Index].FriendlyName;
|
||||
|
||||
SendClientResponse( MutatorID, AddID, Index $ "," $ M.ClassName $ Chr(27) $ M.FriendlyName );
|
||||
bWaitingForReply = bDedicated;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function ReceiveGameConfig(VotingHandler.MapVoteGameConfigLite p_GameConfig)
|
||||
{
|
||||
GameConfig[GameConfig.Length] = p_GameConfig;
|
||||
DebugLog("___Receiving - " $ p_GameConfig.GameName);
|
||||
ReplicationReply();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function ReceiveMapInfo(VotingHandler.MapVoteMapList MapInfo)
|
||||
{
|
||||
MapList[MapList.Length] = MapInfo;
|
||||
DebugLog("___Receiving - " $ MapInfo.MapName);
|
||||
ReplicationReply();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function ReceiveMapVoteCount(VotingHandler.MapVoteScore MVCData, bool bReply)
|
||||
{
|
||||
local int i;
|
||||
local bool bFound;
|
||||
|
||||
for( i=0; i<MapVoteCount.Length; i++ )
|
||||
{
|
||||
if( MVCData.MapIndex == MapVoteCount[i].MapIndex &&
|
||||
MVCData.GameConfigIndex == MapVoteCount[i].GameConfigIndex)
|
||||
{
|
||||
if( MVCData.VoteCount <= 0 )
|
||||
MapVoteCount.Remove( i, 1); // canceled vote
|
||||
else
|
||||
MapVoteCount[i].VoteCount = MVCData.VoteCount; // updated vote
|
||||
bFound = True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !bFound ) // new vote
|
||||
{
|
||||
i = MapVoteCount.Length;
|
||||
MapVoteCount.Insert(i,1);
|
||||
MapVoteCount[i] = MVCData;
|
||||
}
|
||||
|
||||
if( bReply )
|
||||
ReplicationReply();
|
||||
else if ( PlayerOwner != None && PlayerOwner.Player != None )
|
||||
{
|
||||
if ( MapVotingPage(GetController().ActivePage) != None )
|
||||
MapVotingPage(GetController().ActivePage).UpdateMapVoteCount(i,MVCData.VoteCount==0);
|
||||
if( MapInfoPage(GetController().ActivePage) != none )
|
||||
MapVotingPage(GetController().ActivePage.ParentPage).UpdateMapVoteCount(i,MVCData.VoteCount== 0);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function ReceiveKickVoteCount(VotingHandler.KickVoteScore KVCData, bool bReply)
|
||||
{
|
||||
local int i;
|
||||
local bool bFound;
|
||||
|
||||
for( i=0; i<KickVoteCount.Length; i++ )
|
||||
{
|
||||
if( KVCData.PlayerID == KickVoteCount[i].PlayerID )
|
||||
{
|
||||
KickVoteCount[i].KickVoteCount = KVCData.KickVoteCount;
|
||||
bFound = True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !bFound )
|
||||
{
|
||||
i = KickVoteCount.Length;
|
||||
KickVoteCount.Insert(i,1);
|
||||
KickVoteCount[i] = KVCData;
|
||||
}
|
||||
|
||||
if( bReply )
|
||||
ReplicationReply();
|
||||
else
|
||||
{
|
||||
if( KickVotingPage(GetController().ActivePage) != None )
|
||||
KickVotingPage(GetController().ActivePage).UpdateKickVoteCount(KickVoteCount[i]);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function ReplicationReply()
|
||||
{
|
||||
bWaitingForReply = False;
|
||||
if ( bSendingMatchSetup && TickedReplicationQueue.Length == 0 )
|
||||
{
|
||||
SendClientResponse(StatusID, CompleteID);
|
||||
bSendingMatchSetup = false;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SendMapVote(int MapIndex, int p_GameIndex)
|
||||
{
|
||||
DebugLog("MVRI.SendMapVote(" $ MapIndex $ ", " $ p_GameIndex $ ")");
|
||||
VH.SubmitMapVote(MapIndex,p_GameIndex,Owner);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SendKickVote(int PlayerID)
|
||||
{
|
||||
VH.SubmitKickVote(PlayerID, Owner);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function CloseWindow()
|
||||
{
|
||||
settimer(0,false);
|
||||
GetController().CloseAll(true);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function OpenWindow()
|
||||
{
|
||||
GetController().OpenMenu(GetController().MapVotingMenu);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function string GetMapNameString(int Index)
|
||||
{
|
||||
if(Index >= MapList.Length)
|
||||
return "";
|
||||
else
|
||||
return MapList[Index].MapName;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function MatchSetupLogin(string UserID, string Password)
|
||||
{
|
||||
local int SecLevel;
|
||||
|
||||
if( VH.MatchSetupLogin(UserID,Password,PlayerOwner,SecLevel) )
|
||||
{
|
||||
bMatchSetupPermitted=True;
|
||||
SecurityLevel = SecLevel;
|
||||
|
||||
SendClientResponse(LoginID,"1");
|
||||
}
|
||||
else
|
||||
{
|
||||
bMatchSetupPermitted=False;
|
||||
SendClientResponse(LoginID);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function MatchSetupLogout()
|
||||
{
|
||||
bMatchSetupPermitted = false;
|
||||
bMatchSetupAccepted = false;
|
||||
bSendingMatchSetup = false;
|
||||
VH.MatchSetupLogout( PlayerOwner );
|
||||
|
||||
SendClientResponse("logout");
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function RequestMatchSettings(bool bRefreshMaps, bool bRefreshMutators)
|
||||
{
|
||||
DebugLog("____RequestConfigSettings");
|
||||
|
||||
if(bMatchSetupPermitted)
|
||||
{
|
||||
bMatchSetupAccepted = false;
|
||||
bSendingMatchSetup = true;
|
||||
|
||||
// Send the full list of maps
|
||||
if ( bRefreshMaps )
|
||||
AddToTickedReplicationQueue(REPDATATYPE_Maps, VH.MatchProfile.Maps.Length-1);
|
||||
|
||||
// Send the full list of mutators
|
||||
if ( bRefreshMutators )
|
||||
AddToTickedReplicationQueue(REPDATATYPE_Mutators, VH.MatchProfile.Mutators.Length-1);
|
||||
|
||||
// Send the game configuration, including the active maps & mutators, command line params, and misc. settings
|
||||
AddToTickedReplicationQueue(REPDATATYPE_MatchConfig, VH.MatchProfile.PInfo.Settings.Length + 5);
|
||||
}
|
||||
else SendClientResponse(MatchSetupID, FailedID);
|
||||
}
|
||||
function SendClientResponse( string Identifier, optional string Response, optional string Data )
|
||||
{
|
||||
if ( Identifier == "" )
|
||||
return;
|
||||
|
||||
if ( Response != "" )
|
||||
Identifier $= ":" $ Response;
|
||||
|
||||
if ( Data != "" )
|
||||
Identifier $= ";" $ Data;
|
||||
|
||||
SendResponse(Identifier);
|
||||
}
|
||||
|
||||
function ReceiveCommand( string Command )
|
||||
{
|
||||
local string Type, Info, Data;
|
||||
|
||||
DecodeCommand( Command, Type, Info, Data );
|
||||
HandleCommand( Type, Info, Data );
|
||||
}
|
||||
|
||||
static function DecodeCommand( string Response, out string Type, out string Info, out string Data )
|
||||
{
|
||||
local string str;
|
||||
|
||||
Type = "";
|
||||
Info = "";
|
||||
Data = "";
|
||||
|
||||
if ( Response == "" )
|
||||
return;
|
||||
|
||||
if ( Divide(Response, ":", Type, str) )
|
||||
{
|
||||
if ( !Divide(str, ";", Info, Data) )
|
||||
Info = str;
|
||||
}
|
||||
else Type = Response;
|
||||
}
|
||||
|
||||
function HandleCommand( string Type, string Info, string Data )
|
||||
{
|
||||
local bool bPropagate;
|
||||
|
||||
if ( Type == "" )
|
||||
return;
|
||||
|
||||
log("HandleCommand Type: '"$Type$"' Info: '"$Info$"' Data: '"$Data$"'",'MapVoteDebug');
|
||||
switch ( Type )
|
||||
{
|
||||
case MapID:
|
||||
if ( bMatchSetupPermitted )
|
||||
{
|
||||
bMatchSetupAccepted = false;
|
||||
bPropagate = VH.MatchProfile.ChangeSetting(Type, Info);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MutatorID:
|
||||
if ( bMatchSetupPermitted )
|
||||
{
|
||||
bMatchSetupAccepted = false;
|
||||
bPropagate = VH.MatchProfile.ChangeSetting( Type, Info );
|
||||
}
|
||||
break;
|
||||
|
||||
case GeneralID:
|
||||
if ( bMatchSetupPermitted )
|
||||
{
|
||||
bMatchSetupAccepted = false;
|
||||
switch ( Info )
|
||||
{
|
||||
case OptionID:
|
||||
case TournamentID:
|
||||
case DemoRecID:
|
||||
bPropagate = VH.MatchProfile.ChangeSetting( Info, Data );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( bPropagate )
|
||||
VH.PropagateValue(Self, Type, Info, Data);
|
||||
}
|
||||
|
||||
simulated function SendResponse(string Response)
|
||||
{
|
||||
Super.SendResponse(Response);
|
||||
ReplicationReply();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function MatchSettingsSubmit()
|
||||
{
|
||||
local int i;
|
||||
local bool bAllAccepted;
|
||||
|
||||
DebugLog("____MatchSettingsSubmit()");
|
||||
|
||||
if(bMatchSetupPermitted)
|
||||
{
|
||||
bAllAccepted = true;
|
||||
bMatchSetupAccepted = true;
|
||||
// check if any match setup users did not accept the settings
|
||||
for( i=0; i<VH.MVRI.Length; i++)
|
||||
{
|
||||
if(VH.MVRI[i].bMatchSetupPermitted && !VH.MVRI[i].bMatchSetupAccepted)
|
||||
{
|
||||
bAllAccepted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( bAllAccepted ) // if all match setup users accepted then implement changes
|
||||
VH.MatchProfile.StartMatch();
|
||||
else SendClientResponse(StatusID, lmsgNotAllAccepted);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function SaveAsDefault()
|
||||
{
|
||||
DebugLog("____SaveAsDefault()");
|
||||
|
||||
// double chech permissions just incase
|
||||
if( bMatchSetupPermitted && PlayerOwner.PlayerReplicationInfo.bAdmin )
|
||||
{
|
||||
VH.MatchProfile.SaveDefault();
|
||||
SendClientResponse(StatusID, lmsgSavedAsDefaultSuccess);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function RestoreDefaultProfile()
|
||||
{
|
||||
local MatchConfig MatchProfile;
|
||||
|
||||
DebugLog("____RestoreDefaultProfile()");
|
||||
|
||||
// double chech permissions just incase
|
||||
if( bMatchSetupPermitted )
|
||||
{
|
||||
MatchProfile = VH.MatchProfile;
|
||||
MatchProfile.RestoreDefault(PlayerOwner);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function PlayCountDown(int Count)
|
||||
{
|
||||
local float t;
|
||||
|
||||
if(Count > 10 && Count <= 60 && CountDownSounds[Count-1] != '')
|
||||
PlayerOwner.PlayStatusAnnouncement( CountDownSounds[Count-1], 1);
|
||||
|
||||
if( Count == 10 )
|
||||
{
|
||||
t = GetSoundDuration(PlayerOwner.StatusAnnouncer.PreCacheSound(CountDownSounds[9]));
|
||||
if(t + 0.15 < 1)
|
||||
t = 1;
|
||||
SetTimer(t + 0.15,false);
|
||||
PlayerOwner.PlayStatusAnnouncement( CountDownSounds[9], 1);
|
||||
CountDown = 9;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function Timer()
|
||||
{
|
||||
local float t;
|
||||
|
||||
t = GetSoundDuration(PlayerOwner.StatusAnnouncer.PreCacheSound(CountDownSounds[CountDown-1]));
|
||||
if(t + 0.15 < 1)
|
||||
t = 1;
|
||||
PlayerOwner.PlayStatusAnnouncement( CountDownSounds[CountDown-1], 1);
|
||||
CountDown--;
|
||||
if( CountDown > 0 )
|
||||
SetTimer(t + 0.15,false);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
function RequestPlayerIP( string PlayerName )
|
||||
{
|
||||
local PlayerController P;
|
||||
|
||||
if( PlayerOwner.PlayerReplicationInfo.bAdmin )
|
||||
{
|
||||
foreach DynamicActors( class'PlayerController', P )
|
||||
{
|
||||
if( P.PlayerReplicationInfo.PlayerName ~= PlayerName )
|
||||
{
|
||||
SendPlayerID(P.GetPlayerNetworkAddress(), P.GetPlayerIDHash());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function SendPlayerID(string IPAddress, string PlayerID)
|
||||
{
|
||||
local KickInfoPage Page;
|
||||
|
||||
Page = KickInfoPage(GetController().ActivePage);
|
||||
if(Page != None)
|
||||
{
|
||||
Page.lb_PlayerInfoBox.Add(class'KickInfoPage'.default.IPText,IPAddress);
|
||||
Page.lb_PlayerInfoBox.Add(class'KickInfoPage'.default.IDText,PlayerID);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
simulated function DebugLog(string Text)
|
||||
{
|
||||
if(bDebugLog)
|
||||
log(Text,'MapVoteDebug');
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
simulated function bool MatchSetupLocked() { return !bMatchSetupPermitted; }
|
||||
simulated function bool MapVoteEnabled() { return bMapVote; }
|
||||
simulated function bool KickVoteEnabled() { return bKickVote; }
|
||||
simulated function bool MatchSetupEnabled() { return bMatchSetup; }
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
RemoteRole=ROLE_SimulatedProxy
|
||||
NetPriority=1
|
||||
bOnlyRelevantToOwner=True
|
||||
MapVote=-1
|
||||
GameVote=-1
|
||||
KickVote=-1
|
||||
bDebugLog=false
|
||||
NetUpdateFrequency=1
|
||||
bMatchSetupPermitted=False
|
||||
bNetNotify=True
|
||||
|
||||
ProcessCommand=ReceiveCommand
|
||||
|
||||
CountDownSounds(0)=one
|
||||
CountDownSounds(1)=two
|
||||
CountDownSounds(2)=three
|
||||
CountDownSounds(3)=four
|
||||
CountDownSounds(4)=five
|
||||
CountDownSounds(5)=six
|
||||
CountDownSounds(6)=seven
|
||||
CountDownSounds(7)=eight
|
||||
CountDownSounds(8)=nine
|
||||
CountDownSounds(9)=ten
|
||||
CountDownSounds(19)=20_seconds
|
||||
CountDownSounds(29)=30_seconds_remain
|
||||
CountDownSounds(59)=1_minute_remains
|
||||
|
||||
lmsgSavedAsDefaultSuccess="Profile was saved as default successfully"
|
||||
lmsgNotAllAccepted="You have Accepted the current settings, Waiting for other users to accept."
|
||||
|
||||
MapID="map"
|
||||
MutatorID="mutator"
|
||||
OptionID="option"
|
||||
GeneralID="general"
|
||||
|
||||
URLID="url"
|
||||
StatusID="status"
|
||||
MatchSetupID="matchsetup"
|
||||
LoginID="login"
|
||||
FailedID="failed"
|
||||
CompleteID="done"
|
||||
|
||||
AddID="add"
|
||||
RemoveID="remove"
|
||||
UpdateID="update"
|
||||
|
||||
TournamentID="tournament"
|
||||
DemoRecID="demorec"
|
||||
GameTypeID="game"
|
||||
}
|
||||
|
||||
39
kf_sources/XVoting/Classes/index.html
Normal file
39
kf_sources/XVoting/Classes/index.html
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<html>
|
||||
<head><title>Index of /kf_sources/XVoting/Classes/</title></head>
|
||||
<body>
|
||||
<h1>Index of /kf_sources/XVoting/Classes/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="DefaultMapListLoader.uc">DefaultMapListLoader.uc</a> 06-Oct-2019 10:27 6303
|
||||
<a href="KickInfoPage.uc">KickInfoPage.uc</a> 06-Oct-2019 10:27 5167
|
||||
<a href="KickVoteMultiColumnList.uc">KickVoteMultiColumnList.uc</a> 06-Oct-2019 10:27 9912
|
||||
<a href="KickVoteMultiColumnListBox.uc">KickVoteMultiColumnListBox.uc</a> 06-Oct-2019 10:27 3263
|
||||
<a href="KickVotingPage.uc">KickVotingPage.uc</a> 06-Oct-2019 10:27 4499
|
||||
<a href="MapInfoPage.uc">MapInfoPage.uc</a> 06-Oct-2019 10:27 7024
|
||||
<a href="MapListLoader.uc">MapListLoader.uc</a> 06-Oct-2019 10:27 525
|
||||
<a href="MapVoteCountMultiColumnList.uc">MapVoteCountMultiColumnList.uc</a> 06-Oct-2019 10:27 5217
|
||||
<a href="MapVoteCountMultiColumnListBox.uc">MapVoteCountMultiColumnListBox.uc</a> 06-Oct-2019 10:27 2054
|
||||
<a href="MapVoteFooter.uc">MapVoteFooter.uc</a> 06-Oct-2019 10:27 6263
|
||||
<a href="MapVoteGameConfigPage.uc">MapVoteGameConfigPage.uc</a> 06-Oct-2019 10:27 15392
|
||||
<a href="MapVoteHistory.uc">MapVoteHistory.uc</a> 06-Oct-2019 10:27 2512
|
||||
<a href="MapVoteHistory_INI.uc">MapVoteHistory_INI.uc</a> 06-Oct-2019 10:27 7501
|
||||
<a href="MapVoteMapListConfigPage.uc">MapVoteMapListConfigPage.uc</a> 06-Oct-2019 10:27 5603
|
||||
<a href="MapVoteMultiColumnList.uc">MapVoteMultiColumnList.uc</a> 06-Oct-2019 10:27 5607
|
||||
<a href="MapVoteMultiColumnListBox.uc">MapVoteMultiColumnListBox.uc</a> 06-Oct-2019 10:27 3673
|
||||
<a href="MapVotingPage.uc">MapVotingPage.uc</a> 06-Oct-2019 10:27 8750
|
||||
<a href="MatchConfig.uc">MatchConfig.uc</a> 06-Oct-2019 10:27 16811
|
||||
<a href="MatchConfigPage.uc">MatchConfigPage.uc</a> 06-Oct-2019 10:28 4808
|
||||
<a href="MatchSetupLoginPage.uc">MatchSetupLoginPage.uc</a> 06-Oct-2019 10:27 4540
|
||||
<a href="MatchSetupLoginPanel.uc">MatchSetupLoginPanel.uc</a> 06-Oct-2019 10:27 8027
|
||||
<a href="MatchSetupMain.uc">MatchSetupMain.uc</a> 06-Oct-2019 10:27 6063
|
||||
<a href="MatchSetupMaps.uc">MatchSetupMaps.uc</a> 06-Oct-2019 10:28 12223
|
||||
<a href="MatchSetupMutator.uc">MatchSetupMutator.uc</a> 06-Oct-2019 10:27 9718
|
||||
<a href="MatchSetupPage.uc">MatchSetupPage.uc</a> 06-Oct-2019 10:27 26113
|
||||
<a href="MatchSetupPanelBase.uc">MatchSetupPanelBase.uc</a> 06-Oct-2019 10:27 1999
|
||||
<a href="MatchSetupRules.uc">MatchSetupRules.uc</a> 06-Oct-2019 10:27 1814
|
||||
<a href="PlayerInfoMultiColumnList.uc">PlayerInfoMultiColumnList.uc</a> 06-Oct-2019 10:27 2118
|
||||
<a href="PlayerInfoMultiColumnListBox.uc">PlayerInfoMultiColumnListBox.uc</a> 06-Oct-2019 10:28 1037
|
||||
<a href="VotingPage.uc">VotingPage.uc</a> 06-Oct-2019 10:27 1849
|
||||
<a href="VotingReplicationInfo.uc">VotingReplicationInfo.uc</a> 06-Oct-2019 10:27 24930
|
||||
<a href="xVoting.upkg">xVoting.upkg</a> 06-Oct-2019 10:27 74
|
||||
<a href="xVotingHandler.uc">xVotingHandler.uc</a> 06-Oct-2019 10:27 58506
|
||||
</pre><hr></body>
|
||||
</html>
|
||||
4
kf_sources/XVoting/Classes/xVoting.upkg
Normal file
4
kf_sources/XVoting/Classes/xVoting.upkg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[Flags]
|
||||
AllowDownload=False
|
||||
ClientOptional=False
|
||||
ServerSideOnly=False
|
||||
1760
kf_sources/XVoting/Classes/xVotingHandler.uc
Normal file
1760
kf_sources/XVoting/Classes/xVotingHandler.uc
Normal file
File diff suppressed because it is too large
Load diff
7
kf_sources/XVoting/index.html
Normal file
7
kf_sources/XVoting/index.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<head><title>Index of /kf_sources/XVoting/</title></head>
|
||||
<body>
|
||||
<h1>Index of /kf_sources/XVoting/</h1><hr><pre><a href="../">../</a>
|
||||
<a href="Classes/">Classes/</a> 29-Jun-2025 19:43 -
|
||||
</pre><hr></body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue