コード例 #1
0
    public static GameStartSettings GetEditorStartSettings(byte i_size)
    {
        var cgs = new GameStartSettings();

        cgs.gameMode = GameMode.Editor;
        cgs.chunkGenerationSettings = ChunkGenerationSettings.GetGenerationSettings(ChunkGenerationMode.EditorPreset, i_size);
        return(cgs);
    }
コード例 #2
0
    public void StartGame()
    {
        ChunkGenerationSettings cgs = null;

        switch (chunkPrepareAction)
        {
        case ChunkPreparingAction.Generate: cgs = ChunkGenerationSettings.GetGenerationSettings(chunkGenerationMode, (byte)sizeSlider.value); break;

        case ChunkPreparingAction.Load: cgs = ChunkGenerationSettings.GetLoadingSettings(selectedSaveName); break;

        default: cgs = ChunkGenerationSettings.GetNoActionSettings(); break;
        }
        //

        //
        switch (selectedGameMode)
        {
        case GameMode.Survival:
        {
            if (GameConstants.NeedTutorialNote())
            {
                askWindowText.text   = Localization.GetPhrase(LocalizedPhrase.AskNeedTutorial);
                askWindow_left.text  = Localization.GetWord(LocalizedWord.Tutorial);
                askWindow_leftAction = () => {
                    GameMaster.StartNewGame(GameStartSettings.GetTutorialSettings());
                    askWindow.SetActive(false);
                };
                askWindow_right.text  = Localization.GetWord(LocalizedWord.Cancel);
                askWindow_rightAction = () =>
                {
                    GameConstants.DisableTutorialNote();
                    this.StartGame();
                    askWindow.SetActive(false);
                };
                askWindow.SetActive(true);
                return;
            }
            //
            GameMaster.StartNewGame(
                GameStartSettings.GetStartSettings(GameMode.Survival, cgs, (Difficulty)difficultyDropdown.value, StartFoundingType.Zeppelin)
                );
            break;
        }

        case GameMode.Editor:
        {
            GameMaster.StartNewGame(
                GameStartSettings.GetStartSettings(GameMode.Editor, cgs, (Difficulty)difficultyDropdown.value, StartFoundingType.Zeppelin)
                );
            break;
        }

        case GameMode.Scenario:
        {
            if (ng_selectedScenarioIndex != -1)
            {
                GameMaster.StartNewGame(
                    scenariosRepresentators[ng_selectedScenarioIndex].GetStartSettings()
                    );
            }
            break;
        }
        }
    }