コード例 #1
0
    // Select a component for editing
    public static void SelectComponent(string name)
    {
        Game            game = Game.Get();
        QuestEditorData qed  = game.qed;

        // Quest is a special component
        if (name.Equals("Quest"))
        {
            SelectQuest();
            return;
        }
        // These are special strings for creating new objects
        if (name.Equals("{NEW:Tile}"))
        {
            qed.NewTile();
            return;
        }
        if (name.Equals("{NEW:Door}"))
        {
            qed.NewDoor();
            return;
        }
        if (name.Equals("{NEW:Token}"))
        {
            qed.NewToken();
            return;
        }
        if (name.Equals("{NEW:Monster}"))
        {
            qed.NewMonster();
            return;
        }
        if (name.Equals("{NEW:MPlace}"))
        {
            qed.NewMPlace();
            return;
        }
        if (name.Equals("{NEW:Item}"))
        {
            qed.NewItem();
            return;
        }
        if (name.Equals("{NEW:UniqueMonster}"))
        {
            qed.NewUniqueMonster();
            return;
        }
        if (name.Equals("{NEW:Activation}"))
        {
            qed.NewActivation();
            return;
        }
        if (name.Equals("{NEW:Event}"))
        {
            qed.NewEvent();
            return;
        }
        if (name.Equals("{NEW:Puzzle}"))
        {
            qed.NewPuzzle();
            return;
        }
        // This may happen to due rename/delete
        if (!game.quest.qd.components.ContainsKey(name))
        {
            SelectQuest();
        }

        // Determine the component type and select
        if (game.quest.qd.components[name] is QuestData.Tile)
        {
            SelectAsTile(name);
            return;
        }

        if (game.quest.qd.components[name] is QuestData.Door)
        {
            SelectAsDoor(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.Token)
        {
            SelectAsToken(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.Monster)
        {
            SelectAsMonster(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.MPlace)
        {
            SelectAsMPlace(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.Puzzle)
        {
            SelectAsPuzzle(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.Item)
        {
            SelectAsItem(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.UniqueMonster)
        {
            SelectAsUniqueMonster(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.Activation)
        {
            SelectAsActivation(name);
            return;
        }
        if (game.quest.qd.components[name] is QuestData.Event)
        {
            SelectAsEvent(name);
            return;
        }
    }