Add StockWeapon flag
This commit is contained in:
commit
61da8073d8
|
@ -14,6 +14,7 @@ namespace LibW4M.Data.WeaponFactory
|
||||||
|
|
||||||
public WeaponData Weapon;
|
public WeaponData Weapon;
|
||||||
public WeaponData Cluster;
|
public WeaponData Cluster;
|
||||||
|
public bool StockWeapon;
|
||||||
|
|
||||||
internal XomContainer weaponContainer;
|
internal XomContainer weaponContainer;
|
||||||
internal XomContainer clusterContainer;
|
internal XomContainer clusterContainer;
|
||||||
|
@ -26,6 +27,7 @@ namespace LibW4M.Data.WeaponFactory
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
int[] weaponStore = this.mainContainer.Decompress();
|
int[] weaponStore = this.mainContainer.Decompress();
|
||||||
|
this.StockWeapon = (weaponStore[0] == 1);
|
||||||
this.weaponContainer = this.fileBelongs.xomFile.GetContainerById(weaponStore[1]);
|
this.weaponContainer = this.fileBelongs.xomFile.GetContainerById(weaponStore[1]);
|
||||||
this.clusterContainer = this.fileBelongs.xomFile.GetContainerById(weaponStore[2]);
|
this.clusterContainer = this.fileBelongs.xomFile.GetContainerById(weaponStore[2]);
|
||||||
|
|
||||||
|
@ -39,6 +41,7 @@ namespace LibW4M.Data.WeaponFactory
|
||||||
this.Cluster.Save();
|
this.Cluster.Save();
|
||||||
|
|
||||||
int[] weaponStore = this.mainContainer.Decompress();
|
int[] weaponStore = this.mainContainer.Decompress();
|
||||||
|
weaponStore[0] = (this.StockWeapon ? 1 : 0);
|
||||||
weaponStore[1] = this.weaponContainer.Id;
|
weaponStore[1] = this.weaponContainer.Id;
|
||||||
weaponStore[2] = this.clusterContainer.Id;
|
weaponStore[2] = this.clusterContainer.Id;
|
||||||
this.mainContainer.CompressAndUpdate(weaponStore);
|
this.mainContainer.CompressAndUpdate(weaponStore);
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace W4Gui.Dialogs
|
||||||
{
|
{
|
||||||
if (!saved)
|
if (!saved)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Are you sure you want to exit?\nyou'll loose any changes you've made to the weapon.", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if(MessageBox.Show("Are you sure you want to exit?\nyou'll lose any changes you've made to the weapon.", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
this.saved = true;
|
this.saved = true;
|
||||||
this.DialogResult = DialogResult.Cancel;
|
this.DialogResult = DialogResult.Cancel;
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace W4Gui.Tabs
|
||||||
this.weaponPanel = new W4Gui.Components.WeaponsPanel();
|
this.weaponPanel = new W4Gui.Components.WeaponsPanel();
|
||||||
this.clustersPage = new System.Windows.Forms.TabPage();
|
this.clustersPage = new System.Windows.Forms.TabPage();
|
||||||
this.clusterPanel = new W4Gui.Components.WeaponsPanel();
|
this.clusterPanel = new W4Gui.Components.WeaponsPanel();
|
||||||
|
this.selStockWeapon = new System.Windows.Forms.CheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.weaponSplitContainer)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.weaponSplitContainer)).BeginInit();
|
||||||
this.weaponSplitContainer.Panel1.SuspendLayout();
|
this.weaponSplitContainer.Panel1.SuspendLayout();
|
||||||
this.weaponSplitContainer.Panel2.SuspendLayout();
|
this.weaponSplitContainer.Panel2.SuspendLayout();
|
||||||
|
@ -58,6 +59,7 @@ namespace W4Gui.Tabs
|
||||||
//
|
//
|
||||||
// weaponSplitContainer.Panel2
|
// weaponSplitContainer.Panel2
|
||||||
//
|
//
|
||||||
|
this.weaponSplitContainer.Panel2.Controls.Add(this.selStockWeapon);
|
||||||
this.weaponSplitContainer.Panel2.Controls.Add(this.weaponClusterTabControl);
|
this.weaponSplitContainer.Panel2.Controls.Add(this.weaponClusterTabControl);
|
||||||
this.weaponSplitContainer.Size = new System.Drawing.Size(797, 464);
|
this.weaponSplitContainer.Size = new System.Drawing.Size(797, 464);
|
||||||
this.weaponSplitContainer.SplitterDistance = 265;
|
this.weaponSplitContainer.SplitterDistance = 265;
|
||||||
|
@ -77,7 +79,7 @@ namespace W4Gui.Tabs
|
||||||
//
|
//
|
||||||
this.weaponClusterTabControl.Controls.Add(this.mainWeaponPage);
|
this.weaponClusterTabControl.Controls.Add(this.mainWeaponPage);
|
||||||
this.weaponClusterTabControl.Controls.Add(this.clustersPage);
|
this.weaponClusterTabControl.Controls.Add(this.clustersPage);
|
||||||
this.weaponClusterTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.weaponClusterTabControl.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.weaponClusterTabControl.HotTrack = true;
|
this.weaponClusterTabControl.HotTrack = true;
|
||||||
this.weaponClusterTabControl.Location = new System.Drawing.Point(0, 0);
|
this.weaponClusterTabControl.Location = new System.Drawing.Point(0, 0);
|
||||||
this.weaponClusterTabControl.Name = "weaponClusterTabControl";
|
this.weaponClusterTabControl.Name = "weaponClusterTabControl";
|
||||||
|
@ -113,7 +115,7 @@ namespace W4Gui.Tabs
|
||||||
this.clustersPage.Location = new System.Drawing.Point(4, 24);
|
this.clustersPage.Location = new System.Drawing.Point(4, 24);
|
||||||
this.clustersPage.Name = "clustersPage";
|
this.clustersPage.Name = "clustersPage";
|
||||||
this.clustersPage.Padding = new System.Windows.Forms.Padding(3);
|
this.clustersPage.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.clustersPage.Size = new System.Drawing.Size(517, 432);
|
this.clustersPage.Size = new System.Drawing.Size(192, 72);
|
||||||
this.clustersPage.TabIndex = 1;
|
this.clustersPage.TabIndex = 1;
|
||||||
this.clustersPage.Text = "Clusters";
|
this.clustersPage.Text = "Clusters";
|
||||||
//
|
//
|
||||||
|
@ -122,9 +124,20 @@ namespace W4Gui.Tabs
|
||||||
this.clusterPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.clusterPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.clusterPanel.Location = new System.Drawing.Point(3, 3);
|
this.clusterPanel.Location = new System.Drawing.Point(3, 3);
|
||||||
this.clusterPanel.Name = "clusterPanel";
|
this.clusterPanel.Name = "clusterPanel";
|
||||||
this.clusterPanel.Size = new System.Drawing.Size(507, 422);
|
this.clusterPanel.Size = new System.Drawing.Size(182, 62);
|
||||||
this.clusterPanel.TabIndex = 0;
|
this.clusterPanel.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// selStockWeapon
|
||||||
|
//
|
||||||
|
this.selStockWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.selStockWeapon.AutoSize = true;
|
||||||
|
this.selStockWeapon.Location = new System.Drawing.Point(420, 0);
|
||||||
|
this.selStockWeapon.Name = "selStockWeapon";
|
||||||
|
this.selStockWeapon.Size = new System.Drawing.Size(102, 19);
|
||||||
|
this.selStockWeapon.TabIndex = 1;
|
||||||
|
this.selStockWeapon.Text = "Stock Weapon";
|
||||||
|
this.selStockWeapon.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// WeaponsTab
|
// WeaponsTab
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
@ -134,6 +147,7 @@ namespace W4Gui.Tabs
|
||||||
this.Size = new System.Drawing.Size(797, 464);
|
this.Size = new System.Drawing.Size(797, 464);
|
||||||
this.weaponSplitContainer.Panel1.ResumeLayout(false);
|
this.weaponSplitContainer.Panel1.ResumeLayout(false);
|
||||||
this.weaponSplitContainer.Panel2.ResumeLayout(false);
|
this.weaponSplitContainer.Panel2.ResumeLayout(false);
|
||||||
|
this.weaponSplitContainer.Panel2.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.weaponSplitContainer)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.weaponSplitContainer)).EndInit();
|
||||||
this.weaponSplitContainer.ResumeLayout(false);
|
this.weaponSplitContainer.ResumeLayout(false);
|
||||||
this.weaponClusterTabControl.ResumeLayout(false);
|
this.weaponClusterTabControl.ResumeLayout(false);
|
||||||
|
@ -152,5 +166,6 @@ namespace W4Gui.Tabs
|
||||||
private TabPage clustersPage;
|
private TabPage clustersPage;
|
||||||
private WeaponsPanel clusterPanel;
|
private WeaponsPanel clusterPanel;
|
||||||
private CollectiveListAddDelete weaponList;
|
private CollectiveListAddDelete weaponList;
|
||||||
|
private CheckBox selStockWeapon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace W4Gui.Tabs
|
||||||
WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[weaponList.List.LastSelected] as WeaponStore;
|
WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[weaponList.List.LastSelected] as WeaponStore;
|
||||||
weaponPanel.SaveWeaponData(ref store.Weapon);
|
weaponPanel.SaveWeaponData(ref store.Weapon);
|
||||||
clusterPanel.SaveWeaponData(ref store.Cluster);
|
clusterPanel.SaveWeaponData(ref store.Cluster);
|
||||||
|
store.StockWeapon = selStockWeapon.Checked;
|
||||||
weaponList.List.UpdateName(weaponList.List.LastSelected, store.Weapon.Name.Value);
|
weaponList.List.UpdateName(weaponList.List.LastSelected, store.Weapon.Name.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ namespace W4Gui.Tabs
|
||||||
WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[weaponList.List.CurrentlySelected] as WeaponStore;
|
WeaponStore store = DataManager.SaveFile.WeaponFactoryCollective[weaponList.List.CurrentlySelected] as WeaponStore;
|
||||||
weaponPanel.LoadWeaponData(store.Weapon);
|
weaponPanel.LoadWeaponData(store.Weapon);
|
||||||
clusterPanel.LoadWeaponData(store.Cluster);
|
clusterPanel.LoadWeaponData(store.Cluster);
|
||||||
|
selStockWeapon.Checked = store.StockWeapon;
|
||||||
weaponClusterTabControl.Enabled = true;
|
weaponClusterTabControl.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue