Beispiel #1
0
    public void SaveLoadButton()
    {
        int sid = listController.selectedButtonIndex;

        if (sid == -1)
        {
            return;
        }
        if (saveMode)
        {
            submitWindow.SetActive(true);
            submitQuestionText.text = Localization.GetWord(LocalizedWord.Rewrite) + '?';
            submitButtonText.text   = Localization.GetWord(LocalizedWord.Yes);
            rejectButtonText.text   = Localization.GetWord(LocalizedWord.Cancel);
            deleteSubmit            = false;
        }
        else
        {
            bool   ingame = GameMaster.realMaster != null;
            string name   = savenames[sid];
            if (workWithTerrains)
            {// ЗАГРУЗКА  УРОВНЕЙ  ДЛЯ  РЕДАКТОРА
                string fullPath = GetTerrainSaveFullpath(name);
                if (ingame)
                {
                    if (GameMaster.realMaster.LoadTerrain(fullPath))
                    {
                        gameObject.SetActive(false);
                    }
                }
                else
                {
                    // теоретический сценарий, не должен использоваться
                    if (File.Exists(fullPath))
                    {
                        GameMaster.StartNewGame(
                            GameStartSettings.GetEditorStartSettings(name)
                            );
                    }
                    else
                    {
                        PrepareSavesList();
                    }
                }
            }
            else
            {// ЗАГРУЗКА  УРОВНЕЙ  ДЛЯ  ИГРЫ
                string fullPath = GetGameSaveFullpath(name);
                if (ingame)
                {
                    if (GameMaster.realMaster.LoadGame(fullPath))
                    {
                        gameObject.SetActive(false);
                        UIController.GetCurrent().GetMainCanvasController().ChangeActiveWindow(ActiveWindowMode.NoWindow);
                        AnnouncementCanvasController.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.GameLoaded));
                    }
                }
                else
                {
                    if (File.Exists(fullPath))
                    {
                        GameMaster.StartNewGame(
                            GameStartSettings.GetLoadingSettings(GameMode.Survival, name)
                            );
                    }
                    else
                    {
                        PrepareSavesList();
                    }
                }
            }
        }
    }
 public void Editor_Start()
 {
     GameMaster.StartNewGame(GameStartSettings.GetEditorStartSettings(editor_chunkSizeValue));
 }