public override void RemoveListener(ControllerButton button, RoleValueEventListener listener, ButtonEventType type = ButtonEventType.Click)
 {
     if (typeListeners == null)
     {
         return;
     }
     if (typeListeners[(int)type] == null)
     {
         return;
     }
     if (typeListeners[(int)type][(int)button] == null)
     {
         return;
     }
     typeListeners[(int)type][(int)button] -= listener;
 }
 public override void AddListener(ControllerButton button, RoleValueEventListener listener, ButtonEventType type = ButtonEventType.Click)
 {
     if (typeListeners == null)
     {
         typeListeners = new RoleValueEventListener[BUTTON_EVENT_COUNT][];
     }
     if (typeListeners[(int)type] == null)
     {
         typeListeners[(int)type] = new RoleValueEventListener[CONTROLLER_BUTTON_COUNT];
     }
     if (typeListeners[(int)type][(int)button] == null)
     {
         typeListeners[(int)type][(int)button] = listener;
     }
     else
     {
         typeListeners[(int)type][(int)button] += listener;
     }
 }
Exemple #3
0
 /// <param name="roleType">
 /// Can be DeviceRole, TrackerRole or any other enum type that have ViveRoleEnumAttribute.
 /// Use ViveRole.ValidateViveRoleEnum() to validate role type
 /// </param>
 public static void RemoveListenerEx(Type roleType, int roleValue, ControllerButton button, ButtonEventType eventType, RoleValueEventListener callback)
 {
     GetState(roleType, roleValue).RemoveListener(button, callback, eventType);
 }
Exemple #4
0
 /// <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 AddListenerEx <TRole>(TRole role, ControllerButton button, ButtonEventType eventType, RoleValueEventListener callback)
 {
     GetState(role).AddListener(button, callback, eventType);
 }
Exemple #5
0
 public static void RemoveListener(ViveRoleProperty role, ControllerButton button, RoleValueEventListener callback)
 {
     RemoveListenerEx(role.roleType, role.roleValue, button, ButtonEventType.Press, callback);
 }
 public override void RemoveListener(ControllerButton button, RoleValueEventListener listener, ButtonEventType type = ButtonEventType.Click)
 {
     m_state.RemoveListener(button, listener, type);
 }
 public virtual void RemoveListener(ControllerButton button, RoleValueEventListener listener, ButtonEventType type = ButtonEventType.Click)
 {
 }
 public static void AddListener(ViveRoleProperty role, ControllerButton button, ButtonEventType eventType, RoleValueEventListener callback)
 {
     AddListenerEx(role.roleType, role.roleValue, button, eventType, callback);
 }