UTMenu
Class UTSettingsCWindow

source: e:\games\UnrealTournament\UTMenu\Classes\UTSettingsCWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UWindow.UWindowPageWindow
                  |
                  +--UMenu.UMenuPageWindow
                     |
                     +--UMenu.UMenuGameSettingsBase
                        |
                        +--UTMenu.UTSettingsCWindow
Direct Known Subclasses:UTTeamSCWindow

class UTSettingsCWindow
extends UMenu.UMenuGameSettingsBase


Variables
 string AirControlHelp
 UWindowHSliderControl AirControlSlider
 string AirControlText
 UWindowCheckbox TranslocCheck
 string TranslocHelp
 string TranslocText


Function Summary
 void AirControlChanged()
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void LoadCurrentValues()
     
// Replaces UMenuGameSettingsCWindow's version
 void Notify(UWindowDialogControl C, byte E)
 void SpeedChanged()
     
// Replaces UMenuGameSettingsCWindow's version
 void StyleChanged()
     
// Replaces UMenuGameSettingsCWindow's version
 void TranslocChanged()



Source Code


00001	class UTSettingsCWindow extends UMenuGameSettingsBase;
00002	
00003	// Translocator
00004	var UWindowCheckbox TranslocCheck;
00005	var localized string TranslocText;
00006	var localized string TranslocHelp;
00007	
00008	// AirControl
00009	var UWindowHSliderControl AirControlSlider;
00010	var localized string AirControlText;
00011	var localized string AirControlHelp;
00012	
00013	function Created()
00014	{
00015		local int ControlWidth, ControlLeft, ControlRight;
00016		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00017	
00018		Super.Created();
00019	
00020		ControlWidth = WinWidth/2.5;
00021		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00022		ControlRight = WinWidth/2 + ControlLeft;
00023	
00024		CenterWidth = (WinWidth/4)*3;
00025		CenterPos = (WinWidth - CenterWidth)/2;
00026	
00027		ButtonWidth = WinWidth - 140;
00028		ButtonLeft = WinWidth - ButtonWidth - 40;
00029	
00030		// Air Control
00031		AirControlSlider = UWindowHSliderControl(CreateControl(class'UWindowHSliderControl', CenterPos, ControlOffset, CenterWidth, 1));
00032		AirControlSlider.SetRange(5, 100, 5);
00033		AirControlSlider.SetHelpText(AirControlHelp);
00034		AirControlSlider.SetFont(F_Normal);
00035		ControlOffset += 25;
00036	
00037		// Translocator
00038		TranslocCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', CenterPos, ControlOffset, CenterWidth, 1));
00039		TranslocCheck.SetText(TranslocText);
00040		TranslocCheck.SetHelpText(TranslocHelp);
00041		TranslocCheck.SetFont(F_Normal);
00042		TranslocCheck.Align = TA_Right;
00043		ControlOffset += 25;
00044	
00045		if (ClassIsChildOf( BotmatchParent.GameClass, class'Assault' ))
00046			TranslocCheck.HideWindow();
00047	}
00048	
00049	function BeforePaint(Canvas C, float X, float Y)
00050	{
00051		local int ControlWidth, ControlLeft, ControlRight;
00052		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00053	
00054		Super.BeforePaint(C, X, Y);
00055	
00056		ControlWidth = WinWidth/2.5;
00057		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00058		ControlRight = WinWidth/2 + ControlLeft;
00059	
00060		CenterWidth = (WinWidth/4)*3;
00061		CenterPos = (WinWidth - CenterWidth)/2;
00062	
00063		TranslocCheck.SetSize(CenterWidth - 110, 1);
00064		TranslocCheck.WinLeft = CenterPos + 55;
00065	
00066		AirControlSlider.SetSize(CenterWidth, 1);
00067		AirControlSlider.SliderWidth = 90;
00068		AirControlSlider.WinLeft = CenterPos;
00069	}
00070	
00071	function Notify(UWindowDialogControl C, byte E)
00072	{
00073		if (!Initialized)
00074			return;
00075	
00076		Super.Notify(C, E);
00077	
00078		switch(E)
00079		{
00080		case DE_Change:
00081			switch(C)
00082			{
00083				case TranslocCheck:
00084					TranslocChanged();
00085					break;
00086			case AirControlSlider:
00087				AirControlChanged();
00088				break;
00089			}
00090		}
00091	}
00092	
00093	function AirControlChanged()
00094	{
00095		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.AirControl = AirControlSlider.GetValue() / 100;
00096		AirControlSlider.SetText(AirControlText$" ["$Int(AirControlSlider.GetValue())$"%]:");
00097	}
00098	
00099	// Replaces UMenuGameSettingsCWindow's version
00100	function LoadCurrentValues()
00101	{
00102		local int S;
00103		local int AC;
00104	
00105		AC = Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.AirControl * 100.0;
00106		AirControlSlider.SetValue(AC);
00107		AirControlSlider.SetText(AirControlText$" ["$AC$"%]:");
00108	
00109		TranslocCheck.bChecked = Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bUseTranslocator;
00110	
00111		if ( Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bMegaSpeed )
00112			StyleCombo.SetSelectedIndex(2);
00113		else if ( Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bHardcoreMode )
00114			StyleCombo.SetSelectedIndex(1);
00115		else
00116			StyleCombo.SetSelectedIndex(0);
00117	
00118		S = Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.GameSpeed * 100.0;
00119		SpeedSlider.SetValue(S);
00120		SpeedSlider.SetText(SpeedText$" ["$S$"%]:");
00121	}
00122	
00123	// Replaces UMenuGameSettingsCWindow's version
00124	function StyleChanged()
00125	{
00126		switch (StyleCombo.GetSelectedIndex())
00127		{
00128			case 0:
00129				Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bMegaSpeed = false;
00130				Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bHardCoreMode = false;
00131				AirControlSlider.SetValue(35);
00132				break;
00133			case 1:
00134				Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bMegaSpeed = false;
00135				Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bHardCoreMode = true;
00136				AirControlSlider.SetValue(35);
00137				break;
00138			case 2:
00139				Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bMegaSpeed = true;
00140				Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bHardCoreMode = true;
00141				AirControlSlider.SetValue(65);
00142				break;
00143		}
00144	}
00145	
00146	// Replaces UMenuGameSettingsCWindow's version
00147	function SpeedChanged()
00148	{
00149		local int S;
00150	
00151		S = SpeedSlider.GetValue();
00152		SpeedSlider.SetText(SpeedText$" ["$S$"%]:");
00153		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.GameSpeed = float(S) / 100.0;
00154	}
00155	
00156	function TranslocChanged()
00157	{
00158		Class<DeathMatchPlus>(BotmatchParent.GameClass).Default.bUseTranslocator = TranslocCheck.bChecked;
00159	}
00160	
00161	defaultproperties
00162	{
00163	     TranslocText="Translocator"
00164	     TranslocHelp="If checked, each player will be equipped with a Translocator Personal Transport Device."
00165	     AirControlText="Air Control"
00166	     AirControlHelp="Use this slider to specify how much control you have over your player's movement whilst in the air."
00167	}

End Source Code