Esempio n. 1
0
 // This is probably the weirdest one, so some comments here.
 private void MakeClanFilter(float xOffset, float yOffset)
 {
     // As usual, start with initalizing the filters if they aren't yet.
     // (Probably should use two if-statements as a fail-safe, but there should be no way only one of them
     // is ever set and not the other)
     if (clanFilter1 == null || clanFilter2 == null)
     {
         clanFilter1 = new RunDataFilterClan(saveManager, RunDataFilterClan.CLAN_ANY, RunDataFilterClan.AS_PRIMARY);
         filterManager.AddFilter(clanFilter1);
         clanFilter2 = new RunDataFilterClan(saveManager, RunDataFilterClan.CLAN_ANY, RunDataFilterClan.AS_SECONDARY);
         filterManager.AddFilter(clanFilter2);
     }
     // First clan: Choose the clan as well as the role it should play.
     clanRoleDropdown = CustomUIManager.AddDropdownToComponent(content, "ClanRoleDropdown", RunDataFilterClan.roleOptions, xOffset - 10, yOffset);
     CustomUIManager.AddLabelToComponent(content, "Clan:", xOffset + 260, yOffset, 100, 50);
     clanDropdown1 = CustomUIManager.AddDropdownToComponent(content, "ClanDropdown1", clanFilter1.clanOptions, xOffset + columnWidth, yOffset);
     // For the second clan, the role directly results from the first clan's role, so we can use a simple label.
     // However, we need to update that label accordingly if the first clan's role is changed, see below.
     secondClanLabel = CustomUIManager.AddLabelToComponent(content, "Secondary Clan:", xOffset, yOffset + 70, 350, 50);
     clanDropdown2   = CustomUIManager.AddDropdownToComponent(content, "ClanDropdown1", clanFilter2.clanOptions, xOffset + columnWidth, yOffset + lineHeight);
     // Add listeners.
     clanRoleDropdown.optionChosenSignal.AddListener(HandleClanRole);
     clanDropdown1.optionChosenSignal.AddListener(HandleClan1);
     clanDropdown2.optionChosenSignal.AddListener(HandleClan2);
     // If the current filter settings are not the default ones, we need to update the UI elements. As we also
     // need to do this whenever the first clan's role is changed, put it in a seperate method.
     UpdateClanFilter();
     // "Register" the UI elements.
     dropdowns.Add(clanRoleDropdown);
     dropdowns.Add(clanDropdown1);
     dropdowns.Add(clanDropdown2);
 }
 public static void Postfix(ref RunHistoryScreen __instance, ref SaveManager saveManager)
 {
     // Only do this if the elements are actually usable
     if (CustomUIManager.AreTemplatesUsable())
     {
         // Add a few UI elements. TODO: Currenty, these are added directly to the screen. It might be nicer to add
         // them to the screen's content, but I'm too lazy for it right now.
         CustomUIManager.AddLabelToComponent(__instance, "Apply Filters:", 170, 145, 200, 50);
         AdvancedRunHistory.applyFiltersToggle      = CustomUIManager.AddToggleToComponent(__instance, "ApplyFiltersToggle", 310, 146);
         AdvancedRunHistory.applyFiltersToggle.isOn = AdvancedRunHistory.filterManager.Active;
         AdvancedRunHistory.openFilterDialogButton  = CustomUIManager.AddButtonToComponent(__instance, "OpenFilterScreenButton", "Edit Filters", 570, 140, 250, 60);
         // If the Filter dialog has not yet been created, do so. Otherwise, reinitalize it.
         if (AdvancedRunHistory.filterDialog == null)
         {
             AdvancedRunHistory.filterDialog = new RunFilterDialog(__instance, saveManager, AdvancedRunHistory.filterManager);
         }
         else
         {
             AdvancedRunHistory.filterDialog.Reinit(__instance);
         }
     }
     else
     {
         AdvancedRunHistory.Log("At least one UI template has not been initalized successfully", LogLevel.Error);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Reinitalize the dialog. Use this if the dialog has already been created, but the UI elements have been
 /// destroyed due to a screen transition.
 /// </summary>
 /// <param name="parent">The container for this dialog, see <see cref="RunFilterDialog.RunFilterDialog"/></param>
 public void Reinit(RunHistoryScreen parent)
 {
     this.dialog = CustomUIManager.CreateCustomDialog(parent, "FilterDialog", "Run Data Filters");
     content     = dialog.transform.Find("Content");
     dropdowns   = new List <GameUISelectableDropdown>();
     sliders     = new List <SelectableSliderHelper>();
     MakeOutcomeFilter(firstColumn, firstLine);
     MakeRunTypeFilter(firstColumn, firstLine + lineHeight);
     MakeCovenantFilter(firstColumn, firstLine + lineHeight * 2);
     MakeClanFilter(firstColumn, firstLine + lineHeight * 4);
     MakeProgressFilter(firstColumn, firstLine + lineHeight * 6);
 }
Esempio n. 4
0
 private void MakeRunTypeFilter(float xOffset, float yOffset)
 {
     if (runTypeFilter == null)
     {
         runTypeFilter = new RunDataFilterRunType();
         filterManager.AddFilter(runTypeFilter);
     }
     CustomUIManager.AddLabelToComponent(content, "Run Type:", xOffset, yOffset, 240, 50);
     runTypeFilterDropdown = CustomUIManager.AddDropdownToComponent(content, "RunTypeDropdown", runTypeFilter.options, xOffset + columnWidth, yOffset);
     runTypeFilterDropdown.optionChosenSignal.AddListener(HandleRunType);
     runTypeFilterDropdown.SetValue(runTypeFilter.options[runTypeFilter.SelectedRunType]);
     dropdowns.Add(runTypeFilterDropdown);
 }
Esempio n. 5
0
 // A lot of methods to initalize filters and UI elements, some very similar code, not gonna comment them all.
 private void MakeOutcomeFilter(float xOffset, float yOffset)
 {
     // If the filter has not yet been created, do so and add it to the filter manager
     if (outcomeFilter == null)
     {
         outcomeFilter = new RunDataFilterOutcome();
         filterManager.AddFilter(outcomeFilter);
     }
     // UI stuff
     CustomUIManager.AddLabelToComponent(content, "Run Outcome:", xOffset, yOffset, 240, 50);
     outcomeFilterDropdown = CustomUIManager.AddDropdownToComponent(content, "OutcomeDropdown", outcomeFilter.options, xOffset + columnWidth, yOffset);
     outcomeFilterDropdown.optionChosenSignal.AddListener(HandleOutcome);
     // Manually set the dropdown menu to the current option chosen. There might be a less ugly way to do this.
     outcomeFilterDropdown.SetValue(outcomeFilter.options[outcomeFilter.Outcome]);
     dropdowns.Add(outcomeFilterDropdown);
 }
Esempio n. 6
0
 private void MakeProgressFilter(float xOffset, float yOffset)
 {
     if (progressFilter == null)
     {
         progressFilter = new RunDataFilterProgress();
         filterManager.AddFilter(progressFilter);
     }
     CustomUIManager.AddLabelToComponent(content, "Min Ring:", xOffset, yOffset, 240, 50);
     CustomUIManager.AddLabelToComponent(content, "Max Ring:", xOffset, yOffset + 70, 240, 50);
     progressMinSlider = CustomUIManager.AddSliderToComponent(content, "MinProgressSlider", 0, 0, 25, xOffset + columnWidth, yOffset, 240);
     progressMaxSlider = CustomUIManager.AddSliderToComponent(content, "MaxProgressSlider", 25, 0, 25, xOffset + columnWidth, yOffset + lineHeight, 240);
     progressMinSlider.ValueChangedSignal.AddListener(HandleMinProgress);
     progressMaxSlider.ValueChangedSignal.AddListener(HandleMaxProgress);
     UpdateProgressFilter();
     sliders.Add(progressMinSlider);
     sliders.Add(progressMaxSlider);
 }
Esempio n. 7
0
 private void MakeCovenantFilter(float xOffset, float yOffset)
 {
     if (covenantFilter == null)
     {
         covenantFilter = new RunDataFilterCovenant();
         filterManager.AddFilter(covenantFilter);
     }
     CustomUIManager.AddLabelToComponent(content, "Min Covenant:", xOffset, yOffset, 240, 50);
     CustomUIManager.AddLabelToComponent(content, "Max Covenant:", xOffset, yOffset + 70, 240, 50);
     covenantMinSlider = CustomUIManager.AddSliderToComponent(content, "MinCovenantSlider", 0, 0, 25, xOffset + columnWidth, yOffset, 240);
     covenantMaxSlider = CustomUIManager.AddSliderToComponent(content, "MaxCovenantSlider", 25, 0, 25, xOffset + columnWidth, yOffset + lineHeight, 240);
     covenantMinSlider.ValueChangedSignal.AddListener(HandleMinCovenant);
     covenantMaxSlider.ValueChangedSignal.AddListener(HandleMaxCovenant);
     UpdateCovenantFilter();
     sliders.Add(covenantMinSlider);
     sliders.Add(covenantMaxSlider);
 }