private FrameworkElement CreateTab() { var minDistanceEditBox = new TextBox(); _minDistanceEditBox = minDistanceEditBox; minDistanceEditBox.Width = 60; minDistanceEditBox.Text = _app.Config.MidAirCutMinDistance.ToString(); minDistanceEditBox.ToolTip = "The minimum distance between the position where the projectile was shot from and the impact position. Setting it to 0 will not filter based on distance."; var minAirTimeEditBox = new TextBox(); _minAirTimeEditBox = minAirTimeEditBox; minAirTimeEditBox.Width = 60; minAirTimeEditBox.Text = _app.Config.MidAirCutMinAirTimeMs.ToString(); minAirTimeEditBox.ToolTip = "The minimum amount of time the victim was in the air prior to the hit, in milli-seconds."; var allowRocketsCheckBox = new CheckBox(); _allowRocketsCheckBox = allowRocketsCheckBox; allowRocketsCheckBox.HorizontalAlignment = HorizontalAlignment.Left; allowRocketsCheckBox.VerticalAlignment = VerticalAlignment.Center; allowRocketsCheckBox.IsChecked = _app.Config.MidAirCutAllowRocket; var allowBFGsCheckBox = new CheckBox(); _allowBFGsCheckBox = allowBFGsCheckBox; allowBFGsCheckBox.HorizontalAlignment = HorizontalAlignment.Left; allowBFGsCheckBox.VerticalAlignment = VerticalAlignment.Center; allowBFGsCheckBox.IsChecked = _app.Config.MidAirCutAllowBFG; var rulesPanelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); rulesPanelList.Add(App.CreateTuple("Allow Rockets?", allowRocketsCheckBox)); rulesPanelList.Add(App.CreateTuple("Allow BFG?", allowBFGsCheckBox)); rulesPanelList.Add(App.CreateTuple("Min. Distance", minDistanceEditBox)); rulesPanelList.Add(App.CreateTuple("Min. Air Time [ms]", minAirTimeEditBox)); var rulesPanel = WpfHelper.CreateDualColumnPanel(rulesPanelList, 120, 5); rulesPanel.HorizontalAlignment = HorizontalAlignment.Center; rulesPanel.VerticalAlignment = VerticalAlignment.Center; var rulesGroupBox = new GroupBox(); rulesGroupBox.Header = "Frag Rules"; rulesGroupBox.HorizontalAlignment = HorizontalAlignment.Left; rulesGroupBox.VerticalAlignment = VerticalAlignment.Top; rulesGroupBox.Margin = new Thickness(5); rulesGroupBox.Content = rulesPanel; var actionsGroupBox = CutByPatternComponent.CreateActionsGroupBox(UDT_DLL.udtPatternType.MidAirFrags); var helpTextBlock = new TextBlock(); helpTextBlock.Margin = new Thickness(5); helpTextBlock.TextWrapping = TextWrapping.WrapWithOverflow; helpTextBlock.Text = "Recommended minimum value for victim air time: 300 ms" + "\nRecommended minimum value for projectile distance: 300 \"Quake units\"" + "\n\nIf you set a low min. distance like 300, it would be recommended to set the air time to be at least 600." + "\nAlternatively, if you set a low min. air time like 300, it would be recommended to set the min. distance to at least 600."; var helpGroupBox = new GroupBox(); helpGroupBox.Margin = new Thickness(5); helpGroupBox.Header = "Help"; helpGroupBox.HorizontalAlignment = HorizontalAlignment.Left; helpGroupBox.VerticalAlignment = VerticalAlignment.Top; helpGroupBox.Content = helpTextBlock; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(rulesGroupBox); rootPanel.Children.Add(actionsGroupBox); rootPanel.Children.Add(helpGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
private FrameworkElement CreateTab() { var minCarryTimeTextBox = new TextBox(); _minCarryTimeTextBox = minCarryTimeTextBox; minCarryTimeTextBox.Width = 50; minCarryTimeTextBox.Text = App.FormatMinutesSeconds(_app.Config.FlagCaptureMinCarryTimeMs / 1000); minCarryTimeTextBox.ToolTip = "seconds OR minutes:seconds"; var maxCarryTimeTextBox = new TextBox(); _maxCarryTimeTextBox = maxCarryTimeTextBox; maxCarryTimeTextBox.Width = 50; maxCarryTimeTextBox.Text = App.FormatMinutesSeconds(_app.Config.FlagCaptureMaxCarryTimeMs / 1000); maxCarryTimeTextBox.ToolTip = "seconds OR minutes:seconds"; var allowBaseToBaseCheckBox = new CheckBox(); _allowBaseToBaseCheckBox = allowBaseToBaseCheckBox; allowBaseToBaseCheckBox.VerticalAlignment = VerticalAlignment.Center; allowBaseToBaseCheckBox.IsChecked = _app.Config.FlagCaptureAllowBaseToBase; allowBaseToBaseCheckBox.Content = " Allow flag pick-ups from the flag's return position?"; var allowMissingToBaseCheckBox = new CheckBox(); _allowMissingToBaseCheckBox = allowMissingToBaseCheckBox; allowMissingToBaseCheckBox.VerticalAlignment = VerticalAlignment.Center; allowMissingToBaseCheckBox.IsChecked = _app.Config.FlagCaptureAllowMissingToBase; allowMissingToBaseCheckBox.Content = " Allow flag pick-ups not from the flag's return position?"; var rulesPanelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); rulesPanelList.Add(App.CreateTuple("Min. Carry Time", minCarryTimeTextBox)); rulesPanelList.Add(App.CreateTuple("Max. Carry Time", maxCarryTimeTextBox)); rulesPanelList.Add(App.CreateTuple("Base Pick-ups?", allowBaseToBaseCheckBox)); rulesPanelList.Add(App.CreateTuple("Non-base Pick-ups?", allowMissingToBaseCheckBox)); var rulesPanel = WpfHelper.CreateDualColumnPanel(rulesPanelList, 120, 5); rulesPanel.HorizontalAlignment = HorizontalAlignment.Center; rulesPanel.VerticalAlignment = VerticalAlignment.Center; var rulesGroupBox = new GroupBox(); rulesGroupBox.Header = "Capture Rules"; rulesGroupBox.HorizontalAlignment = HorizontalAlignment.Left; rulesGroupBox.VerticalAlignment = VerticalAlignment.Top; rulesGroupBox.Margin = new Thickness(5); rulesGroupBox.Content = rulesPanel; var actionsGroupBox = CutByPatternComponent.CreateActionsGroupBox(UDT_DLL.udtPatternType.FlagCaptures); var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(rulesGroupBox); rootPanel.Children.Add(actionsGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
private FrameworkElement CreateTab() { var config = _app.Config; var minSpeedEditBox = new TextBox(); _minSpeedEditBox = minSpeedEditBox; minSpeedEditBox.HorizontalAlignment = HorizontalAlignment.Left; minSpeedEditBox.VerticalAlignment = VerticalAlignment.Top; minSpeedEditBox.Width = 60; minSpeedEditBox.Text = config.FlickRailMinSpeed.ToString(); minSpeedEditBox.ToolTip = "Angular velocity threshold, in degrees per second."; var minAngleDeltaEditBox = new TextBox(); _minAngleDeltaEditBox = minAngleDeltaEditBox; minAngleDeltaEditBox.HorizontalAlignment = HorizontalAlignment.Left; minAngleDeltaEditBox.VerticalAlignment = VerticalAlignment.Top; minAngleDeltaEditBox.Width = 60; minAngleDeltaEditBox.Text = config.FlickRailMinAngleDelta.ToString(); minAngleDeltaEditBox.ToolTip = "Absolute angle difference threshold, in degrees."; _minSpeedSnapsComboBox = CreateSnapshotCountComboBox(config.FlickRailMinSpeedSnaps); _minAngleDeltaSnapsComboBox = CreateSnapshotCountComboBox(config.FlickRailMinAngleDeltaSnaps); var rulesPanelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); rulesPanelList.Add(App.CreateTuple("Min. Speed", minSpeedEditBox)); rulesPanelList.Add(App.CreateTuple("Speed Snapshots", _minSpeedSnapsComboBox)); rulesPanelList.Add(App.CreateTuple("Min. Angle Delta", minAngleDeltaEditBox)); rulesPanelList.Add(App.CreateTuple("Angle Delta Snapshots", _minAngleDeltaSnapsComboBox)); var rulesPanel = WpfHelper.CreateDualColumnPanel(rulesPanelList, 120, 5); rulesPanel.HorizontalAlignment = HorizontalAlignment.Center; rulesPanel.VerticalAlignment = VerticalAlignment.Center; var rulesGroupBox = new GroupBox(); rulesGroupBox.Header = "Flick Rail Rules"; rulesGroupBox.HorizontalAlignment = HorizontalAlignment.Left; rulesGroupBox.VerticalAlignment = VerticalAlignment.Top; rulesGroupBox.Margin = new Thickness(5); rulesGroupBox.Content = rulesPanel; var actionsGroupBox = CutByPatternComponent.CreateActionsGroupBox(UDT_DLL.udtPatternType.FlickRails); var helpTextBlock = new TextBlock(); helpTextBlock.Margin = new Thickness(5); helpTextBlock.TextWrapping = TextWrapping.WrapWithOverflow; helpTextBlock.Text = "Recommended minimum value for angular velocity:" + "\n- 800 degrees/second for a fast flick shot" + "\n- 500 degrees/second for a reasonably fast flick shot" + "\n\nRecommended minimum angle delta for a good flick shot:" + "\n- 50 degrees if over the duration of 2 snapshots in Quake 3 (snapshot duration: usually 33 ms)" + "\n- 37 degrees if over the duration of 2 snapshots in Quake Live (snapshot duration: 25 ms)" + "\n\nNote that:" + "\n- Min. Angle Delta is linearly dependent on Angle Delta Snapshots" + "\n- Min. Speed is independent of Speed Snapshots" + "\n\nIf you don't care about the minimum angle, set Min. Angle Delta to 0 and just tune the Min. Speed value."; rulesPanelList.Add(App.CreateTuple("Min. Speed", minSpeedEditBox)); rulesPanelList.Add(App.CreateTuple("Speed Snapshots", _minSpeedSnapsComboBox)); rulesPanelList.Add(App.CreateTuple("Min. Angle Delta", minAngleDeltaEditBox)); rulesPanelList.Add(App.CreateTuple("Angle Delta Snapshots", _minAngleDeltaSnapsComboBox)); var helpGroupBox = new GroupBox(); helpGroupBox.Margin = new Thickness(5); helpGroupBox.Header = "Help"; helpGroupBox.HorizontalAlignment = HorizontalAlignment.Left; helpGroupBox.VerticalAlignment = VerticalAlignment.Top; helpGroupBox.Content = helpTextBlock; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(rulesGroupBox); rootPanel.Children.Add(actionsGroupBox); rootPanel.Children.Add(helpGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
private FrameworkElement CreateSettingsControl() { var startTimeOffsetEditBox = new TextBox(); _startTimeOffsetEditBox = startTimeOffsetEditBox; startTimeOffsetEditBox.Width = 40; startTimeOffsetEditBox.Text = _app.Config.CutStartOffset.ToString(); startTimeOffsetEditBox.ToolTip = "How many seconds before the (first) pattern matching event do we start the cut?"; var endTimeOffsetEditBox = new TextBox(); _endTimeOffsetEditBox = endTimeOffsetEditBox; endTimeOffsetEditBox.Width = 40; endTimeOffsetEditBox.Text = _app.Config.CutEndOffset.ToString(); endTimeOffsetEditBox.ToolTip = "How many seconds after the (last) pattern matching event event do we end the cut?"; var outputModeCheckBox = new CheckBox(); _outputModeCheckBox = outputModeCheckBox; outputModeCheckBox.HorizontalAlignment = HorizontalAlignment.Left; outputModeCheckBox.VerticalAlignment = VerticalAlignment.Center; outputModeCheckBox.IsChecked = _app.Config.OutputToInputFolder; outputModeCheckBox.Content = " Output cut demos to the input demos' folders?"; outputModeCheckBox.Checked += (obj, args) => OnSameOutputChecked(); outputModeCheckBox.Unchecked += (obj, args) => OnSameOutputUnchecked(); var outputFolderRow = CreateFolderRow( ref _outputFolderTextBox, _app.Config.OutputFolder, "Browse for the folder the processed demos will get written to"); var skipChatOffsetsDialogCheckBox = new CheckBox(); skipChatOffsetsDialogCheckBox.HorizontalAlignment = HorizontalAlignment.Left; skipChatOffsetsDialogCheckBox.VerticalAlignment = VerticalAlignment.Center; skipChatOffsetsDialogCheckBox.IsChecked = _app.Config.SkipChatOffsetsDialog; skipChatOffsetsDialogCheckBox.Content = " Skip the 'Cut Offsets' dialog?"; skipChatOffsetsDialogCheckBox.Checked += (obj, args) => OnSkipChatOffsetsChecked(); skipChatOffsetsDialogCheckBox.Unchecked += (obj, args) => OnSkipChatOffsetsUnchecked(); var skipFolderScanModeCheckBox = new CheckBox(); _skipFolderScanModeCheckBox = skipFolderScanModeCheckBox; skipFolderScanModeCheckBox.HorizontalAlignment = HorizontalAlignment.Left; skipFolderScanModeCheckBox.VerticalAlignment = VerticalAlignment.Center; skipFolderScanModeCheckBox.IsChecked = _app.Config.SkipScanFoldersRecursivelyDialog; skipFolderScanModeCheckBox.Content = " Skip the dialog asking if folder scanning should be recursive?"; skipFolderScanModeCheckBox.Checked += (obj, args) => OnSkipFolderScanRecursiveChecked(); skipFolderScanModeCheckBox.Unchecked += (obj, args) => OnSkipFolderScanRecursiveUnchecked(); var folderScanModeCheckBox = new CheckBox(); _folderScanModeCheckBox = folderScanModeCheckBox; folderScanModeCheckBox.HorizontalAlignment = HorizontalAlignment.Left; folderScanModeCheckBox.VerticalAlignment = VerticalAlignment.Center; folderScanModeCheckBox.IsChecked = _app.Config.ScanFoldersRecursively; folderScanModeCheckBox.Content = " Scan subfolders recursively?"; folderScanModeCheckBox.Checked += (obj, args) => OnFolderScanRecursiveChecked(); folderScanModeCheckBox.Unchecked += (obj, args) => OnFolderScanRecursiveUnchecked(); var maxThreadCountTextBox = new TextBox(); _maxThreadCountTextBox = maxThreadCountTextBox; maxThreadCountTextBox.ToolTip = "The maximum number of threads that you allow UDT to use during batch process operations\n" + "Only set this to a number greater than 1 if you read your demo files from an SSD\n" + "Otherwise, performance will decrease"; maxThreadCountTextBox.HorizontalAlignment = HorizontalAlignment.Left; maxThreadCountTextBox.VerticalAlignment = VerticalAlignment.Center; maxThreadCountTextBox.Text = _app.Config.MaxThreadCount.ToString(); maxThreadCountTextBox.Width = 25; var useInputFolderForBrowsingCheckBox = new CheckBox(); _useInputFolderForBrowsingCheckBox = useInputFolderForBrowsingCheckBox; useInputFolderForBrowsingCheckBox.HorizontalAlignment = HorizontalAlignment.Left; useInputFolderForBrowsingCheckBox.VerticalAlignment = VerticalAlignment.Center; useInputFolderForBrowsingCheckBox.IsChecked = _app.Config.UseInputFolderAsDefaultBrowsingLocation; useInputFolderForBrowsingCheckBox.Content = " Use input folder as default browsing location?"; useInputFolderForBrowsingCheckBox.Checked += (obj, args) => OnInputFolderForBrowsingChecked(); useInputFolderForBrowsingCheckBox.Unchecked += (obj, args) => OnInputFolderForBrowsingUnchecked(); var useInputFolderOnStartUpCheckBox = new CheckBox(); _useInputFolderOnStartUpCheckBox = useInputFolderOnStartUpCheckBox; useInputFolderOnStartUpCheckBox.HorizontalAlignment = HorizontalAlignment.Left; useInputFolderOnStartUpCheckBox.VerticalAlignment = VerticalAlignment.Center; useInputFolderOnStartUpCheckBox.IsChecked = _app.Config.OpenDemosFromInputFolderOnStartUp; useInputFolderOnStartUpCheckBox.Content = " Open demos from input folder on application start-up?"; useInputFolderOnStartUpCheckBox.Checked += (obj, args) => OnUseInputFolderOnStartUpChecked(); useInputFolderOnStartUpCheckBox.Unchecked += (obj, args) => OnUseInputFolderOnStartUpUnchecked(); var inputFolderRow = CreateFolderRow( ref _inputFolderTextBox, _app.Config.InputFolder, "Browse for the folder demos will be read or searched from"); var analyzeOnLoadCheckBox = new CheckBox(); _analyzeOnLoadCheckBox = analyzeOnLoadCheckBox; analyzeOnLoadCheckBox.HorizontalAlignment = HorizontalAlignment.Left; analyzeOnLoadCheckBox.VerticalAlignment = VerticalAlignment.Center; analyzeOnLoadCheckBox.IsChecked = _app.Config.AnalyzeOnLoad; analyzeOnLoadCheckBox.Content = " Analyze demos when loading them into the list?"; analyzeOnLoadCheckBox.Checked += (obj, args) => _app.Config.AnalyzeOnLoad = true; analyzeOnLoadCheckBox.Unchecked += (obj, args) => _app.Config.AnalyzeOnLoad = false; analyzeOnLoadCheckBox.ToolTip = " You can always launch the analysis pass from the \"Manage\" tab."; var mergeCutSectionsCheckBox = new CheckBox(); _mergeCutSectionsCheckBox = mergeCutSectionsCheckBox; mergeCutSectionsCheckBox.HorizontalAlignment = HorizontalAlignment.Left; mergeCutSectionsCheckBox.VerticalAlignment = VerticalAlignment.Center; mergeCutSectionsCheckBox.IsChecked = _app.Config.MergeCutSectionsFromDifferentPatterns; mergeCutSectionsCheckBox.Content = " Merge overlapping cut sections matched by different pattern types?"; mergeCutSectionsCheckBox.Checked += (obj, args) => _app.Config.MergeCutSectionsFromDifferentPatterns = true; mergeCutSectionsCheckBox.Unchecked += (obj, args) => _app.Config.MergeCutSectionsFromDifferentPatterns = false; var colorLogMessagesCheckBox = new CheckBox(); _colorLogMessagesCheckBox = colorLogMessagesCheckBox; colorLogMessagesCheckBox.HorizontalAlignment = HorizontalAlignment.Left; colorLogMessagesCheckBox.VerticalAlignment = VerticalAlignment.Center; colorLogMessagesCheckBox.IsChecked = _app.Config.ColorLogWarningsAndErrors; colorLogMessagesCheckBox.Content = " Color the log window's warning and error messages?"; colorLogMessagesCheckBox.Checked += (obj, args) => _app.Config.ColorLogWarningsAndErrors = true; colorLogMessagesCheckBox.Unchecked += (obj, args) => _app.Config.ColorLogWarningsAndErrors = false; colorLogMessagesCheckBox.ToolTip = "The option is disabled by default because it might not integrate well with your current theme."; var runUpdaterAtStartUpCheckBox = new CheckBox(); _runUpdaterAtStartUpCheckBox = runUpdaterAtStartUpCheckBox; runUpdaterAtStartUpCheckBox.HorizontalAlignment = HorizontalAlignment.Left; runUpdaterAtStartUpCheckBox.VerticalAlignment = VerticalAlignment.Center; runUpdaterAtStartUpCheckBox.IsChecked = _app.Config.RunUpdaterAtStartUp; runUpdaterAtStartUpCheckBox.Content = " Run the updater at application start-up time?"; runUpdaterAtStartUpCheckBox.Checked += (obj, args) => _app.Config.RunUpdaterAtStartUp = true; runUpdaterAtStartUpCheckBox.Unchecked += (obj, args) => _app.Config.RunUpdaterAtStartUp = false; const int OutputFolderIndex = 1; const int SkipRecursiveDialogIndex = 4; const int InputFolderIndex = 8; var panelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); panelList.Add(App.CreateTuple("Output Mode", outputModeCheckBox)); panelList.Add(App.CreateTuple("=> Output Folder", outputFolderRow)); panelList.Add(App.CreateTuple("Chat/Death History", skipChatOffsetsDialogCheckBox)); panelList.Add(App.CreateTuple("Recursive Scan", skipFolderScanModeCheckBox)); panelList.Add(App.CreateTuple("=> Recursive", folderScanModeCheckBox)); panelList.Add(App.CreateTuple("Max Thread Count", maxThreadCountTextBox)); panelList.Add(App.CreateTuple("Browsing Location", useInputFolderForBrowsingCheckBox)); panelList.Add(App.CreateTuple("Open on Start-up", useInputFolderOnStartUpCheckBox)); panelList.Add(App.CreateTuple("=> Input Folder", inputFolderRow)); panelList.Add(App.CreateTuple("Analyze on Load", analyzeOnLoadCheckBox)); panelList.Add(App.CreateTuple("Start Time Offset [s]", startTimeOffsetEditBox)); panelList.Add(App.CreateTuple("End Time Offset [s]", endTimeOffsetEditBox)); panelList.Add(App.CreateTuple("Merge Cut Sections", mergeCutSectionsCheckBox)); panelList.Add(App.CreateTuple("Color Log Messages", colorLogMessagesCheckBox)); panelList.Add(App.CreateTuple("Start-up Updates", runUpdaterAtStartUpCheckBox)); var settingsPanel = WpfHelper.CreateDualColumnPanel(panelList, 135, 2); settingsPanel.HorizontalAlignment = HorizontalAlignment.Left; settingsPanel.VerticalAlignment = VerticalAlignment.Top; settingsPanel.Margin = new Thickness(0); var settingStackPanel = settingsPanel as StackPanel; _outputFolderRow = settingStackPanel.Children[OutputFolderIndex] as FrameworkElement; SetActive(_outputFolderRow, !_app.Config.OutputToInputFolder); _skipRecursiveDialog = settingStackPanel.Children[SkipRecursiveDialogIndex] as FrameworkElement; SetActive(_skipRecursiveDialog, _app.Config.SkipScanFoldersRecursivelyDialog); _inputFolderRow = settingStackPanel.Children[InputFolderIndex] as FrameworkElement; UpdateInputFolderActive(); var settingsGroupBox = new GroupBox(); settingsGroupBox.HorizontalAlignment = HorizontalAlignment.Left; settingsGroupBox.VerticalAlignment = VerticalAlignment.Top; settingsGroupBox.Margin = new Thickness(5); settingsGroupBox.Header = "Settings"; settingsGroupBox.Content = settingsPanel; var plugInNames = UDT_DLL.GetStringArray(UDT_DLL.udtStringArray.PlugInNames); var jsonPlugInsStackPanel = new StackPanel(); jsonPlugInsStackPanel.HorizontalAlignment = HorizontalAlignment.Stretch; jsonPlugInsStackPanel.VerticalAlignment = VerticalAlignment.Stretch; jsonPlugInsStackPanel.Margin = new Thickness(5); jsonPlugInsStackPanel.Children.Add(new TextBlock { Text = "Select which analyzers are enabled" }); for (int i = 0; i < (int)UDT_DLL.udtParserPlugIn.Count; ++i) { var checkBox = new CheckBox(); checkBox.Margin = new Thickness(5, 5, 0, 0); checkBox.Content = " " + plugInNames[i].Capitalize(); checkBox.IsChecked = BitManip.IsBitSet(_app.Config.JSONPlugInsEnabled, i); var iCopy = i; // Make sure we capture a local copy in the lambda. checkBox.Checked += (obj, args) => BitManip.SetBit(ref _app.Config.JSONPlugInsEnabled, iCopy); checkBox.Unchecked += (obj, args) => BitManip.ClearBit(ref _app.Config.JSONPlugInsEnabled, iCopy); _jsonEnabledPlugInsCheckBoxes.Add(checkBox); jsonPlugInsStackPanel.Children.Add(checkBox); } var jsonPlugInsGroupBox = new GroupBox(); jsonPlugInsGroupBox.HorizontalAlignment = HorizontalAlignment.Left; jsonPlugInsGroupBox.VerticalAlignment = VerticalAlignment.Top; jsonPlugInsGroupBox.Margin = new Thickness(5); jsonPlugInsGroupBox.Header = "JSON Export"; jsonPlugInsGroupBox.Content = jsonPlugInsStackPanel; var perfStatsNames = UDT_DLL.GetStringArray(UDT_DLL.udtStringArray.PerfStatsNames); var perfStatsStackPanel = new StackPanel(); perfStatsStackPanel.HorizontalAlignment = HorizontalAlignment.Stretch; perfStatsStackPanel.VerticalAlignment = VerticalAlignment.Stretch; perfStatsStackPanel.Margin = new Thickness(5); perfStatsStackPanel.Children.Add(new TextBlock { Text = "Select which job stats are printed in the log window" }); for (int i = 0; i < (int)CSharpPerfStats.Count; ++i) { var checkBox = new CheckBox(); checkBox.Margin = new Thickness(5, 5, 0, 0); checkBox.Content = " " + CSharpPerfStatsConstants.Strings[i].Capitalize(); checkBox.IsChecked = BitManip.IsBitSet(_app.Config.CSharpPerfStatsEnabled, i); var iCopy = i; // Make sure we capture a local copy in the lambda. checkBox.Checked += (obj, args) => BitManip.SetBit(ref _app.Config.CSharpPerfStatsEnabled, iCopy); checkBox.Unchecked += (obj, args) => BitManip.ClearBit(ref _app.Config.CSharpPerfStatsEnabled, iCopy); _enabledCSharpPerfStatsCheckBoxes.Add(checkBox); perfStatsStackPanel.Children.Add(checkBox); } for (int i = 0; i < (int)UDT_DLL.StatsConstants.PerfFieldCount; ++i) { var checkBox = new CheckBox(); checkBox.Margin = new Thickness(5, 5, 0, 0); checkBox.Content = " " + perfStatsNames[i].Capitalize(); checkBox.IsChecked = BitManip.IsBitSet(_app.Config.PerfStatsEnabled, i); var iCopy = i; // Make sure we capture a local copy in the lambda. checkBox.Checked += (obj, args) => BitManip.SetBit(ref _app.Config.PerfStatsEnabled, iCopy); checkBox.Unchecked += (obj, args) => BitManip.ClearBit(ref _app.Config.PerfStatsEnabled, iCopy); _enabledPerfStatsCheckBoxes.Add(checkBox); perfStatsStackPanel.Children.Add(checkBox); } var perfStatsGroupBox = new GroupBox(); perfStatsGroupBox.HorizontalAlignment = HorizontalAlignment.Left; perfStatsGroupBox.VerticalAlignment = VerticalAlignment.Top; perfStatsGroupBox.Margin = new Thickness(5); perfStatsGroupBox.Header = "Performance Logging"; perfStatsGroupBox.Content = perfStatsStackPanel; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Children.Add(settingsGroupBox); rootPanel.Children.Add(perfStatsGroupBox); rootPanel.Children.Add(jsonPlugInsGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
private FrameworkElement CreateCutByTimeTab() { var startTimeEditBox = new TextBox(); _startTimeEditBox = startTimeEditBox; startTimeEditBox.Width = 50; startTimeEditBox.Text = "00:00"; startTimeEditBox.ToolTip = "Format: seconds OR minutes:seconds"; var endTimeEditBox = new TextBox(); _endTimeEditBox = endTimeEditBox; endTimeEditBox.Width = 50; endTimeEditBox.Text = "00:20"; endTimeEditBox.ToolTip = "Format: seconds OR minutes:seconds"; var gameStateIndexEditBox = new TextBox(); _gameStateIndexEditBox = gameStateIndexEditBox; gameStateIndexEditBox.Width = 50; gameStateIndexEditBox.Text = "0"; gameStateIndexEditBox.ToolTip = "The 0-based index of the last GameState message that comes before the content you want to cut"; var panelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); panelList.Add(App.CreateTuple("Start Time", startTimeEditBox)); panelList.Add(App.CreateTuple("End Time", endTimeEditBox)); panelList.Add(App.CreateTuple("GameState Index", gameStateIndexEditBox)); var optionsPanel = WpfHelper.CreateDualColumnPanel(panelList, 100, 5); optionsPanel.HorizontalAlignment = HorizontalAlignment.Center; optionsPanel.VerticalAlignment = VerticalAlignment.Center; _gameStateIndexRow = optionsPanel.Children[2] as FrameworkElement; var cutOptionsGroupBox = new GroupBox(); cutOptionsGroupBox.HorizontalAlignment = HorizontalAlignment.Left; cutOptionsGroupBox.VerticalAlignment = VerticalAlignment.Top; cutOptionsGroupBox.Margin = new Thickness(5); cutOptionsGroupBox.Header = "Cut Configuration"; cutOptionsGroupBox.Content = optionsPanel; var cutButton = new Button(); cutButton.HorizontalAlignment = HorizontalAlignment.Left; cutButton.VerticalAlignment = VerticalAlignment.Center; cutButton.Content = "Cut!"; cutButton.Width = 75; cutButton.Height = 25; cutButton.Margin = new Thickness(5); cutButton.Click += (obj, args) => OnCutByTimeClicked(); var actionsGroupBox = new GroupBox(); actionsGroupBox.HorizontalAlignment = HorizontalAlignment.Left; actionsGroupBox.VerticalAlignment = VerticalAlignment.Top; actionsGroupBox.Margin = new Thickness(5); actionsGroupBox.Header = "Actions"; actionsGroupBox.Content = cutButton; var calcMatchSelectionComboBox = new ComboBox(); _calcMatchSelectionComboBox = calcMatchSelectionComboBox; calcMatchSelectionComboBox.HorizontalAlignment = HorizontalAlignment.Stretch; calcMatchSelectionComboBox.VerticalAlignment = VerticalAlignment.Center; calcMatchSelectionComboBox.Items.Add("Match #1"); calcMatchSelectionComboBox.SelectedIndex = 0; calcMatchSelectionComboBox.SelectionChanged += (obj, args) => UpdateCalcServerTime(); var calcTimeEditBox = new TextBox(); _calcTimeEditBox = calcTimeEditBox; calcTimeEditBox.VerticalAlignment = VerticalAlignment.Center; calcTimeEditBox.Width = 50; calcTimeEditBox.Text = "00:00"; calcTimeEditBox.ToolTip = "Format: seconds OR minutes:seconds"; calcTimeEditBox.TextChanged += (obj, args) => UpdateCalcServerTime(); var calcClockDirCheckBox = new CheckBox(); _calcClockDirCheckBox = calcClockDirCheckBox; calcClockDirCheckBox.VerticalAlignment = VerticalAlignment.Center; calcClockDirCheckBox.Content = " Is the timestamp for the game clock going up?"; calcClockDirCheckBox.IsChecked = true; calcClockDirCheckBox.Checked += (obj, args) => UpdateCalcServerTime(); calcClockDirCheckBox.Unchecked += (obj, args) => UpdateCalcServerTime(); var calcOvertimeCheckBox = new CheckBox(); _calcOvertimeCheckBox = calcOvertimeCheckBox; calcOvertimeCheckBox.VerticalAlignment = VerticalAlignment.Center; calcOvertimeCheckBox.Content = " Was the game in overtime at that timestamp?"; calcOvertimeCheckBox.IsChecked = false; calcOvertimeCheckBox.Checked += (obj, args) => UpdateCalcServerTime(); calcOvertimeCheckBox.Unchecked += (obj, args) => UpdateCalcServerTime(); var calcOutputTimeEditBox = new TextBox(); _calcOutputTimeEditBox = calcOutputTimeEditBox; calcOutputTimeEditBox.VerticalAlignment = VerticalAlignment.Center; calcOutputTimeEditBox.Width = 50; calcOutputTimeEditBox.Text = "?"; calcOutputTimeEditBox.IsReadOnly = true; calcOutputTimeEditBox.TextChanged += (obj, args) => UpdateCalcServerTime(); var calcFillValuesButton = new Button(); calcFillValuesButton.VerticalAlignment = VerticalAlignment.Center; calcFillValuesButton.Width = 75; calcFillValuesButton.Height = 25; calcFillValuesButton.Content = "Fill Values"; calcFillValuesButton.ToolTip = "Fill in the fields of the Cut Configuration group box above using your settings?"; calcFillValuesButton.Click += (obj, args) => FillCutByTimeFields(); var calcErrorTextBlock = new TextBlock(); _calcErrorTextBlock = calcErrorTextBlock; calcErrorTextBlock.VerticalAlignment = VerticalAlignment.Center; calcErrorTextBlock.Text = "none"; var calcList = new List <Tuple <FrameworkElement, FrameworkElement> >(); calcList.Add(App.CreateTuple("", "Round-based game types are not supported.")); calcList.Add(App.CreateTuple("", "Overtimes with the clock going down are not supported.")); calcList.Add(App.CreateTuple("Match", calcMatchSelectionComboBox)); calcList.Add(App.CreateTuple("Match Time", calcTimeEditBox)); calcList.Add(App.CreateTuple("Clock Goes Up?", calcClockDirCheckBox)); calcList.Add(App.CreateTuple("In Overtime?", calcOvertimeCheckBox)); calcList.Add(App.CreateTuple("Server Time", calcOutputTimeEditBox)); calcList.Add(App.CreateTuple("Error", calcErrorTextBlock)); calcList.Add(App.CreateTuple("", calcFillValuesButton)); var calcPanel = WpfHelper.CreateDualColumnPanel(calcList, 100, 3); calcPanel.HorizontalAlignment = HorizontalAlignment.Center; calcPanel.VerticalAlignment = VerticalAlignment.Center; _calcMatchSelectionRow = calcPanel.Children[2] as FrameworkElement; _calcOvertimeRow = calcPanel.Children[5] as FrameworkElement; _calcErrorRow = calcPanel.Children[7] as FrameworkElement; var calcGroupBox = new GroupBox(); _calcGroupBox = calcGroupBox; calcGroupBox.HorizontalAlignment = HorizontalAlignment.Left; calcGroupBox.VerticalAlignment = VerticalAlignment.Top; calcGroupBox.Margin = new Thickness(5); calcGroupBox.Header = "Match Time to Server Time Converter"; calcGroupBox.Content = calcPanel; var helpTextBlock = new TextBlock(); helpTextBlock.Margin = new Thickness(5); helpTextBlock.TextWrapping = TextWrapping.WrapWithOverflow; helpTextBlock.Text = "The times UDT uses are server times, not match times." + "\nThe time format is either (seconds) or (minutes:seconds)." + "\n\nThe GameState index is the 0-based index of the last GameState message that comes before the content you want to cut." + "\n\nTo see the range of usable time values for a specific GameState index, check out the \"Server Time Range\" row(s) in the \"General\" tab under \"Info\"."; var helpGroupBox = new GroupBox(); helpGroupBox.HorizontalAlignment = HorizontalAlignment.Left; helpGroupBox.VerticalAlignment = VerticalAlignment.Top; helpGroupBox.Margin = new Thickness(5); helpGroupBox.Header = "Help"; helpGroupBox.Content = helpTextBlock; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(cutOptionsGroupBox); rootPanel.Children.Add(actionsGroupBox); rootPanel.Children.Add(calcGroupBox); rootPanel.Children.Add(helpGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
public TimeOffsetsDialog(Window parent, int startOffset, int endOffset) { var startTimeEditBox = new TextBox(); startTimeEditBox.Width = 50; startTimeEditBox.Text = "10"; startTimeEditBox.ToolTip = "seconds OR minutes:seconds"; var endTimeEditBox = new TextBox(); endTimeEditBox.Width = 50; endTimeEditBox.Text = "10"; endTimeEditBox.ToolTip = "seconds OR minutes:seconds"; var panelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); panelList.Add(App.CreateTuple("Start Time", startTimeEditBox)); panelList.Add(App.CreateTuple("End Time", endTimeEditBox)); var optionsPanel = WpfHelper.CreateDualColumnPanel(panelList, 100, 5); optionsPanel.HorizontalAlignment = HorizontalAlignment.Center; optionsPanel.VerticalAlignment = VerticalAlignment.Center; var cutOptionsGroupBox = new GroupBox(); cutOptionsGroupBox.Header = "Cut Configuration"; cutOptionsGroupBox.HorizontalAlignment = HorizontalAlignment.Stretch; cutOptionsGroupBox.VerticalAlignment = VerticalAlignment.Stretch; cutOptionsGroupBox.Margin = new Thickness(5); cutOptionsGroupBox.Content = optionsPanel; var okButton = new Button(); okButton.Content = "OK"; okButton.Width = 75; okButton.Height = 25; okButton.Margin = new Thickness(5); okButton.HorizontalAlignment = HorizontalAlignment.Right; var cancelButton = new Button(); cancelButton.Content = "Cancel"; cancelButton.Width = 75; cancelButton.Height = 25; cancelButton.Margin = new Thickness(5); cancelButton.HorizontalAlignment = HorizontalAlignment.Right; var rootPanel = new DockPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Center; rootPanel.VerticalAlignment = VerticalAlignment.Center; rootPanel.Children.Add(cutOptionsGroupBox); rootPanel.Children.Add(cancelButton); rootPanel.Children.Add(okButton); DockPanel.SetDock(cutOptionsGroupBox, Dock.Top); DockPanel.SetDock(cancelButton, Dock.Right); DockPanel.SetDock(okButton, Dock.Right); var window = new Window(); okButton.Click += (obj, args) => { window.DialogResult = true; window.Close(); }; cancelButton.Click += (obj, args) => { window.DialogResult = false; window.Close(); }; window.Owner = parent; window.WindowStyle = WindowStyle.ToolWindow; window.AllowsTransparency = false; window.Background = new SolidColorBrush(System.Windows.SystemColors.ControlColor); window.ShowInTaskbar = false; window.SizeToContent = SizeToContent.WidthAndHeight; window.ResizeMode = ResizeMode.NoResize; window.Icon = UDT.Properties.Resources.UDTIcon.ToImageSource(); window.Title = "Cut Offsets"; window.Content = rootPanel; window.Loaded += (obj, args) => { window.Left = parent.Left + (parent.Width - window.Width) / 2; window.Top = parent.Top + (parent.Height - window.Height) / 2; }; window.ShowDialog(); _valid = window.DialogResult ?? false; if (!_valid) { return; } if (!int.TryParse(startTimeEditBox.Text, out _startOffset)) { _valid = false; return; } if (!int.TryParse(endTimeEditBox.Text, out _endOffset)) { _valid = false; return; } if (_startOffset <= 0 || _endOffset <= 0) { _valid = false; } }
private FrameworkElement CreateTab() { var startTimeOffsetTextBox = new TextBox(); _startTimeOffsetTextBox = startTimeOffsetTextBox; startTimeOffsetTextBox.Width = 50; startTimeOffsetTextBox.Text = App.FormatMinutesSeconds(_app.Config.MatchCutStartTimeOffsetMs / 1000); startTimeOffsetTextBox.ToolTip = "seconds OR minutes:seconds"; var endTimeOffsetTextBox = new TextBox(); _endTimeOffsetTextBox = endTimeOffsetTextBox; endTimeOffsetTextBox.Width = 50; endTimeOffsetTextBox.Text = App.FormatMinutesSeconds(_app.Config.MatchCutEndTimeOffsetMs / 1000); endTimeOffsetTextBox.ToolTip = "seconds OR minutes:seconds"; var rulesPanelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); rulesPanelList.Add(App.CreateTuple("Start Time Offset", startTimeOffsetTextBox)); rulesPanelList.Add(App.CreateTuple("End Time Offset", endTimeOffsetTextBox)); var rulesPanel = WpfHelper.CreateDualColumnPanel(rulesPanelList, 120, 5); rulesPanel.HorizontalAlignment = HorizontalAlignment.Center; rulesPanel.VerticalAlignment = VerticalAlignment.Center; var rulesGroupBox = new GroupBox(); rulesGroupBox.Header = "Match Cut Rules"; rulesGroupBox.HorizontalAlignment = HorizontalAlignment.Left; rulesGroupBox.VerticalAlignment = VerticalAlignment.Top; rulesGroupBox.Margin = new Thickness(5); rulesGroupBox.Content = rulesPanel; var actionsGroupBox = CutByPatternComponent.CreateActionsGroupBox(UDT_DLL.udtPatternType.Matches); var helpTextBlock = new TextBlock(); helpTextBlock.Margin = new Thickness(5); helpTextBlock.TextWrapping = TextWrapping.WrapWithOverflow; helpTextBlock.Text = "This cut filter is there to help create a new demo for every match in the demo.\n\n" + "The 'Start Time Offset' field is only applied if no pre-match count-down is found.\n" + "The 'End Time Offset' field is only applied if no post-match intermission is found."; var helpGroupBox = new GroupBox(); helpGroupBox.Margin = new Thickness(5); helpGroupBox.Header = "Help"; helpGroupBox.HorizontalAlignment = HorizontalAlignment.Left; helpGroupBox.VerticalAlignment = VerticalAlignment.Top; helpGroupBox.Content = helpTextBlock; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(rulesGroupBox); rootPanel.Children.Add(actionsGroupBox); rootPanel.Children.Add(helpGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
private bool ShowChatRuleEditDialog(ChatRule chatRule) { var ruleNamesDic = new List <Tuple <string, string> >(); ruleNamesDic.Add(new Tuple <string, string>("Contains", "Contains")); ruleNamesDic.Add(new Tuple <string, string>("Starts With", "StartsWith")); ruleNamesDic.Add(new Tuple <string, string>("Ends With", "EndsWith")); var operatorComboBox = new ComboBox(); operatorComboBox.Width = 150; foreach (var ruleName in ruleNamesDic) { operatorComboBox.Items.Add(ruleName.Item1); } operatorComboBox.SelectedIndex = ruleNamesDic.FindIndex(r => r.Item2.ToLower() == chatRule.Operator.ToLower()); var valueEditBox = new TextBox(); valueEditBox.Width = 200; valueEditBox.Text = chatRule.Value; var caseCheckBox = new CheckBox(); caseCheckBox.VerticalAlignment = VerticalAlignment.Center; caseCheckBox.Content = " The operator must respect case sensitivity"; caseCheckBox.IsChecked = chatRule.CaseSensitive; var colorsCheckBox = new CheckBox(); colorsCheckBox.VerticalAlignment = VerticalAlignment.Center; colorsCheckBox.Content = " Ignore the Quake 3 color codes (e.g. ^1 for red)"; colorsCheckBox.IsChecked = chatRule.IgnoreColors; var teamMessagesCheckBox = new CheckBox(); teamMessagesCheckBox.VerticalAlignment = VerticalAlignment.Center; teamMessagesCheckBox.Content = " Search team chat too?"; teamMessagesCheckBox.IsChecked = chatRule.SearchTeamMessages; var panelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); panelList.Add(App.CreateTuple("Operator", operatorComboBox)); panelList.Add(App.CreateTuple("Pattern", valueEditBox)); panelList.Add(App.CreateTuple("Case Sensitive?", caseCheckBox)); panelList.Add(App.CreateTuple("Ignore Colors?", colorsCheckBox)); panelList.Add(App.CreateTuple("Team Chat?", teamMessagesCheckBox)); var rulePanel = WpfHelper.CreateDualColumnPanel(panelList, 100, 5); rulePanel.HorizontalAlignment = HorizontalAlignment.Center; rulePanel.VerticalAlignment = VerticalAlignment.Center; var ruleGroupBox = new GroupBox(); ruleGroupBox.HorizontalAlignment = HorizontalAlignment.Center; ruleGroupBox.VerticalAlignment = VerticalAlignment.Center; ruleGroupBox.Margin = new Thickness(5); ruleGroupBox.Header = "Rule"; ruleGroupBox.Content = rulePanel; var okButton = new Button(); okButton.Content = "OK"; okButton.Width = 75; okButton.Height = 25; okButton.Margin = new Thickness(5); okButton.HorizontalAlignment = HorizontalAlignment.Right; var cancelButton = new Button(); cancelButton.Content = "Cancel"; cancelButton.Width = 75; cancelButton.Height = 25; cancelButton.Margin = new Thickness(5); cancelButton.HorizontalAlignment = HorizontalAlignment.Right; var rootPanel = new DockPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Center; rootPanel.VerticalAlignment = VerticalAlignment.Center; rootPanel.Children.Add(ruleGroupBox); rootPanel.Children.Add(cancelButton); rootPanel.Children.Add(okButton); DockPanel.SetDock(ruleGroupBox, Dock.Top); DockPanel.SetDock(cancelButton, Dock.Right); DockPanel.SetDock(okButton, Dock.Right); var window = new Window(); okButton.Click += (obj, args) => { window.DialogResult = true; window.Close(); }; cancelButton.Click += (obj, args) => { window.DialogResult = false; window.Close(); }; var appWindow = _app.MainWindow; window.Owner = _app.MainWindow; window.WindowStyle = WindowStyle.ToolWindow; window.AllowsTransparency = false; window.Background = new SolidColorBrush(System.Windows.SystemColors.ControlColor); window.ShowInTaskbar = false; window.Title = "Chat Rule Editor"; window.Content = rootPanel; window.Width = 420; window.Height = 280; window.Left = appWindow.Left + (appWindow.Width - window.Width) / 2; window.Top = appWindow.Top + (appWindow.Height - window.Height) / 2; window.ShowDialog(); var result = window.DialogResult ?? false; if (!result) { return(false); } chatRule.CaseSensitive = caseCheckBox.IsChecked ?? false; chatRule.IgnoreColors = colorsCheckBox.IsChecked ?? false; chatRule.SearchTeamMessages = teamMessagesCheckBox.IsChecked ?? false; chatRule.Operator = ruleNamesDic.Find(r => r.Item1 == operatorComboBox.Text).Item2;; chatRule.Value = valueEditBox.Text; return(true); }
private FrameworkElement CreateCutByFragTab() { _playerMODFilters = new FilterGroupBox("Cause of Death Filters", UDT_DLL.udtStringArray.PlayerMeansOfDeath, 3); // @TODO: Power-up Filters var minFragCountEditBox = new TextBox(); _minFragCountEditBox = minFragCountEditBox; minFragCountEditBox.Width = 40; minFragCountEditBox.Text = _app.Config.FragCutMinFragCount.ToString(); var timeBetweenFragsEditBox = new TextBox(); _timeBetweenFragsEditBox = timeBetweenFragsEditBox; timeBetweenFragsEditBox.Width = 40; timeBetweenFragsEditBox.Text = _app.Config.FragCutTimeBetweenFrags.ToString(); var allowSelfKillsCheckBox = new CheckBox(); _allowSelfKillsCheckBox = allowSelfKillsCheckBox; allowSelfKillsCheckBox.HorizontalAlignment = HorizontalAlignment.Left; allowSelfKillsCheckBox.VerticalAlignment = VerticalAlignment.Center; allowSelfKillsCheckBox.IsChecked = _app.Config.FragCutAllowSelfKills; allowSelfKillsCheckBox.ToolTip = "Self kills are suicides where the player shot himself with a weapon"; var allowTeamKillsCheckBox = new CheckBox(); _allowTeamKillsCheckBox = allowTeamKillsCheckBox; allowTeamKillsCheckBox.HorizontalAlignment = HorizontalAlignment.Left; allowTeamKillsCheckBox.VerticalAlignment = VerticalAlignment.Center; allowTeamKillsCheckBox.IsChecked = _app.Config.FragCutAllowTeamKills; var allowAnyDeathCheckBox = new CheckBox(); _allowAnyDeathCheckBox = allowAnyDeathCheckBox; allowAnyDeathCheckBox.HorizontalAlignment = HorizontalAlignment.Left; allowAnyDeathCheckBox.VerticalAlignment = VerticalAlignment.Center; allowAnyDeathCheckBox.IsChecked = _app.Config.FragCutAllowAnyDeath; allowAnyDeathCheckBox.ToolTip = "This includes suicides where the killer is the world: lava, fall damage, hurt triggers, etc"; var rulesPanelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); rulesPanelList.Add(App.CreateTuple("Min. Frag Count", minFragCountEditBox)); rulesPanelList.Add(App.CreateTuple("Max. Time Between Frags [s]", timeBetweenFragsEditBox)); rulesPanelList.Add(App.CreateTuple("Allow Self Kills?", allowSelfKillsCheckBox)); rulesPanelList.Add(App.CreateTuple("Allow Any Death?", allowAnyDeathCheckBox)); rulesPanelList.Add(App.CreateTuple("Allow Team Kills?", allowTeamKillsCheckBox)); var rulesPanel = WpfHelper.CreateDualColumnPanel(rulesPanelList, 175, 5); rulesPanel.HorizontalAlignment = HorizontalAlignment.Center; rulesPanel.VerticalAlignment = VerticalAlignment.Center; var rulesGroupBox = new GroupBox(); rulesGroupBox.Header = "Frag Rules"; rulesGroupBox.HorizontalAlignment = HorizontalAlignment.Left; rulesGroupBox.VerticalAlignment = VerticalAlignment.Top; rulesGroupBox.Margin = new Thickness(5); rulesGroupBox.Content = rulesPanel; var actionsGroupBox = CutByPatternComponent.CreateActionsGroupBox(UDT_DLL.udtPatternType.FragSequences); var helpTextBlock = new TextBlock(); helpTextBlock.Margin = new Thickness(5); helpTextBlock.TextWrapping = TextWrapping.WrapWithOverflow; helpTextBlock.Text = "Self-kills are suicides where the player shot himself with a weapon." + "\nDeaths can include 'suicides' where the killer is the world: lava, fall damage, hurt triggers, etc."; var helpGroupBox = new GroupBox(); helpGroupBox.Margin = new Thickness(5); helpGroupBox.Header = "Help"; helpGroupBox.HorizontalAlignment = HorizontalAlignment.Left; helpGroupBox.VerticalAlignment = VerticalAlignment.Top; helpGroupBox.Content = helpTextBlock; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(rulesGroupBox); rootPanel.Children.Add(actionsGroupBox); rootPanel.Children.Add(helpGroupBox); rootPanel.Children.Add(new WpfHelper.WrapPanelNewLine()); rootPanel.Children.Add(_playerMODFilters.RootElement); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
private FrameworkElement CreateTab() { var minCount = _app.Config.MultiRailCutMinFragCount; var minCountIndex = 0; if (minCount >= 2 && minCount <= 8) { minCountIndex = minCount - 2; } var minFragCountComboBox = new ComboBox(); _minFragCountComboBox = minFragCountComboBox; minFragCountComboBox.MinWidth = 40; for (var i = 2; i <= 8; ++i) { minFragCountComboBox.Items.Add(i.ToString()); } minFragCountComboBox.SelectedIndex = minCountIndex; var rulesPanelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); rulesPanelList.Add(App.CreateTuple("Min. Frag Count", minFragCountComboBox)); var rulesPanel = WpfHelper.CreateDualColumnPanel(rulesPanelList, 120, 5); rulesPanel.HorizontalAlignment = HorizontalAlignment.Center; rulesPanel.VerticalAlignment = VerticalAlignment.Center; var rulesGroupBox = new GroupBox(); rulesGroupBox.Header = "Frag Rules"; rulesGroupBox.HorizontalAlignment = HorizontalAlignment.Left; rulesGroupBox.VerticalAlignment = VerticalAlignment.Top; rulesGroupBox.Margin = new Thickness(5); rulesGroupBox.Content = rulesPanel; var actionsGroupBox = CutByPatternComponent.CreateActionsGroupBox(UDT_DLL.udtPatternType.MultiFragRails); var helpTextBlock = new TextBlock(); helpTextBlock.Margin = new Thickness(5); helpTextBlock.TextWrapping = TextWrapping.WrapWithOverflow; helpTextBlock.Text = "A \"multi-frag rail\" is a railgun shot that kills at least 2 players."; var helpGroupBox = new GroupBox(); helpGroupBox.Margin = new Thickness(5); helpGroupBox.Header = "Help"; helpGroupBox.HorizontalAlignment = HorizontalAlignment.Left; helpGroupBox.VerticalAlignment = VerticalAlignment.Top; helpGroupBox.Content = helpTextBlock; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(rulesGroupBox); rootPanel.Children.Add(actionsGroupBox); rootPanel.Children.Add(helpGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }
private FrameworkElement CreateTab() { var snapshotCount = _app.Config.TimeShiftSnapshotCount; snapshotCount = Math.Max(snapshotCount, 1); snapshotCount = Math.Min(snapshotCount, 8); var snapshotCountComboBox = new ComboBox(); _snapshotCountComboBox = snapshotCountComboBox; snapshotCountComboBox.HorizontalAlignment = HorizontalAlignment.Left; snapshotCountComboBox.VerticalAlignment = VerticalAlignment.Top; snapshotCountComboBox.Margin = new Thickness(5); snapshotCountComboBox.Width = 40; for (var i = 1; i <= 8; ++i) { snapshotCountComboBox.Items.Add(i); } snapshotCountComboBox.SelectedIndex = snapshotCount - 1; var settingsPanelList = new List <Tuple <FrameworkElement, FrameworkElement> >(); settingsPanelList.Add(App.CreateTuple("Snapshot Count", snapshotCountComboBox)); var settingsPanel = WpfHelper.CreateDualColumnPanel(settingsPanelList, 120, 0); settingsPanel.HorizontalAlignment = HorizontalAlignment.Center; settingsPanel.VerticalAlignment = VerticalAlignment.Center; var settingsGroupBox = new GroupBox(); settingsGroupBox.Header = "Settings"; settingsGroupBox.HorizontalAlignment = HorizontalAlignment.Left; settingsGroupBox.VerticalAlignment = VerticalAlignment.Top; settingsGroupBox.Content = settingsPanel; var goButton = new Button(); goButton.HorizontalAlignment = HorizontalAlignment.Left; goButton.VerticalAlignment = VerticalAlignment.Top; goButton.Content = "Go!"; goButton.Width = 75; goButton.Height = 25; goButton.Margin = new Thickness(5); goButton.Click += (obj, args) => OnGoClicked(); var actionsGroupBox = new GroupBox(); actionsGroupBox.HorizontalAlignment = HorizontalAlignment.Left; actionsGroupBox.VerticalAlignment = VerticalAlignment.Top; actionsGroupBox.Margin = new Thickness(5); actionsGroupBox.Header = "Actions"; actionsGroupBox.Content = goButton; var helpTextBlock = new TextBlock(); helpTextBlock.Margin = new Thickness(5); helpTextBlock.TextWrapping = TextWrapping.WrapWithOverflow; helpTextBlock.Text = "This modifier will move the position of the non-first-person view players back in time by the specified amount of snapshots.\n" + "The main purpose of this is to make the demo look more like what the player whose view was recorded in first-person actually saw, which is desirable for movie-making.\n" + "\n" + "For LG tracking, 1 snapshot should do.\n" + "For rail shots, 1 + (first-person player ping / snapshot duration) should do.\n" + "Depending on cpma/q3mme doing the playback and cg_smoothClients being on/off, you might want to add 1 to the snapshot count."; var helpGroupBox = new GroupBox(); helpGroupBox.Margin = new Thickness(5); helpGroupBox.Header = "Help"; helpGroupBox.HorizontalAlignment = HorizontalAlignment.Left; helpGroupBox.VerticalAlignment = VerticalAlignment.Top; helpGroupBox.Content = helpTextBlock; var rootPanel = new WrapPanel(); rootPanel.HorizontalAlignment = HorizontalAlignment.Stretch; rootPanel.VerticalAlignment = VerticalAlignment.Stretch; rootPanel.Margin = new Thickness(5); rootPanel.Orientation = Orientation.Horizontal; rootPanel.Children.Add(settingsGroupBox); rootPanel.Children.Add(actionsGroupBox); rootPanel.Children.Add(helpGroupBox); var scrollViewer = new ScrollViewer(); scrollViewer.HorizontalAlignment = HorizontalAlignment.Stretch; scrollViewer.VerticalAlignment = VerticalAlignment.Stretch; scrollViewer.Margin = new Thickness(5); scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; scrollViewer.Content = rootPanel; return(scrollViewer); }