Ejemplo n.º 1
0
 public override bool IsReleased(ButtonType buttonType)
 {
     if (IsNormalButton(buttonType) && inputManager.IsDisabled((MarkType)buttonType))
     {
         return(false);
     }
     return(inputInfo.IsReleased(buttonType));
 }
Ejemplo n.º 2
0
 public override bool IsReleased(ButtonType buttonType)
 {
     if (buttonType > ButtonType.L)
     {
         return(baseInputInfo.IsReleased(buttonType));
     }
     return(released[(int)buttonType]);
 }
Ejemplo n.º 3
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.º 4
0
 /// <summary>
 /// 離されたかどうかを取得します。
 /// </summary>
 /// <param name="buttonType"></param>
 /// <returns></returns>
 public override bool IsReleased(ButtonType buttonType)
 {
     return(baseInputInfo.IsReleased(buttonType));
 }
Ejemplo n.º 5
0
        public override void Update(InputInfoBase inputInfo, MouseInfo mouseInfo)
        {
            ProcessNetworkData();
            if (fadeOut)
            {
                if (black.Alpha >= 1)
                {
                    black.Alpha = 1;
                    switch (fadeOutAction)
                    {
                    case FadeOutAction.WaitFinish:
                        waitFinishCount++;
                        if (waitFinishCount % 10 == 9)
                        {
                            client.Write(MessagePackSerializer.Serialize(new SendResultNetworkData
                            {
                                Result = new Result
                                {
                                    Score      = mainGameComponent.Score,
                                    CoolCount  = mainGameComponent.CoolCount,
                                    GoodCount  = mainGameComponent.GoodCount,
                                    SafeCount  = mainGameComponent.SafeCount,
                                    SadCount   = mainGameComponent.SadCount,
                                    WorstCount = mainGameComponent.WorstCount,
                                    MaxCombo   = mainGameComponent.MaxCombo
                                }
                            }));
                        }
                        break;

                    case FadeOutAction.SendNetworkData:
                        client.Write(MessagePackSerializer.Serialize(new SendResultNetworkData
                        {
                            Result = new Result
                            {
                                Score      = mainGameComponent.Score,
                                CoolCount  = mainGameComponent.CoolCount,
                                GoodCount  = mainGameComponent.GoodCount,
                                SafeCount  = mainGameComponent.SafeCount,
                                SadCount   = mainGameComponent.SadCount,
                                WorstCount = mainGameComponent.WorstCount,
                                MaxCombo   = mainGameComponent.MaxCombo
                            }
                        }));
                        fadeOutAction = FadeOutAction.WaitFinish;
                        break;
                    }
                }
                else
                {
                    black.Alpha += 0.05f;
                    if (black.Alpha >= 1)
                    {
                        black.Alpha = 1;
                    }
                }
            }

            userScoreListComponent.Update();
            if (ready)
            {
                if (!paused)
                {
                    int lastWorstCount = mainGameComponent.GameResultManager.WorstCount;
                    mainGameComponent.Update(inputInfo, mouseInfo);

                    if (gameRule.ItemAvailable && gameRule.ItemSupplyType == ItemSupplyType.ComboWorstCount)
                    {
                        int currentWorstCount = mainGameComponent.GameResultManager.WorstCount;
                        int count             = currentWorstCount / gameRule.ItemSupplyWorstCount - lastWorstCount / gameRule.ItemSupplyWorstCount;
                        for (int i = 0; i < count; i++)
                        {
                            itemOverrayComponent.AddItem(lastMarkPos);
                        }
                    }
                }
            }

            if (paused)
            {
                if (pauseMenu != null)
                {
                    pauseMenu.Update(inputInfo);
                }
            }
            else
            {
                if (lastStartPressCount >= 60)
                {
                    paused |= pauseMenu != null;
                }

                if (inputInfo.IsReleased(ButtonType.Start) && lastStartPressCount < 60)
                {
                    if (itemManagerComponent.CanUse)
                    {
                        UseItem(itemManagerComponent.Use());
                    }
                }
            }

            foreach (ItemUseEventArgs args in itemManagerComponent.EnumerateItem())
            {
                if (ItemUseManager.Manager.IsAutoUse(args.ItemType))
                {
                    UseItem(args.ItemType);
                    args.Use = true;
                }
            }

            itemManagerComponent.Update();
            itemOverrayComponent.Update();
            config.Update();
            filterSprite.Update();
            base.Update();
            CheckChange();
            lastStartPressCount = inputInfo.GetPressingFrame(ButtonType.Start);
            if (expansionClient != null)
            {
                var currentTime = mainGameComponent.MoviePosition;
                expansionClient.Send(new UpdateInfo
                {
                    Score       = mainGameComponent.Score,
                    PlayerId    = selfUser.ID,
                    CurrentTime = currentTime,
                    Life        = mainGameComponent.GameResultManager.CurrentLife,
                    CoolCount   = mainGameComponent.CoolCount,
                    GoodCount   = mainGameComponent.GoodCount,
                    SafeCount   = mainGameComponent.SafeCount,
                    SadCount    = mainGameComponent.SadCount,
                    WorstCount  = mainGameComponent.WorstCount,
                    MaxCombo    = mainGameComponent.MaxCombo
                });
                foreach (var user in userPlayStateList)
                {
                    expansionClient.Send(new UpdateInfo
                    {
                        Score       = user.Score,
                        PlayerId    = user.User.ID,
                        CurrentTime = currentTime,
                        Life        = user.Life
                    });
                }
            }
        }