Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 |
class RPGStatsMenu extends GUIPage DependsOn(RPGStatsInv); var RPGStatsInv StatsInv; var moEditBox WeaponSpeedBox, HealthBonusBox, AdrenalineMaxBox, AttackBox, DefenseBox, AmmoMaxBox, PointsAvailableBox; //Index of first stat display, first + button and first numeric edit in controls array var int StatDisplayControlsOffset, ButtonControlsOffset, AmtControlsOffset; var int NumButtonControls; var GUIListBox Abilities; var localized string CurrentLevelText, MaxText, CostText, CantBuyText; function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); WeaponSpeedBox = moEditBox(Controls[2]); HealthBonusBox = moEditBox(Controls[3]); AdrenalineMaxBox = moEditBox(Controls[4]); AttackBox = moEditBox(Controls[5]); DefenseBox = moEditBox(Controls[6]); AmmoMaxBox = moEditBox(Controls[7]); PointsAvailableBox = moEditBox(Controls[8]); Abilities = GUIListBox(Controls[16]); } function bool CloseClick(GUIComponent Sender) { Controller.CloseMenu(false); return true; } function MyOnClose(optional bool bCanceled) { if (StatsInv != None) { StatsInv.StatsMenu = None; StatsInv = None; } Super.OnClose(bCanceled); } function bool LevelsClick(GUIComponent Sender) { Controller.OpenMenu("UT2004RPG.RPGPlayerLevelsMenu"); StatsInv.ProcessPlayerLevel = RPGPlayerLevelsMenu(Controller.TopPage()).ProcessPlayerLevel; StatsInv.ServerRequestPlayerLevels(); return true; } //Initialize, using the given RPGStatsInv for the stats data and for client->server function calls function InitFor(RPGStatsInv Inv) { local int x, y, Index, Cost, Level, OldAbilityListIndex, OldAbilityListTop; local RPGPlayerDataObject TempDataObject; StatsInv = Inv; StatsInv.StatsMenu = self; WeaponSpeedBox.SetText(string(StatsInv.Data.WeaponSpeed)); HealthBonusBox.SetText(string(StatsInv.Data.HealthBonus)); AdrenalineMaxBox.SetText(string(StatsInv.Data.AdrenalineMax)); AttackBox.SetText(string(StatsInv.Data.Attack)); DefenseBox.SetText(string(StatsInv.Data.Defense)); AmmoMaxBox.SetText(string(StatsInv.Data.AmmoMax)); PointsAvailableBox.SetText(string(StatsInv.Data.PointsAvailable)); GUILabel(Controls[27]).Caption = GUILabel(default.Controls[27]).Caption @ string(StatsInv.Data.Level); GUILabel(Controls[28]).Caption = GUILabel(default.Controls[28]).Caption @ string(StatsInv.Data.Experience) $ "/" $ string(StatsInv.Data.NeededExp); if (StatsInv.Data.PointsAvailable <= 0) DisablePlusButtons(); else EnablePlusButtons(); //show/hide buttons if stat caps reached for (x = 0; x < 6; x++) if ( StatsInv.StatCaps[x] >= 0 && int(moEditBox(Controls[StatDisplayControlsOffset+x]).GetText()) >= StatsInv.StatCaps[x] ) { Controls[ButtonControlsOffset+x].SetVisibility(false); Controls[AmtControlsOffset+x].SetVisibility(false); } // on a client, the data object doesn't exist, so make a temporary one for calling the abilities' functions if (StatsInv.Role < ROLE_Authority) { TempDataObject = RPGPlayerDataObject(StatsInv.Level.ObjectPool.AllocateObject(class'RPGPlayerDataObject')); TempDataObject.InitFromDataStruct(StatsInv.Data); } else { TempDataObject = StatsInv.DataObject; } //Fill the ability listbox OldAbilityListIndex = Abilities.List.Index; OldAbilityListTop = Abilities.List.Top; Abilities.List.Clear(); for (x = 0; x < StatsInv.AllAbilities.length; x++) { Index = -1; for (y = 0; y < StatsInv.Data.Abilities.length; y++) if (StatsInv.AllAbilities[x] == StatsInv.Data.Abilities[y]) { Index = y; y = StatsInv.Data.Abilities.length; } if (Index == -1) Level = 0; else Level = StatsInv.Data.AbilityLevels[Index]; if (Level >= StatsInv.AllAbilities[x].default.MaxLevel) Abilities.List.Add(StatsInv.AllAbilities[x].default.AbilityName@"("$CurrentLevelText@Level@"["$MaxText$"])", StatsInv.AllAbilities[x], string(Cost)); else { Cost = StatsInv.AllAbilities[x].static.Cost(TempDataObject, Level); if (Cost <= 0) Abilities.List.Add(StatsInv.AllAbilities[x].default.AbilityName@"("$CurrentLevelText@Level$","@CantBuyText$")", StatsInv.AllAbilities[x], string(Cost)); else Abilities.List.Add(StatsInv.AllAbilities[x].default.AbilityName@"("$CurrentLevelText@Level$","@CostText@Cost$")", StatsInv.AllAbilities[x], string(Cost)); } } //restore list's previous state Abilities.List.SetIndex(OldAbilityListIndex); Abilities.List.SetTopItem(OldAbilityListTop); UpdateAbilityButtons(Abilities); // free the temporary data object on clients if (StatsInv.Role < ROLE_Authority) { StatsInv.Level.ObjectPool.FreeObject(TempDataObject); } } function bool StatPlusClick(GUIComponent Sender) { local int x, SenderIndex; for (x = ButtonControlsOffset; x < ButtonControlsOffset + NumButtonControls; x++) if (Controls[x] == Sender) { SenderIndex = x; break; } SenderIndex -= ButtonControlsOffset; DisablePlusButtons(); StatsInv.ServerAddPointTo(int(GUINumericEdit(Controls[SenderIndex + AmtControlsOffset]).Value), EStatType(SenderIndex)); return true; } function DisablePlusButtons() { local int x; for (x = ButtonControlsOffset; x < ButtonControlsOffset + NumButtonControls; x++) Controls[x].MenuStateChange(MSAT_Disabled); } function EnablePlusButtons() { local int x; for (x = ButtonControlsOffset; x < ButtonControlsOffset + NumButtonControls; x++) Controls[x].MenuStateChange(MSAT_Blurry); for (x = AmtControlsOffset; x < AmtControlsOffset + NumButtonControls; x++) { GUINumericEdit(Controls[x]).MaxValue = StatsInv.Data.PointsAvailable; GUINumericEdit(Controls[x]).CalcMaxLen(); if (int(GUINumericEdit(Controls[x]).Value) > StatsInv.Data.PointsAvailable) GUINumericEdit(Controls[x]).SetValue(StatsInv.Data.PointsAvailable); } } function bool UpdateAbilityButtons(GUIComponent Sender) { local int Cost; Cost = int(Abilities.List.GetExtra()); if (Cost <= 0 || Cost > StatsInv.Data.PointsAvailable) Controls[18].MenuStateChange(MSAT_Disabled); else Controls[18].MenuStateChange(MSAT_Blurry); return true; } function bool ShowAbilityDesc(GUIComponent Sender) { local class<RPGAbility> Ability; Ability = class<RPGAbility>(Abilities.List.GetObject()); Controller.OpenMenu("UT2004RPG.RPGAbilityDescMenu"); RPGAbilityDescMenu(Controller.TopPage()).t_WindowTitle.Caption = Ability.default.AbilityName; RPGAbilityDescMenu(Controller.TopPage()).MyScrollText.SetContent(Ability.default.Description); return true; } function bool BuyAbility(GUIComponent Sender) { DisablePlusButtons(); Controls[18].MenuStateChange(MSAT_Disabled); StatsInv.ServerAddAbility(class<RPGAbility>(Abilities.List.GetObject())); return true; } function bool ResetClick(GUIComponent Sender) { Controller.OpenMenu("UT2004RPG.RPGResetConfirmPage"); RPGResetConfirmPage(Controller.TopPage()).StatsMenu = self; return true; } defaultproperties { StatDisplayControlsOffset=2 ButtonControlsOffset=9 AmtControlsOffset=19 NumButtonControls=6 CurrentLevelText="Current Level:" MaxText="MAX" CostText="Cost:" CantBuyText="Can't Buy" bRenderWorld=True bAllowedAsLast=True OnClose=RPGStatsMenu.MyOnClose Begin Object Class=FloatingImage Name=FloatingFrameBackground Image=Texture'2K4Menus.NewControls.Display1' DropShadow=None ImageStyle=ISTY_Stretched ImageRenderStyle=MSTY_Normal WinTop=0.020000 WinLeft=0.000000 WinWidth=1.000000 WinHeight=0.980000 RenderWeight=0.000003 End Object Controls(0)=FloatingImage'UT2004RPG.RPGStatsMenu.FloatingFrameBackground' Begin Object Class=GUIButton Name=CloseButton Caption="Close" WinTop=0.900000 WinLeft=0.550000 WinWidth=0.200000 OnClick=RPGStatsMenu.CloseClick OnKeyEvent=CloseButton.InternalOnKeyEvent End Object Controls(1)=GUIButton'UT2004RPG.RPGStatsMenu.CloseButton' Begin Object Class=moEditBox Name=WeaponSpeedSelect bReadOnly=True CaptionWidth=0.775000 Caption="Weapon Speed Bonus (%)" OnCreateComponent=WeaponSpeedSelect.InternalOnCreateComponent IniOption="@INTERNAL" WinTop=0.117448 WinLeft=0.250000 WinWidth=0.362500 WinHeight=0.040000 End Object Controls(2)=moEditBox'UT2004RPG.RPGStatsMenu.WeaponSpeedSelect' Begin Object Class=moEditBox Name=HealthBonusSelect bReadOnly=True CaptionWidth=0.775000 Caption="Health Bonus" OnCreateComponent=HealthBonusSelect.InternalOnCreateComponent IniOption="@INTERNAL" WinTop=0.197448 WinLeft=0.250000 WinWidth=0.362500 WinHeight=0.040000 End Object Controls(3)=moEditBox'UT2004RPG.RPGStatsMenu.HealthBonusSelect' Begin Object Class=moEditBox Name=AdrenalineMaxSelect bReadOnly=True CaptionWidth=0.775000 Caption="Max Adrenaline" OnCreateComponent=AdrenalineMaxSelect.InternalOnCreateComponent IniOption="@INTERNAL" WinTop=0.277448 WinLeft=0.250000 WinWidth=0.362500 WinHeight=0.040000 End Object Controls(4)=moEditBox'UT2004RPG.RPGStatsMenu.AdrenalineMaxSelect' Begin Object Class=moEditBox Name=AttackSelect bReadOnly=True CaptionWidth=0.775000 Caption="Damage Bonus (0.5%)" OnCreateComponent=AttackSelect.InternalOnCreateComponent IniOption="@INTERNAL" WinTop=0.357448 WinLeft=0.250000 WinWidth=0.362500 WinHeight=0.040000 End Object Controls(5)=moEditBox'UT2004RPG.RPGStatsMenu.AttackSelect' Begin Object Class=moEditBox Name=DefenseSelect bReadOnly=True CaptionWidth=0.775000 Caption="Damage Reduction (0.5%)" OnCreateComponent=DefenseSelect.InternalOnCreateComponent IniOption="@INTERNAL" WinTop=0.437448 WinLeft=0.250000 WinWidth=0.362500 WinHeight=0.040000 End Object Controls(6)=moEditBox'UT2004RPG.RPGStatsMenu.DefenseSelect' Begin Object Class=moEditBox Name=MaxAmmoSelect bReadOnly=True CaptionWidth=0.775000 Caption="Max Ammo Bonus (%)" OnCreateComponent=MaxAmmoSelect.InternalOnCreateComponent IniOption="@INTERNAL" WinTop=0.517448 WinLeft=0.250000 WinWidth=0.362500 WinHeight=0.040000 End Object Controls(7)=moEditBox'UT2004RPG.RPGStatsMenu.MaxAmmoSelect' Begin Object Class=moEditBox Name=PointsAvailableSelect bReadOnly=True CaptionWidth=0.775000 Caption="Stat Points Available" OnCreateComponent=PointsAvailableSelect.InternalOnCreateComponent IniOption="@INTERNAL" WinTop=0.597448 WinLeft=0.250000 WinWidth=0.362500 WinHeight=0.040000 End Object Controls(8)=moEditBox'UT2004RPG.RPGStatsMenu.PointsAvailableSelect' Begin Object Class=GUIButton Name=WeaponSpeedButton Caption="+" WinTop=0.127448 WinLeft=0.737500 WinWidth=0.040000 OnClick=RPGStatsMenu.StatPlusClick OnKeyEvent=WeaponSpeedButton.InternalOnKeyEvent End Object Controls(9)=GUIButton'UT2004RPG.RPGStatsMenu.WeaponSpeedButton' Begin Object Class=GUIButton Name=HealthBonusButton Caption="+" WinTop=0.207448 WinLeft=0.737500 WinWidth=0.040000 OnClick=RPGStatsMenu.StatPlusClick OnKeyEvent=HealthBonusButton.InternalOnKeyEvent End Object Controls(10)=GUIButton'UT2004RPG.RPGStatsMenu.HealthBonusButton' Begin Object Class=GUIButton Name=AdrenalineMaxButton Caption="+" WinTop=0.287448 WinLeft=0.737500 WinWidth=0.040000 OnClick=RPGStatsMenu.StatPlusClick OnKeyEvent=AdrenalineMaxButton.InternalOnKeyEvent End Object Controls(11)=GUIButton'UT2004RPG.RPGStatsMenu.AdrenalineMaxButton' Begin Object Class=GUIButton Name=AttackButton Caption="+" WinTop=0.367448 WinLeft=0.737500 WinWidth=0.040000 OnClick=RPGStatsMenu.StatPlusClick OnKeyEvent=AttackButton.InternalOnKeyEvent End Object Controls(12)=GUIButton'UT2004RPG.RPGStatsMenu.AttackButton' Begin Object Class=GUIButton Name=DefenseButton Caption="+" WinTop=0.447448 WinLeft=0.737500 WinWidth=0.040000 OnClick=RPGStatsMenu.StatPlusClick OnKeyEvent=DefenseButton.InternalOnKeyEvent End Object Controls(13)=GUIButton'UT2004RPG.RPGStatsMenu.DefenseButton' Begin Object Class=GUIButton Name=AmmoMaxButton Caption="+" WinTop=0.527448 WinLeft=0.737500 WinWidth=0.040000 OnClick=RPGStatsMenu.StatPlusClick OnKeyEvent=AmmoMaxButton.InternalOnKeyEvent End Object Controls(14)=GUIButton'UT2004RPG.RPGStatsMenu.AmmoMaxButton' Begin Object Class=GUIButton Name=LevelsButton Caption="See Player Levels" WinTop=0.900000 WinLeft=0.225000 WinWidth=0.250000 OnClick=RPGStatsMenu.LevelsClick OnKeyEvent=LevelsButton.InternalOnKeyEvent End Object Controls(15)=GUIButton'UT2004RPG.RPGStatsMenu.LevelsButton' Begin Object Class=GUIListBox Name=AbilityList bVisibleWhenEmpty=True OnCreateComponent=AbilityList.InternalOnCreateComponent StyleName="AbilityList" Hint="These are the abilities you can purchase with stat points." WinTop=0.700000 WinLeft=0.215000 WinWidth=0.435000 WinHeight=0.150000 OnClick=RPGStatsMenu.UpdateAbilityButtons End Object Controls(16)=GUIListBox'UT2004RPG.RPGStatsMenu.AbilityList' Begin Object Class=GUIButton Name=AbilityDescButton Caption="Info" WinTop=0.700000 WinLeft=0.675000 WinWidth=0.100000 OnClick=RPGStatsMenu.ShowAbilityDesc OnKeyEvent=AbilityDescButton.InternalOnKeyEvent End Object Controls(17)=GUIButton'UT2004RPG.RPGStatsMenu.AbilityDescButton' Begin Object Class=GUIButton Name=AbilityBuyButton Caption="Buy" WinTop=0.810000 WinLeft=0.675000 WinWidth=0.100000 OnClick=RPGStatsMenu.BuyAbility OnKeyEvent=AbilityBuyButton.InternalOnKeyEvent End Object Controls(18)=GUIButton'UT2004RPG.RPGStatsMenu.AbilityBuyButton' Begin Object Class=GUINumericEdit Name=WeaponSpeedAmt Value="5" MinValue=1 MaxValue=5 WinTop=0.117448 WinLeft=0.645000 WinWidth=0.080000 OnDeActivate=WeaponSpeedAmt.ValidateValue End Object Controls(19)=GUINumericEdit'UT2004RPG.RPGStatsMenu.WeaponSpeedAmt' Begin Object Class=GUINumericEdit Name=HealthBonusAmt Value="5" MinValue=1 MaxValue=5 WinTop=0.197448 WinLeft=0.645000 WinWidth=0.080000 OnDeActivate=HealthBonusAmt.ValidateValue End Object Controls(20)=GUINumericEdit'UT2004RPG.RPGStatsMenu.HealthBonusAmt' Begin Object Class=GUINumericEdit Name=AdrenalineMaxAmt Value="5" MinValue=1 MaxValue=5 WinTop=0.277448 WinLeft=0.645000 WinWidth=0.080000 OnDeActivate=AdrenalineMaxAmt.ValidateValue End Object Controls(21)=GUINumericEdit'UT2004RPG.RPGStatsMenu.AdrenalineMaxAmt' Begin Object Class=GUINumericEdit Name=AttackAmt Value="5" MinValue=1 MaxValue=5 WinTop=0.357448 WinLeft=0.645000 WinWidth=0.080000 OnDeActivate=AttackAmt.ValidateValue End Object Controls(22)=GUINumericEdit'UT2004RPG.RPGStatsMenu.AttackAmt' Begin Object Class=GUINumericEdit Name=DefenseAmt Value="5" MinValue=1 MaxValue=5 WinTop=0.437448 WinLeft=0.645000 WinWidth=0.080000 OnDeActivate=DefenseAmt.ValidateValue End Object Controls(23)=GUINumericEdit'UT2004RPG.RPGStatsMenu.DefenseAmt' Begin Object Class=GUINumericEdit Name=MaxAmmoAmt Value="5" MinValue=1 MaxValue=5 WinTop=0.517448 WinLeft=0.645000 WinWidth=0.080000 OnDeActivate=MaxAmmoAmt.ValidateValue End Object Controls(24)=GUINumericEdit'UT2004RPG.RPGStatsMenu.MaxAmmoAmt' Begin Object Class=GUIButton Name=ResetButton Caption="Reset" FontScale=FNS_Small StyleName="ResetButton" WinTop=0.050000 WinLeft=0.225000 WinWidth=0.065000 WinHeight=0.025000 OnClick=RPGStatsMenu.ResetClick OnKeyEvent=ResetButton.InternalOnKeyEvent End Object Controls(25)=GUIButton'UT2004RPG.RPGStatsMenu.ResetButton' Begin Object Class=GUIHeader Name=TitleBar bUseTextHeight=True Caption="Stat Improvement" WinHeight=0.043750 RenderWeight=0.100000 bBoundToParent=True bScaleToParent=True bAcceptsInput=True bNeverFocus=False ScalingType=SCALE_X End Object Controls(26)=GUIHeader'UT2004RPG.RPGStatsMenu.TitleBar' Begin Object Class=GUILabel Name=LevelLabel Caption="Level:" TextAlign=TXTA_Center TextColor=(B=255,G=255,R=255) WinTop=0.047500 WinHeight=0.025000 bBoundToParent=True bScaleToParent=True End Object Controls(27)=GUILabel'UT2004RPG.RPGStatsMenu.LevelLabel' Begin Object Class=GUILabel Name=EXPLabel Caption="Experience:" TextAlign=TXTA_Center TextColor=(B=255,G=255,R=255) WinTop=0.072500 WinHeight=0.025000 bBoundToParent=True bScaleToParent=True End Object Controls(28)=GUILabel'UT2004RPG.RPGStatsMenu.EXPLabel' WinLeft=0.200000 WinWidth=0.600000 WinHeight=1.000000 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |