示例#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);
 }
示例#2
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);
 }
示例#3
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);
 }