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 |
//============================================================================== // Single player tutorial screen // // Written by Michiel Hendriks // (c) 2003, Epic Games, Inc. All Rights Reserved //============================================================================== class UT2K4SPTab_Tutorials extends UT2K4SPTab_Base config; #exec OBJ LOAD FILE=2K4Menus.utx #exec OBJ LOAD FILE=Laddershots.utx /** Single player tutorial record. Gameclass is used for the tutorial name Preview is the image to use when the tutorial is available PreviewLocked is used when it's locked Map is the url to start */ struct SPTutorial { var string GameClass; var string Preview; var string PreviewLocked; var string Map; var bool unLocked; }; var config array<SPTutorial> Tutorials; var Material BorderMat, ShadowMat; var localized string StartTutorial; var array<GUIImage> TutImages; function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); CreateButtons(); } function CreateButtons() { local int i, cols, rows, n; local float colWidth, rowHeight, cellWidth, cellHeight, spacingHeight, spacingWidth, X, Y; local GUIImage img; local GUISectionBackground sbg; local GUIButton btn; local CacheManager.GameRecord GR; rows = round(sqrt(Tutorials.Length)); cols = ceil(float(Tutorials.Length)/float(rows)); colWidth = WinWidth/cols; rowHeight = WinHeight/rows; cellWidth = colWidth*0.9; cellHeight = rowHeight*0.9; // calculate aspect ratio 1:1 X = FMin(cellWidth, cellHeight); cellWidth = X; cellHeight = X; // find centers spacingHeight = (rowHeight-cellHeight)/2.0 + 0.005; spacingWidth = (colWidth-cellWidth)/2.0 + 0.005; for (i = 0; i < Tutorials.Length; i++) { X = (i%cols)*colWidth+spacingWidth+WinLeft; Y = (i/cols)*rowHeight+spacingHeight+WinTop; if (((i/cols)+1 == rows) && (rows*cols > Tutorials.Length)) { // center last row n = rows*cols-Tutorials.Length; X = X+(colWidth*n)/2.0; } GR = class'CacheManager'.static.getGameRecord(Tutorials[i].GameClass); btn = new class'GUIButton'; btn.StyleName = "NoBackground"; btn.bFocusOnWatch = true; btn.WinHeight = cellWidth; btn.WinWidth = cellHeight; btn.WinTop = Y; btn.WinLeft = X; btn.OnClick = OnTutorialClick; btn.tag = i; btn.Hint = StartTutorial@GR.GameName; btn.RenderWeight = 0.4; btn.TabOrder = Controls.length+1; AppendComponent(btn, true); sbg = new class'AltSectionBackground'; sbg.WinHeight = cellHeight; sbg.WinWidth = cellWidth; sbg.WinTop = Y; sbg.WinLeft = X; sbg.RenderWeight = 0.1; sbg.Caption = GR.GameName; AppendComponent(sbg, true); img = new class'GUIImage'; img.ImageStyle = ISTY_Scaled; img.WinHeight = (cellHeight-0.09605); img.WinWidth = (cellWidth-0.02625); img.WinTop = Y+0.046667; img.WinLeft = X+0.01375; img.X1 = 0; img.Y1 = 0; img.X2 = 1023; img.Y2 = 767; img.RenderWeight = 0.17; AppendComponent(img, true); TutImages[i] = img; } } function ShowPanel(bool bShow) { local int i; local Material ss; Super.ShowPanel(bShow); if (bShow) btnPlayEnabled(false); if (!bShow) return; for (i = 0; i < Tutorials.length; i++) { if (TutImages[i].Image == none) { if (Tutorials[i].unLocked || (Tutorials[i].PreviewLocked == "")) ss = Material(DynamicLoadObject(Tutorials[i].Preview, class'Material')); else ss = Material(DynamicLoadObject(Tutorials[i].PreviewLocked, class'Material')); TutImages[i].Image = ss; } } } function bool OnTutorialClick(GUIComponent Sender) { GP = UT2K4GameProfile(PlayerOwner().Level.Game.CurrentGameProfile); if ( GP != none ) { GP.bInLadderGame = true; // so that it'll reload into SP menus GP.SpecialEvent = ""; GP.lmdFreshInfo = false; PlayerOwner().Level.Game.SavePackage(GP.PackageName); PlayerOwner().ConsoleCommand ("START"@Tutorials[Sender.Tag].Map$"?quickstart=true?TeamScreen=false?NumBots=0?savegame="$GP.PackageName); } else { PlayerOwner().ConsoleCommand ("START"@Tutorials[Sender.Tag].Map$"?quickstart=true?TeamScreen=false?NumBots=0"); } MainWindow.bAllowedAsLast = true; Controller.CloseAll(false,true); return true; } static function unlockButton(string tag) { if (tag ~= "TDM") Default.Tutorials[0].unlocked = true; else if (tag ~= "CTF") Default.Tutorials[1].unlocked = true; else if (tag ~= "DOM") Default.Tutorials[2].unlocked = true; else if (tag ~= "BR") Default.Tutorials[3].unlocked = true; //else if (tag ~= "AS") TutorialData[4].unlocked = true; StaticSaveConfig(); } defaultproperties { Tutorials[0]=(GameClass="xGame.xDeathMatch",Preview="LadderShots.TeamDMMoneyShot",PreviewLocked="LadderShots.TeamDMShot",Map="TUT-DM",unLocked=false) Tutorials[1]=(GameClass="xGame.xCTFGame",Preview="LadderShots.CTFMoneyShot",PreviewLocked="LadderShots.CTFShot",Map="TUT-CTF",unLocked=false) Tutorials[2]=(GameClass="xGame.xDoubleDom",Preview="LadderShots.DOMMoneyShot",PreviewLocked="LadderShots.DOMShot",Map="TUT-DOM2",unLocked=false) Tutorials[3]=(GameClass="xGame.xBombingRun",Preview="LadderShots.BRMoneyShot",PreviewLocked="LadderShots.BRShot",Map="TUT-BR",unLocked=false) BorderMat=Material'2K4Menus.Controls.sectionback' ShadowMat=Material'2K4Menus.Controls.shadow' StartTutorial="Click to play tutorial for" PanelCaption="Tutorial" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |