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 |
// ==================================================================== // Single player menu for establishing profile. // author: capps 8/26/02 // ==================================================================== /////////// // TODO // draw team picture in blue class Tab_SPProfileNew extends Tab_SPPanelBase; var GUIEditBox ePlayerName; var GUIEditBox eTeamName; var GUIComboBox cDifficulty; var GUICharacterListTeam clPlayerSkins; var GUIImageList iTeamSymbols; var localized string DefaultName, DefaultTeamName; var string DefaultCharacter, TeamSymbolPrefix; var int DefaultTeamSymbol; var int CurrentTeamSymbolNum; // currently displayed team symbol number var localized string Err_ProfileExists; var localized string Err_CantCreateProfile; const MINSYMBOL = 1; const MAXSYMBOL = 22; function InitComponent(GUIController pMyController, GUIComponent MyOwner) { local int i; ePlayerName = GUIEditBox(GUIMenuOption(Controls[2]).MyComponent); ePlayerName.MaxWidth=16; // as per polge, check Tab_PlayerSettings if you change this ePlayerName.bConvertSpaces=true; ePlayerName.OnClick=PlayerOnClick; eTeamName = GUIEditBox(GUIMenuOption(Controls[3]).MyComponent); eTeamName.MaxWidth=16; eTeamName.OnClick=PlayerOnClick; cDifficulty = GUIComboBox(GUIMenuOption(Controls[4]).MyComponent); clPlayerSkins = GUICharacterListTeam(Controls[6]); iTeamSymbols = GUIImageList(Controls[10]); Super.Initcomponent(pMyController, MyOwner); if (!class'Tab_PlayerSettings'.default.bUnlocked) clPlayerSkins.InitListExclusive("UNLOCK", "DUP"); else clPlayerSkins.InitListExclusive("DUP"); Controls[5].FocusInstead = clPlayerSkins; Controls[7].FocusInstead = clPlayerSkins; Controls[8].FocusInstead = clPlayerSkins; Controls[9].FocusInstead = iTeamSymbols; Controls[11].FocusInstead = iTeamSymbols; Controls[12].FocusInstead = iTeamSymbols; for (i=0; i<class'Tab_SPProfileLoad'.default.NumDifficulties; i++) cDifficulty.AddItem(class'Tab_SPProfileLoad'.default.Difficulties[i]); cDifficulty.ReadOnly(true); LoadSymbols(); // Symbols are loaded once only. ClearStats(); } function InitPanel() { Super.InitPanel(); MyButton.Hint = class'UT2SinglePlayerMain'.default.TabHintProfileNew; UT2SinglePlayerMain(MyButton.MenuOwner.MenuOwner).ChangeHint(MyButton.Hint); UT2SinglePlayerMain(MyButton.MenuOwner.MenuOwner).ResetTitleBar(MyButton); } function bool PlayerOnClick(GUIComponent Sender) { if ( Sender == ePlayerName ) { if ( ePlayerName.TextStr == DefaultName ) ePlayerName.TextStr = ""; } else if ( Sender == eTeamName ) { if ( eTeamName.TextStr == DefaultTeamName ) eTeamName.TextStr = ""; } return Super.OnClick(Sender); } function string GetTeamSymbolName(int idx) { return TeamSymbolPrefix$Right("0"$idx, 2); } function string CurrentTeamSymbolName() { return String(iTeamSymbols.Image); } function LoadSymbols() { local int i; local Material M; local array<string> SymbolNames; Controller.GetTeamSymbolList(SymbolNames, true); // get all usable team symbols for (i = 0; i < SymbolNames.Length; i++) { M = Material(DynamicLoadObject(SymbolNames[i], class'Material')); iTeamSymbols.AddMaterial(String(i), M); } } // update all the various boxes to show the stats of this profile function ClearStats() { // update name ePlayerName.TextStr = DefaultName; // update team name eTeamName.TextStr = DefaultTeamName; // update difficulty cDifficulty.SetText(class'xInterface.Tab_SPProfileLoad'.default.Difficulties[1]); // update character portrait clPlayerSkins.Find(DefaultCharacter); // update team symbol iTeamSymbols.FirstImage(); } function bool CreateClick(GUIComponent Sender) { local class<GameProfile> profileclass; local string profilename; local GameProfile GP; local GUIQuestionPage Page; local array<string> profilenames; local int i; local bool bFileExists; if ( ePlayerName.TextStr == "" ) ePlayerName.TextStr = DefaultName; if ( eTeamName.TextStr == "" ) eTeamName.TextStr = DefaultTeamName; profilename = ePlayerName.TextStr; profileclass = class<GameProfile>(DynamicLoadObject("xGame.UT2003GameProfile", class'Class')); // test if a profile with this name already exists GP = PlayerOwner().Level.Game.LoadDataObject(profileclass, "GameProfile", profilename); if ( GP != none ) { GP = none; // it may just still be lying around in memory, un GC'd, so test if there's a file there bFileExists=false; Controller.GetProfileList("",profilenames); for ( i=0; i<profilenames.Length; i++ ) { if ( profilenames[i] ~= profilename ) { bFileExists=true; break; } } // there's still a file there, too, so just exit with warning. if ( bFileExists ) { // profile already exists, warn player if (Controller.OpenMenu("XInterface.GUIQuestionPage")) { Page = GUIQuestionPage(Controller.ActivePage); Page.SetupQuestion(Page.Replace(err_ProfileExists, "prof", Caps(profilename)), QBTN_Ok, QBTN_Ok); } return true; } } GP = PlayerOwner().Level.Game.CreateDataObject(profileclass, "GameProfile", profilename); if ( GP != none ) { GP.PlayerName = ePlayerName.TextStr; GP.TeamName = eTeamName.TextStr; GP.TeamSymbolName = String(iTeamSymbols.Image); GP.PlayerCharacter = clPlayerSkins.GetName(); GP.BaseDifficulty = cDifficulty.Index; PlayerOwner().Level.Game.CurrentGameProfile = GP; GP.Initialize(PlayerOwner().Level.Game, profilename); PlayerOwner().Level.Game.CurrentGameProfile.bInLadderGame=true; // so it'll reload into SP menus if (!PlayerOwner().Level.Game.SavePackage(profilename)) { Log("SINGLEPLAYER couldn't save profile package!"); } GUITabControl(MyButton.MenuOwner).ReplaceTab(MyButton, class'UT2SinglePlayerMain'.default.TabNameProfileLoad, "xInterface.Tab_SPProfileLoad", , , true); GUITabControl(MyButton.MenuOwner).ActivateTabByName(class'UT2SinglePlayerMain'.default.TabNameQualification, true); // Broadcast about the new Profile ProfileUpdated(); // launch the game introduction PlayerOwner().ConsoleCommand("START ut2-intro.ut2?quickstart=true?TeamScreen=False?savegame="$profilename); Controller.CloseAll(false); } else { // couldn't create profile, give warning if (Controller.OpenMenu("XInterface.GUIQuestionPage")) { Page = GUIQuestionPage(Controller.ActivePage); Page.SetupQuestion(Err_CantCreateProfile, QBTN_Ok, QBTN_Ok); } return true; } return true; } function bool PrevSkin(GUIComponent Sender) { clPlayerSkins.ScrollLeft(); return true; } function bool NextSkin(GUIComponent Sender) { clPlayerSkins.ScrollRight(); return true; } function bool PrevSymbol(GUIComponent Sender) { iTeamSymbols.PrevImage(); return true; } function bool NextSymbol(GUIComponent Sender) { iTeamSymbols.NextImage(); return true; } function bool BackClick(GUIComponent Sender) { local array<string> profilenames; // if they click back and there are no existing profiles, take them to main by closing the SP menu Controller.GetProfileList("",profilenames); if ( profilenames.Length == 0 ) Controller.CloseMenu(); GUITabControl(MyButton.MenuOwner).ReplaceTab(MyButton, class'UT2SinglePlayerMain'.default.TabNameProfileLoad, "xInterface.Tab_SPProfileLoad", , , true); return true; } function bool DefaultsClick(GUIComponent Sender) { ClearStats(); return true; } defaultproperties { DefaultName="Player" DefaultTeamName="Team" DefaultCharacter="Gorge" TeamSymbolPrefix="TeamSymbols_UT2003.sym" DefaultTeamSymbol=1 Err_ProfileExists="Profile with name %prof% already exists!" Err_CantCreateProfile="Profile creation failed." Begin Object Class=GUIButton Name=btnSaveProfile Caption="CREATE PROFILE" Hint="Create a profile with these settings" WinTop=0.925000 WinLeft=0.744060 WinWidth=0.223438 WinHeight=0.075000 OnClick=Tab_SPProfileNew.CreateClick OnKeyEvent=btnSaveProfile.InternalOnKeyEvent End Object Controls(0)=GUIButton'XInterface.Tab_SPProfileNew.btnSaveProfile' Begin Object Class=GUIImage Name=imgEditsBack Image=Texture'InterfaceContent.Menu.EditBox' ImageStyle=ISTY_Stretched WinTop=0.073000 WinLeft=0.504375 WinWidth=0.444304 WinHeight=0.770000 bNeverFocus=True End Object Controls(1)=GUIImage'XInterface.Tab_SPProfileNew.imgEditsBack' Begin Object Class=moEditBox Name=moebPlayerName bVerticalLayout=True Caption="Player Name: " LabelFont="UT2SmallFont" LabelColor=(B=255,G=255,R=255) OnCreateComponent=moebPlayerName.InternalOnCreateComponent Hint="Your character's name" WinTop=0.286087 WinLeft=0.553125 WinWidth=0.345000 WinHeight=0.122500 End Object Controls(2)=moEditBox'XInterface.Tab_SPProfileNew.moebPlayerName' Begin Object Class=moEditBox Name=moebTeamName bVerticalLayout=True Caption="Team Name: " LabelFont="UT2SmallFont" LabelColor=(B=255,G=255,R=255) OnCreateComponent=moebTeamName.InternalOnCreateComponent Hint="The name of your team" WinTop=0.428007 WinLeft=0.553125 WinWidth=0.345000 WinHeight=0.122500 End Object Controls(3)=moEditBox'XInterface.Tab_SPProfileNew.moebTeamName' Begin Object Class=moComboBox Name=mocbDifficulty bVerticalLayout=True Caption="Difficulty: " LabelFont="UT2SmallFont" LabelColor=(B=255,G=255,R=255) OnCreateComponent=mocbDifficulty.InternalOnCreateComponent Hint="Customize your challenge" WinTop=0.568803 WinLeft=0.553125 WinWidth=0.345000 WinHeight=0.122500 End Object Controls(4)=moComboBox'XInterface.Tab_SPProfileNew.mocbDifficulty' Begin Object Class=GUIImage Name=imgSkinsBack Image=Texture'InterfaceContent.Menu.EditBox' ImageStyle=ISTY_Stretched WinTop=0.073000 WinLeft=0.055938 WinWidth=0.215000 WinHeight=0.770000 bNeverFocus=True End Object Controls(5)=GUIImage'XInterface.Tab_SPProfileNew.imgSkinsBack' Begin Object Class=GUICharacterListTeam Name=clistPlayerSkins FixedItemsPerPage=1 StyleName="CharButton" Hint="Your character's appearance, use arrow keys to change" WinTop=0.117917 WinLeft=0.083462 WinWidth=0.124694 WinHeight=0.500000 OnClick=clistPlayerSkins.InternalOnClick OnRightClick=clistPlayerSkins.InternalOnRightClick OnMousePressed=clistPlayerSkins.InternalOnMousePressed OnMouseRelease=clistPlayerSkins.InternalOnMouseRelease OnKeyEvent=clistPlayerSkins.InternalOnKeyEvent OnBeginDrag=clistPlayerSkins.InternalOnBeginDrag OnEndDrag=clistPlayerSkins.InternalOnEndDrag OnDragDrop=clistPlayerSkins.InternalOnDragDrop OnDragEnter=clistPlayerSkins.InternalOnDragEnter OnDragLeave=clistPlayerSkins.InternalOnDragLeave OnDragOver=clistPlayerSkins.InternalOnDragOver End Object Controls(6)=GUICharacterListTeam'XInterface.Tab_SPProfileNew.clistPlayerSkins' Begin Object Class=GUIGFXButton Name=btnPrevSkin Graphic=FinalBlend'InterfaceContent.Menu.fbArrowLeft' Position=ICP_Scaled Hint="Selects a new appearance for your character" WinTop=0.640000 WinLeft=0.080000 WinWidth=0.080000 WinHeight=0.080000 bNeverFocus=True OnClick=Tab_SPProfileNew.PrevSkin OnKeyEvent=btnPrevSkin.InternalOnKeyEvent End Object Controls(7)=GUIGFXButton'XInterface.Tab_SPProfileNew.btnPrevSkin' Begin Object Class=GUIGFXButton Name=btnNextSkin Graphic=FinalBlend'InterfaceContent.Menu.fbArrowRight' Position=ICP_Scaled Hint="Selects a new appearance for your character" WinTop=0.640000 WinLeft=0.172187 WinWidth=0.080000 WinHeight=0.080000 bNeverFocus=True OnClick=Tab_SPProfileNew.NextSkin OnKeyEvent=btnNextSkin.InternalOnKeyEvent End Object Controls(8)=GUIGFXButton'XInterface.Tab_SPProfileNew.btnNextSkin' Begin Object Class=GUIImage Name=imgSymbolsBack Image=Texture'InterfaceContent.Menu.EditBox' ImageStyle=ISTY_Stretched WinTop=0.073000 WinLeft=0.280243 WinWidth=0.215000 WinHeight=0.770000 bNeverFocus=True End Object Controls(9)=GUIImage'XInterface.Tab_SPProfileNew.imgSymbolsBack' Begin Object Class=GUIImageList Name=ilTeamSymbols bWrap=True ImageStyle=ISTY_Justified ImageRenderStyle=MSTY_Normal ImageAlign=IMGA_Center Hint="Your team's symbol; use arrow keys to change" WinTop=0.137175 WinLeft=0.303972 WinWidth=0.167212 WinHeight=0.500000 End Object Controls(10)=GUIImageList'XInterface.Tab_SPProfileNew.ilTeamSymbols' Begin Object Class=GUIGFXButton Name=btnPrevSymbol Graphic=FinalBlend'InterfaceContent.Menu.fbArrowLeft' Position=ICP_Scaled Hint="Selects a new symbol for your team" WinTop=0.640000 WinLeft=0.298750 WinWidth=0.080000 WinHeight=0.080000 bNeverFocus=True OnClick=Tab_SPProfileNew.PrevSymbol OnKeyEvent=btnPrevSymbol.InternalOnKeyEvent End Object Controls(11)=GUIGFXButton'XInterface.Tab_SPProfileNew.btnPrevSymbol' Begin Object Class=GUIGFXButton Name=btnNextSymbol Graphic=FinalBlend'InterfaceContent.Menu.fbArrowRight' Position=ICP_Scaled Hint="Selects a new symbol for your team" WinTop=0.640000 WinLeft=0.389375 WinWidth=0.080000 WinHeight=0.080000 bNeverFocus=True OnClick=Tab_SPProfileNew.NextSymbol OnKeyEvent=btnNextSymbol.InternalOnKeyEvent End Object Controls(12)=GUIGFXButton'XInterface.Tab_SPProfileNew.btnNextSymbol' Begin Object Class=GUIButton Name=btnBack Caption="BACK" Hint="Return to previous menu" WinTop=0.925000 WinLeft=0.028125 WinWidth=0.200000 WinHeight=0.075000 OnClick=Tab_SPProfileNew.BackClick OnKeyEvent=btnBack.InternalOnKeyEvent End Object Controls(13)=GUIButton'XInterface.Tab_SPProfileNew.btnBack' Begin Object Class=GUIButton Name=btnDefaults Caption="SET TO DEFAULTS" Hint="Set this profile back to default values" WinTop=0.925000 WinLeft=0.367500 WinWidth=0.232813 WinHeight=0.075000 OnClick=Tab_SPProfileNew.DefaultsClick OnKeyEvent=btnDefaults.InternalOnKeyEvent End Object Controls(14)=GUIButton'XInterface.Tab_SPProfileNew.btnDefaults' Begin Object Class=GUILabel Name=lblCharacter Caption="Select|Character" TextAlign=TXTA_Center TextColor=(B=255,G=255,R=255) TextFont="UT2SmallFont" bMultiLine=True WinTop=0.724583 WinLeft=0.064062 WinWidth=0.200000 WinHeight=0.100000 End Object Controls(15)=GUILabel'XInterface.Tab_SPProfileNew.lblCharacter' Begin Object Class=GUILabel Name=lblTeamSymbol Caption="Select|Team Symbol" TextAlign=TXTA_Center TextColor=(B=255,G=255,R=255) TextFont="UT2SmallFont" bMultiLine=True WinTop=0.724583 WinLeft=0.284375 WinWidth=0.200000 WinHeight=0.100000 End Object Controls(16)=GUILabel'XInterface.Tab_SPProfileNew.lblTeamSymbol' Begin Object Class=GUIImage Name=symbolBackground Image=Texture'InterfaceContent.Menu.BorderBoxA1' ImageStyle=ISTY_Stretched ImageRenderStyle=MSTY_Normal WinTop=0.237865 WinLeft=0.296196 WinWidth=0.179101 WinHeight=0.297265 End Object Controls(17)=GUIImage'XInterface.Tab_SPProfileNew.symbolBackground' Begin Object Class=GUIImage Name=portraitBackground Image=Texture'InterfaceContent.Menu.BorderBoxA1' ImageStyle=ISTY_Stretched ImageRenderStyle=MSTY_Normal WinTop=0.110469 WinLeft=0.094141 WinWidth=0.146680 WinHeight=0.506094 bVisible=False End Object Controls(18)=GUIImage'XInterface.Tab_SPProfileNew.portraitBackground' WinTop=0.150000 WinHeight=0.770000 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |