Esempio n. 1
0
    public void NewUI()
    {
        Game game  = Game.Get();
        int  index = 0;

        while (game.quest.qd.components.ContainsKey("UI" + index))
        {
            index++;
        }
        QuestData.UI ui = new QuestData.UI("UI" + index);
        game.quest.qd.components.Add("UI" + index, ui);
        SelectComponent("UI" + index);
    }
Esempio n. 2
0
    override public float AddSubEventComponents(float offset)
    {
        uiComponent = component as QuestData.UI;

        UIElement ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());

        ui.SetLocation(0, offset, 4.5f, 1);
        ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "IMAGE")));

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(5, offset, 14, 1);
        ui.SetText(uiComponent.imageName);
        ui.SetButton(delegate { SetImage(); });
        new UIElementBorder(ui);
        offset += 2;

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(0, offset, 6, 1);
        ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "UNITS")));

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(6, offset, 6, 1);
        ui.SetButton(delegate { ChangeUnits(); });
        new UIElementBorder(ui);
        if (uiComponent.verticalUnits)
        {
            ui.SetText(new StringKey("val", "VERTICAL"));
        }
        else
        {
            ui.SetText(new StringKey("val", "HORIZONTAL"));
        }
        offset += 2;

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(0, offset++, 4, 1);
        ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "ALIGN")));

        DrawAlignSelection(offset, -1, -1, "┏");
        DrawAlignSelection(offset, 0, -1, "━");
        DrawAlignSelection(offset, 1, -1, "┓");

        DrawAlignSelection(offset, -1, 0, "┃");
        DrawAlignSelection(offset, 0, 0, "╋");
        DrawAlignSelection(offset, 1, 0, "┃");

        DrawAlignSelection(offset, -1, 1, "┗");
        DrawAlignSelection(offset, 0, 1, "━");
        DrawAlignSelection(offset, 1, 1, "┛");
        offset += 3;

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(0, offset++, 10, 1);
        ui.SetText(new StringKey("val", "POSITION"));

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(0, offset, 2, 1);
        ui.SetText("X:");

        locXUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform());
        locXUIE.SetLocation(2, offset, 3, 1);
        locXUIE.SetText(uiComponent.location.x.ToString());
        locXUIE.SetSingleLine();
        locXUIE.SetButton(delegate { UpdateNumbers(); });
        new UIElementBorder(locXUIE);

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(5, offset, 2, 1);
        ui.SetText("Y:");

        locYUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform());
        locYUIE.SetLocation(7, offset, 3, 1);
        locYUIE.SetText(uiComponent.location.y.ToString());
        locYUIE.SetSingleLine();
        locYUIE.SetButton(delegate { UpdateNumbers(); });
        new UIElementBorder(locYUIE);
        offset += 2;

        ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
        ui.SetLocation(0, offset, 5, 1);
        ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "SIZE")));

        sizeUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform());
        sizeUIE.SetLocation(5, offset, 3, 1);
        sizeUIE.SetText(uiComponent.size.ToString());
        sizeUIE.SetSingleLine();
        sizeUIE.SetButton(delegate { UpdateNumbers(); });
        new UIElementBorder(sizeUIE);

        if (uiComponent.imageName.Length == 0)
        {
            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(10, offset, 5, 1);
            ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "ASPECT")));

            aspectUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform());
            aspectUIE.SetLocation(15, offset, 3, 1);
            aspectUIE.SetText(uiComponent.aspect.ToString());
            aspectUIE.SetSingleLine();
            aspectUIE.SetButton(delegate { UpdateNumbers(); });
            new UIElementBorder(aspectUIE);
            offset += 2;

            textUIE = new UIElementEditablePaneled(Game.EDITOR, scrollArea.GetScrollTransform());
            textUIE.SetLocation(0.5f, offset, 19, 38);
            textUIE.SetText(uiComponent.uiText.Translate(true));
            offset += textUIE.HeightToTextPadding(1);
            textUIE.SetButton(delegate { UpdateUIText(); });
            new UIElementBorder(textUIE);
            offset += 1;

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(0, offset, 7, 1);
            ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "RICH_TEXT")));

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(7, offset, 3, 1);
            ui.SetButton(delegate { SetRichText(); });
            if (uiComponent.richText)
            {
                ui.SetText(new StringKey("val", "TRUE"));
            }
            else
            {
                ui.SetText(new StringKey("val", "FALSE"));
            }
            new UIElementBorder(ui);

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(10, offset, 4.5f, 1);
            ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "TEXT_ALIGNMENT")));

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(14.5f, offset, 5, 1);
            ui.SetText(new StringKey("val", uiComponent.textAlignment.ToString()));
            ui.SetButton(delegate { SetTextAlignment(); });
            new UIElementBorder(ui);
            offset += 2;

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(0, offset, 7, 1);
            ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "TEXT_SIZE")));

            textSizeUIE = new UIElementEditable(Game.EDITOR, scrollArea.GetScrollTransform());
            textSizeUIE.SetLocation(7, offset, 3, 1);
            textSizeUIE.SetText(uiComponent.textSize.ToString());
            textSizeUIE.SetSingleLine();
            textSizeUIE.SetButton(delegate { UpdateTextSize(); });
            new UIElementBorder(textSizeUIE);

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(10, offset, 4.5f, 1);
            ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "COLOR")));

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(14.5f, offset, 5, 1);
            ui.SetText(new StringKey("val", uiComponent.textColor));
            ui.SetButton(delegate { SetColour(); });
            new UIElementBorder(ui);
            offset += 2;

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(0, offset, 8.5f, 1);
            ui.SetText(new StringKey("val", "X_COLON", new StringKey("val", "BACKGROUND_COLOUR")));

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(8.5f, offset, 4.5f, 1);
            ui.SetText(new StringKey("val", uiComponent.textBackgroundColor));
            ui.SetButton(delegate { SetBackgroundColour(); });
            new UIElementBorder(ui);
            offset += 2;

            ui = new UIElement(Game.EDITOR, scrollArea.GetScrollTransform());
            ui.SetLocation(0.5f, offset, 8, 1);
            ui.SetText(uiComponent.textColor);
            ui.SetButton(delegate { ToggleBorder(); });
            new UIElementBorder(ui);
            if (uiComponent.border)
            {
                ui.SetText(new StringKey("val", "BORDER"));
            }
            else
            {
                ui.SetText(new StringKey("val", "NO_BORDER"));
            }
        }
        offset += 2;

        DrawUIComponent();

        return(offset);
    }