public static void Main(string[] args) { g_testEntries = AllTests.GetTests(); testCount = g_testEntries.Count(); testIndex = Math.Max(0, Math.Min(testIndex, testCount - 1)); testSelection = testIndex; entry = g_testEntries[testIndex]; test = entry.createFcn(); GraphicsManager.SetWindowState(OpenTK.WindowState.Maximized); string title = String.Format("Box2D Version {0}.{1}.{2}", Settings._version.major, Settings._version.minor, Settings._version.revision); GraphicsManager.SetTitle(title); camera = new Camera2D(); camera.OnRender += SimulationLoop; camera.SetZoom(12); camera.CenterOnTarget(true); camera.SetLocation(0, 0); GraphicsManager.Update += new GraphicsManager.Updater(GraphicsManager_Update); WindowControl glui = new WindowControl(MainCanvas.GetCanvas()); glui.Dock = Gwen.Pos.Left; Label text = new Label(glui); text.Text = "Tests"; text.SetPosition(10, 10); testList = new ListBox(glui); testList.RowSelected += delegate(Base sender, ItemSelectedEventArgs tlargs) { testSelection = testList.SelectedRowIndex; }; foreach (TestEntry e in g_testEntries) { testList.AddRow(e.name, "", e); } testList.SelectedRowIndex = testSelection; testList.SetPosition(10, 30); testList.SetSize(170, 180); //glui.add_separator(); Base SettingsBox = new Base(glui); SettingsBox.SetSize(200, 185); SettingsBox.SetPosition(0, 250); { NumericUpDown spinner = new NumericUpDown(SettingsBox); spinner.Text = "Vel Iters"; spinner.Min = 1; spinner.Max = 500; spinner.ValueChanged += delegate(Base sender, EventArgs vcargs) { settings.velocityIterations = (int)spinner.Value; }; spinner.Value = settings.velocityIterations; spinner.SetPosition(10, 10); NumericUpDown posSpinner = new NumericUpDown(SettingsBox); posSpinner.Min = 0; posSpinner.Max = 100; posSpinner.Text = "Pos Iters"; posSpinner.ValueChanged += delegate(Base sender, EventArgs psargs) { settings.positionIterations = (int)posSpinner.Value; }; posSpinner.Value = settings.positionIterations; posSpinner.SetPosition(10, 35); NumericUpDown hertzSpinner = new NumericUpDown(SettingsBox); hertzSpinner.Text = "Hertz"; hertzSpinner.Min = 5; hertzSpinner.Max = 200; hertzSpinner.ValueChanged += delegate(Base sender, EventArgs hargs) { settingsHz = hertzSpinner.Value; }; hertzSpinner.Value = settingsHz; hertzSpinner.SetPosition(10, 60); LabeledCheckBox scb = new LabeledCheckBox(SettingsBox); scb.Text = "Sleep"; scb.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableSleep = scb.IsChecked; }; scb.IsChecked = settings.enableSleep; scb.SetPosition(10, 85); LabeledCheckBox wsu = new LabeledCheckBox(SettingsBox); wsu.Text = "Warm Starting"; wsu.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableWarmStarting = wsu.IsChecked; }; wsu.IsChecked = settings.enableWarmStarting; wsu.SetPosition(10, 110); LabeledCheckBox toi = new LabeledCheckBox(SettingsBox); toi.Text = "Time of Impact"; toi.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableContinuous = toi.IsChecked; }; toi.IsChecked = settings.enableContinuous; toi.SetPosition(10, 135); LabeledCheckBox ssb = new LabeledCheckBox(SettingsBox); ssb.Text = "Sub-Stepping"; ssb.CheckChanged += delegate(Base sender, EventArgs argsscb) { settings.enableSubStepping = ssb.IsChecked; }; ssb.IsChecked = settings.enableSubStepping; ssb.SetPosition(10, 160); } Base drawPanel = new Base(glui); drawPanel.Dock = Gwen.Pos.Bottom; drawPanel.SetSize(200, 225); { LabeledCheckBox cbShapes = new LabeledCheckBox(drawPanel); cbShapes.Text = "Shapes"; cbShapes.IsChecked = settings.drawShapes; cbShapes.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawShapes = cbShapes.IsChecked; }; cbShapes.SetPosition(10, 10); //glui.add_checkbox_to_panel(drawPanel, "Joints", &settings.drawJoints); LabeledCheckBox cbJoints = new LabeledCheckBox(drawPanel); cbJoints.Text = "Joints"; cbJoints.IsChecked = settings.drawJoints; cbJoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawJoints = cbJoints.IsChecked; }; cbJoints.SetPosition(10, 30); //glui.add_checkbox_to_panel(drawPanel, "AABBs", &settings.drawAABBs); LabeledCheckBox cbAABBs = new LabeledCheckBox(drawPanel); cbAABBs.Text = "AABBs"; cbAABBs.IsChecked = settings.drawAABBs; cbAABBs.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawAABBs = cbAABBs.IsChecked; }; cbAABBs.SetPosition(10, 50); //glui.add_checkbox_to_panel(drawPanel, "Contact Points", &settings.drawContactPoints); LabeledCheckBox cbPoints = new LabeledCheckBox(drawPanel); cbPoints.Text = "Contact Points"; cbPoints.IsChecked = settings.drawContactPoints; cbPoints.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactPoints = cbPoints.IsChecked; }; cbPoints.SetPosition(10, 70); //glui.add_checkbox_to_panel(drawPanel, "Contact Normals", &settings.drawContactNormals); LabeledCheckBox cbNormals = new LabeledCheckBox(drawPanel); cbNormals.Text = "Contact Normals"; cbNormals.IsChecked = settings.drawContactNormals; cbNormals.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactNormals = cbNormals.IsChecked; }; cbNormals.SetPosition(10, 90); //glui.add_checkbox_to_panel(drawPanel, "Contact Impulses", &settings.drawContactImpulse); LabeledCheckBox cbImpulses = new LabeledCheckBox(drawPanel); cbImpulses.Text = "Contact Impulses"; cbImpulses.IsChecked = settings.drawContactImpulse; cbImpulses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawContactImpulse = cbImpulses.IsChecked; }; cbImpulses.SetPosition(10, 110); //glui.add_checkbox_to_panel(drawPanel, "Friction Impulses", &settings.drawFrictionImpulse); LabeledCheckBox cbFriction = new LabeledCheckBox(drawPanel); cbFriction.Text = "Friction Impulses"; cbFriction.IsChecked = settings.drawFrictionImpulse; cbFriction.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawFrictionImpulse = cbFriction.IsChecked; }; cbFriction.SetPosition(10, 130); //glui.add_checkbox_to_panel(drawPanel, "Center of Masses", &settings.drawCOMs); LabeledCheckBox cbMasses = new LabeledCheckBox(drawPanel); cbMasses.Text = "Center of Masses"; cbMasses.IsChecked = settings.drawCOMs; cbMasses.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawCOMs = cbMasses.IsChecked; }; cbMasses.SetPosition(10, 150); //glui.add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats); LabeledCheckBox cbStatistics = new LabeledCheckBox(drawPanel); cbStatistics.Text = "Statistics"; cbStatistics.IsChecked = settings.drawStats; cbStatistics.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawStats = cbStatistics.IsChecked; }; cbStatistics.SetPosition(10, 170); //glui.add_checkbox_to_panel(drawPanel, "Profile", &settings.drawProfile); LabeledCheckBox cbProfile = new LabeledCheckBox(drawPanel); cbProfile.Text = "Profile"; cbProfile.IsChecked = settings.drawProfile; cbProfile.CheckChanged += delegate(Base cbshapes, EventArgs eacbshapes) { settings.drawProfile = cbProfile.IsChecked; }; cbProfile.SetPosition(10, 190); } Base Buttons = new Base(glui); Buttons.Dock = Gwen.Pos.Bottom; Buttons.Height = 100; { Button btnPause = new Button(Buttons); btnPause.Text = "Pause"; btnPause.IsToggle = true; btnPause.SetPosition(10, 10); btnPause.ToggleState = settings.pause; btnPause.Clicked += delegate(Base sender, ClickedEventArgs evargs) { settings.pause = btnPause.ToggleState; }; Button btnSS = new Button(Buttons); btnSS.Text = "Single Step"; btnSS.SetPosition(10, 40); btnSS.Clicked += delegate(Base sender, ClickedEventArgs evargs) { SingleStep(); }; Button btnRestart = new Button(Buttons); btnRestart.Text = "Restart"; btnRestart.SetPosition(10, 70); btnRestart.Clicked += delegate(Base sender, ClickedEventArgs evargs) { Restart(); }; } glui.SetSize(200, 300); GraphicsManager.Start(); }
//Init public OptionsWindow(Canvas parent, MainMenu mainMenu, ImagePanel parentPanel) { //Assign References mMainMenu = mainMenu; //Main Menu Window mOptionsPanel = new ImagePanel(parent, "OptionsWindow") { IsHidden = true }; Interface.InputBlockingElements.Add(mOptionsPanel); //Menu Header mOptionsHeader = new Label(mOptionsPanel, "OptionsHeader"); mOptionsHeader.SetText(Strings.Options.title); //Options Get Stored in the Options Scroll Control mOptionsContainer = new ScrollControl(mOptionsPanel, "OptionsContainer"); mOptionsContainer.EnableScroll(false, false); mOptionsContainer.Show(); //Resolution Background mResolutionBackground = new ImagePanel(mOptionsContainer, "ResolutionPanel"); //Options - Resolution Label mResolutionLabel = new Label(mResolutionBackground, "ResolutionLabel"); mResolutionLabel.SetText(Strings.Options.resolution); mResolutionList = new ComboBox(mResolutionBackground, "ResolutionCombobox"); var myModes = Graphics.Renderer.GetValidVideoModes(); myModes?.ForEach( t => { var item = mResolutionList.AddItem(t); item.Alignment = Pos.Left; } ); //FPS Background mFpsBackground = new ImagePanel(mOptionsContainer, "FPSPanel"); //Options - FPS Label mFpsLabel = new Label(mFpsBackground, "FPSLabel"); mFpsLabel.SetText(Strings.Options.targetfps); //Options - FPS List mFpsList = new ComboBox(mFpsBackground, "FPSCombobox"); mFpsList.AddItem(Strings.Options.vsync); mFpsList.AddItem(Strings.Options.fps30); mFpsList.AddItem(Strings.Options.fps60); mFpsList.AddItem(Strings.Options.fps90); mFpsList.AddItem(Strings.Options.fps120); mFpsList.AddItem(Strings.Options.unlimitedfps); //Options - Fullscreen Checkbox mFullscreen = new LabeledCheckBox(mOptionsContainer, "FullscreenCheckbox") { Text = Strings.Options.fullscreen }; mAutocloseWindowsCheckbox = new LabeledCheckBox(mOptionsContainer, "AutocloseWindowsCheckbox") { Text = Strings.Options.AutocloseWindows }; mEditKeybindingsBtn = new Button(mOptionsContainer, "KeybindingsButton") { Text = Strings.Controls.edit }; mEditKeybindingsBtn.Clicked += EditKeybindingsButton_Clicked; //Options - Sound Label mSoundLabel = new Label(mOptionsContainer, "SoundLabel"); mSoundLabel.SetText(Strings.Options.soundvolume.ToString(100)); //Options - Sound Slider mSoundSlider = new HorizontalSlider(mOptionsContainer, "SoundSlider"); mSoundSlider.Min = 0; mSoundSlider.Max = 100; mSoundSlider.ValueChanged += _soundSlider_ValueChanged; //Options - Music Label mMusicLabel = new Label(mOptionsContainer, "MusicLabel"); mMusicLabel.SetText(Strings.Options.musicvolume.ToString(100)); //Options - Music Slider mMusicSlider = new HorizontalSlider(mOptionsContainer, "MusicSlider"); mMusicSlider.Min = 0; mMusicSlider.Max = 100; mMusicSlider.ValueChanged += _musicSlider_ValueChanged; //Controls Get Stored in the Controls Scroll Control mControlsContainer = new ScrollControl(mOptionsPanel, "ControlsContainer"); mControlsContainer.EnableScroll(false, true); mControlsContainer.Hide(); mApplyKeybindingsButton = new Button(mOptionsPanel, "ExitControlsButton"); mApplyKeybindingsButton.Text = Strings.Options.apply; mApplyKeybindingsButton.Hide(); mApplyKeybindingsButton.Clicked += ApplyKeybindingsButton_Clicked; mCancelKeybindingsButton = new Button(mOptionsPanel, "CancelControlsButton"); mCancelKeybindingsButton.Text = Strings.Options.back; mCancelKeybindingsButton.Hide(); mCancelKeybindingsButton.Clicked += CancelKeybindingsButton_Clicked; mRestoreKeybindingsButton = new Button(mOptionsPanel, "RestoreControlsButton"); mRestoreKeybindingsButton.Text = Strings.Options.restore; mRestoreKeybindingsButton.Hide(); mRestoreKeybindingsButton.Clicked += RestoreKeybindingsButton_Clicked; var row = 0; var defaultFont = GameContentManager.Current?.GetFont("sourcesansproblack", 16); foreach (Control control in Enum.GetValues(typeof(Control))) { var offset = row * 32; var name = Enum.GetName(typeof(Control), control)?.ToLower(); var label = new Label(mControlsContainer, $"Control{Enum.GetName(typeof(Control), control)}Label") { Text = Strings.Controls.controldict[name], AutoSizeToContents = true, Font = defaultFont }; label.SetBounds(8, 8 + offset, 0, 24); label.SetTextColor(new Color(255, 255, 255, 255), Label.ControlState.Normal); var key1 = new Button(mControlsContainer, $"Control{Enum.GetName(typeof(Control), control)}Button1") { Text = "", AutoSizeToContents = false, UserData = new KeyValuePair <Control, int>(control, 1), Font = defaultFont }; key1.Clicked += Key_Clicked; var key2 = new Button(mControlsContainer, $"Control{Enum.GetName(typeof(Control), control)}Button2") { Text = "", AutoSizeToContents = false, UserData = new KeyValuePair <Control, int>(control, 2), Font = defaultFont }; key2.Clicked += Key_Clicked; mKeyButtons.Add(control, new[] { key1, key2 }); row++; } //Options - Apply Button mApplyBtn = new Button(mOptionsContainer, "ApplyButton"); mApplyBtn.SetText(Strings.Options.apply); mApplyBtn.Clicked += ApplyBtn_Clicked; //Options - Back Button mBackBtn = new Button(mOptionsContainer, "CancelButton"); mBackBtn.SetText(Strings.Options.cancel); mBackBtn.Clicked += BackBtn_Clicked; Input.KeyDown += OnKeyDown; Input.MouseDown += OnKeyDown; mOptionsPanel.LoadJsonUi( mainMenu == null ? GameContentManager.UI.InGame : GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString() ); CloseKeybindings(); }
//Init public CreateCharacterWindow( Canvas parent, MainMenu mainMenu, ImagePanel parentPanel, SelectCharacterWindow selectCharacterWindow ) { //Assign References mMainMenu = mainMenu; mSelectCharacterWindow = selectCharacterWindow; //Main Menu Window mCharCreationPanel = new ImagePanel(parent, "CharacterCreationWindow"); mCharCreationPanel.IsHidden = true; //Menu Header mCharCreationHeader = new Label(mCharCreationPanel, "CharacterCreationHeader"); mCharCreationHeader.SetText(Strings.CharacterCreation.title); //Character Name Background mCharacterNameBackground = new ImagePanel(mCharCreationPanel, "CharacterNamePanel"); //Character name Label mCharnameLabel = new Label(mCharacterNameBackground, "CharacterNameLabel"); mCharnameLabel.SetText(Strings.CharacterCreation.name); //Character name Textbox mCharnameTextbox = new TextBox(mCharacterNameBackground, "CharacterNameField"); mCharnameTextbox.SubmitPressed += CharnameTextbox_SubmitPressed; //Class Background mClassBackground = new ImagePanel(mCharCreationPanel, "ClassPanel"); //Class Label mClassLabel = new Label(mClassBackground, "ClassLabel"); mClassLabel.SetText(Strings.CharacterCreation.Class); //Class Combobox mClassCombobox = new ComboBox(mClassBackground, "ClassCombobox"); mClassCombobox.ItemSelected += classCombobox_ItemSelected; //Hint Label mHintLabel = new Label(mCharCreationPanel, "HintLabel"); mHintLabel.SetText(Strings.CharacterCreation.hint); mHintLabel.IsHidden = true; //Hint2 Label mHint2Label = new Label(mCharCreationPanel, "Hint2Label"); mHint2Label.SetText(Strings.CharacterCreation.hint2); mHint2Label.IsHidden = true; //Character Container mCharacterContainer = new ImagePanel(mCharCreationPanel, "CharacterContainer"); //Character sprite mCharacterPortrait = new ImagePanel(mCharacterContainer, "CharacterPortait"); mCharacterPortrait.SetSize(48, 48); // Hair Sprite mCharacterHair = new ImagePanel(mCharacterContainer, "CharacterHair"); mCharacterHair.SetSize(48, 48); //Next Sprite Button mNextSpriteButton = new Button(mCharacterContainer, "NextSpriteButton"); mNextSpriteButton.Clicked += _nextSpriteButton_Clicked; //Prev Sprite Button mPrevSpriteButton = new Button(mCharacterContainer, "PreviousSpriteButton"); mPrevSpriteButton.Clicked += _prevSpriteButton_Clicked; //Next Hair Button mNextHairButton = new Button(mCharacterContainer, "NextHairButton"); mNextHairButton.Clicked += _nextHairButton_Clicked; //Prev Hair Button mPrevHairButton = new Button(mCharacterContainer, "PreviousHairButton"); mPrevHairButton.Clicked += _prevHairButton_Clicked; //Class Background mGenderBackground = new ImagePanel(mCharCreationPanel, "GenderPanel"); //Gender Label mGenderLabel = new Label(mGenderBackground, "GenderLabel"); mGenderLabel.SetText(Strings.CharacterCreation.gender); //Male Checkbox mMaleChk = new LabeledCheckBox(mGenderBackground, "MaleCheckbox") { Text = Strings.CharacterCreation.male }; mMaleChk.IsChecked = true; mMaleChk.Checked += maleChk_Checked; mMaleChk.UnChecked += femaleChk_Checked; // If you notice this, feel free to hate us ;) //Female Checkbox mFemaleChk = new LabeledCheckBox(mGenderBackground, "FemaleCheckbox") { Text = Strings.CharacterCreation.female }; mFemaleChk.Checked += femaleChk_Checked; mFemaleChk.UnChecked += maleChk_Checked; //Register - Send Registration Button mCreateButton = new Button(mCharCreationPanel, "CreateButton"); mCreateButton.SetText(Strings.CharacterCreation.create); mCreateButton.Clicked += CreateButton_Clicked; mBackButton = new Button(mCharCreationPanel, "BackButton"); mBackButton.IsHidden = true; mBackButton.SetText(Strings.CharacterCreation.back); mBackButton.Clicked += BackButton_Clicked; mCharCreationPanel.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString()); }
public void InitializeLayout() { labelFont = this.Skin.DefaultFont.Copy(); labelFont.Size = 14; labelFont.Smooth = true; headerSection = new Base(this); labeled_citation_report_id = LabeledComponent.StatefulTextbox(headerSection, "Citation", RelationalPosition.LEFT, Configs.BaseFormControlSpacing); LabeledInputs.Add(labeled_citation_report_id); citationeeInformationSection = new FormSection(this, "Personal Information"); citationInformationContent = (new Base(this) { }); labeled_first_name = LabeledComponent.StatefulTextbox(citationInformationContent, "First Name", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_last_name = LabeledComponent.StatefulTextbox(citationInformationContent, "Last Name", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_dob = LabeledComponent.StatefulTextbox(citationInformationContent, "DOB", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_home_address = LabeledComponent.StatefulTextbox(citationInformationContent, "Home Address", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); LabeledInputs.AddRange(new LabeledComponent <StateControlledTextbox>[] { labeled_first_name, labeled_last_name, labeled_dob, labeled_home_address }); vehicleInformationSection = new FormSection(this, "Vehicle Information"); vehicleInformationContent = new Base(this); labeled_vehicle_type = new LabeledComponent <ComboBox>(vehicleInformationContent, "Type", new ComboBox(vehicleInformationContent), RelationalPosition.TOP, RelationalSize.NONE, Configs.BaseFormControlSpacingHalf, labelFont, labelColor); labeled_vehicle_type.Component.AddItem("Select One", "PlaceHolder", String.Empty); labeled_vehicle_type.Component.AddItem("N/A", "N/A", "N/A"); Globals.VehicleDefinitions.Types.Categories.ForEach(x => { labeled_vehicle_type.Component.AddItem(x.Value, x.Value, x.Value); }); labeled_vehicle_model = LabeledComponent.StatefulTextbox(vehicleInformationContent, "Model", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_vehicle_color = LabeledComponent.StatefulTextbox(vehicleInformationContent, "Color", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_vehicle_tag = LabeledComponent.StatefulTextbox(vehicleInformationContent, "Tag", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); LabeledInputs.AddRange(new LabeledComponent <StateControlledTextbox>[] { labeled_vehicle_model, labeled_vehicle_color, labeled_vehicle_tag }); citationLocationSection = new FormSection(this, "Violation Location"); citationLocationContent = (new Base(this) { }); labeled_citation_street_address = LabeledComponent.StatefulTextbox(citationLocationContent, "Street Address", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_citation_city = LabeledComponent.StatefulTextbox(citationLocationContent, "City", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_citation_date = LabeledComponent.StatefulTextbox(citationLocationContent, "Date", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); labeled_citation_time = LabeledComponent.StatefulTextbox(citationLocationContent, "Time", RelationalPosition.TOP, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); LabeledInputs.AddRange(new LabeledComponent <StateControlledTextbox>[] { labeled_citation_street_address, labeled_citation_city, labeled_citation_date, labeled_citation_time }); violationSection = new FormSection(this, "Violation"); violationContent = new Base(this); labeled_available_citation_reasons = new LabeledComponent <TreeControl>(violationContent, "Citation", new TreeControl(violationContent), RelationalPosition.TOP, RelationalSize.NONE, Configs.BaseFormControlSpacingHalf, labelFont, labelColor); labeled_available_citation_reasons.Component.AllowMultiSelect = false; if (ViewType == ViewTypes.CREATE) { btn_finish = LabeledComponent.Button(headerSection, "Finish", RelationalPosition.BOTTOM, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); btn_finish.Component.SaveIcon(); btn_finish.Component.Clicked += ButtonClicked; btn_finish_new = LabeledComponent.Button(headerSection, "Add New", RelationalPosition.BOTTOM, Configs.BaseFormControlSpacingHalf, labelColor, labelFont); btn_finish_new.Component.PlusOneIcon(); btn_finish_new.Component.Clicked += ButtonClicked; court_case_flag = new LabeledCheckBox(citationInformationContent); court_case_flag.Text = "Notice to Appear"; if (Configs.EnableLSPDFRPlusIntegration && Function.IsLSPDFRPlusRunning()) { court_case_flag.IsChecked = true; } else { court_case_flag.IsChecked = false; } PopulateCitationCategories(Globals.CitationDefinitions); } else { PopulateCitationCategories(null); } labeled_citation_details = new LabeledComponent <StateControlledMultilineTextbox>(violationContent, "Details", new StateControlledMultilineTextbox(violationContent), RelationalPosition.TOP, RelationalSize.NONE, Configs.BaseFormControlSpacingHalf, labelFont, labelColor); labeled_vehicle_type.Component.ItemSelected += ComponentPropChanged; labeled_available_citation_reasons.Component.SelectionChanged += ComponentPropChanged; LabeledInputs.ForEach(x => x.Component.TextChanged += ComponentPropChanged); labeled_citation_details.Component.TextChanged += ComponentPropChanged; LockControls(ReadOnly); //The below components should always be "read only" labeled_citation_report_id.Component.Disable(); labeled_citation_date.Component.Disable(); labeled_citation_time.Component.Disable(); }
public static void Create(MainWindow game) { string howto = "You are about to export your track as a video file. Make sure the end of the track is marked by a flag. " + "It will be located in your line rider user directory (Documents/LRA).\r\n" + "Please allow some minutes depending on your computer speed. " + "The window will become unresponsive during this time.\n\n" + "After recording, a console window will open to encode the video. " + "Closing it will cancel the process and all progress will be lost."; if (!SafeFrameBuffer.CanRecord) { howto = "Video export is not supported on this machine.\n\nSorry."; } var popup = PopupWindow.Create(howto, "Export Video", true, true); popup.Width = 350; popup.Container.Height += 50; var btn = popup.Container.FindChildByName("Okay"); btn.Margin = new Margin(btn.Margin.Left, btn.Margin.Top + (Settings.Local.EnableSong ? 70 : 50), btn.Margin.Right, btn.Margin.Bottom); btn = popup.Container.FindChildByName("Cancel"); btn.Margin = new Margin(btn.Margin.Left, btn.Margin.Top + (Settings.Local.EnableSong ? 70 : 50), btn.Margin.Right, btn.Margin.Bottom); popup.Layout(); var radio = new RadioButtonGroup(popup.Container); radio.Name = "qualityselector"; if (Settings.Record108p) { radio.AddOption("720p"); radio.AddOption("1080p").Select(); } else { radio.AddOption("720p").Select(); radio.AddOption("1080p"); } if (!SafeFrameBuffer.CanRecord) { radio.IsHidden = true; } LabeledCheckBox smooth = new LabeledCheckBox(popup.Container); smooth.Name = "smooth"; smooth.IsChecked = Settings.RecordSmooth; smooth.Text = "Smooth Playback"; Align.AlignBottom(smooth); LabeledCheckBox music = new LabeledCheckBox(popup.Container); music.Name = "music"; music.IsChecked = Settings.Local.EnableSong && Settings.RecordMusic; music.IsHidden = !Settings.Local.EnableSong; music.Text = "Include Music"; if (Settings.Local.EnableSong) { popup.Container.Height += 20; Align.PlaceDownLeft(music, smooth); } popup.Layout(); popup.SetPosition((game.RenderSize.Width / 2) - (popup.Width / 2), (game.RenderSize.Height / 2) - (popup.Height / 2)); popup.Dismissed += (o, e) => { if (popup.Result == System.Windows.Forms.DialogResult.OK) { var radiogrp = radio; bool is1080p = radiogrp.Selected.Text == "1080p"; Settings.Record108p = is1080p; Settings.RecordSmooth = smooth.IsChecked; if (Settings.Local.EnableSong) { Settings.RecordMusic = music.IsChecked; } Settings.Save(); if (game.Track.GetFlag() == null) { var pop = PopupWindow.Create( "No flag detected, place one at the end of the track so the recorder knows where to stop.", "Error", true, false); } else if (game.Track.Name == Utils.Constants.DefaultTrackName) { var pop = PopupWindow.Create( "Please name your track before recording.", "Error", true, false); } else { IO.TrackRecorder.RecordTrack(game, is1080p, smooth.IsChecked, music.IsChecked); } } }; }