UMenu
Class UMenuBotSetupClient

source: e:\games\UnrealTournament\UMenu\Classes\UMenuBotSetupClient.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UMenu.UMenuDialogClientWindow
                  |
                  +--UMenu.UMenuPlayerSetupClient
                     |
                     +--UMenu.UMenuBotSetupBase
                        |
                        +--UMenu.UMenuBotSetupClient
Direct Known Subclasses:None

class UMenuBotSetupClient
extends UMenu.UMenuBotSetupBase


Variables
 BotInfo BotInfo


Function Summary
 void Close(optional bool)
 void LoadBots()
 void LoadClasses()
 void LoadCurrent()
 void NameChanged()
 void ResetBots()
 void SaveConfigs()
 void UseSelected()



Source Code


00001	class UMenuBotSetupClient extends UMenuBotSetupBase;
00002	
00003	var BotInfo BotInfo;
00004	
00005	function LoadBots()
00006	{
00007		local class<BotInfo> C;
00008		local int i;
00009		local int NumBots;
00010	
00011		C = class<BotInfo>(DynamicLoadObject("UnrealI.BotInfo", class'Class'));
00012		BotInfo = GetEntryLevel().Spawn(C);
00013	
00014		NumBots = Int(UMenuBotConfigBase(OwnerWindow).NumBotsEdit.GetValue());
00015	
00016		// Add the bots into the combo
00017		for(i=0;i<NumBots;i++)
00018			BotCombo.AddItem(BotWord@string(i+1), String(i));	
00019	}
00020	
00021	function ResetBots()
00022	{
00023		local Class<BotInfo> C;
00024		
00025		C = BotInfo.Class;
00026		BotInfo.Destroy();
00027	
00028		C.ResetConfig();
00029		BotInfo = GetEntryLevel().Spawn(C);
00030	
00031		Initialized = False;
00032		ConfigureBot = 0;
00033		BotCombo.SetSelectedIndex(0);
00034		LoadCurrent();
00035		UseSelected();
00036		Initialized = True;
00037	}
00038	
00039	function LoadClasses()
00040	{
00041		local int i;
00042		local int SortWeight;
00043	
00044		for(i=0;i<BotInfo.NumClasses;i++)
00045			ClassCombo.AddItem(BotInfo.AvailableDescriptions[i], BotInfo.AvailableClasses[i], SortWeight);
00046	}
00047	
00048	function Close(optional bool bByParent)
00049	{
00050		Super.Close(bByParent);
00051		BotInfo.SaveConfig();
00052		BotInfo.Destroy();
00053		BotInfo = None;
00054	}
00055	
00056	function LoadCurrent()
00057	{
00058		local int i;
00059	
00060		NameEdit.SetValue(BotInfo.GetBotName(ConfigureBot));
00061		i = TeamCombo.FindItemIndex2(string(BotInfo.BotTeams[ConfigureBot]));
00062		if(i == -1)
00063			i = 255;
00064		TeamCombo.SetSelectedIndex(i);
00065		ClassCombo.SetSelectedIndex(Max(ClassCombo.FindItemIndex2(BotInfo.GetBotClassName(ConfigureBot), True), 0));
00066		SkinCombo.SetSelectedIndex(Max(SkinCombo.FindItemIndex2(BotInfo.GetBotSkin(ConfigureBot), True), 0));
00067		FaceCombo.SetSelectedIndex(0);
00068	}
00069	
00070	function NameChanged()
00071	{
00072		if (Initialized)
00073		{
00074			BotInfo.SetBotName(NameEdit.GetValue(), ConfigureBot);
00075		}
00076	}
00077	
00078	function UseSelected()
00079	{
00080		if (Initialized)
00081		{
00082			// store the stuff in the required botinfo
00083			BotInfo.SetBotClass(ClassCombo.GetValue2(), ConfigureBot);
00084			BotInfo.SetBotSkin(SkinCombo.GetValue2(), ConfigureBot);
00085			BotInfo.SetBotTeam(Int(TeamCombo.GetValue2()), ConfigureBot);
00086		}
00087	
00088		// setup the mesh window appropriately
00089		MeshWindow.SetMeshString(NewPlayerClass.Default.SelectionMesh);
00090		MeshWindow.ClearSkins();
00091		NewPlayerClass.static.SetMultiSkin(MeshWindow.MeshActor, SkinCombo.GetValue2(), FaceCombo.GetValue2(), Int(TeamCombo.GetValue2()));
00092	}
00093	
00094	function SaveConfigs()
00095	{
00096		Super.SaveConfigs();
00097		if(BotInfo != None)
00098			BotInfo.SaveConfig();
00099	}
00100	
00101	defaultproperties
00102	{
00103	}

End Source Code