UTMenu
Class UTBotConfigClient

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

class UTBotConfigClient
extends UMenu.UMenuBotConfigBase


Variables
 UWindowCheckbox BalanceTeamsCheck
 string BalanceTeamsHelp
 string BalanceTeamsText
 Class BotConfig
 UWindowCheckbox DumbDownCheck
 string DumbDownHelp
 string DumbDownText
 string MinPlayersHelp
 string MinPlayersText


Function Summary
 void AutoAdjustChecked()
 void BalanceTeamsChanged()
 void BaseChanged()
     
// replaces UMenuBotConfigClientWindow's version
 void BeforePaint(Canvas C, float X, float Y)
 void ConfigureIndivBots()
 void Created()
 void DumbDownChanged()
 void LoadCurrentValues()
     
// replaces UMenuBotConfigClientWindow's version
 void Notify(UWindowDialogControl C, byte E)
 void NumBotsChanged()
     
// replaces UMenuBotConfigClientWindow's version
 void RandomChecked()
 void SaveConfigs()



Source Code


00001	class UTBotConfigClient extends UMenuBotConfigBase;
00002	
00003	// Botconfig
00004	var Class<ChallengeBotInfo> BotConfig;
00005	
00006	var UWindowCheckbox BalanceTeamsCheck;
00007	var localized string BalanceTeamsText;
00008	var localized string BalanceTeamsHelp;
00009	
00010	var UWindowCheckbox DumbDownCheck;
00011	var localized string DumbDownText;
00012	var localized string DumbDownHelp;
00013	
00014	var localized string MinPlayersText;
00015	var localized string MinPlayersHelp;
00016	
00017	function Created()
00018	{
00019		local int ControlWidth, ControlLeft, ControlRight;
00020		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00021	
00022		Super.Created();
00023	
00024		ControlWidth = WinWidth/2.5;
00025		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00026		ControlRight = WinWidth/2 + ControlLeft;
00027	
00028		CenterWidth = (WinWidth/4)*3;
00029		CenterPos = (WinWidth - CenterWidth)/2;
00030	
00031		if(BotmatchParent.bNetworkGame)
00032		{
00033			NumBotsEdit.SetText(MinPlayersText);
00034			NumBotsEdit.SetHelpText(MinPlayersHelp);
00035		}
00036	
00037		if(class<TeamGamePlus>(BotmatchParent.GameClass) != None)
00038		{
00039			// Balance Teams
00040			BalanceTeamsCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00041			BalanceTeamsCheck.SetText(BalanceTeamsText);
00042			BalanceTeamsCheck.SetHelpText(BalanceTeamsHelp);
00043			BalanceTeamsCheck.SetFont(F_Normal);
00044			BalanceTeamsCheck.Align = TA_Right;
00045	
00046			if(class<Domination>(BotmatchParent.GameClass) != None)
00047			{
00048				DumbDownCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, ControlOffset, ControlWidth, 1));
00049				DumbDownCheck.SetText(DumbDownText);
00050				DumbDownCheck.SetHelpText(DumbDownHelp);
00051				DumbDownCheck.SetFont(F_Normal);
00052				DumbDownCheck.Align = TA_Right;
00053			}
00054	
00055			ControlOffset += 25;
00056		}
00057	}
00058	
00059	function BeforePaint(Canvas C, float X, float Y)
00060	{
00061		local int ControlWidth, ControlLeft, ControlRight;
00062		local int CenterWidth, CenterPos, ButtonWidth, ButtonLeft;
00063	
00064		Super.BeforePaint(C, X, Y);
00065	
00066		ControlWidth = WinWidth/2.5;
00067		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00068		ControlRight = WinWidth/2 + ControlLeft;
00069	
00070		CenterWidth = (WinWidth/4)*3;
00071		CenterPos = (WinWidth - CenterWidth)/2;
00072	
00073		if(BalanceTeamsCheck != None)
00074		{
00075			BalanceTeamsCheck.SetSize(ControlWidth + 10, 1);
00076			BalanceTeamsCheck.WinLeft = ControlLeft - 5;
00077		}
00078	
00079		if(DumbDownCheck != None)
00080		{
00081			DumbDownCheck.SetSize(ControlWidth + 10, 1);
00082			DumbDownCheck.WinLeft = ControlRight - 5;
00083		}
00084	}
00085	
00086	function AutoAdjustChecked()
00087	{
00088		BotConfig.Default.bAdjustSkill = AutoAdjustCheck.bChecked;
00089		BotConfig.static.StaticSaveConfig();
00090	}
00091	
00092	function RandomChecked()
00093	{
00094		BotConfig.Default.bRandomOrder = RandomCheck.bChecked;
00095		BotConfig.static.StaticSaveConfig();
00096	}
00097	
00098	function ConfigureIndivBots()
00099	{
00100		if(int(NumBotsEdit.GetValue()) == 0)
00101			MessageBox(AtLeastOneBotTitle, AtLeastOneBotText, MB_OK, MR_OK, MR_OK);
00102		else
00103			GetParent(class'UWindowFramedWindow').ShowModal(Root.CreateWindow(class'UTConfigIndivBotsWindow', 100, 100, 200, 200, Self));
00104	}
00105	
00106	// replaces UMenuBotConfigClientWindow's version
00107	function LoadCurrentValues()
00108	{
00109		local int i;
00110	
00111		BotConfig = class'DeathMatchPlus'.default.BotConfigType;
00112		for(i=0;i<8;i++)
00113			Skills[i] = BotConfig.default.Skills[i];
00114	
00115		BaseCombo.SetSelectedIndex(Min(BotConfig.default.Difficulty, 7));
00116	
00117		TauntLabel.SetText(SkillTaunts[BaseCombo.GetSelectedIndex()]);
00118	
00119		AutoAdjustCheck.bChecked = BotConfig.Default.bAdjustSkill;
00120		RandomCheck.bChecked = BotConfig.Default.bRandomOrder;
00121	
00122		if(BotmatchParent.bNetworkGame)
00123			NumBotsEdit.SetValue(string(class'DeathMatchPlus'.Default.MinPlayers));
00124		else
00125			NumBotsEdit.SetValue(string(class'DeathMatchPlus'.Default.InitialBots));
00126	
00127		if(BalanceTeamsCheck != None)
00128			BalanceTeamsCheck.bChecked = class'TeamGamePlus'.Default.bBalanceTeams;
00129	
00130		if(DumbDownCheck != None)
00131			DumbDownCheck.bChecked = !class'Domination'.Default.bDumbDown;
00132	}
00133	
00134	// replaces UMenuBotConfigClientWindow's version
00135	function BaseChanged()
00136	{
00137		TauntLabel.SetText(SkillTaunts[BaseCombo.GetSelectedIndex()]);
00138		BotConfig.Default.Difficulty = BaseCombo.GetSelectedIndex();
00139		BotConfig.static.StaticSaveConfig();
00140	}
00141	
00142	// replaces UMenuBotConfigClientWindow's version
00143	function NumBotsChanged()
00144	{
00145		if (int(NumBotsEdit.GetValue()) > 16)
00146			NumBotsEdit.SetValue("16");
00147	
00148		if(BotmatchParent.bNetworkGame)
00149			class<DeathMatchPlus>(BotmatchParent.GameClass).default.MinPlayers = int(NumBotsEdit.GetValue());
00150		else
00151			class<DeathMatchPlus>(BotmatchParent.GameClass).default.InitialBots = int(NumBotsEdit.GetValue());
00152		BotmatchParent.GameClass.static.StaticSaveConfig();
00153	}
00154	
00155	function BalanceTeamsChanged()
00156	{
00157		class'TeamGamePlus'.Default.bBalanceTeams = BalanceTeamsCheck.bChecked;
00158		Log("Set BalanceTeams to: "$class'TeamGamePlus'.Default.bBalanceTeams);
00159		class'TeamGamePlus'.static.StaticSaveConfig();
00160	}
00161	
00162	function DumbDownChanged()
00163	{
00164		class'Domination'.Default.bDumbDown = !DumbDownCheck.bChecked;
00165		class'Domination'.static.StaticSaveConfig();
00166	}
00167	
00168	function SaveConfigs()
00169	{
00170		Super.SaveConfigs();
00171	}
00172	
00173	function Notify(UWindowDialogControl C, byte E)
00174	{
00175		if (!Initialized)
00176			return;
00177	
00178		Super.Notify(C, E);
00179	
00180		switch(E)
00181		{
00182		case DE_Change:
00183			switch(C)
00184			{
00185			case BalanceTeamsCheck:
00186				BalanceTeamsChanged();
00187				break;
00188			case DumbDownCheck:
00189				DumbDownChanged();
00190				break;
00191			}
00192			break;
00193		}
00194	}
00195	
00196	defaultproperties
00197	{
00198	     BalanceTeamsText="Balance Teams"
00199	     BalanceTeamsHelp="If this setting is checked, bots will automatically change teams to ensure there is a balanced number of members on each team."
00200	     DumbDownText="Enhanced Team AI"
00201	     DumbDownHelp="Enable enhanced team artificial intelligence features for the bots in this game."
00202	     MinPlayersText="Min. Total Players"
00203	     MinPlayersHelp="Bots will fill out the game to ensure there are always this many players.  Set this number to 0 to disable bots."
00204	     Skills(2)="Experienced"
00205	     Skills(3)="Skilled"
00206	     Skills(4)="Adept"
00207	     Skills(5)="Masterful"
00208	     Skills(6)="Inhuman"
00209	     Skills(7)="Godlike"
00210	     SkillTaunts(1)="They know how to kill."
00211	     SkillTaunts(2)="Don't get cocky."
00212	     SkillTaunts(3)="You think you're tough?"
00213	     SkillTaunts(4)="You'd better be good."
00214	     SkillTaunts(5)="I hope you like to respawn."
00215	     SkillTaunts(6)="You're already dead."
00216	     SkillTaunts(7)="I am the Alpha and the Omega."
00217	}

End Source Code