public void OnGUI() { EditorGUILayout.BeginVertical(); GUILayout.Label(_QuestionText, _WordWrapStyle, GUILayout.ExpandWidth(true)); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.Space(10); if (GUILayout.Button("Yes")) { OnConfirm?.Invoke(); OnButton?.Invoke(true); Close(); } GUILayout.Space(10); if (GUILayout.Button("No")) { OnButton?.Invoke(false); Close(); } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(10); EditorGUILayout.EndVertical(); }
public void RemoveButtonCall(int player, string action, OnButton callback) { int actionInd = GetActionIndex(action); if (actionInd != -1) { RemoveButtonCall(player, actionInd, callback); } }
public void RemoveButtonCall(int player, int action, OnButton callback) { if (action < mBinds.Length && player < mBinds[action].players.Length) { PlayerData pd = mBinds[action].players[player]; mButtonCallSetQueue[mButtonCallSetQueueCount] = new ButtonCallSetData() { pd = pd, cb = callback, add = false }; mButtonCallSetQueueCount++; } }
public void CheckInput() { if (Input.GetButtonDown(ButtonName)) { OnButtonDown?.Invoke(); } if (Input.GetButtonUp(ButtonName)) { OnButtonUp?.Invoke(); } if (Input.GetButton(ButtonName)) { OnButton?.Invoke(); } }
public void RemoveButtonCall(OnButton callback) { for (int i = 0; i < mBinds.Length; i++) { for (int j = 0; j < mBinds[i].players.Length; j++) { PlayerData pd = mBinds[i].players[j]; if (pd.callback == callback) { mButtonCallSetQueue[mButtonCallSetQueueCount] = new ButtonCallSetData() { pd = pd, cb = callback, add = false }; mButtonCallSetQueueCount++; } } } }
public void PointerEnter() { OnButton.Play(); }
public void ExitAll() { gazedBtn = OnButton.NONE; }
public void EnterExit() { gazedBtn = OnButton.EXIT; }
public void EnterDown() { gazedBtn = OnButton.DOWN; }
public void EnterUp() { gazedBtn = OnButton.UP; }
public void EnterRight() { gazedBtn = OnButton.RIGHT; }
public void EnterLeft() { gazedBtn = OnButton.LEFT; }
//Private Methods void Awake() { gazedBtn = OnButton.NONE; }
private void OnWindowButtonPress(WindowHandle *window, Keys key, int scanCode, InputAction action, KeyModifiers mods) => OnButton?.Invoke(key, action, mods);
private void Update() { if (SDL_Installed && !SDL_Initialized) { InitSDL(); } if (!SDL_Initialized) { return; } SDL.SDL_Event e; while (SDL.SDL_PollEvent(out e) > 0) { switch (e.type) { case SDL.SDL_EventType.SDL_KEYDOWN: OnKey?.Invoke(e, true); break; case SDL.SDL_EventType.SDL_KEYUP: OnKey?.Invoke(e, false); break; case SDL.SDL_EventType.SDL_CONTROLLERAXISMOTION: OnAxisMotion?.Invoke(e); break; case SDL.SDL_EventType.SDL_CONTROLLERBUTTONDOWN: OnButton?.Invoke(e, true); break; case SDL.SDL_EventType.SDL_CONTROLLERBUTTONUP: OnButton?.Invoke(e, false); break; case SDL.SDL_EventType.SDL_CONTROLLERDEVICEADDED: Controller.AddDevice(e.cdevice.which); OnDeviceAdded?.Invoke(e); break; case SDL.SDL_EventType.SDL_CONTROLLERDEVICEREMOVED: Controller.RemoveDisconnected(); OnDeviceRemoved?.Invoke(e); break; case SDL.SDL_EventType.SDL_CONTROLLERDEVICEREMAPPED: OnDeviceRemapped?.Invoke(e); break; case SDL.SDL_EventType.SDL_JOYAXISMOTION: OnAxisMotion?.Invoke(e); break; case SDL.SDL_EventType.SDL_JOYBALLMOTION: OnBallMotion?.Invoke(e); break; case SDL.SDL_EventType.SDL_JOYHATMOTION: OnHatMotion?.Invoke(e); break; case SDL.SDL_EventType.SDL_JOYBUTTONDOWN: OnButton?.Invoke(e, true); break; case SDL.SDL_EventType.SDL_JOYBUTTONUP: OnButton?.Invoke(e, false); break; case SDL.SDL_EventType.SDL_JOYDEVICEADDED: Controller.AddDevice(e.jdevice.which); OnDeviceAdded?.Invoke(e); break; case SDL.SDL_EventType.SDL_JOYDEVICEREMOVED: Controller.RemoveDisconnected(); OnDeviceRemoved?.Invoke(e); break; default: break; } } }
public void RemoveButtonCall(InputAction action, OnButton callback) { mBinds[(int)action].callback -= callback; }
public void AddButtonCall(InputAction action, OnButton callback) { mBinds[(int)action].callback += callback; }