Example #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);
    }
Example #2
0
    private void OnBeforeRenderNextTurn(WidgetButton nextTurn)
    {
        var disabled = !GameSystems.Party.IsPlayerControlled(GameSystems.D20.Initiative.CurrentActor) ||
                       uiCombat_10C040B0;

        nextTurn.SetDisabled(disabled);
    }
Example #3
0
    public void Show()
    {
        mListBox.Clear();

        int       y             = 0;
        const int NUM_SCENARIOS = 0;

        for (int i = 0; i < NUM_SCENARIOS; i++)
        {
            var button = new WidgetButton();
            button.Text = "Arena";
            button.SetId("Arena");
            var innerWidth = mListBox.GetInnerWidth();
            button.Width = innerWidth;
            button.SetAutoSizeWidth(false);
            button.SetStyle("mm-setpieces-list-button");
            button.Y = y;
            btnIds.Add(button);
            var idx = i;
            button.SetClickHandler(() => Select(idx));
            y += button.Height;
            mListBox.Add(button);
        }

        mWidget.Show();
    }
    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;
        }
    }
Example #5
0
        public CraftingTab(GameState gameState, List <Recipe> recipies = null) : base(gameState)
        {
            Icon         = new Sprite(Resources.TileIcons, new Point(4, 2));
            CraftingList = new WidgetList
            {
                Dock       = Dock.Fill,
                ItemHeight = 64,
            };

            var craftButton = new WidgetButton
            {
                Text = "Craft",
                Dock = Dock.Bottom,
            };

            craftButton.MouseClick += Craft;

            foreach (var recipe in recipies ?? RECIPIES.HandCrafted)
            {
                CraftingList.AddItem(new CraftingListItem(recipe,
                                                          GameState.LocalPlayer.Entity.GetComponent <ComponentInventory>().Content));
            }

            Content = new LayoutDock()
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetLabel {
                        Text = "Crafting", Font = Resources.FontAlagard, Dock = Dock.Top
                    },
                    craftButton, CraftingList,
                }
            };
        }
Example #6
0
        //int onButtonCloseClicked();
        //int onButtonFopenClicked();
        //int onButtonWloadClicked();
        //int onDlgCancelClicked();
        //int onDlgOKClicked();
        //int onMeshParamsOKClicked();
        //int onSliderChanged();

        public int InitGUI()
        {
            gui          = Gui.get();
            widget_label = new WidgetLabel(gui, "sun position");
            widget_label.setToolTip("Change the sun's position");
            widget_label.setPosition(10, 10);

            widget_slider = new WidgetSlider(gui, 0, 360, 60);
            widget_slider.setToolTip("Slide to change sun position");
            widget_slider.setPosition(100, 10);
            //widget_slider.setCallback0(Gui.CHANGED, new Widget.Callback0(this, onSliderChanged));

            widget_button_del = new WidgetButton(gui, "Delete");
            widget_button_del.setToolTip("Delect object(s) selected in combo box");
            widget_button_del.setPosition(170, 50);
            UserInterface.Callback0 c0 = new UserInterface.Callback0(onButtonDelClicked);
            widget_button_del.setCallback0(Gui.CLICKED, );

            widget_button_close = new WidgetButton(gui, "Delete");
            widget_button_close.setToolTip("Delect object(s) selected in combo box");
            widget_button_close.setPosition(170, 50);
            //widget_button_close.setCallback0(Gui.CLICKED, new Widget.Callback0(this, OnButtonDelClicked()));

            widget_button_fopen = new WidgetButton(gui, "Delete");
            widget_button_fopen.setToolTip("Delect object(s) selected in combo box");
            widget_button_fopen.setPosition(170, 50);
            //widget_button_fopen.setCallback0(Gui.CLICKED, new Widget.Callback0(this, OnButtonDelClicked()));

            widget_button_wload = new WidgetButton(gui, "Delete");
            widget_button_wload.setToolTip("Delect object(s) selected in combo box");
            widget_button_wload.setPosition(170, 50);
            //widget_button_wload.setCallback0(Gui.CLICKED, new Widget.Callback0(this, OnButtonDelClicked()));

            return(1);
        }
Example #7
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 override void Load()
        {
            var background = Rise.Rnd.Pick(Resources.ParalaxeForest, Resources.ParalaxeMontain);

            Rise.Scene.SetBackground(background);
            Rise.Sound.Play(Resources.Theme0);

            var title = new WidgetLabel
            {
                Text       = Game.Title,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0),
                Font       = Resources.FontAlagard,
                TextSize   = 6f,
            };

            var subTitle = new WidgetLabel
            {
                Text       = Game.SubTitle,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 72),
                Font       = Resources.FontRomulus,
                TextColor  = ColorPalette.Accent,
                TextSize   = 1f,
            };

            var prompt = new WidgetButton("> Press any key <")
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 256),
                Font       = Resources.FontRomulus,
            }.RegisterMouseClickEvent(Game.GoToMainMenu);

            var version = new WidgetLabel
            {
                Text           = $"{Game.Title} {Game.Version}",
                Anchor         = Anchor.BottomRight,
                Origine        = Anchor.BottomRight,
                UnitOffset     = new Point(-16, 0),
                Font           = Resources.FontHack,
                TextAlignement = TextAlignement.Right,
                TextColor      = Color.White * 0.5f,
                TextSize       = 1f,
            };

            Container = new LayoutDock()
            {
                Children =
                {
                    title, subTitle, prompt, version
                }
            };
        }
    public WidgetSlider(int x, int y, [CallerFilePath]
                        string filePath = null, [CallerLineNumber]
                        int lineNumber  = -1) : base(x, y, filePath, lineNumber)
    {
        // Size of the slider itself
        Width  = 177;
        Height = 27;

        var leftButton = new WidgetButton();

        leftButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-left"));
        leftButton.SetClickHandler(() => { SetValue(GetValue() - 1); });
        leftButton.SetRepeat(true);
        leftButton.Width  = 27;
        leftButton.Height = 27;

        var rightButton = new WidgetButton();

        rightButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-right"));
        rightButton.SetClickHandler(() => { SetValue(GetValue() + 1); });
        rightButton.SetRepeat(true);
        rightButton.Width  = 27;
        rightButton.Height = 27;
        rightButton.X      = Width - rightButton.Width;

        var track = new WidgetButton();

        track.SetStyle(Globals.WidgetButtonStyles.GetStyle("slider-track"));
        track.SetClickHandler((x, y) =>
        {
            if (x < _handleButton.X)
            {
                SetValue(GetValue() - Quantum);
            }
            else if (x >= _handleButton.X + _handleButton.Width)
            {
                SetValue(GetValue() + Quantum);
            }
        });
        track.SetRepeat(true);

        var handle = new WidgetSliderHandle(this);

        handle.Y = 2;

        _leftButton   = leftButton;
        _rightButton  = rightButton;
        _track        = track;
        _handleButton = handle;

        Add(track);
        Add(leftButton);
        Add(rightButton);
        Add(handle);
    }
Example #10
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;
    }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            PreferredContentSize = new CGSize(PreferredContentSize.Width, 55f);

            UpdateTitle();

            WidgetButton.SetTitle("Tap here to register", UIControlState.Normal);
            WidgetButton.TouchUpInside += (sender, e) => UIApplication.SharedApplication.OpenUrl(new NSUrl("evolveCountdown://"));
        }
Example #12
0
        public SOBattleHUD(BattleHUD scene)
        {
            Scene = scene;

            PauseButton            = new SpriteButton(scene.PauseButtonGameObject);
            HelpButton             = new SpriteButton(scene.HelpButtonGameObject);
            HitArea                = new WidgetButton(scene.HideHudHitAreaGameObject);
            AllMenuPanel           = new GOAllMenuPanel(scene.AllMenuPanel);
            BattleInformationPanel = new PanelBattleInformation(scene.BattleDialogGameObject);
            Transitions            = new Transition(scene.TransitionGameObject);
            Fading = new SpriteFading(scene.ScreenFadeGameObject);
        }
    public WidgetScrollBar() : base(0, 0)
    {
        var upButton = new WidgetButton();

        upButton.SetParent(this);
        upButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-up"));
        upButton.SetClickHandler(() => { SetValue(GetValue() - 1); });
        upButton.SetRepeat(true);

        var downButton = new WidgetButton();

        downButton.SetParent(this);
        downButton.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-down"));
        downButton.SetClickHandler(() => { SetValue(GetValue() + 1); });
        downButton.SetRepeat(true);

        var track = new WidgetButton();

        track.SetParent(this);
        track.SetStyle(Globals.WidgetButtonStyles.GetStyle("scrollbar-track"));
        track.SetClickHandler((x, y) =>
        {
            // The y value is in relation to the track, we need to add it's own Y value,
            // and compare against the current position of the handle
            y += mTrack.Y;
            if (y < mHandleButton.Y)
            {
                SetValue(GetValue() - 5);
            }
            else if (y >= mHandleButton.Y + mHandleButton.Height)
            {
                SetValue(GetValue() + 5);
            }
        });
        track.SetRepeat(true);

        var handle = new WidgetScrollBarHandle(this);

        handle.SetParent(this);
        handle.Height = 100;

        Width = Math.Max(upButton.Width, downButton.Width);

        mUpButton     = upButton;
        mDownButton   = downButton;
        mTrack        = track;
        mHandleButton = handle;

        Add(track);
        Add(upButton);
        Add(downButton);
        Add(handle);
    }
Example #14
0
        protected DialogWindow(string title, string text, string yesText, string noText)
            : base(WindowFlags.CustomAnim | WindowFlags.Blackout)
        {
            m_panel = new WidgetWindow(WidgetManager.GetStyle("dialog_window"));
            Vector2 size = m_panel.Size;

            m_text           = new WidgetText();
            m_text.Text      = text;
            m_text.Size      = new Vector2(size.X, 0);
            m_text.MaxWidth  = size.X - 40;
            m_text.FontSize *= 1.25f;
            m_text.TextAlign = WidgetAlign.VerticalCenter | WidgetAlign.HorizontalCenter;
            m_text.Relayout();
            size            = m_panel.Size = m_panel.Size + new Vector2(0, m_text.Size.Y - 80);
            m_text.Position = new Vector2(0, size.Y / 2 - m_text.Size.Y / 2);
            m_panel.AddChild(m_text);

            Size = size;

            if (!string.IsNullOrEmpty(noText))
            {
                m_noButton      = new WidgetButton(noText);
                m_noButton.Size = new Vector2(128, 48);

                m_noButton.Position = new Vector2(size.X * 2 / 3 - (m_noButton.Size.X) / 2, size.Y - m_noButton.Size.Y - 25);
                m_noButton.OnPress += delegate { HandleButtonPress(1); };
                m_panel.AddChild(m_noButton);
            }

            m_yesButton          = new WidgetButton(yesText);
            m_yesButton.Size     = new Vector2(128, 48);
            m_yesButton.Position = new Vector2(m_noButton == null ? size.X / 2 - (m_yesButton.Size.X) / 2 : size.X / 3 - m_yesButton.Size.X * 0.25f, size.Y - m_yesButton.Size.Y - 25);
            m_yesButton.OnPress += delegate { HandleButtonPress(0); };
            m_panel.AddChild(m_yesButton);

            m_closeButton              = new WidgetButton(WidgetManager.GetStyle("image_button"), "");
            m_closeButton.Size         = new Vector2(40, 40);
            m_closeButton.Image        = "close_icon";
            m_closeButton.ImagePadding = new Margin(10, 10, 10, 10);
            m_closeButton.Position     = new Vector2(size.X - m_closeButton.Size.X, 0);
            m_closeButton.OnPress     += delegate { HandleButtonPress(2); };
            m_panel.AddChild(m_closeButton);

            m_title           = new WidgetLabel();
            m_title.Text      = title;
            m_title.Size      = new Vector2(size.X, 50);
            m_title.Position  = new Vector2(0, 20);
            m_title.FontSize *= 1.5f;
            m_title.TextAlign = WidgetAlign.Top | WidgetAlign.HorizontalCenter;
            m_panel.AddChild(m_title);

            AddChild(m_panel);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            PreferredContentSize = new CGSize(PreferredContentSize.Width, 55f);
            var evolveStartDate = new DateTime(2014, 10, 6);
            var numDays         = (evolveStartDate - DateTime.Now).Days;

            WidgetTitle.Text = String.Format("{0} days until Evolve", numDays);

            WidgetButton.SetTitle("Tap here to register", UIControlState.Normal);

            WidgetButton.TouchUpInside += (sender, e) => UIApplication.SharedApplication.OpenUrl(new NSUrl("evolveCountdown://"));
        }
Example #16
0
    public GenderSystem()
    {
        var doc = WidgetDoc.Load("ui/pc_creation/gender_ui.json");

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

        _maleButton = doc.GetButton("maleButton");
        _maleButton.SetClickHandler(() => ChooseGender(Gender.Male));

        _femaleButton = doc.GetButton("femaleButton");
        _femaleButton.SetClickHandler(() => ChooseGender(Gender.Female));

        // NOTE: Vanilla previously tried showing gender-specific help texts, but those texts actually don't exist
    }
    public TextEntryUi()
    {
        var doc = WidgetDoc.Load("ui/text_entry_ui.json");

        _dialog         = doc.GetRootContainer();
        _dialog.Visible = false;
        _dialog.SetKeyStateChangeHandler(HandleShortcut);
        _dialog.OnHandleMessage += HandleMessage;

        _okButton = doc.GetButton("okButton");
        _okButton.SetClickHandler(Confirm);
        _cancelButton = doc.GetButton("cancelButton");
        _cancelButton.SetClickHandler(Cancel);
        _titleLabel        = doc.GetTextContent("titleLabel");
        _currentInputLabel = doc.GetTextContent("currentInputLabel");
    }
Example #18
0
    private void CreateExitButton()
    {
        var exitButton = new WidgetButton(_uiParams.CharUiMainExitButton);

        exitButton.SetAutoSizeHeight(false);
        exitButton.SetAutoSizeWidth(false);
        exitButton.SetStyle(new WidgetButtonStyle
        {
            DisabledImagePath = _uiParams.TexturePaths[CharUiTexture.MainExitButtonDisabled],
            HoverImagePath    = _uiParams.TexturePaths[CharUiTexture.MainExitButtonHoverOn],
            NormalImagePath   = _uiParams.TexturePaths[CharUiTexture.MainExitButtonHoverOff],
            PressedImagePath  = _uiParams.TexturePaths[CharUiTexture.MainExitButtonHoverPressed]
        });
        exitButton.SetClickHandler(ExitClicked);
        _mainWidget.Add(exitButton);
    }
Example #19
0
        public override void Design()
        {
            Gap    = 0;
            Dock   = DockStyle.Left;
            Bounds = new FloatRect(4, 48, 48, 48);
            var DefaultBounds = new FloatRect(4, 48, 32, 32);
            var DPadding      = new Padding(4);
            var awesome       = Parent.FontIndex.GetFont("awesome", 19f, FontStyle.Regular, GraphicsUnit.Pixel);

            Widgets = new Widget[]
            {
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Bars, Bounds = DefaultBounds, Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                     // bars
                BtnLoadMidi = new WidgetButton(Parent)
                {
                    Text = FontAwesome.Music, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                          // h-bars
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.EllipsisV, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                  // v-bars
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Play, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                             // fore
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Backward, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                 // back
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.FolderOpen, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                   // folder-open
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.FolderOpenO, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                                    // folder-open
                new WidgetButton(Parent)
                {
                    Text = FontAwesome.Save, Bounds = DefaultBounds.Clone(), Padding = DPadding, Font = awesome, Smoother = true
                },                                                                                                                                             // font
            };
        }
Example #20
0
        void ReleaseDesignerOutlets()
        {
            if (WidgetImage != null)
            {
                WidgetImage.Dispose();
                WidgetImage = null;
            }

            if (WidgetTitle != null)
            {
                WidgetTitle.Dispose();
                WidgetTitle = null;
            }

            if (WidgetButton != null)
            {
                WidgetButton.Dispose();
                WidgetButton = null;
            }
        }
        public TabLoadWorld()
        {
            Icon = new Sprite(Resources.TileIcons, new Point(2, 2));

            var title = new WidgetLabel
            {
                Text = "Load World",
                Font = Resources.FontAlagard,
                Dock = Dock.Top
            };

            var saveList = new WidgetList()
            {
                Dock = Dock.Fill
            };

            var loadButton = new WidgetButton
            {
                Text = "Load",
                Dock = Dock.Bottom
            }
            .RegisterMouseClickEvent((sender) =>
            {
                if (saveList.SelectedItem != null)
                {
                    var item = (ListItemWorld)saveList.SelectedItem;
                    Game.Play(item.WorldPath);
                }
            });

            Content = new LayoutDock();
            Content.AddChildren(title, loadButton, saveList);
            Content.Padding = new Spacing(16);

            var s = Directory.GetDirectories(Game.SavesFolder);

            foreach (var save in s)
            {
                saveList.AddItem(new ListItemWorld(Path.GetFileName(save), save));
            }
        }
Example #22
0
    public void Show()
    {
        mListBox.Clear();
        btnIds.Clear();
        seenIndices.Clear();


        for (var i = 0; i < movieIds.Count; i++)
        {
            if (IsMovieSeen(movieIds[i], -1))
            {
                seenIndices.Add(i);
            }
        }

        int y = 0;

        for (int i = 0; i < seenIndices.Count; i++)
        {
            var movieInd = seenIndices[i];

            var button = new WidgetButton();
            button.Text = mMovieNames[movieInd];
            button.SetId(mMovieNames[movieInd]);
            var innerWidth = mListBox.GetInnerWidth();
            button.Width = innerWidth;
            button.SetAutoSizeWidth(false);
            button.SetStyle("mm-cinematics-list-button");
            button.Y = y;
            //var pBtn = button.get();
            btnIds.Add(button);
            var selectIdx = i;
            button.SetClickHandler(() => Select(selectIdx));
            y += button.Height;
            mListBox.Add(button);
        }

        mWidget.Show();
    }
Example #23
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);
    }
Example #24
0
    public AbilityScoreSystem()
    {
        var doc = WidgetDoc.Load("ui/pc_creation/stats_ui.json");

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

        _pointBuyInfo            = doc.GetContainer("pointBuyInfo");
        _pointBuyPointsAvailable = doc.GetTextContent("pointBuyPointsAvailable");

        _titleLabel   = doc.GetTextContent("title");
        _rerollButton = doc.GetButton("reroll");
        _rerollButton.SetClickHandler(RerollStats);
        _rerollsLabel = doc.GetTextContent("rerollsLabel");

        _togglePointBuyButton = doc.GetButton("togglePointBuy");
        _togglePointBuyButton.SetClickHandler(TogglePointBuy);
        _increaseButtons = new WidgetButton[6];
        _decreaseButtons = new WidgetButton[6];
        for (var i = 0; i < 6; i++)
        {
            var abilityIndex = i;
            _increaseButtons[i] = doc.GetButton($"increase-{AttributeIdSuffixes[i]}");
            _increaseButtons[i].SetClickHandler(() => IncreaseStat(abilityIndex));

            _decreaseButtons[i] = doc.GetButton($"decrease-{AttributeIdSuffixes[i]}");
            _decreaseButtons[i].SetClickHandler(() => DecreaseStat(abilityIndex));

            var assignedValContainer = doc.GetContainer($"assigned-val-{AttributeIdSuffixes[i]}");
            var assignedVal          = new AbilityScoreValueWidget(
                assignedValContainer.GetSize(),
                () => _pkt.abilityStats[abilityIndex],
                value => _pkt.abilityStats[abilityIndex] = value,
                true
                );
            assignedValContainer.Add(assignedVal);
            assignedVal.SetMouseMsgHandler(msg => AbilityScoreMouseHandler(msg, assignedVal));

            // Displays the modifier for the assigned attribute
            var assignedModContainer = doc.GetContainer($"assigned-mod-{AttributeIdSuffixes[i]}");
            var assignedMod          = new AbilityScoreModifierWidget(
                assignedValContainer.GetSize(),
                () => _pkt.abilityStats[abilityIndex]
                );
            assignedModContainer.Add(assignedMod);
        }

        // This label is used to draw the ability score currently being dragged
        _draggedAbilityScoreLabel = new WidgetText("", "charGenAssignedStat");

        for (var i = 0; i < 6; i++)
        {
            var index = i;
            var rolledStatContainer = doc.GetContainer("rolledAttribute" + i);
            var rolledStatWidget    = new AbilityScoreValueWidget(
                rolledStatContainer.GetSize(),
                () => charGenRolledStats[index],
                value => charGenRolledStats[index] = value,
                false
                );
            charGenRolledStatsWidgets[i] = rolledStatWidget;
            rolledStatContainer.Add(rolledStatWidget);
            rolledStatWidget.SetMouseMsgHandler(msg => AbilityScoreMouseHandler(msg, rolledStatWidget));
        }
    }
Example #25
0
        public TabNewWorld()
        {
            Icon = new Sprite(Resources.TileIcons, new Point(1, 2));

            var worldNameTextBox = new WidgetTextBox()
            {
                Padding = new Spacing(8),
                Text    = "new world"
            };

            var worldSeedtextBox = new WidgetTextBox()
            {
                Padding = new Spacing(8),
                Text    = Rise.Rnd.Next().ToString()
            };

            var worldTypeList = new WidgetList()
            {
                UnitBound = new Rectangle(0, 0, 256, 128)
            };

            foreach (var item in GENERATOR.GENERATORS)
            {
                worldTypeList.AddItem(new ListItemText(item.Key));
            }

            worldTypeList.SelectFirst();

            var generateButton = new WidgetButton {
                Text = "Generate", Dock = Dock.Bottom
            }
            .RegisterMouseClickEvent((s) => Game.New(worldNameTextBox.Text, worldSeedtextBox.Text,
                                                     GENERATOR.GENERATORS[((ListItemText)worldTypeList.SelectedItem).Text]));

            var worldOptions = new LayoutFlow
            {
                Flow     = LayoutFlowDirection.TopToBottom,
                Dock     = Dock.Fill,
                Children =
                {
                    new WidgetLabel
                    {
                        Text = "World name:", Padding = new Spacing(8), TextAlignement = TextAlignement.Left
                    },
                    worldNameTextBox,
                    new WidgetLabel {
                        Text = "Seed:", Padding = new Spacing(8), TextAlignement = TextAlignement.Left
                    },
                    worldSeedtextBox,
                    new WidgetLabel
                    {
                        Text = "World type:", Padding = new Spacing(8), TextAlignement = TextAlignement.Left
                    },
                    worldTypeList
                }
            };

            Content = new LayoutDock()
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetLabel {
                        Text = "New World", Font = Resources.FontAlagard, Dock = Dock.Top
                    },
                    generateButton,
                    worldOptions,
                }
            };
        }
Example #26
0
        public TestWindow()
            : base(WindowFlags.None)
        {
            Size  = new Vector2(2048, 2048.0f * WindowController.Instance.ScreenHeight / WindowController.Instance.ScreenWidth);
            Scale = WindowController.Instance.ScreenHeight / Size.Y;

            WidgetPanel panel = new WidgetWindow();

            panel.Size     = new Vector2(600, 760);
            panel.Scale    = WindowController.Instance.ScreenScale;
            panel.Position = Size / 2 - panel.Size * panel.Scale / 2;
            AddChild(panel);

            WidgetPanel back = new WidgetPanel(WidgetManager.GetStyle("back_pattern"));

            back.Size = panel.Size;
            panel.AddChild(back);

            WidgetLabel title = new WidgetLabel();

            title.Text      = ResourceLoader.Instance.GetString("login_title");
            title.Size      = new Vector2(panel.Size.X, 60);
            title.Position  = new Vector2(0, 50);
            title.FontSize  = WidgetManager.FontScale * 1.5f;
            title.TextAlign = WidgetAlign.Top | WidgetAlign.HorizontalCenter;
            panel.AddChild(title);

            WidgetLabel loginLabel = new WidgetLabel();

            loginLabel.Text     = ResourceLoader.Instance.GetString("login_login");
            loginLabel.Position = new Vector2(50, 160);
            loginLabel.FontSize = WidgetManager.FontScale * 1.25f;
            panel.AddChild(loginLabel);

            m_loginEdit                = new WidgetTextEdit();
            m_loginEdit.Text           = DefaultLogin;
            m_loginEdit.Size           = new Vector2(500, 45);
            m_loginEdit.Position       = new Vector2(50, 200);
            m_loginEdit.FontSize       = WidgetManager.FontScale * 1.25f;
            m_loginEdit.OnTextEntered += HandleLoginEntered;
            panel.AddChild(m_loginEdit);
            m_loginEdit.SetFocused(true);

            WidgetLabel passLabel = new WidgetLabel();

            passLabel.Text     = ResourceLoader.Instance.GetString("login_password");
            passLabel.Position = new Vector2(50, 260);
            passLabel.FontSize = WidgetManager.FontScale * 1.25f;
            panel.AddChild(passLabel);

            m_passEdit                = new WidgetTextEdit();
            m_passEdit.Text           = DefaultPassword;
            m_passEdit.Size           = new Vector2(500, 45);
            m_passEdit.Position       = new Vector2(50, 300);
            m_passEdit.FontSize       = WidgetManager.FontScale * 1.25f;
            m_passEdit.MaskChar       = "*";
            m_passEdit.OnTextEntered += HandlePassEntered;
            panel.AddChild(m_passEdit);
            m_passEdit.SetFocused(false);

            WidgetLabel localLabel = new WidgetLabel();

            localLabel.Text     = ResourceLoader.Instance.GetString("login_local");
            localLabel.Position = new Vector2(90, 360);
            localLabel.Color    = 0xcceeff;
            localLabel.FontSize = WidgetManager.FontScale * 1.0f;
            panel.AddChild(localLabel);

            m_localCheckBox            = new WidgetCheckBox(true);
            m_localCheckBox.Position   = new Vector2(50, 360);
            m_localCheckBox.Checked    = false;
            localLabel.Visible         = true;
            m_localCheckBox.OnChecked += delegate(WidgetCheckBox cb)
            {
                m_localEdit.Visible = cb.Checked;
            };

            panel.AddChild(m_localCheckBox);

            m_localCheckBox.LinkedLabel = localLabel;

            m_localEdit                  = new WidgetTextEdit();
            m_localEdit.Text             = "127.0.0.1";
            m_localEdit.Size             = new Vector2(500, 45);
            m_localEdit.Position         = new Vector2(50, 100);
            m_localEdit.FontSize         = WidgetManager.FontScale * 1.25f;
            m_localEdit.Visible          = m_localCheckBox.Checked && m_localCheckBox.Visible;
            m_localEdit.OnTextEntered   += delegate { HandleLoginPress(null); };
            m_localEdit.OnValidateInput += HandleValidateIpInput;
            panel.AddChild(m_localEdit);
            m_localEdit.SetFocused(false);


            WidgetButton webSiteButton = new WidgetButton(WidgetManager.GetStyle("text_button"), ResourceLoader.Instance.GetString("login_register"));

            webSiteButton.Position = new Vector2(50, 360 + (m_localCheckBox.Visible ? 40 : 0));
            webSiteButton.FontSize = WidgetManager.FontScale * 1.0f;
            webSiteButton.OnPress += delegate { HandleWebSitePress(null); };
            panel.AddChild(webSiteButton);

            m_loginButton          = new WidgetButton(ResourceLoader.Instance.GetString("login_connect"));
            m_loginButton.Size     = new Vector2(160, 48);
            m_loginButton.FontSize = WidgetManager.FontScale * 1.25f;
            m_loginButton.Position = new Vector2(panel.Size.X / 2 - m_loginButton.Size.X / 2, 460);
            m_loginButton.Enabled  = false;
            m_loginButton.OnPress += delegate { HandleLoginPress(null); };
            m_loginButton.Tooltip  = "@tooltip_connect";
            panel.AddChild(m_loginButton);

            WidgetImage logoImage = new WidgetImage(WidgetBackgroundStyle.ImageFit, "settings_icon");

            logoImage.Size     = new Vector2(64, 64);
            logoImage.Position = new Vector2(20, 15);
            panel.AddChild(logoImage);


            WidgetTextField textTextField = new WidgetTextField(WidgetManager.GetStyle("default_textedit"));

            textTextField.Size     = new Vector2(500, 225);
            textTextField.Position = new Vector2(50, 520);
            textTextField.FontSize = WidgetManager.FontScale * 1.25f;
            textTextField.Visible  = true;
            textTextField.Text     = "WidgetTextField textTextField = new WidgetTextField(WidgetManager.GetStyle(\"default_textedit\"));\n            textTextField.Size = new Vector2(500, 225);\n            textTextField.Position = new Vector2(50, 520);\n            textTextField.FontSize = WidgetManager.FontScale * 1.25f;\n            textTextField.Visible = true";
            panel.AddChild(textTextField);

            m_fpsLabel          = new WidgetLabel();
            m_fpsLabel.Text     = "1";
            m_fpsLabel.Position = new Vector2(440, 20);
            m_fpsLabel.FontSize = WidgetManager.FontScale * 0.75f;
            panel.AddChild(m_fpsLabel);
        }
Example #27
0
        public override void Load()
        {
            Rise.Sound.Play(Resources.Theme0);

            var title = new WidgetLabel
            {
                Text       = Game.Title,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -72),
                Font       = Resources.FontAlagard,
                TextSize   = 3f,
            };

            var subTitle = new WidgetLabel
            {
                Text       = Game.SubTitle,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -16),
                Font       = Resources.FontRomulus,
                TextColor  = ColorPalette.Accent,
                TextSize   = 1f,
            };

            var copyright = new WidgetLabel
            {
                Text     = "© 2017-2021 SMNX",
                Anchor   = Anchor.Bottom,
                Origine  = Anchor.Bottom,
                Font     = Resources.FontRomulus,
                TextSize = 1f
            };

            var continueButton = new WidgetButton
            {
                Enabled    = Game.GetLastGame() != null,
                Text       = "Continue",
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 72),
                UnitBound  = new Rectangle(0, 0, 256, 64),
            }
            .RegisterMouseClickEvent((sender) => Game.Play(Game.GetLastGame()));

            var version = new WidgetLabel
            {
                Text           = $"{Game.Title} {Game.Version}",
                Anchor         = Anchor.BottomRight,
                Origine        = Anchor.BottomRight,
                UnitOffset     = new Point(-16, 0),
                Font           = Resources.FontHack,
                TextAlignement = TextAlignement.Right,
                TextColor      = Color.White * 0.5f,
                TextSize       = 1f,
            };

            var homeTab = new Tab
            {
                Icon    = new Sprite(Resources.TileIcons, new Point(0, 4)),
                Content = new LayoutDock()
                {
                    Children =
                    {
                        title, subTitle, copyright, continueButton
                    }
                }
            };

            var menu = new WidgetTabContainer
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 600, 720),
                TabAnchore = Rise.Platform.Family == PlatformFamily.Mobile ? TabAnchore.Bottom : TabAnchore.Left,
                Tabs       =
                {
                    homeTab,
                    new TabNewWorld(),
                    new TabLoadWorld(),
                    new TabOption(),
                }
            };

            Container = new LayoutDock().AddChildren(menu, version);
        }
Example #28
0
        public TestWindow()
            : base(WindowFlags.None)
        {
            Size  = new Vector2(2048, 2048.0f * WindowController.Instance.ScreenHeight / WindowController.Instance.ScreenWidth);
            Scale = WindowController.Instance.ScreenHeight / Size.Y;

            WidgetPanel panel = new WidgetPanel(WidgetManager.DefaultWindowStyle);

            panel.Size     = new Vector2(600, 560);
            panel.Scale    = WindowController.Instance.ScreenScale;
            panel.Position = Size / 2 - panel.Size * panel.Scale / 2;
            AddChild(panel);

            WidgetPanel back = new WidgetPanel(WidgetManager.GetStyle("back_pattern"));

            back.Size = panel.Size;
            panel.AddChild(back);

            WidgetLabel title = new WidgetLabel();

            title.Text      = ResourceLoader.Instance.GetString("login_title");
            title.Size      = new Vector2(panel.Size.X, 60);
            title.Position  = new Vector2(0, 50);
            title.FontSize  = WidgetManager.DefaultLabelStyle.FontSize * 1.5f;
            title.TextAlign = WidgetAlign.Top | WidgetAlign.HorizontalCenter;
            panel.AddChild(title);

            WidgetLabel loginLabel = new WidgetLabel();

            loginLabel.Text     = ResourceLoader.Instance.GetString("login_login");
            loginLabel.Position = new Vector2(50, 160);
            loginLabel.FontSize = WidgetManager.DefaultLabelStyle.FontSize * 1.25f;
            panel.AddChild(loginLabel);

            m_loginEdit                = new WidgetTextEdit();
            m_loginEdit.Text           = DefaultLogin;
            m_loginEdit.Size           = new Vector2(500, 45);
            m_loginEdit.Position       = new Vector2(50, 200);
            m_loginEdit.FontSize       = WidgetManager.DefaultLabelStyle.FontSize * 1.25f;
            m_loginEdit.OnTextEntered += HandleLoginEntered;
            panel.AddChild(m_loginEdit);
            m_loginEdit.SetFocused(true);

            WidgetLabel passLabel = new WidgetLabel();

            passLabel.Text     = ResourceLoader.Instance.GetString("login_password");
            passLabel.Position = new Vector2(50, 260);
            passLabel.FontSize = WidgetManager.DefaultLabelStyle.FontSize * 1.25f;
            panel.AddChild(passLabel);

            m_passEdit                = new WidgetTextEdit();
            m_passEdit.Text           = DefaultPassword;
            m_passEdit.Size           = new Vector2(500, 45);
            m_passEdit.Position       = new Vector2(50, 300);
            m_passEdit.FontSize       = WidgetManager.DefaultLabelStyle.FontSize * 1.25f;
            m_passEdit.MaskChar       = '*';
            m_passEdit.OnTextEntered += HandlePassEntered;
            panel.AddChild(m_passEdit);
            m_passEdit.SetFocused(false);

            WidgetLabel localLabel = new WidgetLabel();

            localLabel.Text     = ResourceLoader.Instance.GetString("login_local");
            localLabel.Position = new Vector2(90, 360);
            localLabel.Color    = 0xcceeff;
            localLabel.FontSize = WidgetManager.DefaultLabelStyle.FontSize * 1.0f;
            panel.AddChild(localLabel);

            m_localCheckBox = new WidgetCheckBox();
            //m_localCheckBox.Size = new Vector2(30, 30);
            m_localCheckBox.Position   = new Vector2(50, 360);
            m_localCheckBox.Checked    = false;
            localLabel.Visible         = true;
            m_localCheckBox.OnChecked += delegate(WidgetCheckBox cb)
            {
                m_localEdit.Visible = cb.Checked;
            };

            panel.AddChild(m_localCheckBox);

            m_localCheckBox.LinkedLabel = localLabel;

            m_localEdit                = new WidgetTextEdit();
            m_localEdit.Text           = "127.0.0.1";
            m_localEdit.Size           = new Vector2(500, 45);
            m_localEdit.Position       = new Vector2(50, 100);
            m_localEdit.FontSize       = WidgetManager.DefaultLabelStyle.FontSize * 1.25f;
            m_localEdit.Visible        = m_localCheckBox.Checked && m_localCheckBox.Visible;
            m_localEdit.OnTextEntered += delegate { HandleLoginPress(null); };
            panel.AddChild(m_localEdit);
            m_localEdit.SetFocused(false);


            WidgetButton webSiteButton = new WidgetButton(WidgetManager.GetStyle("text_button"), ResourceLoader.Instance.GetString("login_register"));

            webSiteButton.Position = new Vector2(50, 360 + (m_localCheckBox.Visible ? 40 : 0));
            webSiteButton.FontSize = WidgetManager.DefaultLabelStyle.FontSize * 1.0f;
            webSiteButton.OnPress += delegate { HandleWebSitePress(null); };
            panel.AddChild(webSiteButton);

            m_loginButton          = new WidgetButton(ResourceLoader.Instance.GetString("login_connect"));
            m_loginButton.Size     = new Vector2(160, 48);
            m_loginButton.FontSize = WidgetManager.DefaultLabelStyle.FontSize * 1.25f;
            m_loginButton.Position = new Vector2(panel.Size.X / 2 - m_loginButton.Size.X / 2, 460);
            m_loginButton.OnPress += delegate { HandleLoginPress(null); };
            panel.AddChild(m_loginButton);
        }
    public PartyAlignmentUi()
    {
        var doc = WidgetDoc.Load("ui/party_creation/party_alignment.json");

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

        // RENDER: 0x1011be20
        // MESSAGE: 0x1011ed20
        _container.SetKeyStateChangeHandler(evt =>
        {
            if (evt.key == DIK.DIK_ESCAPE && evt.down)
            {
                Cancel();
                return(true);
            }

            return(false);
        });

        // Alignment buttons:
        // MESSAGE: 0x1011e5c0
        // RENDER: 0x1011e460
        _alignmentButtons = new Dictionary <Alignment, WidgetButton>
        {
            { Alignment.TRUE_NEUTRAL, doc.GetButton("alignment_tn") },
            { Alignment.LAWFUL_NEUTRAL, doc.GetButton("alignment_ln") },
            { Alignment.CHAOTIC_NEUTRAL, doc.GetButton("alignment_cn") },
            { Alignment.NEUTRAL_GOOD, doc.GetButton("alignment_ng") },
            { Alignment.LAWFUL_GOOD, doc.GetButton("alignment_lg") },
            { Alignment.CHAOTIC_GOOD, doc.GetButton("alignment_cg") },
            { Alignment.NEUTRAL_EVIL, doc.GetButton("alignment_ne") },
            { Alignment.LAWFUL_EVIL, doc.GetButton("alignment_le") },
            { Alignment.CHAOTIC_EVIL, doc.GetButton("alignment_ce") }
        };
        foreach (var(alignment, button) in _alignmentButtons)
        {
            var alignmentName = GameSystems.Stat.GetAlignmentName(alignment).ToUpper();
            button.Text = alignmentName;

            button.SetClickHandler(() => SelectAlignment(alignment));
        }

        // OK Button:
        // MESSAGE: 0x1011bf70
        // RENDER: 0x1011beb0
        _okButton = doc.GetButton("ok");
        _okButton.SetClickHandler(() =>
        {
            var alignment = _alignment;
            if (alignment.HasValue)
            {
                Hide();
                OnConfirm?.Invoke(alignment.Value);
            }
        });

        // Cancel button: 0x10bdd614
        // MESSAGE: 0x1011ed50
        // RENDER: 0x1011bfa0
        var cancelButton = doc.GetButton("cancel");

        cancelButton.SetClickHandler(Cancel);

        _selectionRect = doc.GetImageContent("selected");
    }
        public MenuAddMinimapWaypoint(GameState gameState) : base(gameState)
        {
            PauseGame     = true;
            EscapeToClose = true;

            var wayPointNameTextBox = new WidgetTextBox()
            {
                Dock = Dock.Top
            };
            var wayPointAddButton = new WidgetButton("Add waypoint")
            {
                Dock = Dock.Bottom
            };

            wayPointAddButton.RegisterMouseClickEvent(_ =>
            {
                AddWaypoint(wayPointAddButton.Text);
                gameState.CurrentMenu = new MenuInGame(gameState);
            });

            Content = new LayoutDock
            {
                Children =
                {
                    new WidgetFancyPanel
                    {
                        UnitBound = new Rectangle(0, 0, 600, 720),
                        Padding   = new Spacing(16),
                        Anchor    = Anchor.Center,
                        Origine   = Anchor.Center,
                        Dock      = Dock.None,

                        Content = new LayoutDock
                        {
                            Children =
                            {
                                new WidgetLabel()
                                {
                                    Text     = "Add waypoint",
                                    Font     = Resources.FontAlagard,
                                    TextSize = 1f,
                                    Dock     = Dock.Top
                                },
                                new WidgetSprite()
                                {
                                    Anchor     = Anchor.TopRight,
                                    Origine    = Anchor.Center,
                                    Sprite     = new Sprite(Resources.TileGui, new Point(7, 7)),
                                    UnitBound  = new Rectangle(0, 0, 48, 48),
                                    UnitOffset = new Point(-24, 24)
                                }.RegisterMouseClickEvent(sender => gameState.CurrentMenu = new MenuInGame(gameState)),
                                new WidgetLabel()
                                {
                                    Text           = "Name:",
                                    Font           = Resources.FontRomulus,
                                    TextAlignement = TextAlignement.Left,
                                    Dock           = Dock.Top
                                },
                                wayPointNameTextBox,
                                wayPointAddButton,
                            }
                        }
                    }
                }
            };
        }