Пример #1
0
    public LogbookKeyButton(LogbookKeyTranslations translations, Rectangle rect) : base(rect)
    {
        AddStyle("logbook-key-button");

        _translations = translations;

        _title           = new WidgetText();
        _title.Text      = " ";
        _title.X         = 5;
        _title.Y         = 2;
        _title.FixedSize = new Size(rect.Width, _title.GetPreferredSize().Height);
        AddContent(_title);

        var currentY = _title.GetPreferredSize().Height + 1;

        _acquiredLabel   = new WidgetText();
        _acquiredLabel.X = 5;
        _acquiredLabel.Y = currentY;
        AddContent(_acquiredLabel);

        var innerRectangle = new WidgetRectangle();

        innerRectangle.X         = 1;
        innerRectangle.Y         = 1;
        innerRectangle.FixedSize = new Size(rect.Width - 2, rect.Height - 2);
        innerRectangle.Pen       = new PackedLinearColorA(0xFF909090);
        AddContent(innerRectangle);

        _outerRectangle     = new WidgetRectangle();
        _outerRectangle.Pen = PackedLinearColorA.White;
        AddContent(_outerRectangle);
    }
    public LogbookKeyAcquiredPopup(LogbookKeyTranslations translations)
    {
        var doc = WidgetDoc.Load("ui/key_acquired_popup.json");

        _window = doc.GetRootContainer();

        doc.GetTextContent("title").Text = translations.NotificationPopupTitle;

        var textContainer = doc.GetContainer("textContainer");

        var text = new WidgetText();

        text.FixedWidth = 237;
        text.Text       = translations.NotificationPopupText;
        textContainer.AddContent(text);

        var prompt = new WidgetText();

        prompt.FixedWidth = 237;
        prompt.Text       = translations.NotificationPopupPrompt;
        prompt.Y          = text.GetPreferredSize().Height + 13;
        textContainer.AddContent(prompt);

        // Created @ 0x1019727c
        // _window.OnHandleMessage += 0x101f5850;
        // _window.OnBeforeRender += 0x10196a10;
        _window.ZIndex  = 100051;
        _window.Name    = "logbook_ui_keys_key_entry_window";
        _window.Visible = false;

        // Created @ 0x10197385
        var acceptButton = doc.GetButton("accept");

        // logbook_ui_key_entry_accept_butn1.OnHandleMessage += 0x10197070;
        // logbook_ui_key_entry_accept_butn1.OnBeforeRender += 0x10196d70;
        acceptButton.Text = translations.NotificationPopupYes;
        acceptButton.Name = "logbook_ui_key_entry_accept_butn";
        acceptButton.SetClickHandler(() =>
        {
            OnChangeNotificationSetting?.Invoke(false);
            Hide();
        });

        // Created @ 0x101974c2
        var declineButton = doc.GetButton("decline");

        // logbook_ui_key_entry_decline_butn1.OnHandleMessage += 0x10197070;
        // logbook_ui_key_entry_decline_butn1.OnBeforeRender += 0x10196d70;
        declineButton.Text = translations.NotificationPopupNo;
        declineButton.Name = "logbook_ui_key_entry_decline_butn";
        declineButton.SetClickHandler(Hide);
    }