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

        TextButton tb = new TextButton(new Vector2(0, 0), new Vector2(3, 1), "Item", 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), name.Substring("Item".Length), delegate { QuestEditorData.ListItem(); });
        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), "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(19, 1), "Item:");

        db.ApplyTag("editor");

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

        float offset = 3;

        for (int i = 0; i < itemComponent.itemName.Length; i++)
        {
            int tmp = i;
            db = new DialogBox(new Vector2(0, offset), new Vector2(19, 1), itemComponent.itemName[i]);
            db.ApplyTag("editor");

            if (itemComponent.traits.Length > 0 || itemComponent.itemName.Length > 1)
            {
                tb = new TextButton(new Vector2(19, offset), new Vector2(1, 1), "-", delegate { RemoveItem(tmp); }, Color.red);
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");
            }
            offset++;
        }

        offset++;

        db = new DialogBox(new Vector2(0, offset), new Vector2(16, 1), "Traits:");
        db.ApplyTag("editor");

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

        for (int i = 0; i < itemComponent.traits.Length; i++)
        {
            int tmp = i;
            db = new DialogBox(new Vector2(0, offset), new Vector2(16, 1), itemComponent.traits[i]);
            db.ApplyTag("editor");

            if (itemComponent.traits.Length > 1 || itemComponent.itemName.Length > 0)
            {
                tb = new TextButton(new Vector2(17, offset), new Vector2(1, 1), "-", delegate { RemoveTrait(tmp); }, Color.red);
                tb.button.GetComponent <UnityEngine.UI.Text>().fontSize = UIScaler.GetSmallFont();
                tb.ApplyTag("editor");
            }
            offset++;
        }
    }