public override void AddTo(WidgetContainer container)
 {
     container.Add(_slider);
     container.AddContent(_minLabel);
     container.AddContent(_maxLabel);
     container.AddContent(_valueLabel);
 }
示例#2
0
    private void CreatePopupWidget(UiPromptListEntry uiPopup)
    {
        var window = new WidgetContainer(new Rectangle(0, 0, 0, 0));

// popup_ui_main_window1.OnBeforeRender += 0x10170a90;
        window.Name    = "popup_ui_main_window";
        window.Visible = false;
        window.SetMouseMsgHandler(msg => true); // Swallow mouse clicks and such
        uiPopup.wnd = window;

        uiPopup.background = new WidgetImage();
        window.AddContent(uiPopup.background);

        uiPopup.titleLabel           = new WidgetText("", "popupTitle");
        uiPopup.titleLabel.X         = 30;
        uiPopup.titleLabel.Y         = 13;
        uiPopup.titleLabel.FixedSize = new Size(230, 26);
        uiPopup.titleLabel.SetCenterVertically(true);
        window.AddContent(uiPopup.titleLabel);

        uiPopup.bodyLabel = new WidgetText("", "popupBody");
        window.AddContent(uiPopup.bodyLabel);

        var okButton = new WidgetButton(new Rectangle(0, 0, 0, 0));

// popup_ui_button1.OnHandleMessage += 0x10171b50;
// popup_ui_button1.OnBeforeRender += 0x10170c30;
// popup_ui_button1.OnRenderTooltip += 0x100027f0;
        okButton.Name    = "popup_ok_button";
        okButton.Visible = false;
        window.Add(okButton);
        uiPopup.btn1 = okButton;
        okButton.SetClickHandler(() => OnClickButton(uiPopup, 0));

        var cancelButton = new WidgetButton(new Rectangle(0, 0, 0, 0));

// popup_ui_button2.OnHandleMessage += 0x10171b50;
// popup_ui_button2.OnBeforeRender += 0x10170e40;
// popup_ui_button2.OnRenderTooltip += 0x100027f0;
        cancelButton.Name    = "popup_cancel_button";
        cancelButton.Visible = false;
        window.Add(cancelButton);
        uiPopup.btn2 = cancelButton;
        cancelButton.SetClickHandler(() => OnClickButton(uiPopup, 1));

        var popup_ui_button3 = new WidgetButton(new Rectangle(0, 0, 0, 0));

// popup_ui_button3.OnHandleMessage += 0x10171b50;
// popup_ui_button3.OnBeforeRender += 0x10171a90;
// popup_ui_button3.OnRenderTooltip += 0x100027f0;
        popup_ui_button3.Name    = "popup_ui_button";
        popup_ui_button3.Visible = false;
        window.Add(popup_ui_button3);
        uiPopup.btn3 = popup_ui_button3;
    }
示例#3
0
    public ActionBarUi()
    {
        _pulseAnimation = GameSystems.Vagrant.AllocateActionBar();
        // These values were configurable in a MES file before
        GameSystems.Vagrant.ActionBarSetPulseValues(_pulseAnimation, 64, 255, 0.125f);

        _combatBarFill        = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Fill.tga", false);
        _combatBarHighlight   = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Highlight.tga", false);
        _combatBarHighlight2  = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Highlight2.tga", false);
        _combatBarGrey        = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_GREY.tga", false);
        _combatBarFillInvalid = Tig.Textures.Resolve("art/interface/COMBAT_UI/CombatBar_Fill_INVALID.tga", false);

        _window      = new WidgetContainer(8, 117, 50, 260);
        _window.Name = "combat_ui_debug_output_window";

        // Hide or show the entire action bar based on combat status
        _window.Visible = false;
        GameSystems.Combat.OnCombatStatusChanged += combatStatus => { _window.Visible = combatStatus; };

        var actionBarImage = new WidgetImage("art/interface/COMBAT_UI/combatbar.img");

        _window.AddContent(actionBarImage);

        var actionBar = new WidgetContainer(new Rectangle(13, 15, 22, 170));

        _window.Add(actionBar);
        actionBar.Name            = "action bar";
        actionBar.OnBeforeRender += () => UiCombatActionBarRender(actionBar);

        // Add a full sized button on top of the action bar to handle tooltips and help requests
        var actionBarButton = new WidgetButton();

        actionBarButton.SetStyle(new WidgetButtonStyle());
        actionBarButton.SetSizeToParent(true);
        actionBarButton.SetClickHandler(OnActionBarButtonClick);
        actionBarButton.TooltipStyle    = "action-bar-tooltip";
        actionBarButton.OnBeforeRender += () =>
        {
            // Use the time update message (one per frame) to update the tooltip text
            actionBarButton.TooltipText = GetActionBarTooltipText();
        };
        actionBar.Add(actionBarButton);

        var nextTurn = new WidgetButton(new Rectangle(0, 194, 50, 50));

        nextTurn.SetStyle(new WidgetButtonStyle
        {
            NormalImagePath   = "art/interface/COMBAT_UI/Action-End-Turn.tga",
            HoverImagePath    = "art/interface/COMBAT_UI/Action-End-Turn-Hover.tga",
            PressedImagePath  = "art/interface/COMBAT_UI/Action-End-Turn-Click.tga",
            DisabledImagePath = "art/interface/COMBAT_UI/Action-End-Turn-Disabled.tga",
        });
        nextTurn.Name            = "next_turn";
        nextTurn.OnBeforeRender += () => OnBeforeRenderNextTurn(nextTurn);
        nextTurn.SetClickHandler(OnNextTurnClick);
        _window.Add(nextTurn);
    }
    public CharSheetHelpUi()
    {
        var widgetDoc = WidgetDoc.Load("ui/char_help.json");

        _scrollView = (WidgetScrollView)widgetDoc.TakeRootWidget();

        _textContainer = new WidgetContainer(0, 0,
                                             _scrollView.GetInnerWidth(), _scrollView.GetInnerHeight());
        _textLabel = new WidgetText();
        _textContainer.AddContent(_textLabel);
        _scrollView.Add(_textContainer);
        _scrollView.AddStyle("char-help-text");
    }
示例#5
0
    public CampingUi()
    {
        _translations = Tig.FS.ReadMesFile("mes/utility_bar.mes");

        var doc = WidgetDoc.Load("ui/camping_ui.json");

        // Begin top level window
        // Created @ 0x1012f29f
        _mainWindow = doc.GetRootContainer();
        // _mainWindow.OnBeforeRender += 0x1012e4d0;
        // Swallow mouse events (to prevent click through)
        _mainWindow.SetMouseMsgHandler(msg => true);
        _mainWindow.SetKeyStateChangeHandler(OnKeyStateChange);
        _mainWindow.ZIndex          = 100000;
        _mainWindow.Visible         = false;
        _mainWindow.OnBeforeRender += UpdateCheckboxes;

        var titleLabel = new WidgetText(WindowTitle, "camping-button-text");

        titleLabel.X         = 31;
        titleLabel.Y         = 11;
        titleLabel.FixedSize = new Size(230, 12);
        _mainWindow.AddContent(titleLabel);

        // Labels for the hours/days to rest

        _daysToRestLabelText = new WidgetText(DaysLabel, "camping-torest-labels");
        _mainWindow.AddContent(_daysToRestLabelText);
        _hoursToRestLabelText = new WidgetText(HoursLabel, "camping-torest-labels");
        _mainWindow.AddContent(_hoursToRestLabelText);
        _daysToRestText = new WidgetText("0", "camping-torest");
        _mainWindow.AddContent(_daysToRestText);
        _hoursToRestText = new WidgetText("0", "camping-torest");
        _mainWindow.AddContent(_hoursToRestText);

        _restButton = doc.GetButton("restButton");
        _restButton.SetClickHandler(OnRestClicked);

        _cancelButton      = doc.GetButton("cancelButton");
        _cancelButton.Text = ButtonLabelCancel;
        _cancelButton.SetClickHandler(Hide);

        _incrementDaysButton = doc.GetButton("incDaysButton");
        _incrementDaysButton.SetRepeat(true);
        _incrementDaysButton.SetClickHandler(OnIncrementDays);

        _decrementDaysButton = doc.GetButton("decDaysButton");
        _decrementDaysButton.SetRepeat(true);
        _decrementDaysButton.SetClickHandler(OnDecrementDays);

        _incrementHoursButton = doc.GetButton("incHoursButton");
        _incrementHoursButton.SetRepeat(true);
        _incrementHoursButton.SetClickHandler(OnIncrementHours);

        _decrementHoursButton = doc.GetButton("decHoursButton");
        _decrementHoursButton.SetRepeat(true);
        _decrementHoursButton.SetClickHandler(OnDecrementHours);

        _restUntilHealedCheckbox = new CampingCheckbox(new Rectangle(86, 96, 113, 15), UntilHealedLabel,
                                                       "camping-checkbox-labels");
        _restUntilHealedCheckbox.OnCheckedChange += value => CampingSetTimeUntilHealed();
        _mainWindow.Add(_restUntilHealedCheckbox);

        _restUntilNightCheckbox = new CampingCheckbox(new Rectangle(86, 117, 113, 15), UntilEveningLabel,
                                                      "camping-checkbox-labels");
        _restUntilNightCheckbox.OnCheckedChange += value => UiCampingSetTimeToUntilNighttime();
        _mainWindow.Add(_restUntilNightCheckbox);

        _restUntilDayCheckbox = new CampingCheckbox(new Rectangle(86, 138, 113, 15), UntilMorningLabel,
                                                    "camping-checkbox-labels");
        _restUntilDayCheckbox.OnCheckedChange += value => UiCampingSetTimeToUntilDaytime();
        _mainWindow.Add(_restUntilDayCheckbox);

        // Begin top level window
        // Created @ 0x1019b2c8
        // var @ [TempleDllLocation(0x11e72ad8)]
        var sticky_ui_main_window1 = new WidgetContainer(new Rectangle(0, 0, 0, 0));

        // sticky_ui_main_window1.OnHandleMessage += 0x101f5850;
        // sticky_ui_main_window1.OnBeforeRender += 0x1019a9a0;
        sticky_ui_main_window1.ZIndex  = 0;
        sticky_ui_main_window1.Name    = "sticky_ui_main_window";
        sticky_ui_main_window1.Visible = false;
        // Created @ 0x1019b39a
        // var @ [TempleDllLocation(0x11e7277c)]
        var radialmenuslideracceptbutton1 = new WidgetButton(new Rectangle(328, 370, 112, 22));

        // radialmenuslideracceptbutton1.OnHandleMessage += 0x1019af30;
        // radialmenuslideracceptbutton1.OnBeforeRender += 0x1019ac10;
        radialmenuslideracceptbutton1.Name = "radial menu slider accept button";
        sticky_ui_main_window1.Add(radialmenuslideracceptbutton1);
        // Created @ 0x1019b4a1
        // var @ [TempleDllLocation(0x11e72ad4)]
        var radialmenusliderdeclinebutton1 = new WidgetButton(new Rectangle(452, 370, 112, 22));

        // radialmenusliderdeclinebutton1.OnHandleMessage += 0x1019af30;
        // radialmenusliderdeclinebutton1.OnBeforeRender += 0x1019ac10;
        radialmenusliderdeclinebutton1.Name = "radial menu slider decline button";
        sticky_ui_main_window1.Add(radialmenusliderdeclinebutton1);
        // Created @ 0x1019b5a9
        // var @ [TempleDllLocation(0x11e72b9c)]
        var radialmenuslidercheckboxbutton1 = new WidgetButton(new Rectangle(335, 354, 40, 11));

        // radialmenuslidercheckboxbutton1.OnHandleMessage += 0x1019b1d0;
        // radialmenuslidercheckboxbutton1.OnBeforeRender += 0x1019afa0;
        radialmenuslidercheckboxbutton1.Name = "radial menu slider checkbox button";
        sticky_ui_main_window1.Add(radialmenuslidercheckboxbutton1);
    }