Ejemplo n.º 1
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;
    }
Ejemplo n.º 2
0
    public CharSheetSkillsUi()
    {
        var detailsDoc = WidgetDoc.Load("ui/char_skills.json");

        Container = detailsDoc.GetRootContainer();
        Container.SetMouseMsgHandler(msg =>
        {
            // Forward mouse wheel messages to the scrollbar
            if ((msg.flags & MouseEventFlag.ScrollWheelChange) != 0)
            {
                _scrollbar.HandleMouseMessage(msg);
            }

            return(true);
        });
        Container.Name    = "char_skills_ui_main_window";
        Container.Visible = false;

        _skillRanks     = detailsDoc.GetTextContent("skill-ranks-label");
        _attributeBonus = detailsDoc.GetTextContent("skill-attribute-bonus-label");
        _attributeType  = detailsDoc.GetTextContent("skill-attribute-type-label");
        _miscBonus      = detailsDoc.GetTextContent("skill-misc-bonus-label");
        _total          = detailsDoc.GetTextContent("skill-total-label");
        HideSkillDetails();

        for (var i = 0; i < 20; i++)
        {
            var button = new SkillButton(new Rectangle(1, 1 + 13 * i, 156, 13));
            button.OnMouseEnter += _ => ShowSkillDetails(button);
            button.OnMouseExit  += _ => HideSkillDetails();
            button.SetMouseMsgHandler(msg =>
            {
                if ((msg.flags & MouseEventFlag.ScrollWheelChange) != 0)
                {
                    return(_scrollbar.HandleMouseMessage(msg));
                }

                return(false);
            });
            Container.Add(button);
            _skillButtons[i] = button;
        }

        if (VisibleSkills.Length > _skillButtons.Length)
        {
            _scrollbar = new WidgetScrollBar(new Rectangle(160, -4, 13, 267));
            _scrollbar.SetMin(0);
            _scrollbar.Max = VisibleSkills.Length - _skillButtons.Length;
            Container.Add(_scrollbar);
            _scrollbar.SetValueChangeHandler((value) => UpdateSkillButtons());
        }

        UpdateSkillButtons();
    }
Ejemplo n.º 3
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);
    }