コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: InputManager.cs プロジェクト: WangWeiNing/MateUnity
        public void RemoveButtonCall(int player, string action, OnButton callback)
        {
            int actionInd = GetActionIndex(action);

            if (actionInd != -1)
            {
                RemoveButtonCall(player, actionInd, callback);
            }
        }
コード例 #3
0
ファイル: InputManager.cs プロジェクト: WangWeiNing/MateUnity
        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++;
            }
        }
コード例 #4
0
 public void CheckInput()
 {
     if (Input.GetButtonDown(ButtonName))
     {
         OnButtonDown?.Invoke();
     }
     if (Input.GetButtonUp(ButtonName))
     {
         OnButtonUp?.Invoke();
     }
     if (Input.GetButton(ButtonName))
     {
         OnButton?.Invoke();
     }
 }
コード例 #5
0
ファイル: InputManager.cs プロジェクト: WangWeiNing/MateUnity
 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++;
             }
         }
     }
 }
コード例 #6
0
 public void PointerEnter()
 {
     OnButton.Play();
 }
コード例 #7
0
 public void ExitAll()
 {
     gazedBtn = OnButton.NONE;
 }
コード例 #8
0
 public void EnterExit()
 {
     gazedBtn = OnButton.EXIT;
 }
コード例 #9
0
 public void EnterDown()
 {
     gazedBtn = OnButton.DOWN;
 }
コード例 #10
0
 public void EnterUp()
 {
     gazedBtn = OnButton.UP;
 }
コード例 #11
0
 public void EnterRight()
 {
     gazedBtn = OnButton.RIGHT;
 }
コード例 #12
0
 public void EnterLeft()
 {
     gazedBtn = OnButton.LEFT;
 }
コード例 #13
0
    //Private Methods

    void Awake()
    {
        gazedBtn = OnButton.NONE;
    }
コード例 #14
0
 private void OnWindowButtonPress(WindowHandle *window, Keys key, int scanCode, InputAction action, KeyModifiers mods)
 => OnButton?.Invoke(key, action, mods);
コード例 #15
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;
                }
            }
        }
コード例 #16
0
 public void RemoveButtonCall(InputAction action, OnButton callback)
 {
     mBinds[(int)action].callback -= callback;
 }
コード例 #17
0
 public void AddButtonCall(InputAction action, OnButton callback)
 {
     mBinds[(int)action].callback += callback;
 }