public void GetInvocationData() { string levelName = null; int playerCount = -1; requestData = null; // Iterate through all selector components (Levels, Character count) foreach (var pair in selector.SubSelectionEntries) { // The apply button has no components if (pair.Value.Components.Count > 0) { GameObject selectedMenuComponent = pair.Value.Components[pair.Value.Current]; AbstractActionHandler componentAction = selectedMenuComponent.GetComponent <AbstractActionHandler>(); if (componentAction is LeaderboardWorldAction) { levelName = ((LeaderboardWorldAction)componentAction).world.ToString(); } else if (componentAction is LeaderboardPlayerCountAction) { playerCount = (int)((LeaderboardPlayerCountAction)componentAction).playerCount; } // Apply the action of each menu component componentAction.PerformAction <AbstractActionHandler>(this); } } requestData = new RequestData(levelName, playerCount); }
internal AbstractActionHandler Find(AbstractAction action) { AbstractActionHandler result = null; _items.TryGetValue(action.Name, out result); return(result); }
private void ApplyQualitySettings() { // Iterate through all selector components (Resolution, Quality, Anti-Aliasing, ...) foreach (var pair in selector.SubSelectionEntries) { // The apply button has no components if (pair.Value.Components.Count > 0) { GameObject selectedSetting = pair.Value.Components[pair.Value.Current]; AbstractActionHandler settingAction = selectedSetting.GetComponent <AbstractActionHandler>(); // Apply the action of each selected setting (of the specific component) settingAction.PerformAction <AbstractActionHandler>(this); } } }
private void AddChildrenToContainer(AbstractMenuManager parent) { int i = 0; foreach (AbstractActionHandler action in buttons) { GameObject instantiatedAction = Instantiate(action.gameObject); AbstractActionHandler actionComponent = instantiatedAction.GetComponent <AbstractActionHandler>(); NavigationInformation navigationInformation = instantiatedAction.GetComponent <NavigationInformation>(); navigationInformation.SelectionID = i++; instantiatedAction.transform.SetParent(parent.gameObject.transform, false); // Listen to action performed so the parent submenu destroys automatically actionComponent.ActionPerformed += parent.DestroyMenuManager; } }
internal void Unregister(AbstractActionHandler handler) { _items.Remove(handler.ActionName); }
internal void Register(AbstractActionHandler handler) { _items.Add(handler.ActionName, handler); }