UMenu
Class UMenuBotConfigClientWindow

source: e:\games\UnrealTournament\UMenu\Classes\UMenuBotConfigClientWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UWindow.UWindowPageWindow
                  |
                  +--UMenu.UMenuPageWindow
                     |
                     +--UMenu.UMenuBotConfigBase
                        |
                        +--UMenu.UMenuBotConfigClientWindow
Direct Known Subclasses:None

class UMenuBotConfigClientWindow
extends UMenu.UMenuBotConfigBase


Variables
 UWindowCheckbox BIMCheck
 string BIMHelp
 string BIMText
 Class BotConfig


Function Summary
 void AutoAdjustChecked()
 void BIMChanged()
 void BaseChanged()
 void BeforePaint(Canvas C, float x, float Y)
 void ConfigureIndivBots()
 void Created()
 void LoadCurrentValues()
 void Notify(UWindowDialogControl C, byte E)
 void NumBotsChanged()
 void RandomChecked()
 void SaveConfigs()



Source Code


00001	class UMenuBotConfigClientWindow extends UMenuBotConfigBase;
00002	
00003	// Botconfig
00004	var Class<BotInfo> BotConfig;
00005	
00006	var UWindowCheckbox BIMCheck;
00007	var localized string BIMText;
00008	var localized string BIMHelp;
00009	
00010	function Created()
00011	{
00012		local int ControlWidth, ControlLeft, ControlRight;
00013		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00014	
00015		ControlWidth = WinWidth/2.5;
00016		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00017		ControlRight = WinWidth/2 + ControlLeft;
00018	
00019		CenterWidth = (WinWidth/4)*3;
00020		CenterPos = (WinWidth - CenterWidth)/2;
00021	
00022		SetBotmatchParent();
00023	
00024		if(BotmatchParent.bNetworkGame)
00025		{
00026			BIMCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', CenterPos, ControlOffset, CenterWidth, 1));
00027			BIMCheck.SetText(BIMText);
00028			BIMCheck.SetHelpText(BIMHelp);
00029			BIMCheck.SetFont(F_Normal);
00030			BIMCheck.Align = TA_Right;
00031	
00032			ControlOffset += 25;
00033		}
00034	
00035		Super.Created();
00036	}
00037	
00038	function BeforePaint(Canvas C, float x, float Y)
00039	{
00040		local int ControlWidth, ControlLeft, ControlRight;
00041		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00042	
00043		Super.BeforePaint(C, X, Y);
00044	
00045		ControlWidth = WinWidth/2.5;
00046		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00047		ControlRight = WinWidth/2 + ControlLeft;
00048	
00049		CenterWidth = (WinWidth/4)*3;
00050		CenterPos = (WinWidth - CenterWidth)/2;
00051	
00052		if(BIMCheck != None)
00053		{
00054			
00055			BIMCheck.SetSize(CenterWidth - 90, 1);
00056			BIMCheck.WinLeft = CenterPos + 45;
00057		}
00058	}
00059	
00060	function Notify(UWindowDialogControl C, byte E)
00061	{
00062		if (!Initialized)
00063			return;
00064	
00065		Super.Notify(C, E);
00066	
00067		switch(E)
00068		{
00069		case DE_Change:
00070			switch(C)
00071			{
00072			case BIMCheck:
00073				BIMChanged();
00074				break;
00075			}
00076		}
00077	}
00078	
00079	function LoadCurrentValues()
00080	{
00081		BotConfig = Class<DeathMatchGame>(BotmatchParent.GameClass).Default.BotConfigType;
00082	
00083		TauntLabel.SetText(SkillTaunts[BotConfig.Default.Difficulty]);
00084		BaseCombo.SetSelectedIndex(BotConfig.Default.Difficulty);
00085		AutoAdjustCheck.bChecked = BotConfig.Default.bAdjustSkill;
00086		RandomCheck.bChecked = BotConfig.Default.bRandomOrder;
00087		NumBotsEdit.SetValue(string(Class<DeathMatchGame>(BotmatchParent.GameClass).Default.InitialBots));
00088		if(BIMCheck != None)
00089			BIMCheck.bChecked = Class<DeathMatchGame>(BotmatchParent.GameClass).Default.bMultiPlayerBots;
00090	}
00091	
00092	function BaseChanged()
00093	{
00094		TauntLabel.SetText(SkillTaunts[BaseCombo.GetSelectedIndex()]);
00095		BotConfig.Default.Difficulty = BaseCombo.GetSelectedIndex();
00096	}
00097	
00098	function NumBotsChanged()
00099	{
00100		if (int(NumBotsEdit.GetValue()) > 15)
00101			NumBotsEdit.SetValue("15");
00102		Class<DeathMatchGame>(BotmatchParent.GameClass).Default.InitialBots = int(NumBotsEdit.GetValue());
00103	}
00104	
00105	function BIMChanged()
00106	{
00107		if(BIMCheck != None)
00108			Class<DeathMatchGame>(BotmatchParent.GameClass).Default.bMultiPlayerBots = BIMCheck.bChecked;		
00109	}
00110	
00111	function AutoAdjustChecked()
00112	{
00113		BotConfig.Default.bAdjustSkill = AutoAdjustCheck.bChecked;
00114	}
00115	
00116	function RandomChecked()
00117	{
00118		BotConfig.Default.bRandomOrder = RandomCheck.bChecked;
00119	}
00120	
00121	function ConfigureIndivBots()
00122	{
00123		if(Class<DeathMatchGame>(BotmatchParent.GameClass).Default.InitialBots == 0)
00124			MessageBox(AtLeastOneBotTitle, AtLeastOneBotText, MB_OK, MR_OK, MR_OK);
00125		else
00126			GetParent(class'UWindowFramedWindow').ShowModal(Root.CreateWindow(class'UMenuConfigIndivBotsWindow', 100, 100, 200, 200, Self));
00127	}
00128	
00129	function SaveConfigs()
00130	{
00131		Super.SaveConfigs();
00132		BotConfig.static.StaticSaveConfig();
00133		Class<DeathMatchGame>(BotmatchParent.GameClass).static.StaticSaveConfig();
00134	}
00135	
00136	defaultproperties
00137	{
00138	     BIMText="Enable Bots"
00139	     BIMHelp="If checked, bots will be present in your new multiplayer game."
00140	}

End Source Code