Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

KFGui.GUILibraryMenu


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
class GUILibraryMenu extends UT2k4MainPage;
const LIBLIST_CATS=3;
var automated GUIPanel p_Info;
var automated GUIListBox CategoryBox;
var automated GUILibraryItemsBox ItemsBox;
var automated GUISectionBackground CategoryBG,ItemBG,InfoBG;
var GUIList myCategories;
var GUIShowLibList myItems;

var GUILabel TimerBox;
//var KFBuyItemsList myItems;
var editconst noexport float SavedPitch;

var array<string> BuyListHeaders;
var array<string> BuyListItemNames;

//Use these values to modify/test
var int playerscore;
var float playerweight;
var float maxweight;
var float GameDifficulty;

var Sound SellSound,BuySound;


var array < GUIShowable > AllBuyableItems;

function InitComponent( GUIController MyController, GUIComponent MyOwner )
{
	local int i;
	Super.InitComponent( MyController, MyOwner );


	CategoryBG.ManageComponent(CategoryBox);
	ItemBG.ManageComponent(ItemsBox);
	myCategories = CategoryBox.List;

	for(i=0;i<LIBLIST_CATS;i++)
		myCategories.Add(KFPlayerController(PlayerOwner()).LibraryListHeaders[i]);

	//myCategories = CategoryBox.List;
	myItems = ItemsBox.List;
}

event HandleParameters(string Param1, string Param2)
{
	CategoryChange(self);
}

function KFBuyMenuClosed(optional Bool bCanceled)
{
	local rotator NewRot;

	// Reset player
	NewRot = PlayerOwner().Rotation;
	NewRot.Pitch = SavedPitch;
	PlayerOwner().SetRotation(NewRot);
	Super.OnClose(bCanceled);
}

event Opened(GUIComponent Sender)
{
	local rotator PlayerRot;

	Super.Opened(Sender);
	// 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;

	//Indicate that we're buying things.
        //KFPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo).bBuyingStuff = true;
}

function NewInfo(GUIShowable 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(eLibCat(myCategories.Index));;
	 //  GUILibraryMenuFooter(t_Footer).SetBuyMode(b.GetBuyCaption(eLibCat(myCategories.Index)),CanAfford(b)&&b.CanButtonMe(PlayerOwner(),myCategories.Index != 0),b.IsA('BuyableAmmo') && myCategories.Index !=0,b.Isa('BuyableAmmo') );
   } else
   {
	   p_Info = new class'GUILibInfoPanel';
	   GUILibraryMenuFooter(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('GUILibInfoPanel'))
	   GUILibInfoPanel(p_Info).Display(b);
}

function bool CanAfford(GUIShowable b)
{
	return myCategories.Index == 0 || (playerscore-b.cost >=0 && playerweight+b.weight <= maxweight);
}

function CategoryChange(GUIComponent Sender)
{
	local int i,j;

	myItems.Clear();
	i = myCategories.Index;

	for(j=0;j<allBuyableItems.length;j++)
	{
		if(AllBuyableItems[j].ShowMe(PlayerOwner().Pawn,eLibCat(i),self))
			myItems.Add(AllBuyableItems[j]);
	}
	myItems.OnChange(myItems);
}



function BuyCurrent()
{

}

function BuyFill()
{

}

function bool CanAutoAmmo()
{
	Return False;
}

function DoAutoAmmo()
{

}

function GUIShowable FindWeapon(class<Inventory> WeaponType)
{
	Return None;
}

function InitAmmoForNewGun(class<Inventory> WeaponType)
{

}

function CloseSale(bool savePurchases)
{
}

defaultproperties
{
     Begin Object Class=GUIListBox Name=BoxForCategories
         bVisibleWhenEmpty=True
         OnCreateComponent=BoxForCategories.InternalOnCreateComponent
         Hint="Choose among these categories of equipment."
         WinTop=0.110215
         WinLeft=0.020000
         WinWidth=0.400000
         WinHeight=0.500000
         TabOrder=1
         bBoundToParent=True
         bScaleToParent=True
         OnChange=GUILibraryMenu.CategoryChange
     End Object
     CategoryBox=GUIListBox'KFGui.GUILibraryMenu.BoxForCategories'

     Begin Object Class=GUILibraryItemsBox Name=itmbox
         bVisibleWhenEmpty=True
         bSorted=True
         OnCreateComponent=itmbox.InternalOnCreateComponent
         Hint="Equipment in this category"
         WinHeight=1.000000
         TabOrder=1
         bBoundToParent=True
         bScaleToParent=True
     End Object
     ItemsBox=GUILibraryItemsBox'KFGui.GUILibraryMenu.itmbox'

     Begin Object Class=AltSectionBackground Name=catbg
         Caption="Categories"
         WinTop=0.060215
         WinLeft=0.010000
         WinWidth=0.440000
         WinHeight=0.383940
         OnPreDraw=catbg.InternalPreDraw
     End Object
     CategoryBG=AltSectionBackground'KFGui.GUILibraryMenu.catbg'

     Begin Object Class=AltSectionBackground Name=itmbg
         Caption="Items"
         WinTop=0.060215
         WinLeft=0.480000
         WinWidth=0.500000
         WinHeight=0.880000
         OnPreDraw=itmbg.InternalPreDraw
     End Object
     ItemBG=AltSectionBackground'KFGui.GUILibraryMenu.itmbg'

     Begin Object Class=AltSectionBackground Name=infbg
         Caption="Info"
         WinTop=0.454030
         WinLeft=0.010000
         WinWidth=0.440000
         WinHeight=0.486185
         OnPreDraw=infbg.InternalPreDraw
     End Object
     InfoBG=AltSectionBackground'KFGui.GUILibraryMenu.infbg'

     Begin Object Class=GUILabel Name=TimerTextBox
         Caption="SHOP CLOSES IN: "
         WinTop=0.250000
         WinLeft=0.100000
         WinWidth=0.200000
         WinHeight=0.200000
         bNeverFocus=True
     End Object
     TimerBox=GUILabel'KFGui.GUILibraryMenu.TimerTextBox'

     SellSound=SoundGroup'KF_InventorySnd.Cash_Pickup'
     BuySound=Sound'PatchSounds.slide1-5'
     Begin Object Class=GUITabControl Name=PageTabs
         bDockPanels=True
         TabHeight=0.040000
         WinLeft=0.010000
         WinWidth=0.980000
         WinHeight=0.040000
         RenderWeight=0.490000
         TabOrder=3
         bAcceptsInput=True
         OnActivate=PageTabs.InternalOnActivate
     End Object
     c_Tabs=GUITabControl'KFGui.GUILibraryMenu.PageTabs'

     Begin Object Class=GUILibraryMenuFooter Name=LibFooter
         WinTop=0.957943
         RenderWeight=0.300000
         TabOrder=8
         OnPreDraw=BuyFooter.InternalOnPreDraw
     End Object
     t_Footer=GUILibraryMenuFooter'KFGui.GUILibraryMenu.LibFooter'

     Begin Object Class=BackgroundImage Name=KFBackground
         Image=Texture'2K4Menus.Controls.LockerBG'
         ImageStyle=ISTY_Tiled
         RenderWeight=0.010000
         bBoundToParent=True
         bScaleToParent=True
     End Object
     i_Background=BackgroundImage'KFGui.GUILibraryMenu.KFBackground'

     bAllowedAsLast=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:26.000 - Creation time: Fri 13-10-2023 03:19:02.449 - Created with UnCodeX