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 |
/** * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. * * Key binding screen for the PC. */ class UTUIFrontEnd_BindKeysPC extends UTUIFrontEnd; /** Binding list object, we need to route key presses to this first. */ var transient UTUIKeyBindingList BindingList; /** Old bindings before making any changes. */ var transient array<PlayerInput.KeyBind> OldBindings; /** Whether to display the crucialbind warning when closing the lose saved data screen. */ var transient bool bShowCrucialBindWarning; /** Delegate to mark the profile as dirty. */ delegate MarkDirty(); /** Post initialize callback. */ event PostInitialize() { Super.PostInitialize(); // Find widget references BindingList = UTUIKeyBindingList(FindChild('lstKeys', true)); BindingList.OnAcceptOptions=OnBindingList_AcceptOptions; // Store old bindings OldBindings = BindingList.GetPlayerInput().Bindings; } /** Callback to setup the buttonbar for this scene. */ function SetupButtonBar() { ButtonBar.Clear(); ButtonBar.AppendButton("<Strings:UTGameUI.ButtonCallouts.Back>", OnButtonBar_Back); ButtonBar.AppendButton("<Strings:UTGameUI.ButtonCallouts.Accept>", OnButtonBar_Accept); ButtonBar.AppendButton("<Strings:UTGameUI.ButtonCallouts.ResetToDefaults>", OnButtonBar_ResetToDefaults); } /** Will first check to see if there are any unbound crucial binds and close the scene if not. */ function bool CheckForCrucialBindsAndClose() { local int CrucialBindIdx; local UTUIScene_MessageBox MessageBoxReference; local array<string> MessageBoxOptions; local string CrucialBindTitle; CrucialBindIdx = BindingList.GetFirstUnboundCrucialBind(); if (CrucialBindIdx == -1) { CloseScene(self); return true; } else { MessageBoxReference = GetMessageBoxScene(BindingList.NonIntrusiveMessageBoxScene); if(MessageBoxReference != none) { MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.Back>"); MessageBoxReference.SetPotentialOptions(MessageBoxOptions); CrucialBindTitle = BindingList.LocalizedFriendlyNames[CrucialBindIdx]; MessageBoxReference.Display("<Strings:UTGameUI.MessageBox.CrucialBindErrorMsg>", CrucialBindTitle); } MessageBoxReference = None; } return false; } /** Confirmation for the exit game dialog. */ function OnMenu_LoseChanges_Confirm(UTUIScene_MessageBox MessageBox, int SelectedItem, int PlayerIndex) { local PlayerInput PInput; if(SelectedItem==0) { // restore old bindings PInput = BindingList.GetPlayerInput(); PInput.Bindings = OldBindings; PInput.SaveConfig(); BindingList.RefreshBindingLabels(); CheckForCrucialBindsAndClose(); bShowCrucialBindWarning = true; } else { bShowCrucialBindWarning = false; } } /** Called when the back dialog is closed. */ function OnBackSceneDeactivated( UIScene DeactivatedScene ) { if (bShowCrucialBindWarning) { CheckForCrucialBindsAndClose(); } } /** Callback for when the user wants to exit this screen. */ function OnBack() { local UTUIScene_MessageBox MessageBoxReference; local array<string> MessageBoxOptions; if (BindingList.BindingsHaveChanged()) { MessageBoxReference = GetMessageBoxScene(); if(MessageBoxReference != none) { MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.Accept>"); MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.Cancel>"); MessageBoxReference.SetPotentialOptions(MessageBoxOptions); MessageBoxReference.Display("<Strings:UTGameUI.MessageBox.LoseChangesWarning_Message>", "<Strings:UTGameUI.MessageBox.LoseChangesWarning_Title>", OnMenu_LoseChanges_Confirm, 1); } MessageBoxReference = None; } else { CheckForCrucialBindsAndClose(); } } /** Callback for when the user wants to save their options. */ function OnAccept() { local PlayerInput PInput; local UTProfileSettings PlayerProfile; local UTPlayerController UTPC; local int PlayerIndex; PlayerIndex = GetPlayerIndex(); PlayerProfile = GetPlayerProfile(PlayerIndex); PInput = BindingList.GetPlayerInput(); PlayerProfile.StoreKeysUsingPlayerInput(PInput); // Save keys to INI PInput.SaveConfig(); // Clear the bind key cache in the controller UTPC = GetUTPlayerOwner(PlayerIndex); if (UTPC != none) { UTPC.ClearStringAliasBindingMapCache(); } // Mark the screen for saving if successfully closing and a change was made. if ( CheckForCrucialBindsAndClose() && BindingList.BindingsHaveChanged() ) { MarkDirty(); } } /** Callback for when the user wants to reset to the default set of option values. */ function OnResetToDefaults() { local UTUIScene_MessageBox MessageBoxReference; local array<string> MessageBoxOptions; MessageBoxReference = GetMessageBoxScene(); if(MessageBoxReference != none) { MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.ResetToDefaultAccept>"); MessageBoxOptions.AddItem("<Strings:UTGameUI.ButtonCallouts.Cancel>"); MessageBoxReference.SetPotentialOptions(MessageBoxOptions); MessageBoxReference.Display("<Strings:UTGameUI.MessageBox.ResetToDefaults_Message>", "<Strings:UTGameUI.MessageBox.ResetToDefaults_Title>", OnMenu_ResetToDefaults_Confirm, 1); } MessageBoxReference = None; } /** Confirmation for the exit game dialog. */ function OnMenu_ResetToDefaults_Confirm(UTUIScene_MessageBox MessageBox, int SelectedItem, int PlayerIndex) { if(SelectedItem==0) { BindingList.ReloadDefaults(); } } /** Accept button was pressed on the option list. */ function OnBindingList_AcceptOptions(UIScreenObject InObject, int PlayerIndex) { OnAccept(); } /** Button bar callbacks. */ function bool OnButtonBar_Accept(UIScreenObject InButton, int PlayerIndex) { OnAccept(); return true; } function bool OnButtonBar_Back(UIScreenObject InButton, int PlayerIndex) { OnBack(); return true; } function bool OnButtonBar_ResetToDefaults(UIScreenObject InButton, int PlayerIndex) { OnResetToDefaults(); return true; } /** * Provides a hook for unrealscript to respond to input using actual input key names (i.e. Left, Tab, etc.) * * Called when an input key event is received which this widget responds to and is in the correct state to process. The * keys and states widgets receive input for is managed through the UI editor's key binding dialog (F8). * * This delegate is called BEFORE kismet is given a chance to process the input. * * @param EventParms information about the input event. * * @return TRUE to indicate that this input key was processed; no further processing will occur on this input key event. */ function bool HandleInputKey( const out InputEventParameters EventParms ) { local bool bResult; if(EventParms.EventType==IE_Released && EventParms.InputKeyName=='XboxTypeS_A') { OnAccept(); bResult=true; } if(bResult==false) { // Let the binding list get first chance at the input because the user may be binding a key. bResult=BindingList.HandleInputKey(EventParms); } if(bResult == false) { if(EventParms.EventType==IE_Released) { if(EventParms.InputKeyName=='XboxTypeS_B' || EventParms.InputKeyName=='Escape') { OnBack(); bResult=true; } else if(EventParms.InputKeyName=='XboxTypeS_LeftTrigger') { OnResetToDefaults(); bResult=true; } } } return bResult; } defaultproperties { Begin Object Class=UIComp_Event Name=SceneEventComponent ObjName=SceneEventComponent Archetype=UIComp_Event'UTGame.Default__UTUIFrontEnd:SceneEventComponent' ObjectArchetype=UIComp_Event'UTGame.Default__UTUIFrontEnd:SceneEventComponent' End Object EventProvider=SceneEventComponent Name="Default__UTUIFrontEnd_BindKeysPC" ObjectArchetype=UTUIFrontEnd'UTGame.Default__UTUIFrontEnd' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |