Esempio n. 1
0
    override public void Update()
    {
        base.Update();
        CameraController.SetCamera(monsterComponent.location);
        Game game = Game.Get();

        TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(3, 1), CommonStringKeys.SPAWN, delegate { QuestEditorData.TypeSelect(); });

        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize  = UIScaler.GetSmallFont();
        tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight;
        tb.ApplyTag("editor");

        tb = new TextButton(new Vector2(3, 0), new Vector2(16, 1),
                            new StringKey(name.Substring("Spawn".Length), false), delegate { QuestEditorData.ListSpawn(); });
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize  = UIScaler.GetSmallFont();
        tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft;
        tb.ApplyTag("editor");

        tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); });
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        int       offset = 1;
        DialogBox db     = null;

        for (int heroes = 2; heroes < 5; heroes++)
        {
            int h = heroes;
            db = new DialogBox(new Vector2(0, offset), new Vector2(5, 1), new StringKey("val", "NUMBER_HEROS", new StringKey(heroes.ToString(), false)));
            db.ApplyTag("editor");

            tb = new TextButton(new Vector2(19, offset++), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { MonsterPlaceAdd(h); }, Color.green);
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
            tb.ApplyTag("editor");

            for (int i = 0; i < 8; i++)
            {
                if (monsterComponent.placement[heroes].Length > i)
                {
                    int    mSlot = i;
                    string place = monsterComponent.placement[heroes][i];

                    tb = new TextButton(new Vector2(0, offset), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { MonsterPlaceRemove(h, mSlot); }, Color.red);
                    tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                    tb.ApplyTag("editor");

                    tb = new TextButton(new Vector2(1, offset), new Vector2(19, 1), new StringKey(place, false), delegate { QuestEditorData.SelectComponent(place); });
                    tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                    tb.ApplyTag("editor");
                }
                offset++;
            }
        }

        game.tokenBoard.AddHighlight(monsterComponent.location, "MonsterLoc", "editor");
    }
    override public void Update()
    {
        base.Update();
        CameraController.SetCamera(spawnComponent.location);
        Game game = Game.Get();

        TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(3, 1), CommonStringKeys.SPAWN, delegate { QuestEditorData.TypeSelect(); });

        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize  = UIScaler.GetSmallFont();
        tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleRight;
        tb.ApplyTag("editor");

        tb = new TextButton(new Vector2(3, 0), new Vector2(16, 1),
                            new StringKey(null, name.Substring("Spawn".Length), false), delegate { QuestEditorData.ListSpawn(); });
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize  = UIScaler.GetSmallFont();
        tb.button.GetComponent <UnityEngine.UI.Text>().alignment = TextAnchor.MiddleLeft;
        tb.ApplyTag("editor");

        tb = new TextButton(new Vector2(19, 0), new Vector2(1, 1), CommonStringKeys.E, delegate { Rename(); });
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");


        DialogBox db = new DialogBox(new Vector2(0, 2), new Vector2(4, 1), CommonStringKeys.POSITION);

        db.ApplyTag("editor");

        tb = new TextButton(new Vector2(4, 2), new Vector2(1, 1), CommonStringKeys.POSITION_SNAP, delegate { GetPosition(); });
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        tb = new TextButton(new Vector2(5, 2), new Vector2(1, 1), CommonStringKeys.POSITION_FREE, delegate { GetPosition(false); });
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        if (!spawnComponent.locationSpecified)
        {
            tb = new TextButton(new Vector2(7, 2), new Vector2(4, 1), POSITION_TYPE_UNUSED, delegate { PositionTypeCycle(); });
        }
        else
        {
            tb = new TextButton(new Vector2(7, 2), new Vector2(4, 1), POSITION_TYPE_HIGHLIGHT, delegate { PositionTypeCycle(); });
        }
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        tb = new TextButton(new Vector2(0, 4), new Vector2(8, 1), CommonStringKeys.EVENT, delegate { QuestEditorData.SelectAsEvent(name); });
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        db = new DialogBox(new Vector2(4, 6), new Vector2(3, 1), new StringKey("val", "X_COLON", HEALTH));
        db.ApplyTag("editor");

        // Dumbers dont need translation
        healthDBE = new DialogBoxEditable(new Vector2(7, 6), new Vector2(3, 1),
                                          spawnComponent.uniqueHealthBase.ToString(), delegate { UpdateHealth(); });
        healthDBE.ApplyTag("editor");
        healthDBE.AddBorder();

        db = new DialogBox(new Vector2(10, 6), new Vector2(7, 1), new StringKey("val", "X_COLON", HEALTH_HERO));
        db.ApplyTag("editor");

        // Numbers dont need translation
        healthHeroDBE = new DialogBoxEditable(new Vector2(17, 6), new Vector2(3, 1),
                                              spawnComponent.uniqueHealthHero.ToString(), delegate { UpdateHealthHero(); });
        healthHeroDBE.ApplyTag("editor");
        healthHeroDBE.AddBorder();

        if (game.gameType is D2EGameType)
        {
            tb = new TextButton(
                new Vector2(12, 4), new Vector2(8, 1),
                CommonStringKeys.PLACEMENT,
                delegate { QuestEditorData.SelectAsSpawnPlacement(name); });
            tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
            tb.ApplyTag("editor");

            if (spawnComponent.unique)
            {
                tb = new TextButton(new Vector2(0, 6), new Vector2(4, 1), MONSTER_UNIQUE, delegate { UniqueToggle(); });
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");

                db = new DialogBox(new Vector2(0, 8), new Vector2(5, 1), new StringKey("val", "X_COLON", UNIQUE_TITLE));
                db.ApplyTag("editor");

                uniqueTitleDBE = new DialogBoxEditable(
                    new Vector2(5, 8), new Vector2(15, 1),
                    spawnComponent.uniqueTitle.Translate(),
                    delegate { UpdateUniqueTitle(); });
                uniqueTitleDBE.ApplyTag("editor");
                uniqueTitleDBE.AddBorder();

                db = new DialogBox(new Vector2(0, 10), new Vector2(20, 1), new StringKey("val", "X_COLON", UNIQUE_INFO));
                db.ApplyTag("editor");

                uniqueTextDBE = new DialogBoxEditable(
                    new Vector2(0, 11), new Vector2(20, 8),
                    spawnComponent.uniqueText.Translate(),
                    delegate { UpdateUniqueText(); });
                uniqueTextDBE.ApplyTag("editor");
                uniqueTextDBE.AddBorder();
            }
            else
            {
                tb = new TextButton(new Vector2(0, 6), new Vector2(4, 1), MONSTER_NORMAL, delegate { UniqueToggle(); });
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");
            }
        }

        db = new DialogBox(new Vector2(0, 20), new Vector2(3, 1), new StringKey("val", "X_COLON", TYPES));
        db.ApplyTag("editor");

        tb = new TextButton(new Vector2(12, 20), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { MonsterTypeAdd(0); }, Color.green);
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        int i = 0;

        for (i = 0; i < 8; i++)
        {
            if (spawnComponent.mTypes.Length > i)
            {
                int    mSlot = i;
                string mName = spawnComponent.mTypes[i];
                if (mName.IndexOf("Monster") == 0)
                {
                    mName = mName.Substring("Monster".Length);
                }

                tb = new TextButton(new Vector2(0, 21 + i), new Vector2(1, 1), CommonStringKeys.MINUS, delegate { MonsterTypeRemove(mSlot); }, Color.red);
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");

                tb = new TextButton(new Vector2(1, 21 + i), new Vector2(11, 1), new StringKey(null, mName, false), delegate { MonsterTypeReplace(mSlot); });
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");

                tb = new TextButton(new Vector2(12, 21 + i), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { MonsterTypeAdd(mSlot + 1); }, Color.green);
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");
            }
        }


        db = new DialogBox(new Vector2(14, 20), new Vector2(3, 1), REQ_TRAITS);
        db.ApplyTag("editor");

        tb = new TextButton(new Vector2(19, 20), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { MonsterTraitsAdd(); }, Color.green);
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        for (i = 0; i < 8; i++)
        {
            if (spawnComponent.mTraitsRequired.Length > i)
            {
                int    mSlot = i;
                string mName = spawnComponent.mTraitsRequired[i];

                tb = new TextButton(new Vector2(14, 21 + i), new Vector2(1, 1),
                                    CommonStringKeys.MINUS, delegate { MonsterTraitsRemove(mSlot); }, Color.red);
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");

                tb = new TextButton(new Vector2(15, 21 + i), new Vector2(5, 1),
                                    new StringKey("val", mName), delegate { MonsterTraitReplace(mSlot); });
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");
            }
        }

        db = new DialogBox(new Vector2(14, 21 + spawnComponent.mTraitsRequired.Length), new Vector2(3, 1), POOL_TRAITS);
        db.ApplyTag("editor");

        tb = new TextButton(new Vector2(19, 21 + spawnComponent.mTraitsRequired.Length), new Vector2(1, 1), CommonStringKeys.PLUS, delegate { MonsterTraitsAdd(true); }, Color.green);
        tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
        tb.ApplyTag("editor");

        for (int j = 0; j < 8; j++)
        {
            if (spawnComponent.mTraitsPool.Length > j)
            {
                int    mSlot = j;
                string mName = spawnComponent.mTraitsPool[j];

                tb = new TextButton(new Vector2(14, 22 + spawnComponent.mTraitsRequired.Length + j),
                                    new Vector2(1, 1), CommonStringKeys.MINUS, delegate { MonsterTraitsRemove(mSlot, true); }, Color.red);
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");

                tb = new TextButton(new Vector2(15, 22 + spawnComponent.mTraitsRequired.Length + j),
                                    new Vector2(5, 1), new StringKey("val", mName), delegate { MonsterTraitReplace(mSlot, true); });
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");
            }
        }

        game.tokenBoard.AddHighlight(spawnComponent.location, "MonsterLoc", "editor");
    }