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 |
//============================================================================== // Created on: 09/17/2003 // Custom page to handle configuration of the Waves property in SkaarjPack.Invasion // // This is an example of how to write a GUIPage to handle a PlayInfo struct. // // Written by Ron Prestenback // © 2003, Epic Games, Inc. All Rights Reserved // TODO: Override l_Title ondraw in order to have custom background color //============================================================================== class UT2K4InvasionWaveConfig extends GUICustomPropertyPage; var string PropName; var string PropValue; var array<string> Waves; var automated GUIImage i_Background; var automated moNumericEdit nu_Wave; var automated GUIMultiOptionListBox lb_Waves; var GUIMultiOptionList li_waves; var localized string WaveText, DiffHint, DurationHint, MaxInvaderHint,AIHint; // Local copy of wave info struct WaveInfo { var int WaveMask; var byte WaveMaxMonsters; var byte WaveDuration; var float WaveDifficulty; }; struct WaveMonster { var localized string MName; var int Mask; }; var int ActiveWave; // Wave currently being edited var WaveInfo WaveCopy[16]; var WaveMonster WaveMonsters[16]; var moSlider sl_Diff; var moNumericEdit nu_Duration; var moNumericEdit nu_MaxMonster; function string GetResult() { return PropValue; } function InitComponent(GUIController MyController, GUIComponent MyOwner) { local int i; local class<GameInfo> InvClass; Super.InitComponent(MyController, MyOwner); InvClass = class<GameInfo>(DynamicLoadObject("SkaarjPack.Invasion", class'Class')); li_Waves = lb_Waves.List; li_Waves.OnChange = InternalOnChange; li_Waves.bDrawSelectionBorder = False; li_Waves.ItemPadding=0.15; li_Waves.ColumnWidth=0.95; li_Waves.bHotTrackSound = False; sl_Diff = moSlider(li_Waves.AddItem( "XInterface.moSlider", None, InvClass.static.GetDisplayText("WaveDifficulty"), true )); nu_Duration = moNumericEdit(li_Waves.AddItem( "XInterface.moNumericEdit", None, InvClass.static.GetDisplayText("WaveDuration"), true )); nu_MaxMonster = moNumericEdit(li_Waves.AddItem( "XInterface.moNumericEdit", None, InvClass.static.GetDisplayText("WaveMaxMonsters"), true )); sl_Diff.Hint = DiffHint; nu_Duration.Hint=DurationHint; nu_MaxMonster.Hint=MaxInvaderHint; for ( i = 0; i < li_Waves.NumColumns; i++ ) li_Waves.AddItem( "XInterface.GUIListSpacer" ); sb_Main.ManageComponent(lb_Waves); sb_Main.LeftPadding=0; sb_Main.RightPadding=0; sb_Main.TopPadding=0.05; sb_Main.BottomPadding=0.05; sb_Main.SetPosition(0.030234,0.075000,0.851640,0.565624); InitWaveControls(); } function InitWaveControls() { InitDifficulty(); InitDuration(); InitMaxMonsters(); } function InitDifficulty() { sl_Diff.Setup( 0.0, 3.0 ); sl_Diff.CaptionWidth = 0.1; sl_Diff.ComponentWidth = -1; sl_Diff.bAutoSizeCaption = true; sl_Diff.ComponentJustification = TXTA_Left; } function InitDuration() { nu_Duration.Setup( 1, 255, 1 ); nu_Duration.CaptionWidth = 0.1; nu_Duration.ComponentWidth = 0.3; nu_Duration.bAutoSizeCaption = true; nu_Duration.ComponentJustification = TXTA_Center; } function InitMaxMonsters() { nu_MaxMonster.Setup( 1, 24, 1 ); nu_MaxMonster.CaptionWidth = 0.1; nu_MaxMonster.ComponentWidth = 0.3; nu_MaxMonster.bAutoSizeCaption = true; nu_MaxMonster.ComponentJustification = TXTA_Center; } function SetOwner( GUIComponent NewOwner ) { Super.SetOwner(NewOwner); PropName = Item.DisplayName; PropValue = Mid(Item.Value,2,Len(Item.Value) - 4); t_WindowTitle.Caption = PropName; DisassembleWaveString(); InitializeList(); } function AssembleWaveString() { local int i; PropValue = "(("; for ( i = 0; i < ArrayCount(WaveCopy); i++ ) { if ( i > 0 ) PropValue $= "),("; PropValue $= "WaveMask=" $ WaveCopy[i].WaveMask; PropValue $= ",WaveMaxMonsters=" $ WaveCopy[i].WaveMaxMonsters; PropValue $= ",WaveDuration=" $ WaveCopy[i].WaveDuration; PropValue $= ",WaveDifficulty=" $ WaveCopy[i].WaveDifficulty; } PropValue $= "))"; } function DisassembleWaveString() { local int i; // Remove extra () and "" Split(PropValue, "),(", Waves); for ( i = 0; i < Waves.Length && i < ArrayCount(WaveCopy); i++ ) { WaveCopy[i].WaveMask = int(ParseOption(Waves[i], ",", "WaveMask")); WaveCopy[i].WaveMaxMonsters = byte(ParseOption(Waves[i], ",", "WaveMaxMonsters")); WaveCopy[i].WaveDuration = byte(ParseOption(Waves[i], ",", "WaveDuration")); WaveCopy[i].WaveDifficulty = float(ParseOption(Waves[i], ",", "WaveDifficulty")); } } function InitializeList() { local int i; local moCheckBox ch; for ( i = 0; i < ArrayCount(WaveCopy); i++ ) { ch = moCheckbox(li_Waves.AddItem( "XInterface.moCheckbox",, WaveMonsters[i].MName )); if ( ch != None ) { ch.Tag = WaveMonsters[i].Mask; ch.bAutoSizeCaption = True; } } UpdateWaveValues(); } function string GetDataString() { return PropValue; } event Closed( GUIComponent Sender, bool bCancelled ) { if ( !bCancelled ) AssembleWaveString(); else PropValue = "((" $ PropValue $ "))"; Super.Closed(Sender, bCancelled); } function InternalOnChange(GUIComponent Sender) { local GUIMenuOption mo; if ( Sender == nu_Wave ) { ActiveWave = nu_Wave.GetValue(); UpdateWaveValues(); } else if ( Sender == li_Waves ) { mo = li_Waves.Get(); if ( mo == sl_Diff ) WaveCopy[ActiveWave].WaveDifficulty = sl_Diff.GetValue(); else if ( mo == nu_Duration ) WaveCopy[ActiveWave].WaveDuration = nu_Duration.GetValue(); else if ( mo == nu_MaxMonster ) WaveCopy[ActiveWave].WaveMaxMonsters = nu_MaxMonster.GetValue(); if ( moCheckBox(mo) != None ) { if ( moCheckbox(mo).IsChecked() ) WaveCopy[ActiveWave].WaveMask = WaveCopy[ActiveWave].WaveMask | mo.Tag; else WaveCopy[ActiveWave].WaveMask = WaveCopy[ActiveWave].WaveMask & ~mo.Tag; } } } // Called when the active wave has been changed - updates all components with the correct values function UpdateWaveValues() { local moCheckbox ch; local int i; sl_Diff.SetComponentValue( WaveCopy[ActiveWave].WaveDifficulty, true ); nu_Duration.SetComponentValue( WaveCopy[ActiveWave].WaveDuration, True ); nu_MaxMonster.SetComponentValue( WaveCopy[ActiveWave].WaveMaxMonsters, True ); for ( i = 3; i < li_Waves.Elements.Length; i++ ) { ch = moCheckBox(li_Waves.Elements[i]); if ( ch == None ) continue; ch.SetComponentValue( WaveCopy[ActiveWave].WaveMask & ch.Tag, True ); } } DefaultProperties { Begin Object Class=moNumericEdit Name=WaveNumber Caption="Wave No." Hint="Select the wave you'd like to configure" WinWidth=0.220000 WinHeight=0.042857 WinLeft=0.407353 WinTop=0.092990 MinValue=0 MaxValue=15 CaptionWidth=0.1 ComponentWidth=0.3 bAutoSizeCaption=true ComponentJustification=TXTA_Center OnChange=InternalOnChange RenderWeight=0.7 bBoundToParent=True bScaleToParent=True End Object nu_Wave=WaveNumber Begin Object Class=GUIMultiOptionListBox Name=WavesList NumColumns=3 OnChange=InternalOnChange WinWidth=0.983750 WinHeight=0.698149 WinLeft=0.007500 WinTop=0.150608 TabOrder=1 bVisibleWhenEmpty=True bBoundToParent=True bScaleToParent=True // StyleName="ServerBrowserGrid" End Object lb_Waves=WavesList WaveMonsters(0)=(MName="Pupae",Mask=1) WaveMonsters(1)=(MName="Razor Fly",Mask=2) WaveMonsters(2)=(MName="Manta",Mask=4) WaveMonsters(3)=(MName="Krall",Mask=8) WaveMonsters(4)=(MName="Elite Krall",Mask=16) WaveMonsters(5)=(MName="Gasbag",Mask=32) WaveMonsters(6)=(MName="Brute",Mask=64) WaveMonsters(7)=(MName="Skaarj",Mask=128) WaveMonsters(8)=(MName="Behemoth",Mask=256) WaveMonsters(9)=(MName="Ice Skaarj",Mask=512) WaveMonsters(10)=(MName="Fire Skaarj",Mask=1024) WaveMonsters(11)=(MName="Warlord",Mask=2048) WaveMonsters(12)=(MName="Pupae",Mask=4096) WaveMonsters(13)=(MName="Pupae",Mask=8192) WaveMonsters(14)=(MName="Razor Fly",Mask=16384) WaveMonsters(15)=(MName="Razor Fly",Mask=32768) bDrawFocusedLast=False WinWidth=0.9 WinHeight=0.7 WinLeft=0.05 WinTop=0.15 DefaultWidth=0.9 DefaultHeight=0.7 DefaultLeft=0.05 DefaultTop=0.15 DiffHint="How hard should this wave be." DurationHint="How long should this wave last." MaxInvaderHint="What is the maximum number of monsters to spawn for this wave." AIHint="Allow/Disallow this monster" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |