public override void RemoveListener(ControllerButton button, RoleEventListener <TRole> listener, ButtonEventType type = ButtonEventType.Click) { if (listeners == null) { return; } if (listeners[(int)type] == null) { return; } if (listeners[(int)type][(int)button] == null) { return; } listeners[(int)type][(int)button] -= listener; }
public override void AddListener(ControllerButton button, RoleEventListener <TRole> listener, ButtonEventType type = ButtonEventType.Click) { if (listeners == null) { listeners = new RoleEventListener <TRole> [BUTTON_EVENT_COUNT][]; } if (listeners[(int)type] == null) { listeners[(int)type] = new RoleEventListener <TRole> [CONTROLLER_BUTTON_COUNT]; } if (listeners[(int)type][(int)button] == null) { listeners[(int)type][(int)button] = listener; } else { listeners[(int)type][(int)button] += listener; } }
/// <typeparam name="TRole"> /// Can be DeviceRole, TrackerRole or any other enum type that have ViveRoleEnumAttribute. /// Use ViveRole.ValidateViveRoleEnum() to validate role type /// </typeparam> /// <param name="role"> /// TRole can be DeviceRole, TrackerRole or any other enum type that have ViveRoleEnumAttribute. /// Use ViveRole.ValidateViveRoleEnum() to validate role type /// </param> public static void RemoveListenerEx <TRole>(TRole role, ControllerButton button, ButtonEventType eventType, RoleEventListener <TRole> callback) { GetState(role).RemoveListener(button, callback, eventType); }
public virtual void RemoveListener(ControllerButton button, RoleEventListener <TRole> listener, ButtonEventType type = ButtonEventType.Click) { }