From bf060a5df6ed96c6bbbc5fb1481cf9c085e03b71 Mon Sep 17 00:00:00 2001
From: Li
Date: Sat, 14 Jan 2023 19:46:18 -0800
Subject: [PATCH] Add highscore editing GUI
---
LibW4M/Data/Highscores/HighscoreCollective.cs | 63 +++++++
LibW4M/Data/Highscores/HighscoreData.cs | 55 ++++++
LibW4M/W4SaveFile.cs | 12 +-
W4Gui/Components/HighscoresPanel.Designer.cs | 156 ++++++++++++++++++
W4Gui/Components/HighscoresPanel.cs | 40 +++++
W4Gui/Components/HighscoresPanel.resx | 60 +++++++
W4Gui/Components/TeamsPanel.Designer.cs | 89 +++++-----
W4Gui/Main.Designer.cs | 66 ++++++++
W4Gui/Tabs/HighscoresTab.Designer.cs | 98 +++++++++++
W4Gui/Tabs/HighscoresTab.cs | 62 +++++++
W4Gui/Tabs/HighscoresTab.resx | 60 +++++++
W4Gui/Tabs/WeaponsTab.cs | 3 +-
W4Gui/W4Gui.csproj.user | 6 +
13 files changed, 721 insertions(+), 49 deletions(-)
create mode 100644 LibW4M/Data/Highscores/HighscoreCollective.cs
create mode 100644 LibW4M/Data/Highscores/HighscoreData.cs
create mode 100644 W4Gui/Components/HighscoresPanel.Designer.cs
create mode 100644 W4Gui/Components/HighscoresPanel.cs
create mode 100644 W4Gui/Components/HighscoresPanel.resx
create mode 100644 W4Gui/Tabs/HighscoresTab.Designer.cs
create mode 100644 W4Gui/Tabs/HighscoresTab.cs
create mode 100644 W4Gui/Tabs/HighscoresTab.resx
diff --git a/LibW4M/Data/Highscores/HighscoreCollective.cs b/LibW4M/Data/Highscores/HighscoreCollective.cs
new file mode 100644
index 0000000..b0c417e
--- /dev/null
+++ b/LibW4M/Data/Highscores/HighscoreCollective.cs
@@ -0,0 +1,63 @@
+using LibXom.Data;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LibW4M.Data.Highscores
+{
+ public class HighscoreCollective : SaveDataCollective
+ {
+ public HighscoreCollective(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer)
+ {
+ }
+
+ public override void Load()
+ {
+ // highscore data is stored after teams data section of TeamDataCollective.
+
+ int[] decompressedCollective = mainContainer.Decompress();
+ int teamsLen = decompressedCollective[0];
+ int highscoreStart = teamsLen + 1;
+ int highscoresLen = decompressedCollective[highscoreStart];
+ for (int i = 0; i < highscoresLen; i++)
+ {
+ HighscoreData highscoreData = new HighscoreData(fileBelongs, fileBelongs.xomFile.GetContainerById(decompressedCollective[highscoreStart + i + 1]));
+ collectiveEntries.Add(highscoreData);
+ }
+ }
+
+ public override void Save()
+ {
+ // Decompress the collective
+ int[] decompressedCollective = mainContainer.Decompress();
+ // get total length of teams collective
+ int teamsLen = decompressedCollective[0];
+ // Highscore collective starts right *after* the teams collective.
+ int highscoreStart = teamsLen + 1;
+ // get the current number of highscores.
+ int highscoresLen = Length;
+
+ // copy teams data from collective.
+ int[] teamsData = new int[teamsLen + 1];
+ Array.Copy(decompressedCollective, teamsData, teamsData.Length);
+
+ // copy teams data back to collective.
+ int[] newCollective = new int[teamsData.Length + highscoresLen + 1];
+ Array.Copy(teamsData, newCollective, teamsData.Length);
+
+ // populate highscores collective
+ newCollective[highscoreStart] = highscoresLen;
+ for (int i = 0; i < highscoresLen; i++)
+ {
+ HighscoreData highscoreData = collectiveEntries[i] as HighscoreData;
+ highscoreData.Save();
+ newCollective[highscoreStart + i + 1] = highscoreData.mainContainer.Id;
+ }
+
+ // Compress whole collective and update the underlying container.
+ mainContainer.CompressAndUpdate(newCollective);
+ }
+ }
+}
diff --git a/LibW4M/Data/Highscores/HighscoreData.cs b/LibW4M/Data/Highscores/HighscoreData.cs
new file mode 100644
index 0000000..116ffd4
--- /dev/null
+++ b/LibW4M/Data/Highscores/HighscoreData.cs
@@ -0,0 +1,55 @@
+using LibXom.Data;
+using LibXom.Streams;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection.PortableExecutable;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LibW4M.Data.Highscores
+{
+ public class HighscoreData : SaveDataEntry
+ {
+
+ public override string FriendlyName
+ {
+ get
+ {
+ return WinnerName.Value + " - " + WinnerTime.ToString();
+ }
+ }
+
+ public XomString WinnerName;
+ public int WinnerTime;
+
+ public HighscoreData(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer)
+ {
+ }
+
+ public override void Load()
+ {
+ using (XomStreamReader reader = new XomStreamReader(new MemoryStream(mainContainer.GetData())))
+ {
+ reader.Skip(3);
+ WinnerName = fileBelongs.LookupStringFromId(reader.ReadCompressedInt());
+ WinnerTime = reader.ReadInt32();
+ }
+ }
+
+ public override void Save()
+ {
+ using (MemoryStream ms = new MemoryStream())
+ {
+ using (XomStreamWriter writer = new XomStreamWriter(ms))
+ {
+ writer.Skip(3);
+ writer.WriteCompressedInt(WinnerName.Id);
+ writer.WriteInt32(WinnerTime);
+ ms.Seek(0x00, SeekOrigin.Begin);
+ mainContainer.SetData(ms.ToArray());
+ }
+ }
+ }
+ }
+}
diff --git a/LibW4M/W4SaveFile.cs b/LibW4M/W4SaveFile.cs
index c42ecc9..891fa05 100644
--- a/LibW4M/W4SaveFile.cs
+++ b/LibW4M/W4SaveFile.cs
@@ -1,4 +1,5 @@
using LibW4M.Data;
+using LibW4M.Data.Highscores;
using LibW4M.Data.Teams;
using LibW4M.Data.WeaponFactory;
using LibXom;
@@ -12,6 +13,7 @@ namespace LibW4M
internal List collectives = new List();
private WeaponsCollective weaponFactoryCollective;
private TeamsCollective teamDataColective;
+ private HighscoreCollective highscoreCollective;
public WeaponsCollective WeaponFactoryCollective
{
get
@@ -26,7 +28,13 @@ namespace LibW4M
return teamDataColective;
}
}
-
+ public HighscoreCollective HighscoreDataCollective
+ {
+ get
+ {
+ return highscoreCollective;
+ }
+ }
internal XomFile xomFile;
@@ -106,7 +114,7 @@ namespace LibW4M
this.xomFile = w4Save;
weaponFactoryCollective = new WeaponsCollective(this, this.xomFile.GetTypeByName("WeaponFactoryCollective").Containers.First());
teamDataColective = new TeamsCollective(this, this.xomFile.GetTypeByName("TeamDataColective").Containers.First());
-
+ highscoreCollective = new HighscoreCollective(this, this.xomFile.GetTypeByName("TeamDataColective").Containers.First());
}
}
}
\ No newline at end of file
diff --git a/W4Gui/Components/HighscoresPanel.Designer.cs b/W4Gui/Components/HighscoresPanel.Designer.cs
new file mode 100644
index 0000000..c99ca74
--- /dev/null
+++ b/W4Gui/Components/HighscoresPanel.Designer.cs
@@ -0,0 +1,156 @@
+namespace W4Gui.Components
+{
+ partial class HighscoresPanel
+ {
+ ///
+ /// 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.highscoreTabControl = new System.Windows.Forms.TabControl();
+ this.generalTab = new System.Windows.Forms.TabPage();
+ this.tblGeneral = new System.Windows.Forms.TableLayoutPanel();
+ this.lblWinnerTime = new System.Windows.Forms.Label();
+ this.lblWinnerName = new System.Windows.Forms.Label();
+ this.selWinnerName = new System.Windows.Forms.TextBox();
+ this.selWinnerTime = new W4Gui.Components.IntUpDown();
+ this.highscoreTabControl.SuspendLayout();
+ this.generalTab.SuspendLayout();
+ this.tblGeneral.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // highscoreTabControl
+ //
+ this.highscoreTabControl.Controls.Add(this.generalTab);
+ this.highscoreTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.highscoreTabControl.HotTrack = true;
+ this.highscoreTabControl.Location = new System.Drawing.Point(0, 0);
+ this.highscoreTabControl.Name = "highscoreTabControl";
+ this.highscoreTabControl.SelectedIndex = 0;
+ this.highscoreTabControl.Size = new System.Drawing.Size(707, 419);
+ this.highscoreTabControl.TabIndex = 1;
+ //
+ // generalTab
+ //
+ this.generalTab.BackColor = System.Drawing.Color.Transparent;
+ this.generalTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.generalTab.Controls.Add(this.tblGeneral);
+ this.generalTab.Location = new System.Drawing.Point(4, 24);
+ this.generalTab.Name = "generalTab";
+ this.generalTab.Padding = new System.Windows.Forms.Padding(3);
+ this.generalTab.Size = new System.Drawing.Size(699, 391);
+ this.generalTab.TabIndex = 0;
+ this.generalTab.Text = "General";
+ //
+ // tblGeneral
+ //
+ this.tblGeneral.AutoSize = true;
+ this.tblGeneral.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset;
+ this.tblGeneral.ColumnCount = 2;
+ this.tblGeneral.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tblGeneral.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tblGeneral.Controls.Add(this.lblWinnerTime, 0, 1);
+ this.tblGeneral.Controls.Add(this.lblWinnerName, 0, 0);
+ this.tblGeneral.Controls.Add(this.selWinnerName, 1, 0);
+ this.tblGeneral.Controls.Add(this.selWinnerTime, 1, 1);
+ this.tblGeneral.Dock = System.Windows.Forms.DockStyle.Top;
+ this.tblGeneral.Location = new System.Drawing.Point(3, 3);
+ this.tblGeneral.Name = "tblGeneral";
+ this.tblGeneral.RowCount = 2;
+ this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
+ this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
+ this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tblGeneral.Size = new System.Drawing.Size(689, 64);
+ this.tblGeneral.TabIndex = 0;
+ //
+ // lblWinnerTime
+ //
+ this.lblWinnerTime.AutoSize = true;
+ this.lblWinnerTime.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lblWinnerTime.Location = new System.Drawing.Point(5, 33);
+ this.lblWinnerTime.Name = "lblWinnerTime";
+ this.lblWinnerTime.Size = new System.Drawing.Size(83, 29);
+ this.lblWinnerTime.TabIndex = 17;
+ this.lblWinnerTime.Text = "Winner Time:";
+ this.lblWinnerTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // lblWinnerName
+ //
+ this.lblWinnerName.AutoSize = true;
+ this.lblWinnerName.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lblWinnerName.Location = new System.Drawing.Point(5, 2);
+ this.lblWinnerName.Name = "lblWinnerName";
+ this.lblWinnerName.Size = new System.Drawing.Size(83, 29);
+ this.lblWinnerName.TabIndex = 0;
+ this.lblWinnerName.Text = "Winner Name:";
+ this.lblWinnerName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // selWinnerName
+ //
+ this.selWinnerName.Dock = System.Windows.Forms.DockStyle.Top;
+ this.selWinnerName.Location = new System.Drawing.Point(96, 5);
+ this.selWinnerName.Name = "selWinnerName";
+ this.selWinnerName.PlaceholderText = "Winner Name";
+ this.selWinnerName.Size = new System.Drawing.Size(588, 23);
+ this.selWinnerName.TabIndex = 1;
+ //
+ // selWinnerTime
+ //
+ this.selWinnerTime.Dock = System.Windows.Forms.DockStyle.Top;
+ this.selWinnerTime.Location = new System.Drawing.Point(96, 36);
+ this.selWinnerTime.Name = "selWinnerTime";
+ this.selWinnerTime.Size = new System.Drawing.Size(588, 23);
+ this.selWinnerTime.TabIndex = 18;
+ this.selWinnerTime.Text = "0";
+ this.selWinnerTime.Value = 0;
+ //
+ // HighscoresPanel
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.LightGray;
+ this.Controls.Add(this.highscoreTabControl);
+ this.Name = "HighscoresPanel";
+ this.Size = new System.Drawing.Size(707, 419);
+ this.highscoreTabControl.ResumeLayout(false);
+ this.generalTab.ResumeLayout(false);
+ this.generalTab.PerformLayout();
+ this.tblGeneral.ResumeLayout(false);
+ this.tblGeneral.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private TabControl highscoreTabControl;
+ private TabPage generalTab;
+ private TableLayoutPanel tblGeneral;
+ private Label lblWinnerName;
+ private TextBox selWinnerName;
+ private Label lblWinnerTime;
+ private IntUpDown selWinnerTime;
+ }
+}
diff --git a/W4Gui/Components/HighscoresPanel.cs b/W4Gui/Components/HighscoresPanel.cs
new file mode 100644
index 0000000..7137f6b
--- /dev/null
+++ b/W4Gui/Components/HighscoresPanel.cs
@@ -0,0 +1,40 @@
+using LibW4M.Data.Highscores;
+using LibW4M.Data.Teams;
+using LibW4M.Data.WeaponFactory;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using W4Gui.Dialogs;
+
+namespace W4Gui.Components
+{
+ public partial class HighscoresPanel : UserControl
+ {
+ public HighscoresPanel()
+ {
+ InitializeComponent();
+ }
+
+
+ public void SaveHighscoreData(ref HighscoreData highscore)
+ {
+ // Load general
+ highscore.WinnerName = DataManager.SaveFile.LookupString(selWinnerName.Text);
+ highscore.WinnerTime = selWinnerTime.Value;
+ }
+
+ public void LoadHighscoreData(HighscoreData highscore)
+ {
+ // Load general
+ this.selWinnerName.Text = highscore.WinnerName.Value;
+ this.selWinnerTime.Value = highscore.WinnerTime;
+ }
+
+ }
+}
diff --git a/W4Gui/Components/HighscoresPanel.resx b/W4Gui/Components/HighscoresPanel.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/W4Gui/Components/HighscoresPanel.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/W4Gui/Components/TeamsPanel.Designer.cs b/W4Gui/Components/TeamsPanel.Designer.cs
index e31c29b..6f3dfcb 100644
--- a/W4Gui/Components/TeamsPanel.Designer.cs
+++ b/W4Gui/Components/TeamsPanel.Designer.cs
@@ -31,6 +31,8 @@
this.teamTabControl = new System.Windows.Forms.TabControl();
this.generalTab = new System.Windows.Forms.TabPage();
this.tblGeneral = new System.Windows.Forms.TableLayoutPanel();
+ this.selPlayerUsername = new System.Windows.Forms.TextBox();
+ this.lblPlayer = new System.Windows.Forms.Label();
this.lblWormName = new System.Windows.Forms.Label();
this.lblSkillLevel = new System.Windows.Forms.Label();
this.lblTeamName = new System.Windows.Forms.Label();
@@ -40,6 +42,7 @@
this.apperanceTab = new System.Windows.Forms.TabPage();
this.tblApperance = new System.Windows.Forms.TableLayoutPanel();
this.lblGlasses = new System.Windows.Forms.Label();
+ this.lblFace = new System.Windows.Forms.Label();
this.lblGloves = new System.Windows.Forms.Label();
this.lblHat = new System.Windows.Forms.Label();
this.lblSpeech = new System.Windows.Forms.Label();
@@ -51,6 +54,7 @@
this.selHat = new System.Windows.Forms.TextBox();
this.selGloves = new System.Windows.Forms.TextBox();
this.selGlasses = new System.Windows.Forms.TextBox();
+ this.selFace = new System.Windows.Forms.TextBox();
this.storyTab = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tblStoryFlags = new System.Windows.Forms.TableLayoutPanel();
@@ -80,10 +84,6 @@
this.tblWeapButtonSep = new System.Windows.Forms.TableLayoutPanel();
this.btnEditWeapon = new System.Windows.Forms.Button();
this.btnChangeWeapon = new System.Windows.Forms.Button();
- this.lblPlayer = new System.Windows.Forms.Label();
- this.selPlayerUsername = new System.Windows.Forms.TextBox();
- this.selFace = new System.Windows.Forms.TextBox();
- this.lblFace = new System.Windows.Forms.Label();
this.teamTabControl.SuspendLayout();
this.generalTab.SuspendLayout();
this.tblGeneral.SuspendLayout();
@@ -145,13 +145,32 @@
this.tblGeneral.Name = "tblGeneral";
this.tblGeneral.RowCount = 4;
this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
- this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tblGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tblGeneral.Size = new System.Drawing.Size(689, 379);
this.tblGeneral.TabIndex = 0;
//
+ // selPlayerUsername
+ //
+ this.selPlayerUsername.Dock = System.Windows.Forms.DockStyle.Top;
+ this.selPlayerUsername.Location = new System.Drawing.Point(96, 36);
+ this.selPlayerUsername.Name = "selPlayerUsername";
+ this.selPlayerUsername.PlaceholderText = "Computer Name";
+ this.selPlayerUsername.Size = new System.Drawing.Size(588, 23);
+ this.selPlayerUsername.TabIndex = 18;
+ //
+ // lblPlayer
+ //
+ this.lblPlayer.AutoSize = true;
+ this.lblPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lblPlayer.Location = new System.Drawing.Point(5, 33);
+ this.lblPlayer.Name = "lblPlayer";
+ this.lblPlayer.Size = new System.Drawing.Size(83, 29);
+ this.lblPlayer.TabIndex = 17;
+ this.lblPlayer.Text = "Username:";
+ this.lblPlayer.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
// lblWormName
//
this.lblWormName.AutoSize = true;
@@ -278,6 +297,17 @@
this.lblGlasses.Text = "Glasses:";
this.lblGlasses.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
+ // lblFace
+ //
+ this.lblFace.AutoSize = true;
+ this.lblFace.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lblFace.Location = new System.Drawing.Point(5, 188);
+ this.lblFace.Name = "lblFace";
+ this.lblFace.Size = new System.Drawing.Size(83, 29);
+ this.lblFace.TabIndex = 10;
+ this.lblFace.Text = "Face:";
+ this.lblFace.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
// lblGloves
//
this.lblGloves.AutoSize = true;
@@ -383,6 +413,14 @@
this.selGlasses.Size = new System.Drawing.Size(588, 23);
this.selGlasses.TabIndex = 14;
//
+ // selFace
+ //
+ this.selFace.Dock = System.Windows.Forms.DockStyle.Top;
+ this.selFace.Location = new System.Drawing.Point(96, 191);
+ this.selFace.Name = "selFace";
+ this.selFace.Size = new System.Drawing.Size(588, 23);
+ this.selFace.TabIndex = 15;
+ //
// storyTab
//
this.storyTab.BackColor = System.Drawing.Color.Transparent;
@@ -749,45 +787,6 @@
this.btnChangeWeapon.UseVisualStyleBackColor = true;
this.btnChangeWeapon.Click += new System.EventHandler(this.btnChangeWeapon_Click);
//
- // lblPlayer
- //
- this.lblPlayer.AutoSize = true;
- this.lblPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lblPlayer.Location = new System.Drawing.Point(5, 33);
- this.lblPlayer.Name = "lblPlayer";
- this.lblPlayer.Size = new System.Drawing.Size(83, 29);
- this.lblPlayer.TabIndex = 17;
- this.lblPlayer.Text = "Username:";
- this.lblPlayer.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // selPlayerUsername
- //
- this.selPlayerUsername.Dock = System.Windows.Forms.DockStyle.Top;
- this.selPlayerUsername.Location = new System.Drawing.Point(96, 36);
- this.selPlayerUsername.Name = "selPlayerUsername";
- this.selPlayerUsername.PlaceholderText = "Computer Name";
- this.selPlayerUsername.Size = new System.Drawing.Size(588, 23);
- this.selPlayerUsername.TabIndex = 18;
- //
- // selFace
- //
- this.selFace.Dock = System.Windows.Forms.DockStyle.Top;
- this.selFace.Location = new System.Drawing.Point(96, 191);
- this.selFace.Name = "selFace";
- this.selFace.Size = new System.Drawing.Size(588, 23);
- this.selFace.TabIndex = 15;
- //
- // lblFace
- //
- this.lblFace.AutoSize = true;
- this.lblFace.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lblFace.Location = new System.Drawing.Point(5, 188);
- this.lblFace.Name = "lblFace";
- this.lblFace.Size = new System.Drawing.Size(83, 29);
- this.lblFace.TabIndex = 10;
- this.lblFace.Text = "Face:";
- this.lblFace.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
// TeamsPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
diff --git a/W4Gui/Main.Designer.cs b/W4Gui/Main.Designer.cs
index 05ef773..41b06a4 100644
--- a/W4Gui/Main.Designer.cs
+++ b/W4Gui/Main.Designer.cs
@@ -43,10 +43,16 @@ namespace W4Gui
this.weaponPage = new W4Gui.Tabs.WeaponsTab();
this.teamTab = new System.Windows.Forms.TabPage();
this.teamsPage = new W4Gui.Tabs.TeamsTab();
+ this.schemeTab = new System.Windows.Forms.TabPage();
+ this.highscoreTab = new System.Windows.Forms.TabPage();
+ this.highscoresPage = new W4Gui.Tabs.HighscoresTab();
+ this.inputTab = new System.Windows.Forms.TabPage();
+ this.variablesTab = new System.Windows.Forms.TabPage();
this.mainMenuStrip.SuspendLayout();
this.mainTabControl.SuspendLayout();
this.weaponTab.SuspendLayout();
this.teamTab.SuspendLayout();
+ this.highscoreTab.SuspendLayout();
this.SuspendLayout();
//
// mainMenuStrip
@@ -120,6 +126,10 @@ namespace W4Gui
//
this.mainTabControl.Controls.Add(this.weaponTab);
this.mainTabControl.Controls.Add(this.teamTab);
+ this.mainTabControl.Controls.Add(this.schemeTab);
+ this.mainTabControl.Controls.Add(this.highscoreTab);
+ this.mainTabControl.Controls.Add(this.inputTab);
+ this.mainTabControl.Controls.Add(this.variablesTab);
this.mainTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainTabControl.Enabled = false;
this.mainTabControl.HotTrack = true;
@@ -169,6 +179,56 @@ namespace W4Gui
this.teamsPage.Size = new System.Drawing.Size(858, 499);
this.teamsPage.TabIndex = 0;
//
+ // schemeTab
+ //
+ this.schemeTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.schemeTab.Location = new System.Drawing.Point(4, 24);
+ this.schemeTab.Name = "schemeTab";
+ this.schemeTab.Size = new System.Drawing.Size(192, 72);
+ this.schemeTab.TabIndex = 3;
+ this.schemeTab.Text = "Schemes";
+ this.schemeTab.UseVisualStyleBackColor = true;
+ //
+ // highscoreTab
+ //
+ this.highscoreTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.highscoreTab.Controls.Add(this.highscoresPage);
+ this.highscoreTab.Location = new System.Drawing.Point(4, 24);
+ this.highscoreTab.Name = "highscoreTab";
+ this.highscoreTab.Size = new System.Drawing.Size(868, 509);
+ this.highscoreTab.TabIndex = 2;
+ this.highscoreTab.Text = "Highscores";
+ this.highscoreTab.UseVisualStyleBackColor = true;
+ //
+ // highscoresPage
+ //
+
+ this.highscoresPage.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.highscoresPage.Location = new System.Drawing.Point(3, 3);
+ this.highscoresPage.Name = "highscoresPage";
+ this.highscoresPage.Size = new System.Drawing.Size(858, 499);
+ this.highscoresPage.TabIndex = 0;
+ //
+ // inputTab
+ //
+ this.inputTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.inputTab.Location = new System.Drawing.Point(4, 24);
+ this.inputTab.Name = "inputTab";
+ this.inputTab.Size = new System.Drawing.Size(192, 72);
+ this.inputTab.TabIndex = 4;
+ this.inputTab.Text = "Input Settings";
+ this.inputTab.UseVisualStyleBackColor = true;
+ //
+ // variablesTab
+ //
+ this.variablesTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.variablesTab.Location = new System.Drawing.Point(4, 24);
+ this.variablesTab.Name = "variablesTab";
+ this.variablesTab.Size = new System.Drawing.Size(192, 72);
+ this.variablesTab.TabIndex = 5;
+ this.variablesTab.Text = "Variables";
+ this.variablesTab.UseVisualStyleBackColor = true;
+ //
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -187,6 +247,7 @@ namespace W4Gui
this.mainTabControl.ResumeLayout(false);
this.weaponTab.ResumeLayout(false);
this.teamTab.ResumeLayout(false);
+ this.highscoreTab.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -207,5 +268,10 @@ namespace W4Gui
private ToolStripMenuItem extractAllXomContainersToolStripMenuItem;
private TabPage teamTab;
private TeamsTab teamsPage;
+ private TabPage schemeTab;
+ private TabPage highscoreTab;
+ private TabPage inputTab;
+ private TabPage variablesTab;
+ private HighscoresTab highscoresPage;
}
}
\ No newline at end of file
diff --git a/W4Gui/Tabs/HighscoresTab.Designer.cs b/W4Gui/Tabs/HighscoresTab.Designer.cs
new file mode 100644
index 0000000..fa9a219
--- /dev/null
+++ b/W4Gui/Tabs/HighscoresTab.Designer.cs
@@ -0,0 +1,98 @@
+namespace W4Gui.Tabs
+{
+ partial class HighscoresTab
+ {
+ ///
+ /// 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.highscoresSplitContainer = new System.Windows.Forms.SplitContainer();
+ this.highscoresList = new W4Gui.Components.CollectiveListAddDelete();
+ this.highscoresPanel = new W4Gui.Components.HighscoresPanel();
+ ((System.ComponentModel.ISupportInitialize)(this.highscoresSplitContainer)).BeginInit();
+ this.highscoresSplitContainer.Panel1.SuspendLayout();
+ this.highscoresSplitContainer.Panel2.SuspendLayout();
+ this.highscoresSplitContainer.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // highscoresSplitContainer
+ //
+ this.highscoresSplitContainer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.highscoresSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.highscoresSplitContainer.Location = new System.Drawing.Point(0, 0);
+ this.highscoresSplitContainer.Name = "highscoresSplitContainer";
+ //
+ // highscoresSplitContainer.Panel1
+ //
+ this.highscoresSplitContainer.Panel1.Controls.Add(this.highscoresList);
+ //
+ // highscoresSplitContainer.Panel2
+ //
+ this.highscoresSplitContainer.Panel2.Controls.Add(this.highscoresPanel);
+ this.highscoresSplitContainer.Size = new System.Drawing.Size(797, 464);
+ this.highscoresSplitContainer.SplitterDistance = 265;
+ this.highscoresSplitContainer.TabIndex = 0;
+ //
+ // highscoresList
+ //
+ this.highscoresList.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.highscoresList.Location = new System.Drawing.Point(0, 0);
+ this.highscoresList.Name = "highscoresList";
+ this.highscoresList.Size = new System.Drawing.Size(261, 460);
+ this.highscoresList.TabIndex = 0;
+ this.highscoresList.NewButton += new System.EventHandler(this.teamsList_NewButton);
+ this.highscoresList.DeleteButton += new System.EventHandler(this.teamsList_DeleteButton);
+ //
+ // highscorePanel
+ //
+ this.highscoresPanel.BackColor = System.Drawing.Color.LightGray;
+ this.highscoresPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.highscoresPanel.Location = new System.Drawing.Point(0, 0);
+ this.highscoresPanel.Name = "highscorePanel";
+ this.highscoresPanel.Size = new System.Drawing.Size(524, 460);
+ this.highscoresPanel.TabIndex = 0;
+ //
+ // HighscoresTab
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.highscoresSplitContainer);
+ this.Name = "HighscoresTab";
+ this.Size = new System.Drawing.Size(797, 464);
+ this.highscoresSplitContainer.Panel1.ResumeLayout(false);
+ this.highscoresSplitContainer.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.highscoresSplitContainer)).EndInit();
+ this.highscoresSplitContainer.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private SplitContainer highscoresSplitContainer;
+ private Components.CollectiveListAddDelete highscoresList;
+ private Components.HighscoresPanel highscoresPanel;
+ }
+}
diff --git a/W4Gui/Tabs/HighscoresTab.cs b/W4Gui/Tabs/HighscoresTab.cs
new file mode 100644
index 0000000..130721c
--- /dev/null
+++ b/W4Gui/Tabs/HighscoresTab.cs
@@ -0,0 +1,62 @@
+using LibW4M.Data.Highscores;
+using LibW4M.Data.Teams;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace W4Gui.Tabs
+{
+ public partial class HighscoresTab : TabEntry
+ {
+ public HighscoresTab()
+ {
+ InitializeComponent();
+ this.highscoresList.List.Selected += highscoresList_Selected;
+ this.highscoresList.List.Unselected += highscoresList_Unselected;
+
+ }
+
+ public override void SaveFromControl()
+ {
+ if (this.highscoresList.List.IsItemSelected)
+ highscoresList_Unselected(null, null);
+ }
+
+ public override void LoadIntoControl()
+ {
+ this.highscoresList.List.LoadCollective(DataManager.SaveFile.HighscoreDataCollective);
+ highscoresPanel.Enabled = false;
+ }
+
+ private void highscoresList_Unselected(object? sender, EventArgs e)
+ {
+ HighscoreData highscoreData = DataManager.SaveFile.HighscoreDataCollective[highscoresList.List.LastSelected] as HighscoreData;
+ highscoresPanel.SaveHighscoreData(ref highscoreData);
+ highscoresList.List.UpdateName(highscoresList.List.LastSelected, highscoreData.FriendlyName);
+ }
+
+ private void highscoresList_Selected(object? sender, EventArgs e)
+ {
+ HighscoreData highscoreData = DataManager.SaveFile.HighscoreDataCollective[highscoresList.List.CurrentlySelected] as HighscoreData;
+ highscoresPanel.LoadHighscoreData(highscoreData);
+ highscoresPanel.Enabled = true;
+ }
+
+ private void teamsList_NewButton(object sender, EventArgs e)
+ {
+ throw new NotImplementedException("Adding new highscores from here not implemented yet ;)");
+ }
+
+ private void teamsList_DeleteButton(object sender, EventArgs e)
+ {
+ throw new NotImplementedException("Removing highscores from here not implemented yet ;)");
+ }
+
+ }
+}
diff --git a/W4Gui/Tabs/HighscoresTab.resx b/W4Gui/Tabs/HighscoresTab.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/W4Gui/Tabs/HighscoresTab.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/W4Gui/Tabs/WeaponsTab.cs b/W4Gui/Tabs/WeaponsTab.cs
index 3707566..f4fc92e 100644
--- a/W4Gui/Tabs/WeaponsTab.cs
+++ b/W4Gui/Tabs/WeaponsTab.cs
@@ -48,8 +48,7 @@ namespace W4Gui.Tabs
WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[weaponList.List.CurrentlySelected] as WeaponStore;
weaponPanel.LoadWeaponData(store.Weapon);
clusterPanel.LoadWeaponData(store.Cluster);
- selStockWeapon.Checked = store.StockWeapon;
- weaponClusterTabControl.Enabled = true;
+ selStockWeapon.Checked = store.StockWeapon; weaponClusterTabControl.Enabled = true;
}
private void weaponList_NewButton(object sender, EventArgs e)
diff --git a/W4Gui/W4Gui.csproj.user b/W4Gui/W4Gui.csproj.user
index 4a856df..fbd6ab2 100644
--- a/W4Gui/W4Gui.csproj.user
+++ b/W4Gui/W4Gui.csproj.user
@@ -13,6 +13,9 @@
Component
+
+ UserControl
+
UserControl
@@ -40,6 +43,9 @@
UserControl
+
+ UserControl
+
UserControl