예제 #1
0
            protected override void UpdateImpl()
            {
                if (modified)
                {
                    textSprite.Update();
                    for (int i = 0; i < textSprite.ChildrenCount; i++)
                    {
                        textSprite[i].Position = new SharpDX.Vector2(400 - textSprite.Width / 2, 225 - (25) * textSprite.ChildrenCount / 2 + i * 25);
                        (textSprite[i] as TextureString).Alpha = menuEnabled[i] ? 1 : 0f;
                    }

                    select.Position = new SharpDX.Vector2(400 - textSprite.Width / 2 - 10, textSprite[currentIndex].Position.Y + 10);
                    modified        = false;
                }

                if (selectCount > 0)
                {
                    select.Position = new SharpDX.Vector2(select.Position.X, AnimationUtility.GetAnimationValue(select.Position.Y, textSprite[currentIndex].Position.Y + 10, 0.2f));
                }
                else
                {
                    select.Hidden = true;
                }
            }
예제 #2
0
파일: MainGame.cs 프로젝트: KHCmaster/PPD
        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
                    });
                }
            }
        }
예제 #3
0
 protected override void Update()
 {
     spriteObject.Update();
 }