class GUIClassMenu extends UT2k4MainPage; const BUYLIST_CATS=7; var automated GUIPanel p_Info; var automated GUISelectClassesBox CategoryBox; var automated GUISelectClassesBox ItemsBox; var automated GUISectionBackground CategoryBG,ItemBG,InfoBG; var GUISelectClassList myItems; //var KFBuyItemsList myItems; var editconst noexport float SavedPitch; var array BuyListHeaders; var array BuyListItemNames; //Use these values to modify/test var int playerscore; var float playerweight; var float maxweight; var array < GUIClassSelectable > AllSelectableClasses; function InitComponent( GUIController MyController, GUIComponent MyOwner ) { Super.InitComponent( MyController, MyOwner ); ItemBG.ManageComponent(ItemsBox); myItems = ItemsBox.List; } event HandleParameters(string Param1, string Param2) { local int i; local int maxitems; local class newitem; maxitems = 3; AllSelectableClasses.Remove(0,AllSelectableClasses.Length); //Lets split the delimited replication string and get the array out //Split(KFGameReplicationInfo(PlayerOwner().GameReplicationInfo).ClassListClassNames,",",ClassListClassNames); for(i=0;i(DynamicLoadObject(ClassListClassNames[i],class'Class')); newitem = class 'SelectPlayerSoldier'; AllSelectableClasses.Insert(0,1); AllSelectableClasses[0] = New newitem; } //GUIBuyMenuFooter(t_Footer).SetPlayerStats(playerscore,playerweight); ClassChange(self); } function KFClassMenuClosed(optional Bool bCanceled) { local rotator NewRot; local int i; // Reset player NewRot = PlayerOwner().Rotation; NewRot.Pitch = SavedPitch; PlayerOwner().SetRotation(NewRot); //Reset purchased items. for(i=0;i newitem; Super.Opened(Sender); maxitems = 3; AllSelectableClasses.Remove(0,AllSelectableClasses.Length); for(i=0;i(DynamicLoadObject(ClassListClassNames[i],class'Class')); newitem = class 'SelectPlayerSoldier'; AllSelectableClasses.Insert(0,1); AllSelectableClasses[0] = New newitem; } // Set camera's pitch to zero when menu initialised (otherwise spinny weap goes kooky) PlayerRot = PlayerOwner().Rotation; SavedPitch = PlayerRot.Pitch; PlayerRot.Yaw = PlayerRot.Yaw % 65536; PlayerRot.Pitch = 0; PlayerRot.Roll = 0; PlayerOwner().SetRotation(PlayerRot); playerscore = PlayerOwner().PlayerReplicationInfo.Score; } function NewInfo(GUIClassSelectable b) { if(p_Info != None) { RemoveComponent(p_Info,true); InfoBG.UnmanageComponent(p_Info); p_Info.Closed(p_Info,false); p_Info.free(); p_Info = None; } if(b != None) { // p_Info = new b.GetPanelType(eClasscat(myCategories.Index));; //GUIBuyMenuFooter(t_Footer).SetBuyMode(b.GetBuyCaption(eClasscat(myCategories.Index)),CanAfford(b)&&b.CanButtonMe(PlayerOwner(),myCategories.Index != 0),b.IsA('BuyableAmmo') && myCategories.Index !=0,b.Isa('BuyableAmmo') && BuyableAmmo(b).BuyMoreClips()*b.cost < playerscore); } else { p_Info = new class'GUIClassInfoPanel'; //GUIBuyMenuFooter(t_Footer).SetBuyMode("Buy",false,false,false); } p_Info.WinLeft=0; p_Info.WinTop=0; p_Info.WinWidth=1; p_Info.WinHeight=1; AppendComponent(p_Info,true); InfoBG.ManageComponent(p_Info); if(p_Info.IsA('GUIClassInfoPanel')) GUIClassInfoPanel(p_Info).Display(b); } function bool CanAfford(GUIClassSelectable b) { return true; } function ClassChange(GUIComponent Sender) { local int j; myItems.Clear(); //i = myCategories.Index; for(j=0;j 0) KFGameReplicationInfo(PlayerOwner().Level.Game.GameReplicationInfo).NumPlayersClassSelected ++; if ( KFGameReplicationInfo(PlayerOwner().Level.Game.GameReplicationInfo).NumPlayersClassSelected >= PlayerOwner().level.game.NumPlayers) { KFPlayerController(PlayerOwner()).bClassChosen = true; //PlayerOwner().ServerRestartPlayer(); Log("Number of CLASS SELECT READY players == NUMPLAYERS."); } else PlayerOwner().GotoState('PlayerWaiting'); } // We've got our player class selected, now "Buy" it. function BuyCurrent() { local GUIClassSelectable b; local int i; b = myItems.Elements[myItems.Index]; b.BuyMe(playerscore,playerweight, playerOwner().Pawn); // myCategories.IndexChanged(myCategories); //update lists //Only refresh if we're out of whatever we bought. for(i=0;i