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 CheckInput()
 {
     if (Input.GetButtonDown(ButtonName))
     {
         OnButtonDown?.Invoke();
     }
     if (Input.GetButtonUp(ButtonName))
     {
         OnButtonUp?.Invoke();
     }
     if (Input.GetButton(ButtonName))
     {
         OnButton?.Invoke();
     }
 }
예제 #3
0
        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;
                }
            }
        }
예제 #4
0
 private void OnWindowButtonPress(WindowHandle *window, Keys key, int scanCode, InputAction action, KeyModifiers mods)
 => OnButton?.Invoke(key, action, mods);