Ejemplo n.º 1
0
 /// <summary>
 /// Evaluate the user input. For params, see <see cref="ICustomDialogInputListener.ApplyScreenInput"/>
 /// </summary>
 public bool ApplyScreenInput(CoreInputControlMapping mapping, IGameUIComponent triggeredUI, InputManager.Controls triggeredMappingID)
 {
     // Invoke the ScreenDialog's ApplyScreenInput method. This is mostly to handle correct closing.
     dialog.ApplyScreenInput(mapping, triggeredUI, triggeredMappingID);
     // Evaluate all dropdown menus.
     foreach (GameUISelectableDropdown dropdown in dropdowns)
     {
         if (dropdown.TryClose(mapping, triggeredUI) || dropdown.ApplyScreenInput(mapping, triggeredUI, triggeredMappingID))
         {
             return(true);
         }
     }
     // Evaluate all sliders.
     foreach (SelectableSliderHelper slider in sliders)
     {
         // For some reason, this never seems to trigger at the moment. No idea why.
         if (slider.ApplyScreenInput(mapping, triggeredUI, triggeredMappingID))
         {
             return(true);
         }
     }
     return(false);
 }
        public static void Postfix(ref bool __result, ref ScreenDialog __instance, ref CoreInputControlMapping mapping, ref IGameUIComponent triggeredUI, ref InputManager.Controls triggeredMappingID)
        {
            // Check if there's a custom input listener assigned to this dialog. If that is the case, invoke its
            // ApplyScreenInput.
            ICustomDialogInputListener listener = CustomUIManager.GetCustomDialogInputListener(__instance);

            if (listener != null)
            {
                __result = listener.ApplyScreenInput(mapping, triggeredUI, triggeredMappingID);
            }
        }
 public static bool Prefix(ref RunHistoryScreen __instance, ref bool __result, ref CoreInputControlMapping mapping, ref IGameUIComponent triggeredUI, ref InputManager.Controls triggeredMappingID)
 {
     // If the filter dialog is null, abort.
     if (AdvancedRunHistory.filterDialog == null)
     {
         AdvancedRunHistory.Log("Filter dialog does not seem to have initalized successfully.", LogLevel.Warning);
         return(true);
     }
     // If the filter dialog is open, handle it first.
     if (AdvancedRunHistory.filterDialog.IsActive())
     {
         if (AdvancedRunHistory.filterDialog.ApplyScreenInput(mapping, triggeredUI, triggeredMappingID))
         {
             __result = true;
         }
         // If one of the filters was changed, re-fetch runs.
         if (AdvancedRunHistory.filterDialog.WasUpdated() && AdvancedRunHistory.filterManager.Active)
         {
             UpdateHistoryUI(__instance);
         }
         return(false);
     }
     // "Edit Filters" button clicked: Open the filter dialog.
     if (AdvancedRunHistory.openFilterDialogButton.TryTrigger(triggeredUI, triggeredMappingID))
     {
         AdvancedRunHistory.filterDialog.Open();
         __result = true;
         return(false);
     }
     // "Apply Filters" toggle clicked: Toggle the filter manager's active state and re-fetch runs.
     if (AdvancedRunHistory.applyFiltersToggle.TryTrigger(triggeredUI, triggeredMappingID))
     {
         AdvancedRunHistory.filterManager.Active = AdvancedRunHistory.applyFiltersToggle.Toggle();
         UpdateHistoryUI(__instance);
         return(false);
     }
     // If nothing else has been found, run the original method.
     return(true);
 }