예제 #1
0
    public AlertUi()
    {
        var doc = WidgetDoc.Load("ui/alert_ui.json");

        _mainWindow         = doc.GetRootContainer();
        _mainWindow.ZIndex  = 99800;
        _mainWindow.Name    = "alert_main_window";
        _mainWindow.Visible = false;

        _titleLabel = doc.GetTextContent("title");

        _okButton      = doc.GetButton("alert_ok_button");
        _okButton.Name = "alert_ok_button";
        _okButton.SetClickHandler(OkButtonClicked);
        _mainWindow.Add(_okButton);

        ScrollBoxSettings settings = new ScrollBoxSettings();

        settings.TextArea        = new Rectangle(6, 16, 287, 208);
        settings.ScrollBarPos    = new Point(297, 1);
        settings.ScrollBarHeight = 224;
        settings.Indent          = 7;
        settings.Font            = PredefinedFont.ARIAL_10;

        _scrollBox        = new ScrollBox(new Rectangle(20, 36, 310, 226), settings);
        _scrollBox.ZIndex = 99950;
        _scrollBox.Name   = "scrollbox_main_window";
        _mainWindow.Add(_scrollBox);
    }
예제 #2
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);
    }
예제 #3
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;
    }
예제 #4
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();
    }
예제 #5
0
 public override void AddTo(WidgetContainer container)
 {
     container.Add(_slider);
     container.AddContent(_minLabel);
     container.AddContent(_maxLabel);
     container.AddContent(_valueLabel);
 }
예제 #6
0
    public DeitySystem()
    {
        var doc = WidgetDoc.Load("ui/pc_creation/deity_ui.json");

        Container         = doc.GetRootContainer();
        Container.Visible = false;

        _deityButtons = new Dictionary <DeityId, WidgetButton>();
        foreach (var deityId in GameSystems.Deity.PlayerSelectableDeities)
        {
            var buttonIndex = _deityButtons.Count;
            var button      = new WidgetButton(new Rectangle(
                                                   48 + 171 * (buttonIndex / 10),
                                                   25 + 21 * (buttonIndex % 10),
                                                   162,
                                                   12
                                                   ));
            button.SetStyle("deity-button");
            button.Text          = GameSystems.Deity.GetName(deityId).ToUpper();
            button.OnMouseEnter += msg => ShowDeityHelp(deityId);
            button.OnMouseExit  += msg => UpdateDescriptionBox();
            button.SetClickHandler(() => SelectDeity(deityId));
            Container.Add(button);
            _deityButtons[deityId] = button;
        }
    }
예제 #7
0
    public HeightSystem()
    {
        var doc = WidgetDoc.Load("ui/pc_creation/height_ui.json");

        Container         = doc.GetRootContainer();
        Container.Visible = false;

        _minHeightLabel     = doc.GetTextContent("minHeightLabel");
        _maxHeightLabel     = doc.GetTextContent("maxHeightLabel");
        _currentHeightLabel = doc.GetTextContent("currentHeightLabel");

        _slider = new HeightSlider();
        _slider.SetPos(doc.GetContainer("sliderContainer").GetPos());
        Container.Add(_slider);
        _slider.OnValueChanged += (newValue) => { UpdateModelScale(); };
    }
예제 #8
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);
    }
 public override void AddTo(WidgetContainer container)
 {
     container.Add(_checkbox);
 }