UMenu
Class UMenuGameRulesBase

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

class UMenuGameRulesBase
extends UMenu.UMenuPageWindow


Variables
 UMenuBotmatchClientWindow BotmatchParent
 float ControlOffset
 UWindowEditControl FragEdit
 string FragHelp
 string FragText
 bool Initialized
 UWindowEditControl MaxPlayersEdit
 string MaxPlayersHelp
 string MaxPlayersText
 UWindowEditControl MaxSpectatorsEdit
 string MaxSpectatorsHelp
 string MaxSpectatorsText
 UWindowEditControl TimeEdit
 string TimeHelp
 string TimeText
 UWindowCheckbox WeaponsCheck
 string WeaponsHelp
 string WeaponsText
 bool bControlRight


Function Summary
 void AfterCreate()
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void FragChanged()
 void LoadCurrentValues()
 void MaxPlayersChanged()
 void MaxSpectatorsChanged()
 void Notify(UWindowDialogControl C, byte E)
 void SetupNetworkOptions()
 void TimeChanged()
 void WeaponsChecked()



Source Code


00001	class UMenuGameRulesBase extends UMenuPageWindow;
00002	
00003	var UMenuBotmatchClientWindow BotmatchParent;
00004	
00005	var bool Initialized;
00006	
00007	// Frag Limit
00008	var UWindowEditControl FragEdit;
00009	var localized string FragText;
00010	var localized string FragHelp;
00011	
00012	// Time Limit
00013	var UWindowEditControl TimeEdit;
00014	var localized string TimeText;
00015	var localized string TimeHelp;
00016	
00017	// Max Players
00018	var UWindowEditControl MaxPlayersEdit;
00019	var localized string MaxPlayersText;
00020	var localized string MaxPlayersHelp;
00021	
00022	var UWindowEditControl MaxSpectatorsEdit;
00023	var localized string MaxSpectatorsText;
00024	var localized string MaxSpectatorsHelp;
00025	
00026	// Weapons Stay
00027	var UWindowCheckbox WeaponsCheck;
00028	var localized string WeaponsText;
00029	var localized string WeaponsHelp;
00030	
00031	var float ControlOffset;
00032	var bool bControlRight;
00033	
00034	function Created()
00035	{
00036		local int S;
00037		local int ControlWidth, ControlLeft, ControlRight;
00038		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00039	
00040		Super.Created();
00041	
00042		ControlWidth = WinWidth/2.5;
00043		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00044		ControlRight = WinWidth/2 + ControlLeft;
00045	
00046		CenterWidth = (WinWidth/4)*3;
00047		CenterPos = (WinWidth - CenterWidth)/2;
00048	
00049		ButtonWidth = WinWidth - 140;
00050		ButtonLeft = WinWidth - ButtonWidth - 40;
00051	
00052		BotmatchParent = UMenuBotmatchClientWindow(GetParent(class'UMenuBotmatchClientWindow'));
00053		if (BotmatchParent == None)
00054			Log("Error: UMenuStartMatchClientWindow without UMenuBotmatchClientWindow parent.");
00055	
00056		// Frag Limit
00057		FragEdit = UWindowEditControl(CreateControl(class'UWindowEditControl', ControlLeft, ControlOffset, ControlWidth, 1));
00058		FragEdit.SetText(FragText);
00059		FragEdit.SetHelpText(FragHelp);
00060		FragEdit.SetFont(F_Normal);
00061		FragEdit.SetNumericOnly(True);
00062		FragEdit.SetMaxLength(3);
00063		FragEdit.Align = TA_Right;
00064	
00065		// Time Limit
00066		TimeEdit = UWindowEditControl(CreateControl(class'UWindowEditControl', ControlRight, ControlOffset, ControlWidth, 1));
00067		TimeEdit.SetText(TimeText);
00068		TimeEdit.SetHelpText(TimeHelp);
00069		TimeEdit.SetFont(F_Normal);
00070		TimeEdit.SetNumericOnly(True);
00071		TimeEdit.SetMaxLength(3);
00072		TimeEdit.Align = TA_Right;
00073		ControlOffset += 25;
00074	
00075		// WeaponsStay
00076		WeaponsCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00077		WeaponsCheck.SetText(WeaponsText);
00078		WeaponsCheck.SetHelpText(WeaponsHelp);
00079		WeaponsCheck.SetFont(F_Normal);
00080		WeaponsCheck.bChecked = BotmatchParent.GameClass.Default.bCoopWeaponMode;
00081		WeaponsCheck.Align = TA_Right;
00082		ControlOffset += 25;
00083	
00084		SetupNetworkOptions();
00085	}
00086	
00087	function AfterCreate()
00088	{
00089		Super.AfterCreate();
00090	
00091		DesiredWidth = 270;
00092		DesiredHeight = ControlOffset;
00093	
00094		LoadCurrentValues();
00095		Initialized = True;
00096	}
00097	
00098	function SetupNetworkOptions()
00099	{
00100		local int ControlWidth, ControlLeft, ControlRight;
00101		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00102	
00103		ControlWidth = WinWidth/2.5;
00104		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00105		ControlRight = WinWidth/2 + ControlLeft;
00106	
00107		CenterWidth = (WinWidth/4)*3;
00108		CenterPos = (WinWidth - CenterWidth)/2;
00109	
00110		if(BotmatchParent.bNetworkGame)
00111		{
00112			// Max Players
00113			MaxPlayersEdit = UWindowEditControl(CreateControl(class'UWindowEditControl', ControlLeft, ControlOffset, ControlWidth, 1));
00114			MaxPlayersEdit.SetText(MaxPlayersText);
00115			MaxPlayersEdit.SetHelpText(MaxPlayersHelp);
00116			MaxPlayersEdit.SetFont(F_Normal);
00117			MaxPlayersEdit.SetNumericOnly(True);
00118			MaxPlayersEdit.SetMaxLength(2);
00119			MaxPlayersEdit.Align = TA_Right;
00120			MaxPlayersEdit.SetDelayedNotify(True);
00121	
00122			// Max Spectators
00123			MaxSpectatorsEdit = UWindowEditControl(CreateControl(class'UWindowEditControl', ControlRight, ControlOffset, ControlWidth, 1));
00124			MaxSpectatorsEdit.SetText(MaxSpectatorsText);
00125			MaxSpectatorsEdit.SetHelpText(MaxSpectatorsHelp);
00126			MaxSpectatorsEdit.SetFont(F_Normal);
00127			MaxSpectatorsEdit.SetNumericOnly(True);
00128			MaxSpectatorsEdit.SetMaxLength(2);
00129			MaxSpectatorsEdit.Align = TA_Right;
00130			MaxSpectatorsEdit.SetDelayedNotify(True);
00131			ControlOffset += 25;
00132		}
00133	}
00134	
00135	
00136	function LoadCurrentValues()
00137	{
00138	}
00139	
00140	function BeforePaint(Canvas C, float X, float Y)
00141	{
00142		local int ControlWidth, ControlLeft, ControlRight;
00143		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00144	
00145		Super.BeforePaint(C, X, Y);
00146	
00147		ControlWidth = WinWidth/2.5;
00148		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00149		ControlRight = WinWidth/2 + ControlLeft;
00150	
00151		CenterWidth = (WinWidth/4)*3;
00152		CenterPos = (WinWidth - CenterWidth)/2;
00153	
00154		FragEdit.SetSize(ControlWidth, 1);
00155		FragEdit.WinLeft = ControlLeft;
00156		FragEdit.EditBoxWidth = 25;
00157	
00158		TimeEdit.SetSize(ControlWidth, 1);
00159		TimeEdit.WinLeft = ControlRight;
00160		TimeEdit.EditBoxWidth = 25;
00161	
00162		if(MaxPlayersEdit != None)
00163		{
00164			MaxPlayersEdit.SetSize(ControlWidth, 1);
00165			MaxPlayersEdit.WinLeft = ControlLeft;
00166			MaxPlayersEdit.EditBoxWidth = 25;
00167		}
00168	
00169		if(MaxSpectatorsEdit != None)
00170		{
00171			MaxSpectatorsEdit.SetSize(ControlWidth, 1);
00172			MaxSpectatorsEdit.WinLeft = ControlRight;
00173			MaxSpectatorsEdit.EditBoxWidth = 25;
00174		}
00175	
00176		WeaponsCheck.SetSize(ControlWidth, 1);
00177		WeaponsCheck.WinLeft = ControlLeft;
00178	}
00179	
00180	function Notify(UWindowDialogControl C, byte E)
00181	{
00182		if (!Initialized)
00183			return;
00184	
00185		Super.Notify(C, E);
00186	
00187		switch(E)
00188		{
00189		case DE_Change:
00190			switch(C)
00191			{
00192				case FragEdit:
00193					FragChanged();
00194					break;
00195				case TimeEdit:
00196					TimeChanged();
00197					break;
00198				case MaxPlayersEdit:
00199					MaxPlayersChanged();
00200					break;
00201				case MaxSpectatorsEdit:
00202					MaxSpectatorsChanged();
00203					break;
00204				case WeaponsCheck:
00205					WeaponsChecked();
00206					break;
00207			}
00208		}
00209	}
00210	
00211	function FragChanged()
00212	{
00213	}
00214	
00215	function TimeChanged()
00216	{
00217	}
00218	
00219	function MaxPlayersChanged()
00220	{
00221	}
00222	
00223	function MaxSpectatorsChanged()
00224	{
00225	}
00226	
00227	function WeaponsChecked()
00228	{
00229	}
00230	
00231	defaultproperties
00232	{
00233	     FragText="Frag Limit"
00234	     FragHelp="The game will end if a player achieves this many frags. A value of 0 sets no frag limit."
00235	     TimeText="Time Limit"
00236	     TimeHelp="The game will end if after this many minutes. A value of 0 sets no time limit."
00237	     MaxPlayersText="Max Connections"
00238	     MaxPlayersHelp="Maximum number of human players allowed to connect to the game."
00239	     MaxSpectatorsText="Max Spectators"
00240	     MaxSpectatorsHelp="Maximum number of spectators allowed to connect to the game."
00241	     WeaponsText="Weapons Stay"
00242	     WeaponsHelp="If checked, weapons will stay at their pickup location after being picked up, instead of respawning."
00243	     ControlOffset=20.000000
00244	}

End Source Code