Ejemplo n.º 1
0
 public override void Update(InputInfoBase inputInfo, MouseInfo mouseInfo)
 {
     base.Update(inputInfo, mouseInfo);
     if (inputInfo.IsPressed(ButtonType.R))
     {
         testSceneManager.Next(this);
     }
     else if (inputInfo.IsPressed(ButtonType.L))
     {
         testSceneManager.Previous(this);
     }
     base.Update();
 }
Ejemplo n.º 2
0
 public override bool IsPressed(ButtonType buttonType)
 {
     if (IsNormalButton(buttonType) && inputManager.IsDisabled((MarkType)buttonType))
     {
         return(false);
     }
     return(inputInfo.IsPressed(buttonType));
 }
Ejemplo n.º 3
0
 public override bool IsPressed(ButtonType buttonType)
 {
     if (buttonType > ButtonType.L)
     {
         return(baseInputInfo.IsPressed(buttonType));
     }
     return(pressed[(int)buttonType]);
 }
Ejemplo n.º 4
0
 public override void Update(InputInfoBase inputInfo)
 {
     if (Disposed)
     {
         return;
     }
     if (inputInfo.IsPressed(ButtonType.Up))
     {
         ChangePauseType(-1);
         Sound.Play(PPDSetting.DefaultSounds[0], -1000);
     }
     else if (inputInfo.IsPressed(ButtonType.Down))
     {
         ChangePauseType(1);
         Sound.Play(PPDSetting.DefaultSounds[0], -1000);
     }
     else if (inputInfo.IsPressed(ButtonType.Cross) || inputInfo.IsPressed(ButtonType.Start))
     {
         // 再開
         if (Resumed != null)
         {
             Resumed.Invoke(this, EventArgs.Empty);
         }
     }
     else if (inputInfo.IsPressed(ButtonType.Circle))
     {
         // 再開
         if (pausetype == PauseType.Resume)
         {
             if (Resumed != null)
             {
                 Resumed.Invoke(this, EventArgs.Empty);
             }
         }
         // リターン
         else if (pausetype == PauseType.Return)
         {
             if (Returned != null)
             {
                 Returned.Invoke(this, EventArgs.Empty);
             }
         }
     }
     base.Update();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 押されたかどうかを取得します。
 /// </summary>
 /// <param name="buttonType"></param>
 /// <returns></returns>
 public override bool IsPressed(ButtonType buttonType)
 {
     if (buttonType == ButtonType.Right || buttonType == ButtonType.Left ||
         buttonType == ButtonType.R || buttonType == ButtonType.L)
     {
         var pressCount = baseInputInfo.GetPressingFrame(buttonType);
         if (pressCount % 5 == 4 && pressCount > 20)
         {
             return(true);
         }
     }
     return(baseInputInfo.IsPressed(buttonType));
 }
Ejemplo n.º 6
0
        private void WorkImpl()
        {
            while (!finish)
            {
                if (!loaded || keys == null || buttons == null)
                {
                    continue;
                }

                InputInfoBase inputInfo = null;
                bool          result    = false;
#if DEBUG
                if (Form.ActiveForm == window)
                {
#endif
                lock (settingLock)
                {
                    result = base.GetInput(keys, buttons, CurrentJoyStickIndex, out inputInfo);
                }
#if DEBUG
            }
#endif
                if (result)
                {
                    double time = (double)stopwatch.ElapsedTicks / Stopwatch.Frequency;
                    foreach (ButtonType buttonType in ButtonUtility.Array)
                    {
                        if (inputInfo.IsPressed(buttonType))
                        {
                            var action = new InputAction(buttonType, time, true, stopwatch);
                            lock (queue)
                            {
                                queue.Enqueue(action);
                            }
                            lock (lastPressInfos)
                            {
                                lastPressInfos[buttonType] = action;
                            }
                        }
                        if (inputInfo.IsReleased(buttonType))
                        {
                            lock (queue)
                            {
                                queue.Enqueue(new InputAction(buttonType, time, false, stopwatch));
                            }
                            lock (lastPressInfos)
                            {
                                if (lastPressInfos.ContainsKey(buttonType))
                                {
                                    lastPressInfos.Remove(buttonType);
                                }
                            }
                        }
                    }
                }
                if (sleepTime > 0)
                {
                    Thread.Sleep(sleepTime);
                }
            }
        }
Ejemplo n.º 7
0
        protected override void Update()
        {
            if (input.AssignMode)
            {
                ignoreInputCount = 0;
            }
            else
            {
                ignoreInputCount++;
                if (ignoreInputCount >= 60)
                {
                    ignoreInputCount = 60;
                }
            }

            var           mouseInfo = mouseManager.GetMouseEvents();
            InputInfoBase inputInfo = null;

            if (IsWindowActive)
            {
                input.GetInput(KeyConfigManager.CurrentConfig.Keys,
                               KeyConfigManager.CurrentConfig.Buttons, out inputInfo);
            }
            if (inputInfo == null)
            {
                inputInfo = EmptyInputInfo.Instance;
            }
            if (ignoreInputCount < 30)
            {
                inputInfo = EmptyInputInfo.Instance;
            }

            if (Form.IsCloseRequired && debugMode && !TextBoxEnabled)
            {
                Exit();
            }

            if (!Form.IsCloseRequired && inputInfo.IsPressed(ButtonType.Home) && !Input.AssignMode && !TextBoxEnabled)
            {
                Form.MainForm.Close();
            }

            if (!Form.IsFirstCloseRequierd && inputInfo.IsPressed(ButtonType.Home))
            {
                CancelExit();
            }

            if (sceneManager != null)
            {
                if (!Form.IsCloseRequired)
                {
                    gaussianFilter.Disperson = 0;
                    sceneManager.Update(inputInfo, mouseInfo, sound);
                }
                else
                {
                    sceneManager.Update(EmptyInputInfo.Instance, MouseInfo.Empty, sound);
                    if (currentOverray != null)
                    {
                        currentOverray.Update(Form.IsFirstCloseRequierd, inputInfo, mouseInfo);
                    }
                    gaussianFilter.Disperson += 1;
                    if (gaussianFilter.Disperson >= 100)
                    {
                        gaussianFilter.Disperson = 100;
                    }
                    Form.IsFirstCloseRequierd = false;
                }
            }

            if (goHome)
            {
                sceneManager.PopToHome();
                goHome = false;
                isHome = true;
                CancelExit();

                if (!debugMode)
                {
                    (sceneManager.CurrentScene as HomeScene).ComeHome();
                }
            }

            notifyControl.Update();
            movieVolumeSprite.Update(mouseInfo);
            timerManager.Update();
            ThreadManager.Instance.Update();
        }