UTMenu
Class UTRulesCWindow

source: e:\games\UnrealTournament\UTMenu\Classes\UTRulesCWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UWindow.UWindowPageWindow
                  |
                  +--UMenu.UMenuPageWindow
                     |
                     +--UMenu.UMenuGameRulesBase
                        |
                        +--UTMenu.UTRulesCWindow
Direct Known Subclasses:UTLMSRulesCW, UTTeamRCWindow

class UTRulesCWindow
extends UMenu.UMenuGameRulesBase


Variables
 UWindowCheckbox ForceRespawnCheck
 string ForceRespawnHelp
 string ForceRespawnText
 UWindowCheckbox TourneyCheck
 string TourneyHelp
 string TourneyText


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void ForceRespawnChanged()
 void FragChanged()
     
// replaces UMenuGameRulesCWindow's version
 void LoadCurrentValues()
     
// replaces UMenuGameRulesCWindow's version
 void MaxPlayersChanged()
     
// replaces UMenuGameRulesCWindow's version
 void MaxSpectatorsChanged()
 void Notify(UWindowDialogControl C, byte E)
 void SaveConfigs()
 void SetupNetworkOptions()
 void TimeChanged()
     
// replaces UMenuGameRulesCWindow's version
 void TourneyChanged()
 void WeaponsChecked()
     
// replaces UMenuGameRulesCWindow's version



Source Code


00001	class UTRulesCWindow extends UMenuGameRulesBase;
00002	
00003	// Tourney
00004	var UWindowCheckbox TourneyCheck;
00005	var localized string TourneyText;
00006	var localized string TourneyHelp;
00007	
00008	var UWindowCheckbox ForceRespawnCheck;
00009	var localized string ForceRespawnText;
00010	var localized string ForceRespawnHelp;
00011	
00012	function Created()
00013	{
00014		local int ControlWidth, ControlLeft, ControlRight;
00015		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00016	
00017		Super.Created();
00018	
00019		ControlWidth = WinWidth/2.5;
00020		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00021		ControlRight = WinWidth/2 + ControlLeft;
00022	
00023		CenterWidth = (WinWidth/4)*3;
00024		CenterPos = (WinWidth - CenterWidth)/2;
00025	
00026		ButtonWidth = WinWidth - 140;
00027		ButtonLeft = WinWidth - ButtonWidth - 40;
00028	
00029		// Tourney
00030		TourneyCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, WeaponsCheck.WinTop, ControlWidth, 1));
00031		TourneyCheck.SetText(TourneyText);
00032		TourneyCheck.SetHelpText(TourneyHelp);
00033		TourneyCheck.SetFont(F_Normal);
00034		TourneyCheck.Align = TA_Right;
00035	}
00036	
00037	function SetupNetworkOptions()
00038	{
00039		local int ControlWidth, ControlLeft, ControlRight;
00040		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00041	
00042		Super.SetupNetworkOptions();
00043	
00044		ControlWidth = WinWidth/2.5;
00045		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00046		ControlRight = WinWidth/2 + ControlLeft;
00047	
00048		CenterWidth = (WinWidth/4)*3;
00049		CenterPos = (WinWidth - CenterWidth)/2;
00050	
00051		if(BotmatchParent.bNetworkGame && !ClassIsChildOf( BotmatchParent.GameClass, class'LastManStanding'))
00052		{
00053			ForceRespawnCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00054			ForceRespawnCheck.SetText(ForceRespawnText);
00055			ForceRespawnCheck.SetHelpText(ForceRespawnHelp);
00056			ForceRespawnCheck.SetFont(F_Normal);
00057			ForceRespawnCheck.Align = TA_Right;
00058			ControlOffset += 25;
00059		}
00060	}
00061	
00062	
00063	// replaces UMenuGameRulesCWindow's version
00064	function LoadCurrentValues()
00065	{
00066		FragEdit.SetValue(string(Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.FragLimit));
00067	
00068		TimeEdit.SetValue(string(Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.TimeLimit));
00069	
00070		if(MaxPlayersEdit != None)
00071			MaxPlayersEdit.SetValue(string(Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.MaxPlayers));
00072	
00073		if(MaxSpectatorsEdit != None)
00074			MaxSpectatorsEdit.SetValue(string(Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.MaxSpectators));
00075	
00076		if(BotmatchParent.bNetworkGame)
00077			WeaponsCheck.bChecked = Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bMultiWeaponStay;
00078		else
00079			WeaponsCheck.bChecked = Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bCoopWeaponMode;
00080	
00081		TourneyCheck.bChecked = Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bTournament;
00082	
00083		if(ForceRespawnCheck != None)
00084			ForceRespawnCheck.bChecked = Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bForceRespawn;
00085	}
00086	
00087	function BeforePaint(Canvas C, float X, float Y)
00088	{
00089		local int ControlWidth, ControlLeft, ControlRight;
00090		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00091	
00092		Super.BeforePaint(C, X, Y);
00093	
00094		ControlWidth = WinWidth/2.5;
00095		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00096		ControlRight = WinWidth/2 + ControlLeft;
00097	
00098		CenterWidth = (WinWidth/4)*3;
00099		CenterPos = (WinWidth - CenterWidth)/2;
00100	
00101		TourneyCheck.SetSize(ControlWidth, 1);
00102		TourneyCheck.WinLeft = ControlRight;
00103	
00104		if(ForceRespawnCheck != None)
00105		{
00106			ForceRespawnCheck.SetSize(ControlWidth, 1);
00107			ForceRespawnCheck.WinLeft = ControlLeft;
00108		}
00109	}
00110	
00111	function Notify(UWindowDialogControl C, byte E)
00112	{
00113		if (!Initialized)
00114			return;
00115	
00116		Super.Notify(C, E);
00117	
00118		switch(E)
00119		{
00120		case DE_Change:
00121			switch(C)
00122			{
00123			case TourneyCheck:
00124				TourneyChanged();
00125				break;
00126			case ForceRespawnCheck:
00127				ForceRespawnChanged();
00128				break;
00129			}
00130		}
00131	}
00132	
00133	function TourneyChanged()
00134	{
00135		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bTournament = TourneyCheck.bChecked;
00136	}
00137	
00138	function ForceRespawnChanged()
00139	{
00140		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bForceRespawn = ForceRespawnCheck.bChecked;
00141	}
00142	
00143	// replaces UMenuGameRulesCWindow's version
00144	function FragChanged()
00145	{
00146		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.FragLimit = int(FragEdit.GetValue());
00147	}
00148	
00149	// replaces UMenuGameRulesCWindow's version
00150	function TimeChanged()
00151	{
00152		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.TimeLimit = int(TimeEdit.GetValue());
00153	}
00154	
00155	// replaces UMenuGameRulesCWindow's version
00156	function MaxPlayersChanged()
00157	{
00158		if(int(MaxPlayersEdit.GetValue()) > 16)
00159			MaxPlayersEdit.SetValue("16");
00160		if(int(MaxPlayersEdit.GetValue()) < 1)
00161			MaxPlayersEdit.SetValue("1");
00162	
00163		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.MaxPlayers = int(MaxPlayersEdit.GetValue());
00164	}
00165	
00166	function MaxSpectatorsChanged()
00167	{
00168		if(int(MaxSpectatorsEdit.GetValue()) > 16)
00169			MaxSpectatorsEdit.SetValue("16");
00170		
00171		if(int(MaxSpectatorsEdit.GetValue()) < 0)
00172			MaxSpectatorsEdit.SetValue("0");
00173	
00174		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.MaxSpectators = int(MaxSpectatorsEdit.GetValue());
00175	}
00176	
00177	// replaces UMenuGameRulesCWindow's version
00178	function WeaponsChecked()
00179	{
00180		if(BotmatchParent.bNetworkGame)
00181			Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bMultiWeaponStay = WeaponsCheck.bChecked;
00182		else
00183			Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bCoopWeaponMode = WeaponsCheck.bChecked;
00184	}
00185	
00186	function SaveConfigs()
00187	{
00188		Super.SaveConfigs();
00189		BotmatchParent.GameClass.static.StaticSaveConfig();
00190		GetPlayerOwner().SaveConfig();
00191	}
00192	
00193	defaultproperties
00194	{
00195	     TourneyText="Tournament"
00196	     TourneyHelp="If checked, each player must indicate they are ready by clicking their fire button before the match begins."
00197	     ForceRespawnText="Force Respawn"
00198	     ForceRespawnHelp="If checked, players will be automatically respawned when they die, without waiting for the user to press Fire."
00199	}

End Source Code