Core.Object | +--Engine.Actor | +--Engine.Menu | +--UnrealShare.UnrealMenu | +--UnrealShare.UnrealLongMenu | +--UnrealShare.UnrealGameOptionsMenu
string
AdvancedHelp
AdvancedString
class
GameClass
bool
bCanModifyGore
void
Destroyed()
DrawMenu(Canvas Canvas)
DrawOptions(Canvas Canvas, int StartX, int StartY, int Spacing)
DrawValues(Canvas Canvas, int StartX, int StartY, int Spacing)
MenuProcessInput(byte KeyNum, byte ActionNum)
PostBeginPlay()
ProcessLeft()
ProcessRight()
ProcessSelection()
SaveConfigs()
00001 //============================================================================= 00002 // UnrealGameOptionsMenu 00003 //============================================================================= 00004 class UnrealGameOptionsMenu extends UnrealLongMenu; 00005 00006 var() localized string AdvancedString; 00007 var() localized string AdvancedHelp; 00008 var() config bool bCanModifyGore; 00009 var() class<GameInfo> GameClass; 00010 var GameInfo GameType; 00011 00012 function Destroyed() 00013 { 00014 Super.Destroyed(); 00015 if ( GameType != Level.Game ) 00016 GameType.Destroy(); 00017 } 00018 00019 function PostBeginPlay() 00020 { 00021 Super.PostBeginPlay(); 00022 if ( Level.Game.Class == GameClass ) 00023 GameType = Level.Game; 00024 else 00025 { 00026 GameType = Spawn(GameClass); 00027 if ( Level.Game != None ) 00028 GameType.SetGameSpeed(Level.Game.GameSpeed); 00029 } 00030 } 00031 00032 function MenuProcessInput( byte KeyNum, byte ActionNum ) 00033 { 00034 Super.MenuProcessInput(KeyNum, ActionNum); 00035 if ( !bCanModifyGore ) 00036 { 00037 if ( KeyNum == EInputKey.IK_Up ) 00038 { 00039 if ( Selection == 2 ) 00040 Selection = 1; 00041 } 00042 else if ( KeyNum == EInputKey.IK_Down ) 00043 { 00044 if ( Selection == 2 ) 00045 Selection = 3; 00046 } 00047 } 00048 } 00049 function bool ProcessLeft() 00050 { 00051 if ( Selection == 1 ) 00052 { 00053 if ( Level.Game != None ) 00054 { 00055 Level.Game.SetGameSpeed(FMax(0.5, GameType.GameSpeed - 0.1)); 00056 GameType.GameSpeed = Level.Game.GameSpeed; 00057 } 00058 else 00059 GameType.GameSpeed = FMax(0.5, GameType.GameSpeed - 0.1); 00060 } 00061 else if ( (Selection == 2) && bCanModifyGore ) 00062 GameType.bLowGore = !GameType.bLowGore; 00063 else 00064 return false; 00065 00066 return true; 00067 } 00068 00069 function bool ProcessRight() 00070 { 00071 if ( Selection == 1 ) 00072 { 00073 if ( Level.Game != None ) 00074 { 00075 Level.Game.SetGameSpeed(FMin(2.0, GameType.GameSpeed + 0.1)); 00076 GameType.GameSpeed = Level.Game.GameSpeed; 00077 } 00078 else 00079 GameType.GameSpeed = FMin(2.0, GameType.GameSpeed + 0.1); 00080 } 00081 else if ( (Selection == 2) && bCanModifyGore ) 00082 GameType.bLowGore = !GameType.bLowGore; 00083 else 00084 return false; 00085 00086 return true; 00087 } 00088 00089 function bool ProcessSelection() 00090 { 00091 local Menu ChildMenu; 00092 00093 if ( (Selection == 2) && bCanModifyGore ) 00094 Level.Game.bLowGore = !Level.Game.bLowGore; 00095 else 00096 return false; 00097 00098 if ( ChildMenu != None ) 00099 { 00100 HUD(Owner).MainMenu = ChildMenu; 00101 ChildMenu.ParentMenu = self; 00102 ChildMenu.PlayerOwner = PlayerOwner; 00103 } 00104 return true; 00105 } 00106 00107 function SaveConfigs() 00108 { 00109 if ( GameType != None ) 00110 { 00111 Level.Game.bLowGore = GameType.bLowGore; 00112 GameType.SaveConfig(); 00113 } 00114 PlayerOwner.SaveConfig(); 00115 if ( Level.Game != None ) 00116 PlayerOwner.UpdateURL("GameSpeed",string(Level.Game.GameSpeed), false); 00117 } 00118 00119 function DrawOptions(canvas Canvas, int StartX, int StartY, int Spacing) 00120 { 00121 MenuList[1] = Default.MenuList[1]; 00122 if ( bCanModifyGore ) 00123 MenuList[2] = Default.MenuList[2]; 00124 else 00125 MenuList[2] = ""; 00126 DrawList(Canvas, false, Spacing, StartX, StartY); 00127 } 00128 00129 function DrawValues(canvas Canvas, int StartX, int StartY, int Spacing) 00130 { 00131 local int s; 00132 00133 s = 10 * (GameType.GameSpeed + 0.02); 00134 MenuList[1] = (""$(10 * s)$"%"); 00135 if ( bCanModifyGore ) 00136 MenuList[2] = string(GameType.bLowGore); 00137 else 00138 MenuList[2] = ""; 00139 DrawList(Canvas, false, Spacing, StartX + 160, StartY); 00140 } 00141 00142 function DrawMenu(canvas Canvas) 00143 { 00144 local int StartX, StartY, Spacing; 00145 00146 DrawBackGround(Canvas, false); 00147 00148 StartX = Max(40, 0.5 * Canvas.ClipX - 115); 00149 00150 if ( (MenuLength < 6) || (Canvas.ClipY > 240) ) 00151 { 00152 DrawTitle(Canvas); 00153 Spacing = Clamp(0.04 * Canvas.ClipY, 12, 32); 00154 StartY = Max(40, 0.5 * (Canvas.ClipY - MenuLength * Spacing - 128)); 00155 } 00156 else 00157 { 00158 Spacing = Clamp(0.04 * Canvas.ClipY, 11, 32); 00159 StartY = Max(4, 0.5 * (Canvas.ClipY - MenuLength * Spacing - 128)); 00160 } 00161 DrawOptions(Canvas, StartX, StartY, Spacing); 00162 DrawValues(Canvas, StartX, StartY, Spacing); 00163 DrawHelpPanel(Canvas, StartY + MenuLength * Spacing + 4, 228); 00164 } 00165 00166 defaultproperties 00167 { 00168 AdvancedString="Advanced Options" 00169 AdvancedHelp="Edit advanced game configuration options." 00170 bCanModifyGore=True 00171 GameClass=Class'UnrealShare.SinglePlayer' 00172 MenuLength=2 00173 HelpMessage(1)="Adjust the speed at which time passes in the game." 00174 HelpMessage(2)="If true, reduces the gore in the game." 00175 MenuList(1)="Game Speed" 00176 MenuList(2)="Reduced Gore" 00177 MenuTitle="GAME OPTIONS" 00178 }