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"); }
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 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"); }