public static void UnsubscribeMouseMovementsChangedEvent(ActionsLabels action) { if (axisMovementsChangedCallbacks.ContainsKey(action)) { axisMovementsChangedCallbacks.Remove(action); } }
public static void UnsubscribeButtonEvent(ActionsLabels action) { if (buttonInputsCallbacks.ContainsKey(action)) { buttonInputsCallbacks.Remove(action); } }
public static void SubscribeMouseMovementsChangedEvent(ActionsLabels action, string input, EventTypeChanged type, System.Action callback) { if (axisMovementsChangedCallbacks.ContainsKey(action)) { // Override input axisMovementsChangedCallbacks[action].Value[(int)type] = callback; } else { // Add the input switch (type) { case EventTypeChanged.Changed: SubscribeMouseMovementsChangedEvents(action, input, new System.Action[] { callback, null }); break; case EventTypeChanged.UnChanged: SubscribeMouseMovementsChangedEvents(action, input, new System.Action[] { null, callback }); break; } } }
public static void SubscribeButtonEvents(ActionsLabels action, string[] input, params System.Action[] callbacks) { KeyValuePair <string[], System.Action[]> currentValue = new KeyValuePair <string[], System.Action[]>(input, callbacks); if (buttonInputsCallbacks.ContainsKey(action)) { // Override input buttonInputsCallbacks[action] = currentValue; } else { int enumsLength = Enum.GetNames(typeof(EventTypeButton)).Length; if (callbacks.Length == enumsLength) { buttonInputsCallbacks.Add(action, currentValue); } else { Debug.LogWarning("The size of the callbacks array (" + callbacks.Length + ")" + " is not equals to the lenght of the Enums (" + enumsLength + "). Callbacks ignored."); } } }
public static void SubscribeButtonEvent(ActionsLabels action, string input, EventTypeButton type, System.Action callback) { if (buttonInputsCallbacks.ContainsKey(action)) { buttonInputsCallbacks[action].Value[(int)type] = callback; } else { switch (type) { case EventTypeButton.Up: SubscribeButtonEvents(action, input, new System.Action[] { callback, null, null }); break; case EventTypeButton.Down: SubscribeButtonEvents(action, input, new System.Action[] { null, callback, null }); break; case EventTypeButton.Hold: SubscribeButtonEvents(action, input, new System.Action[] { null, null, callback }); break; } } }
public static void SubscribeMouseMovementsChangedEvents(ActionsLabels action, string input, params System.Action[] callbacks) { SubscribeMouseMovementsChangedEvents(action, new string[] { input }, callbacks); }
public static void SubscribeButtonEvents(ActionsLabels action, string input, params System.Action[] callbacks) { SubscribeButtonEvents(action, new string[] { input }, callbacks); }