From a7e6b55023a40df8aa6c9efd353cfb6c05a40cb8 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Fri, 27 Aug 2021 20:44:09 -0400 Subject: [PATCH] port Raven Software StripEditor from WinForms to UWT and add Waypoint editor (still preliminary) --- .../RavenSoftware/Strip/StripEditor.glade | 262 ++++++++++++++++++ .../RavenSoftware/Strip/StripEditor.uexml | 17 ++ .../Waypoint/WaypointEditor.glade | 161 +++++++++++ ...lEditor.Content.PlatformIndependent.csproj | 4 + .../Editors/Strip/StripEditor.Designer.cs | 236 ---------------- .../Editors/Strip/StripEditor.cs | 149 ++++++---- .../Editors/Waypoint/WaypointEditor.cs | 94 +++++++ ...Plugins.RavenSoftware.UserInterface.csproj | 3 + .../Associations/StripDataFormat.uexml | 26 ++ .../Associations/WNTWaypointDataFormat.uexml | 20 ++ .../TranslationSet/StripDataFormat.cs | 190 +++++++++++++ .../DataFormats/Waypoint/WNTDataFormat.cs | 116 ++++++++ .../Carcass/CarcassObjectModel.cs | 9 +- .../Icarus/IcarusScriptObjectModel.cs | 2 +- .../TranslationSet/TranslationSetEntry.cs | 46 +++ .../TranslationSetObjectModel.cs | 61 ++++ .../TranslationSet/TranslationSetValue.cs | 43 +++ .../ObjectModels/Waypoint/WaypointEntry.cs | 66 +++++ .../Waypoint/WaypointObjectModel.cs | 62 +++++ .../ObjectModels/Waypoint/WaypointType.cs | 29 ++ ...iversalEditor.Plugins.RavenSoftware.csproj | 22 ++ 21 files changed, 1328 insertions(+), 290 deletions(-) create mode 100644 Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.glade create mode 100644 Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.uexml create mode 100644 Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Waypoint/WaypointEditor.glade delete mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.Designer.cs create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Waypoint/WaypointEditor.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/StripDataFormat.uexml create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/WNTWaypointDataFormat.uexml create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/TranslationSet/StripDataFormat.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/Waypoint/WNTDataFormat.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetEntry.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetObjectModel.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetValue.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointEntry.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointObjectModel.cs create mode 100644 Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointType.cs diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.glade b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.glade new file mode 100644 index 00000000..1ba0a1a1 --- /dev/null +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.glade @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + False + + + True + False + vertical + + + + True + False + 8 + 8 + 8 + 8 + 4 + 4 + + + True + True + True + + + 1 + 1 + + + + + True + True + True + + + 1 + 2 + + + + + True + True + True + + + 1 + 0 + + + + + True + False + ID + 0 + + + 0 + 0 + + + + + True + False + Reference + 0 + + + 0 + 1 + + + + + True + False + Description + 0 + + + 0 + 2 + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + + + True + False + Add + Add + True + gtk-add + + + False + True + + + + + True + False + Edit + Edit + True + gtk-edit + + + False + True + + + + + True + False + Remove + Remove + True + gtk-remove + + + False + True + + + + + True + False + + + False + True + + + + + True + False + Clear All Non-English Translations + Clear All Non-English Translations + True + gtk-clear + + + False + True + + + + + False + True + 0 + + + + + True + True + in + + + True + True + tm + + + True + ID + True + True + + + + 0 + + + + + + + True + Language + True + True + + + + 1 + + + + + + + True + Value + True + True + + + + 2 + + + + + + + + + True + True + 1 + + + + + True + True + 1 + + + + + + diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.uexml b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.uexml new file mode 100644 index 00000000..fdb5f843 --- /dev/null +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Strip/StripEditor.uexml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Waypoint/WaypointEditor.glade b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Waypoint/WaypointEditor.glade new file mode 100644 index 00000000..c90e5287 --- /dev/null +++ b/Content/UniversalEditor.Content.PlatformIndependent/Editors/RavenSoftware/Waypoint/WaypointEditor.glade @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + True + False + vertical + + + True + True + in + + + True + True + tmWayponts + + + + + + Index + True + True + + + + 0 + + + + + + + Type + True + True + + + + 1 + + + + + + + A + True + True + + + + 2 + + + + + + + X + True + True + + + + 3 + + + + + + + Y + True + True + + + + 4 + + + + + + + Z + True + True + + + + 5 + + + + + + + liststr + True + True + + + + 6 + + + + + + + Q + True + True + + + + 7 + + + + + + + + + True + True + 0 + + + + + + diff --git a/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj b/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj index 61990d1e..8957004f 100644 --- a/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj +++ b/Content/UniversalEditor.Content.PlatformIndependent/UniversalEditor.Content.PlatformIndependent.csproj @@ -323,6 +323,9 @@ + + + @@ -359,6 +362,7 @@ + diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.Designer.cs b/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.Designer.cs deleted file mode 100644 index a1aea8d1..00000000 --- a/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.Designer.cs +++ /dev/null @@ -1,236 +0,0 @@ -namespace UniversalEditor.Plugins.RavenSoftware.UserInterface.Editors.RavenSoftware.Strip -{ - partial class StripEditor - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.lv = new System.Windows.Forms.ListView(); - this.chGroup = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chLanguage = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.fraList = new System.Windows.Forms.GroupBox(); - this.fraEditor = new System.Windows.Forms.GroupBox(); - this.cmdRemove = new System.Windows.Forms.Button(); - this.cmdUpdate = new System.Windows.Forms.Button(); - this.txtValue = new System.Windows.Forms.TextBox(); - this.cboLanguage = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.cboGroup = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.fraList.SuspendLayout(); - this.fraEditor.SuspendLayout(); - this.SuspendLayout(); - // - // lv - // - this.lv.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.chGroup, - this.chLanguage, - this.chValue}); - this.lv.FullRowSelect = true; - this.lv.GridLines = true; - this.lv.HideSelection = false; - this.lv.Location = new System.Drawing.Point(6, 19); - this.lv.Name = "lv"; - this.lv.Size = new System.Drawing.Size(468, 160); - this.lv.TabIndex = 0; - this.lv.UseCompatibleStateImageBehavior = false; - this.lv.View = System.Windows.Forms.View.Details; - this.lv.SelectedIndexChanged += new System.EventHandler(this.lv_SelectedIndexChanged); - // - // chGroup - // - this.chGroup.Text = "Group"; - this.chGroup.Width = 122; - // - // chLanguage - // - this.chLanguage.Text = "Language"; - this.chLanguage.Width = 129; - // - // chValue - // - this.chValue.Text = "Value"; - this.chValue.Width = 208; - // - // fraList - // - this.fraList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.fraList.Controls.Add(this.lv); - this.fraList.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.fraList.Location = new System.Drawing.Point(3, 3); - this.fraList.Name = "fraList"; - this.fraList.Size = new System.Drawing.Size(480, 185); - this.fraList.TabIndex = 1; - this.fraList.TabStop = false; - this.fraList.Text = "Entry list"; - // - // fraEditor - // - this.fraEditor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.fraEditor.Controls.Add(this.cmdRemove); - this.fraEditor.Controls.Add(this.cmdUpdate); - this.fraEditor.Controls.Add(this.txtValue); - this.fraEditor.Controls.Add(this.cboLanguage); - this.fraEditor.Controls.Add(this.label3); - this.fraEditor.Controls.Add(this.label2); - this.fraEditor.Controls.Add(this.cboGroup); - this.fraEditor.Controls.Add(this.label1); - this.fraEditor.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.fraEditor.Location = new System.Drawing.Point(3, 194); - this.fraEditor.Name = "fraEditor"; - this.fraEditor.Size = new System.Drawing.Size(480, 146); - this.fraEditor.TabIndex = 2; - this.fraEditor.TabStop = false; - this.fraEditor.Text = "Entry editor"; - // - // cmdRemove - // - this.cmdRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.cmdRemove.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.cmdRemove.Location = new System.Drawing.Point(399, 77); - this.cmdRemove.Name = "cmdRemove"; - this.cmdRemove.Size = new System.Drawing.Size(75, 23); - this.cmdRemove.TabIndex = 3; - this.cmdRemove.Text = "&Remove"; - this.cmdRemove.UseVisualStyleBackColor = true; - this.cmdRemove.Click += new System.EventHandler(this.cmdRemove_Click); - // - // cmdUpdate - // - this.cmdUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.cmdUpdate.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.cmdUpdate.Location = new System.Drawing.Point(399, 48); - this.cmdUpdate.Name = "cmdUpdate"; - this.cmdUpdate.Size = new System.Drawing.Size(75, 23); - this.cmdUpdate.TabIndex = 3; - this.cmdUpdate.Text = "Upd&ate"; - this.cmdUpdate.UseVisualStyleBackColor = true; - this.cmdUpdate.Click += new System.EventHandler(this.cmdUpdate_Click); - // - // txtValue - // - this.txtValue.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtValue.Location = new System.Drawing.Point(86, 48); - this.txtValue.Multiline = true; - this.txtValue.Name = "txtValue"; - this.txtValue.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtValue.Size = new System.Drawing.Size(307, 92); - this.txtValue.TabIndex = 2; - // - // cboLanguage - // - this.cboLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cboLanguage.FormattingEnabled = true; - this.cboLanguage.Location = new System.Drawing.Point(273, 19); - this.cboLanguage.Name = "cboLanguage"; - this.cboLanguage.Size = new System.Drawing.Size(201, 21); - this.cboLanguage.TabIndex = 1; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.label3.Location = new System.Drawing.Point(22, 51); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(37, 13); - this.label3.TabIndex = 0; - this.label3.Text = "&Value:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.label2.Location = new System.Drawing.Point(209, 22); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(58, 13); - this.label2.TabIndex = 0; - this.label2.Text = "&Language:"; - // - // cboGroup - // - this.cboGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cboGroup.FormattingEnabled = true; - this.cboGroup.Location = new System.Drawing.Point(86, 19); - this.cboGroup.Name = "cboGroup"; - this.cboGroup.Size = new System.Drawing.Size(117, 21); - this.cboGroup.TabIndex = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.label1.Location = new System.Drawing.Point(22, 22); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(39, 13); - this.label1.TabIndex = 0; - this.label1.Text = "&Group:"; - // - // StripEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.fraEditor); - this.Controls.Add(this.fraList); - this.Name = "StripEditor"; - this.Size = new System.Drawing.Size(486, 343); - this.fraList.ResumeLayout(false); - this.fraEditor.ResumeLayout(false); - this.fraEditor.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.ListView lv; - private System.Windows.Forms.ColumnHeader chGroup; - private System.Windows.Forms.ColumnHeader chLanguage; - private System.Windows.Forms.ColumnHeader chValue; - private System.Windows.Forms.GroupBox fraList; - private System.Windows.Forms.GroupBox fraEditor; - private System.Windows.Forms.Button cmdRemove; - private System.Windows.Forms.Button cmdUpdate; - private System.Windows.Forms.TextBox txtValue; - private System.Windows.Forms.ComboBox cboLanguage; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox cboGroup; - private System.Windows.Forms.Label label1; - } -} diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.cs b/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.cs index bfa292b1..d699db3e 100644 --- a/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.cs +++ b/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Strip/StripEditor.cs @@ -1,83 +1,117 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Text; -using UniversalEditor.ObjectModels.LanguageTranslation; -using UniversalEditor.UserInterface; -using UniversalEditor.UserInterface.WindowsForms; +using MBS.Framework.UserInterface; +using MBS.Framework.UserInterface.Controls; +using MBS.Framework.UserInterface.Controls.ListView; +using MBS.Framework.UserInterface.Dialogs; -namespace UniversalEditor.Plugins.RavenSoftware.UserInterface.Editors.RavenSoftware.Strip +using UniversalEditor.ObjectModels.TranslationSet; +using UniversalEditor.UserInterface; + +namespace UniversalEditor.Plugins.RavenSoftware.UserInterface.Editors.Strip { - public partial class StripEditor : Editor + [ContainerLayout("~/Editors/RavenSoftware/Strip/StripEditor.glade")] + public class StripEditor : Editor { + private NumericTextBox txtID; + private TextBox txtReference; + private TextBox txtDescription; + + private Toolbar tbEntries; + + private ListViewControl tv; + + [EventHandler(nameof(txtID), nameof(TextBox.Changed))] + private void txtID_Changed(object sender, EventArgs e) + { + BeginEdit(); + (ObjectModel as TranslationSetObjectModel).ID = Int32.Parse(txtID.Text); + EndEdit(); + } + [EventHandler(nameof(txtReference), nameof(TextBox.Changed))] + private void txtReference_Changed(object sender, EventArgs e) + { + BeginEdit(); + (ObjectModel as TranslationSetObjectModel).Reference = txtReference.Text; + EndEdit(); + } + [EventHandler(nameof(txtDescription), nameof(TextBox.Changed))] + private void txtDescription_Changed(object sender, EventArgs e) + { + BeginEdit(); + (ObjectModel as TranslationSetObjectModel).Description = txtDescription.Text; + EndEdit(); + } + + private static EditorReference _er = null; + public override EditorReference MakeReference() + { + if (_er == null) + { + _er = base.MakeReference(); + _er.Title = "Translation Set Editor"; + _er.SupportedObjectModels.Add(typeof(TranslationSetObjectModel)); + } + return _er; + } + + private void ToolsCheckMissingTranslationSets_Click(object sender, EventArgs e) + { + MessageDialog.ShowDialog("There are no missing translation sets in the translation file. (Good job, this means your task as a translator is complete!)", "RavenTech Stripper", MessageDialogButtons.OK, MessageDialogIcon.Information); + } + public StripEditor() { - InitializeComponent(); - base.SupportedObjectModels.Add(typeof(LanguageTranslationObjectModel)); - Font = SystemFonts.MenuFont; - - ActionMenuItem mnuTools = (base.MenuBar.Items.Add("mnuTools", "&Tools") as ActionMenuItem); - mnuTools.Items.Add("mnuToolsCheckMissingTranslationSets", "Check for missing translation sets", mnuToolsCheckMissingTranslationSets_Click, 3); - mnuTools.Items.AddSeparator(3); - - ActionMenuItem mnuHelp = (base.MenuBar.Items.Add("mnuHelp", "&Help") as ActionMenuItem); - mnuHelp.Items.Add("mnuHelpAboutStripper", "About RavenTech &Stripper", mnuHelpAboutStripper_Click, -1); + Context.AttachCommandEventHandler("ToolsCheckMissingTranslationSets", ToolsCheckMissingTranslationSets_Click); } - private void mnuToolsCheckMissingTranslationSets_Click(object sender, EventArgs e) - { - MessageBox.Show("There are no missing translation sets in the translation file. (Good job, this means your task as a translator is complete!)", "RavenTech Stripper", MessageBoxButtons.OK, MessageBoxIcon.Information); - } private void mnuHelpAboutStripper_Click(object sender, EventArgs e) { - MessageBox.Show("RavenTech Stripper (Translation Strip Editor)\r\nCopyright (c)2013 Mike Becker's Software\r\nLicensed under the GNU General Public License\r\n\r\nDesigned for use with the RavenTech game engine and Raven Software's customized Jedi Knight II/Jedi Academy engine.", "RavenTech Stripper", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageDialog.ShowDialog("RavenTech Stripper (Translation Strip Editor)\r\nCopyright (c)2013 Mike Becker's Software\r\nLicensed under the GNU General Public License\r\n\r\nDesigned for use with the RavenTech game engine and Raven Software's customized Jedi Knight II/Jedi Academy engine.", "RavenTech Stripper", MessageDialogButtons.OK, MessageDialogIcon.Information); + } + + protected override void OnCreated(EventArgs e) + { + base.OnCreated(e); + OnObjectModelChanged(e); } protected override void OnObjectModelChanged(EventArgs e) { base.OnObjectModelChanged(e); - lv.Items.Clear(); + if (!IsCreated) + return; - LanguageTranslationObjectModel xlate = (ObjectModel as LanguageTranslationObjectModel); + tv.Model.Rows.Clear(); + + TranslationSetObjectModel xlate = (ObjectModel as TranslationSetObjectModel); if (xlate == null) return; - Color color = Color.Gainsboro; + txtID.Value = xlate.ID; + txtReference.Text = xlate.Reference; + txtDescription.Text = xlate.Description; - foreach (Group group in xlate.Groups) + foreach (TranslationSetEntry entry in xlate.Entries) { - cboGroup.Items.Add(group); + // cboGroup.Items.Add(group); - foreach (Entry entry in group.Entries) + foreach (TranslationSetValue value in entry.Values) { - ListViewItem lvi = new ListViewItem(); - lvi.BackColor = color; - lvi.Tag = entry; - lvi.Text = group.Title; - lvi.SubItems.Add(entry.Language); - lvi.SubItems.Add(entry.Value); - - if (!cboLanguage.Items.Contains(entry.Language)) + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] { - cboLanguage.Items.Add(entry.Language); - } - lv.Items.Add(lvi); - } - - if (color == Color.Gainsboro) - { - color = Color.White; - } - else - { - color = Color.Gainsboro; + new TreeModelRowColumn(tv.Model.Columns[0], entry.Reference), + new TreeModelRowColumn(tv.Model.Columns[1], value.LanguageIndex), + new TreeModelRowColumn(tv.Model.Columns[2], value.Value), + // new TreeModelRowColumn(tv.Model.Columns[2], value.Flags.ToString()), + }); + tv.Model.Rows.Add(row); } } - lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); } - private void lv_SelectedIndexChanged(object sender, EventArgs e) + private void tv_SelectionChanged(object sender, EventArgs e) { + /* cboGroup.Text = String.Empty; cboLanguage.Text = String.Empty; txtValue.Text = String.Empty; @@ -101,16 +135,27 @@ namespace UniversalEditor.Plugins.RavenSoftware.UserInterface.Editors.RavenSoftw fraEditor.Enabled = true; cmdUpdate.Text = "&Add"; } + */ } private void cmdUpdate_Click(object sender, EventArgs e) { - Entry entry = (lv.SelectedItems[0].Tag as Entry); + // Entry entry = (lv.SelectedItems[0].Tag as Entry); } private void cmdRemove_Click(object sender, EventArgs e) { } + + public override void UpdateSelections() + { + throw new NotImplementedException(); + } + + protected override Selection CreateSelectionInternal(object content) + { + throw new NotImplementedException(); + } } } diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Waypoint/WaypointEditor.cs b/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Waypoint/WaypointEditor.cs new file mode 100644 index 00000000..65105723 --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/Editors/Waypoint/WaypointEditor.cs @@ -0,0 +1,94 @@ +// +// WaypointEditor.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +using MBS.Framework.UserInterface; +using MBS.Framework.UserInterface.Controls.ListView; +using UniversalEditor.ObjectModels.Waypoint; +using UniversalEditor.UserInterface; + +namespace UniversalEditor.Plugins.RavenSoftware.UserInterface.Editors.Waypoint +{ + [ContainerLayout("~/Editors/RavenSoftware/Waypoint/WaypointEditor.glade")] + public class WaypointEditor : Editor + { + private ListViewControl tvWaypoints; + + private static EditorReference _er = null; + public override EditorReference MakeReference() + { + if (_er == null) + { + _er = base.MakeReference(); + _er.Title = "Waypoint Editor"; + _er.SupportedObjectModels.Add(typeof(WaypointObjectModel)); + } + return _er; + } + + protected override void OnCreated(EventArgs e) + { + base.OnCreated(e); + + OnObjectModelChanged(e); + } + + protected override void OnObjectModelChanged(EventArgs e) + { + base.OnObjectModelChanged(e); + + if (!IsCreated) + return; + + tvWaypoints.Model.Rows.Clear(); + + WaypointObjectModel waypoint = (ObjectModel as WaypointObjectModel); + if (waypoint == null) + return; + + foreach (WaypointEntry entry in waypoint.Entries) + { + TreeModelRow row = new TreeModelRow(new TreeModelRowColumn[] + { + new TreeModelRowColumn(tvWaypoints.Model.Columns[0], entry.Index), + new TreeModelRowColumn(tvWaypoints.Model.Columns[1], entry.Type.ToString()), + new TreeModelRowColumn(tvWaypoints.Model.Columns[2], entry.A), + new TreeModelRowColumn(tvWaypoints.Model.Columns[3], entry.X), + new TreeModelRowColumn(tvWaypoints.Model.Columns[4], entry.Y), + new TreeModelRowColumn(tvWaypoints.Model.Columns[5], entry.Z), + // new TreeModelRowColumn(tvWaypoints.Model.Columns[6], entry.Liststr), + new TreeModelRowColumn(tvWaypoints.Model.Columns[7], entry.Q) + }); + + row.SetExtraData("entry", entry); + tvWaypoints.Model.Rows.Add(row); + } + } + + public override void UpdateSelections() + { + } + + protected override Selection CreateSelectionInternal(object content) + { + return null; + } + } +} diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface.csproj b/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface.csproj index 90a9161b..f5bf9054 100644 --- a/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface.csproj +++ b/Plugins.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface/UniversalEditor.Plugins.RavenSoftware.UserInterface.csproj @@ -40,6 +40,8 @@ + + @@ -48,6 +50,7 @@ + diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/StripDataFormat.uexml b/Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/StripDataFormat.uexml new file mode 100644 index 00000000..f07fbdb6 --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/StripDataFormat.uexml @@ -0,0 +1,26 @@ + + + + + + + + *.sp + *.spe + + + + VERSION 1 + + + + + + + + + + + + + diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/WNTWaypointDataFormat.uexml b/Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/WNTWaypointDataFormat.uexml new file mode 100644 index 00000000..16306df5 --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/Associations/WNTWaypointDataFormat.uexml @@ -0,0 +1,20 @@ + + + + + + + + *.wnt + + + + + + + + + + + + diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/TranslationSet/StripDataFormat.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/TranslationSet/StripDataFormat.cs new file mode 100644 index 00000000..24743d1f --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/TranslationSet/StripDataFormat.cs @@ -0,0 +1,190 @@ +// +// StripDataFormat.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +using System.Collections.Generic; +using MBS.Framework; +using MBS.Framework.Settings; +using UniversalEditor.ObjectModels.PropertyList; +using UniversalEditor.ObjectModels.TranslationSet; +using UniversalEditor.UserInterface; + +namespace UniversalEditor.Plugins.RavenSoftware.DataFormats.TranslationSet +{ + public class StripDataFormat : UniversalEditor.DataFormats.PropertyList.ExtensibleConfiguration.ExtensibleConfigurationDataFormat + { + public StripDataFormat() + { + // apply settings for Strip format + Settings.AllowTopLevelProperties = true; + Settings.PropertySeparator = "\n"; + Settings.PropertyNameValueSeparator = " "; + } + + public int Version { get; set; } = 1; + public string ConfigurationFileName { get; set; } = String.Empty; + + private static DataFormatReference _dfr = null; + protected override DataFormatReference MakeReferenceInternal() + { + if (_dfr == null) + { + _dfr = base.MakeReferenceInternal(); + _dfr.Capabilities.Clear(); + _dfr.Capabilities.Add(typeof(TranslationSetObjectModel), DataFormatCapabilities.All); + _dfr.Title = "Raven Software Strip (String Package) translation set"; + + _dfr.ImportOptions.SettingsGroups[0].Settings.Add(new TextSetting("ConfigurationFileName", "Configuration file name", ConfigurationFileName)); + _dfr.ExportOptions.SettingsGroups[0].Settings.Add(new TextSetting("ConfigurationFileName", "Configuration file name", ConfigurationFileName)); + } + return _dfr; + } + + protected override void BeforeLoadInternal(Stack objectModels) + { + base.BeforeLoadInternal(objectModels); + + objectModels.Push(new PropertyListObjectModel()); + } + protected override void AfterLoadInternal(Stack objectModels) + { + base.AfterLoadInternal(objectModels); + + PropertyListObjectModel plom = (objectModels.Pop() as PropertyListObjectModel); + TranslationSetObjectModel strip = (objectModels.Pop() as TranslationSetObjectModel); + + for (int i = 0; i < plom.Items.Count; i++) + { + if (plom.Items[i] is Property) + { + Property prop = ((Property)plom.Items[i]); + switch (prop.Name) + { + case "VERSION": + { + Version = Int32.Parse(prop.Value?.ToString()); + break; + } + case "CONFIG": + { + ConfigurationFileName = prop.Value?.ToString(); + break; + } + case "ID": + { + strip.ID = Int32.Parse(prop.Value?.ToString()); + break; + } + case "REFERENCE": + { + strip.Reference = prop.Value?.ToString(); + break; + } + case "DESCRIPTION": + { + strip.Description = prop.Value?.ToString(); + break; + } + case "COUNT": + { + // unused - we just keep reading + break; + } + case "INDEX": + { + if (i < plom.Items.Count - 1 && plom.Items[i + 1] is Group) + { + Group grp = (Group)plom.Items[i + 1]; + + TranslationSetEntry entry = new TranslationSetEntry(); + + for (int j = 0; j < grp.Items.Count; j++) + { + if (grp.Items[j] is Property) + { + Property pj = (Property)grp.Items[j]; + if (pj.Name == "REFERENCE") + { + string reff = (string)pj.Value; + entry.Reference = reff; + } + else if (pj.Name.StartsWith("TEXT_LANGUAGE")) + { + TranslationSetValue value = new TranslationSetValue(); + + value.LanguageIndex = Int32.Parse(pj.Name.Substring("TEXT_LANGUAGE".Length)); + value.Value = (string)pj.Value; + + entry.Values.Add(value); + } + } + } + + strip.Entries.Add(entry); + } + else + { + ((EditorApplication)Application.Instance).Messages.Add(HostApplicationMessageSeverity.Error, "bad .sp file - INDEX not followed by group"); + Console.WriteLine("ue: ravensoft: strip: bad .sp file - INDEX not followed by group"); + break; + } + break; + } + } + } + } + + + + // always remember to do this in case someone inherits from this file format , for whatever reason + objectModels.Push(strip); + } + protected override void BeforeSaveInternal(Stack objectModels) + { + base.BeforeSaveInternal(objectModels); + + TranslationSetObjectModel strip = (objectModels.Pop() as TranslationSetObjectModel); + PropertyListObjectModel plom = new PropertyListObjectModel(); + + plom.Items.AddProperty("VERSION", "1"); + plom.Items.AddProperty("CONFIG", "W:\\bin\\striped.cfg"); + plom.Items.AddProperty("ID", strip.ID.ToString()); + plom.Items.AddProperty("REFERENCE", strip.Reference); + plom.Items.AddProperty("DESCRIPTION", strip.Description); + plom.Items.AddProperty("COUNT", strip.Entries.Count.ToString()); + + for (int i = 0; i < strip.Entries.Count; i++) + { + TranslationSetEntry entry = strip.Entries[i]; + plom.Items.AddProperty("INDEX", i.ToString()); + + Group g = new Group(); + g.Items.AddProperty("REFERENCE", entry.Reference); + for (int j = 0; j < entry.Values.Count; j++) + { + g.Items.AddProperty(String.Format("TEXT_LANGUAGE{0}", entry.Values[j].LanguageIndex), entry.Values[j].Value); + } + plom.Items.Add(g); + } + + objectModels.Push(plom); + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/Waypoint/WNTDataFormat.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/Waypoint/WNTDataFormat.cs new file mode 100644 index 00000000..f59cbad2 --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/DataFormats/Waypoint/WNTDataFormat.cs @@ -0,0 +1,116 @@ +// +// WNTDataFormat.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +using System.Collections.Generic; +using UniversalEditor.ObjectModels.Waypoint; + +namespace UniversalEditor.DataFormats.Waypoint +{ + public class WNTDataFormat : DataFormat + { + public WNTDataFormat() + { + } + + private static DataFormatReference _dfr = null; + protected override DataFormatReference MakeReferenceInternal() + { + if (_dfr == null) + { + _dfr = base.MakeReferenceInternal(); + _dfr.Capabilities.Add(typeof(WaypointObjectModel), DataFormatCapabilities.All); + _dfr.Title = "Raven Software WNT bot route waypoint data"; + } + return _dfr; + } + + protected override void LoadInternal(ref ObjectModel objectModel) + { + WaypointObjectModel waypoint = (objectModel as WaypointObjectModel); + if (waypoint == null) + throw new ObjectModelNotSupportedException(); + + int lineidx = 0; + while (!Accessor.Reader.EndOfStream) + { + lineidx++; + + string line = Accessor.Reader.ReadLine(); + string[] parts = line.Split(new char[] { ' ' }); + if (parts.Length < 9) + { + Console.WriteLine("ue: ravensoft: waypoint: line {0} invalid - does not contain at least 9 elements"); + continue; + } + + if (!parts[3].StartsWith("(")) + { + Console.WriteLine("ue: ravensoft: waypoint: line {0} invalid - part 3 does not start with '('"); + continue; + } + else + { + parts[3] = parts[3].Substring(1); + } + if (!parts[5].EndsWith(")")) + { + Console.WriteLine("ue: ravensoft: waypoint: line {0} invalid - part 3 does not start with '('"); + continue; + } + else + { + parts[5] = parts[5].Substring(0, parts[5].Length - 1); + } + + if (parts[6] != "{") + { + Console.WriteLine("ue: ravensoft: waypoint: line {0} invalid - part 6 does not equal '{'"); + continue; + } + + List liststrs = new List(); + for (int i = 7; i < parts.Length - 1; i++) + { + if (parts[i] == "}") + break; + + liststrs.Add(parts[i]); + } + + WaypointEntry entry = new WaypointEntry(); + entry.Index = Int32.Parse(parts[0]); + entry.Type = (WaypointType)Int32.Parse(parts[1]); + entry.A = Double.Parse(parts[2]); + entry.X = Double.Parse(parts[3]); + entry.Y = Double.Parse(parts[4]); + entry.Z = Double.Parse(parts[5]); + entry.Q = Double.Parse(parts[parts.Length - 1]); + + waypoint.Entries.Add(entry); + } + } + + protected override void SaveInternal(ObjectModel objectModel) + { + + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Carcass/CarcassObjectModel.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Carcass/CarcassObjectModel.cs index 605971f5..7164f761 100644 --- a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Carcass/CarcassObjectModel.cs +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Carcass/CarcassObjectModel.cs @@ -23,8 +23,15 @@ namespace UniversalEditor.Plugins.RavenSoftware.ObjectModels.Carcass { public class CarcassObjectModel : ObjectModel { - public CarcassObjectModel() + private static ObjectModelReference _omr = null; + protected override ObjectModelReference MakeReferenceInternal() { + if (_omr == null) + { + _omr = base.MakeReferenceInternal(); + _omr.Path = new string[] { "Game development", "Raven Software", "Carcass model skin configuration" }; + } + return _omr; } public ModelReference.ModelReferenceCollection ModelReferences { get; } = new ModelReference.ModelReferenceCollection(); diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Icarus/IcarusScriptObjectModel.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Icarus/IcarusScriptObjectModel.cs index 14b23330..e8f31d8d 100644 --- a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Icarus/IcarusScriptObjectModel.cs +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Icarus/IcarusScriptObjectModel.cs @@ -47,7 +47,7 @@ namespace UniversalEditor.ObjectModels.Icarus protected override ObjectModelReference MakeReferenceInternal() { ObjectModelReference omr = base.MakeReferenceInternal(); - omr.Path = new string[] { "Game development", "ICARUS engine script" }; + omr.Path = new string[] { "Game development", "Raven Software", "ICARUS script" }; return omr; } } diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetEntry.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetEntry.cs new file mode 100644 index 00000000..1f59e1e6 --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetEntry.cs @@ -0,0 +1,46 @@ +// +// TranslationSetEntry.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +namespace UniversalEditor.ObjectModels.TranslationSet +{ + public class TranslationSetEntry : ICloneable + { + public class TranslationSetEntryCollection + : System.Collections.ObjectModel.Collection + { + + } + + public string Reference { get; set; } = null; + public TranslationSetValue.TranslationSetValueCollection Values { get; } = new TranslationSetValue.TranslationSetValueCollection(); + + public object Clone() + { + TranslationSetEntry clone = new TranslationSetEntry(); + clone.Reference = (Reference.Clone() as string); + foreach (TranslationSetValue value in Values) + { + clone.Values.Add(value.Clone() as TranslationSetValue); + } + return clone; + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetObjectModel.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetObjectModel.cs new file mode 100644 index 00000000..52319fa3 --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetObjectModel.cs @@ -0,0 +1,61 @@ +// +// TranslationSetObjectModel.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +namespace UniversalEditor.ObjectModels.TranslationSet +{ + public class TranslationSetObjectModel : ObjectModel + { + private static ObjectModelReference _omr = null; + + public TranslationSetEntry.TranslationSetEntryCollection Entries { get; } = new TranslationSetEntry.TranslationSetEntryCollection(); + + public int ID { get; set; } = 0; + public string Reference { get; set; } = null; + public string Description { get; set; } = null; + + protected override ObjectModelReference MakeReferenceInternal() + { + if (_omr == null) + { + _omr = base.MakeReferenceInternal(); + _omr.Path = new string[] { "Game development", "Raven Software", "Translation set / strip (string package)" }; + } + return _omr; + } + + public override void Clear() + { + Entries.Clear(); + } + + public override void CopyTo(ObjectModel where) + { + TranslationSetObjectModel clone = (where as TranslationSetObjectModel); + if (clone == null) + throw new ObjectModelNotSupportedException(); + + foreach (TranslationSetEntry entry in Entries) + { + clone.Entries.Add(entry.Clone() as TranslationSetEntry); + } + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetValue.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetValue.cs new file mode 100644 index 00000000..7176870c --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/TranslationSet/TranslationSetValue.cs @@ -0,0 +1,43 @@ +// +// TranslationSetValue.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +namespace UniversalEditor.ObjectModels.TranslationSet +{ + public class TranslationSetValue : ICloneable + { + public class TranslationSetValueCollection + : System.Collections.ObjectModel.Collection + { + + } + + public int LanguageIndex { get; set; } = 0; + public string Value { get; set; } = null; + + public object Clone() + { + TranslationSetValue clone = new TranslationSetValue(); + clone.LanguageIndex = LanguageIndex; + clone.Value = (Value?.Clone() as string); + return clone; + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointEntry.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointEntry.cs new file mode 100644 index 00000000..1a12547e --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointEntry.cs @@ -0,0 +1,66 @@ +// +// WaypointEntry.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +namespace UniversalEditor.ObjectModels.Waypoint +{ + public class WaypointEntry : ICloneable + { + public class WaypointEntryCollection + : System.Collections.ObjectModel.Collection + { + + } + + public int Index { get; set; } = 0; + public WaypointType Type { get; set; } = WaypointType.Default; + public double A { get; set; } = 0.0; + + public double X { get; set; } = 0.0; + public double Y { get; set; } = 0.0; + public double Z { get; set; } = 0.0; + + public double Q { get; set; } = 0.0; + + private string DoubleToString(double value) + { + return Math.Round(value, 6).ToString().PadRight(8, '0'); + } + + public override string ToString() + { + string liststr = String.Empty; + return String.Format("{0} {1} {2} ({3} {4} {5}) {{ {6} }} {7}", Index, (int)Type, DoubleToString(A), DoubleToString(X), DoubleToString(Y), DoubleToString(Z), liststr, DoubleToString(Q)); + } + + public object Clone() + { + WaypointEntry clone = new WaypointEntry(); + clone.Index = Index; + clone.Type = Type; + clone.A = A; + clone.X = X; + clone.Y = Y; + clone.Z = Z; + clone.Q = Q; + return clone; + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointObjectModel.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointObjectModel.cs new file mode 100644 index 00000000..d3c8b91b --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointObjectModel.cs @@ -0,0 +1,62 @@ +// +// WaypointObjectModel.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +namespace UniversalEditor.ObjectModels.Waypoint +{ + // FIXME: this should be moved to a parent Quake plugin or something, + // as it also relates to wpeditor waypoints in xonotic, etc. + public class WaypointObjectModel : ObjectModel + { + /// + /// Gets a collection of instances that + /// represent the waypoints defined in this botroutes file. + /// + /// The collection of instances. + public WaypointEntry.WaypointEntryCollection Entries { get; } = new WaypointEntry.WaypointEntryCollection(); + + private static ObjectModelReference _omr = null; + protected override ObjectModelReference MakeReferenceInternal() + { + if (_omr == null) + { + _omr = base.MakeReferenceInternal(); + _omr.Path = new string[] { "Game development", "Bot waypoint route" }; + } + return _omr; + } + + public override void Clear() + { + Entries.Clear(); + } + public override void CopyTo(ObjectModel where) + { + WaypointObjectModel clone = (where as WaypointObjectModel); + if (clone == null) + throw new ObjectModelNotSupportedException(); + + foreach (WaypointEntry entry in Entries) + { + clone.Entries.Add(entry.Clone() as WaypointEntry); + } + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointType.cs b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointType.cs new file mode 100644 index 00000000..e4ebb35f --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/ObjectModels/Waypoint/WaypointType.cs @@ -0,0 +1,29 @@ +// +// WaypointType.cs +// +// Author: +// Michael Becker +// +// Copyright (c) 2021 Mike Becker's Software +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +using System; +namespace UniversalEditor.ObjectModels.Waypoint +{ + public enum WaypointType + { + Default = 0, + Jump = 16 + } +} diff --git a/Plugins/UniversalEditor.Plugins.RavenSoftware/UniversalEditor.Plugins.RavenSoftware.csproj b/Plugins/UniversalEditor.Plugins.RavenSoftware/UniversalEditor.Plugins.RavenSoftware.csproj index e250505b..8e875b9f 100644 --- a/Plugins/UniversalEditor.Plugins.RavenSoftware/UniversalEditor.Plugins.RavenSoftware.csproj +++ b/Plugins/UniversalEditor.Plugins.RavenSoftware/UniversalEditor.Plugins.RavenSoftware.csproj @@ -61,6 +61,14 @@ + + + + + + + + @@ -92,6 +100,14 @@ {4FD9DB1D-76AA-48D1-8446-95376C4A2BC2} UniversalEditor.Plugins.Multimedia3D + + {30467E5C-05BC-4856-AADC-13906EF4CADD} + UniversalEditor.Essential + + + {29E1C1BB-3EA5-4062-B62F-85EEC703FE07} + MBS.Framework.UserInterface + @@ -100,10 +116,16 @@ + + + + + +