Exemple #1
0
    public void Configure(List <string> arguments)
    {
        try
        {
            if (arguments.Count < 1)
            {
                string message = "The command '<color=" + ConsoleConfiguration.HighlightColour + ">configure default-maze</color>' needs an additional argument with the name of the level that should be the new default.json";

                message += ConfigureCommand.GetConfigurableArguments();
                throw new NotEnoughArgumentsConsoleException(message);
            }

            string sanatisedLevelName = arguments[0].ToLower().Replace(" ", "-");

            bool levelExists = MazeLevelLoader.MazeLevelExists(sanatisedLevelName);

            if (!levelExists)
            {
                string message = $"Could not find a maze level with the name {sanatisedLevelName}.";
                throw new CouldNotFindMazeLevelConsoleException(message);
            }

            MazeLevelLoader.ReplaceMazeLevel(sanatisedLevelName, "default");

            Console.Instance.PrintToReportText($"{sanatisedLevelName} is now the default maze level.");
        }
        catch (System.Exception)
        {
            throw;
        }
    }
    public void LoadMaze()
    {
        Logger.Log("Load maze (in editor)");
        if (string.IsNullOrWhiteSpace(_mazeName))
        {
            Logger.Warning(Logger.Datawriting, "In order to save the maze level, please fill in a maze name");
            return;
        }

        bool mazeLevelNameExists = MazeLevelLoader.MazeLevelExists(_mazeName);

        if (mazeLevelNameExists)
        {
            MazeLevelGameplayManager.Instance.UnloadLevel();

            MazeLevelData mazeLevelData = MazeLevelLoader.LoadMazeLevelData(_mazeName);
            MazeLevelLoader.LoadMazeLevelForEditor(mazeLevelData);
        }

        EditorSelectedMazeTileModifierContainer selectedTileModifierContainer = EditorCanvasUI.Instance.SelectedTileModifierContainer as EditorSelectedMazeTileModifierContainer;

        selectedTileModifierContainer?.SetInitialModifierValues();

        EditorMazeTileModificationPanel.Instance?.Reset();
        EditorMazeTileModificationPanel.Instance?.DestroyModifierActions();
    }
    private MazeLevelData GetMazeLevelData(string sanatisedLevelName)
    {
        bool levelExists = MazeLevelLoader.MazeLevelExists(sanatisedLevelName);

        if (!levelExists)
        {
            string message = $"Could not find a maze level with the name '<color={sanatisedLevelName}>info maze</color>'.\n";
            throw new MazeLevelNameNotFoundConsoleException(message);
        }

        MazeLevelData mazeLevelData = MazeLevelLoader.LoadMazeLevelData(sanatisedLevelName);

        return(mazeLevelData);
    }