public void StageLoad()
        {
            //remove
            StageInit.StageBlockRemove(MainWindow.mainCanvas);
            StageInit.StageObjectsRemove(MainWindow.mainCanvas);
            StageInit.StageEnemyRemove(MainWindow.mainCanvas);
            StageInit.StageItemRemove(MainWindow.mainCanvas);

            StageManager.lstClearCondition.Clear();

            StageInit.InitBlockData();

            //StageData loding of JSONfile.
            StageDataSetting.SetData();
            txkStageName.Text = StageOrder.lstStageOrder[StageManager.stageNum].name;

            StageInit.StageBlockSet(MainWindow.mainCanvas);
            StageManager.StageObjectsSetting(MainWindow.mainCanvas);
        }
예제 #2
0
        public static void GameTransitionController(Canvas canvas, Canvas caLife, Canvas caMana)
        {
            switch (gameTransition)
            {
            case GameTransitionType.Title:

                if (!endSplashLogo)
                {
                    splashLogoPhase = 4;
                    switch (splashLogoPhase)
                    {
                    case 0:

                        if (splashWaitTotal < 1000)
                        {
                            splashWaitTotal += MainWindow.elapsedTime;
                        }
                        else
                        {
                            splashLogoPhase++;
                            splashWaitTotal = 0;
                        }
                        break;

                    case 1:
                        if (screenFadeTotal < 1)
                        {
                            double temp = (double)MainWindow.elapsedTime / 2000;
                            screenFadeTotal += Math.Round(temp, 2);

                            ImageData.imgTitle[0].Opacity = screenFadeTotal;
                        }
                        else
                        {
                            ImageData.imgTitle[0].Opacity = 1;
                            splashLogoPhase++;
                        }
                        break;

                    case 2:

                        if (splashWaitTotal < 2000)
                        {
                            splashWaitTotal += MainWindow.elapsedTime;
                        }
                        else
                        {
                            splashLogoPhase++;
                            splashWaitTotal = 0;
                        }
                        break;

                    case 3:
                        if (screenFadeTotal > 0)
                        {
                            double temp = (double)MainWindow.elapsedTime / 2000;
                            screenFadeTotal -= Math.Round(temp, 2);

                            ImageData.imgTitle[0].Opacity = screenFadeTotal;
                        }
                        else
                        {
                            ImageData.imgTitle[0].Opacity = 0;
                            splashLogoPhase++;
                        }
                        break;

                    case 4:
                        if (splashWaitTotal < 1000)
                        {
                            splashWaitTotal += MainWindow.elapsedTime;
                        }
                        else
                        {
                            endSplashLogo   = true;
                            screenFadeTotal = 0;

                            Sound.SoundBgmSelector(BgmName.Opening);
                            Sound.bgm.Play();

                            MainWindow.TitleOpen(canvas);
                        }
                        break;
                    }
                }
                else
                {
                    MainWindow.countTime += MainWindow.elapsedTime;

                    if (MainWindow.countTime >= 1000)
                    {
                        MainWindow.titleStrSwitch = !MainWindow.titleStrSwitch;
                        MainWindow.countTime      = 0;

                        if (!MainWindow.titleStrSwitch)
                        {
                            ImageData.imgTitle[1].Visibility = Visibility.Hidden;
                        }
                        else
                        {
                            ImageData.imgTitle[1].Visibility = Visibility.Visible;
                        }
                    }
                }

                break;

            case GameTransitionType.StageInit:

                StageInit.InitBlockData();
                StageDataSetting.SetData();

                StageInit.StageBlockSet(canvas);
                StageManager.StageObjectsSetting(canvas);

                MainWindow.lblMode.Content = "ゲームモード:ステージ開始";
                gameTransition             = GameTransitionType.StageStart;

                break;

            case GameTransitionType.StageStart:

                if (!eventStart)
                {
                    duringTransition = true;

                    StageEvent.InitEvent();
                    eventCount = 0;
                    eventStart = true;
                }

                break;

            case GameTransitionType.StageDuring:

                if (StageManager.StageClearCheck())
                {
                    gameTransition             = GameTransitionType.StageEnd;
                    MainWindow.lblMode.Content = "ゲームモード:ステージ終了";
                }
                else
                {
                    if (growthEnemy)
                    {
                        SpawnEnemy.SpawnSelect(canvas, "");
                        growthEnemy = false;
                    }
                }

                break;

            case GameTransitionType.StageEnd:

                if (!eventStart)
                {
                    duringTransition = true;
                    eventStart       = true;
                }

                break;

            case GameTransitionType.StageNext:

                if (!stageTestPlay)
                {
                    StageManager.stageNum++;
                    if (StageManager.stageNum >= StageOrder.lstStageOrder.Count)
                    {
                        MainWindow.timerFrameUpdate.Stop();

                        MessageBox.Show("すべてのステージが終わりました。ゲームを終了します。", "ゲームの終了", MessageBoxButton.OK, MessageBoxImage.Information);

                        Application.Current.Shutdown();
                    }

                    StageInit.StageBlockRemove(canvas);
                    StageInit.StageObjectsRemove(canvas);
                    StageInit.StageEnemyRemove(canvas);
                    growthEnemy = false;
                    StageInit.StageItemRemove(canvas);
                    MainWindow.canScreenFade.Visibility = Visibility.Hidden;

                    StageManager.lstClearCondition.Clear();
                    StageManager.clearFlag = false;

                    MainWindow.lblMode.Content = "ゲームモード:ステージ準備";
                    gameTransition             = GameTransitionType.StageInit;
                }
                else
                {
                    MainWindow.timerFrameUpdate.Stop();
                    gameTransition         = GameTransitionType.EditMode;
                    stageTestPlay          = false;
                    StageManager.clearFlag = false;
                    MainWindow.canScreenFade.Visibility = Visibility.Hidden;

                    MainWindow.stageEditor.StageLoad();

                    MainWindow.stageEditor.StageEditorDataSetting();
                    StageEditorOperator.EditorPlayerPaletteSetting();

                    MainWindow.stageEditor.tbcEditSelect.IsEnabled       = true;
                    MainWindow.stageEditor.btnStageNumDecrease.IsEnabled = true;
                    MainWindow.stageEditor.btnStageNumIncrease.IsEnabled = true;
                    MainWindow.stageEditor.btnStageOrder.IsEnabled       = true;
                    MainWindow.stageEditor.btnStageTestPlay.IsEnabled    = true;
                    MainWindow.stageEditor.btnEventWindowOpen.IsEnabled  = true;
                }

                break;

            case GameTransitionType.EditMode:

                break;
            }
        }