From 32778d1316697a22b2faae16749c60581f7e84f6 Mon Sep 17 00:00:00 2001 From: Li Date: Fri, 10 Mar 2023 13:29:54 +1300 Subject: [PATCH] Abstract some stuff away with enums --- LibW4M/Data/Schemes/SchemeData.cs | 44 ++++++------ LibW4M/Data/YesNo.cs | 14 ++++ W4Gui/Components/SchemePanel.Designer.cs | 90 ++++++++++++------------ W4Gui/Components/SchemePanel.cs | 10 +-- W4Gui/Components/YesNoComboBox.cs | 33 +++++++++ W4Gui/W4Gui.csproj.user | 3 + 6 files changed, 122 insertions(+), 72 deletions(-) create mode 100644 LibW4M/Data/YesNo.cs create mode 100644 W4Gui/Components/YesNoComboBox.cs diff --git a/LibW4M/Data/Schemes/SchemeData.cs b/LibW4M/Data/Schemes/SchemeData.cs index b963a15..360513e 100644 --- a/LibW4M/Data/Schemes/SchemeData.cs +++ b/LibW4M/Data/Schemes/SchemeData.cs @@ -79,10 +79,10 @@ namespace LibW4M.Data.Schemes public WeaponSettingsData BadPoisonMystery; public WeaponSettingsData GoodPoisonMystery; - public int ArtileryMode; - public int TeleportIn; + public YesNo ArtileryMode; + public YesNo TeleportIn; public int Wins; - public int WormSelect; + public YesNo WormSelect; public int WormHealth; public int RoundTime; public int TurnTime; @@ -98,12 +98,12 @@ namespace LibW4M.Data.Schemes public SuddenDeath SuddenDeath; public WaterSpeed WaterSpeed; - public int DisplayTime; + public YesNo DisplayTime; public int LandTime; public int RopeTime; - public int FallDamage; + public YesNo FallDamage; public int HotSeat; - public int Special; + public YesNo Special; public int MineFuse; public int HelpPanelDelay; @@ -186,10 +186,10 @@ namespace LibW4M.Data.Schemes - this.ArtileryMode = reader.ReadInt32(); - this.TeleportIn = reader.ReadInt32(); + this.ArtileryMode = (YesNo)reader.ReadInt32(); + this.TeleportIn = (YesNo)reader.ReadInt32(); this.Wins = reader.ReadInt32(); - this.WormSelect = reader.ReadInt32(); + this.WormSelect = (YesNo)reader.ReadInt32(); this.WormHealth = reader.ReadInt32(); this.RoundTime = reader.ReadInt32(); this.TurnTime = reader.ReadInt32(); @@ -203,12 +203,12 @@ namespace LibW4M.Data.Schemes this.Stockpiling = (Stockpiling)reader.ReadInt32(); this.SuddenDeath = (SuddenDeath)reader.ReadInt32(); this.WaterSpeed = (WaterSpeed)reader.ReadInt32(); - this.DisplayTime = reader.ReadInt32(); + this.DisplayTime = (YesNo)reader.ReadInt32(); this.LandTime = reader.ReadInt32(); this.RopeTime = reader.ReadInt32(); - this.FallDamage = reader.ReadInt32(); + this.FallDamage = (YesNo)reader.ReadInt32(); this.HotSeat = reader.ReadInt32(); - this.Special = reader.ReadInt32(); + this.Special = (YesNo)reader.ReadInt32(); this.MineFuse = reader.ReadInt32(); this.HelpPanelDelay = reader.ReadInt32(); this.MineFactoryOn = reader.ReadBool(); @@ -306,8 +306,8 @@ namespace LibW4M.Data.Schemes this.BadPoisonMystery.Crate = 20; this.GoodPoisonMystery.Crate = 30; - this.ArtileryMode = 0; - this.TeleportIn = 0; + this.ArtileryMode = YesNo.No; + this.TeleportIn = YesNo.No; this.Wins = 2; this.WormSelect = 0; this.WormHealth = 100; @@ -325,10 +325,10 @@ namespace LibW4M.Data.Schemes this.SuddenDeath = SuddenDeath.OneHealth; this.WaterSpeed = WaterSpeed.Medium; - this.DisplayTime = 1; + this.DisplayTime = YesNo.Yes; this.LandTime = 3000; this.RopeTime = 5000; - this.FallDamage = 1; + this.FallDamage = YesNo.Yes; this.HotSeat = 10000; this.Special = 0; this.HelpPanelDelay = 3000; @@ -531,10 +531,10 @@ namespace LibW4M.Data.Schemes writer.WriteCompressedInt(this.BadPoisonMystery.mainContainer.Id); writer.WriteCompressedInt(this.GoodPoisonMystery.mainContainer.Id); - writer.WriteInt32(this.ArtileryMode); - writer.WriteInt32(this.TeleportIn); + writer.WriteInt32((int)this.ArtileryMode); + writer.WriteInt32((int)this.TeleportIn); writer.WriteInt32(this.Wins); - writer.WriteInt32(this.WormSelect); + writer.WriteInt32((int)this.WormSelect); writer.WriteInt32(this.WormHealth); writer.WriteInt32(this.RoundTime); writer.WriteInt32(this.TurnTime); @@ -548,12 +548,12 @@ namespace LibW4M.Data.Schemes writer.WriteInt32((int)this.Stockpiling); writer.WriteInt32((int)this.SuddenDeath); writer.WriteInt32((int)this.WaterSpeed); - writer.WriteInt32(this.DisplayTime); + writer.WriteInt32((int)this.DisplayTime); writer.WriteInt32(this.LandTime); writer.WriteInt32(this.RopeTime); - writer.WriteInt32(this.FallDamage); + writer.WriteInt32((int)this.FallDamage); writer.WriteInt32(this.HotSeat); - writer.WriteInt32(this.Special); + writer.WriteInt32((int)this.Special); writer.WriteInt32(this.MineFuse); writer.WriteInt32(this.HelpPanelDelay); writer.WriteBool(this.MineFactoryOn); diff --git a/LibW4M/Data/YesNo.cs b/LibW4M/Data/YesNo.cs new file mode 100644 index 0000000..5237356 --- /dev/null +++ b/LibW4M/Data/YesNo.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibW4M.Data +{ + public enum YesNo : int + { + No = 0, + Yes = 1 + } +} diff --git a/W4Gui/Components/SchemePanel.Designer.cs b/W4Gui/Components/SchemePanel.Designer.cs index 6020466..39b6d52 100644 --- a/W4Gui/Components/SchemePanel.Designer.cs +++ b/W4Gui/Components/SchemePanel.Designer.cs @@ -42,27 +42,27 @@ this.selTurnTime = new W4Gui.Components.IntUpDown(); this.selWormHealth = new W4Gui.Components.IntUpDown(); this.selRoundTime = new W4Gui.Components.IntUpDown(); - this.selWormSelectAtGameStart = new W4Gui.Components.IntUpDown(); + this.selWormSelectAtGameStart = new W4Gui.Components.YesNoComboBox(); this.lblTurnTime = new System.Windows.Forms.Label(); this.lblRoundTime = new System.Windows.Forms.Label(); this.lblWormHealth = new System.Windows.Forms.Label(); this.lblWormSelect = new System.Windows.Forms.Label(); this.lblNumRounds = new System.Windows.Forms.Label(); - this.selTeleportIn = new W4Gui.Components.IntUpDown(); + this.selTeleportIn = new W4Gui.Components.YesNoComboBox(); this.lblTeleportIn = new System.Windows.Forms.Label(); this.lblArtiliaryMode = new System.Windows.Forms.Label(); this.selLock = new System.Windows.Forms.TextBox(); this.lblLock = new System.Windows.Forms.Label(); this.lblSchemeName = new System.Windows.Forms.Label(); this.selSchemeName = new System.Windows.Forms.TextBox(); - this.selArtilaryMode = new W4Gui.Components.IntUpDown(); + this.selArtilaryMode = new W4Gui.Components.YesNoComboBox(); this.selNumRounds = new W4Gui.Components.IntUpDown(); - this.selDisplayTime = new W4Gui.Components.IntUpDown(); + this.selDisplayTime = new W4Gui.Components.YesNoComboBox(); this.selLandTime = new W4Gui.Components.IntUpDown(); this.selRopeTime = new W4Gui.Components.IntUpDown(); - this.selFallDamage = new W4Gui.Components.IntUpDown(); + this.selFallDamage = new W4Gui.Components.YesNoComboBox(); this.selHotSeat = new W4Gui.Components.IntUpDown(); - this.selSpecial = new W4Gui.Components.IntUpDown(); + this.selSpecial = new W4Gui.Components.YesNoComboBox(); this.selHelpPanelDisplay = new W4Gui.Components.IntUpDown(); this.selStockpiling = new System.Windows.Forms.ComboBox(); this.tblPermanatToggle = new System.Windows.Forms.TableLayoutPanel(); @@ -591,7 +591,7 @@ this.selArtilaryMode.Name = "selArtilaryMode"; this.selArtilaryMode.Size = new System.Drawing.Size(546, 23); this.selArtilaryMode.TabIndex = 22; - this.selArtilaryMode.Text = "0"; + this.selArtilaryMode.Text = "No"; this.selArtilaryMode.Value = 0; // // selNumRounds @@ -1817,7 +1817,7 @@ this.utilityTab.Location = new System.Drawing.Point(4, 24); this.utilityTab.Name = "utilityTab"; this.utilityTab.Padding = new System.Windows.Forms.Padding(3); - this.utilityTab.Size = new System.Drawing.Size(687, 355); + this.utilityTab.Size = new System.Drawing.Size(180, 40); this.utilityTab.TabIndex = 1; this.utilityTab.Text = "Utilties"; this.utilityTab.UseVisualStyleBackColor = true; @@ -1873,7 +1873,7 @@ this.tblWeapUtil.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tblWeapUtil.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tblWeapUtil.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tblWeapUtil.Size = new System.Drawing.Size(660, 1341); + this.tblWeapUtil.Size = new System.Drawing.Size(153, 1341); this.tblWeapUtil.TabIndex = 1; // // selArmour @@ -1882,7 +1882,7 @@ this.selArmour.Dock = System.Windows.Forms.DockStyle.Top; this.selArmour.Location = new System.Drawing.Point(108, 1241); this.selArmour.Name = "selArmour"; - this.selArmour.Size = new System.Drawing.Size(547, 95); + this.selArmour.Size = new System.Drawing.Size(40, 95); this.selArmour.TabIndex = 32; // // selDoubleDamage @@ -1891,7 +1891,7 @@ this.selDoubleDamage.Dock = System.Windows.Forms.DockStyle.Top; this.selDoubleDamage.Location = new System.Drawing.Point(108, 1138); this.selDoubleDamage.Name = "selDoubleDamage"; - this.selDoubleDamage.Size = new System.Drawing.Size(547, 95); + this.selDoubleDamage.Size = new System.Drawing.Size(40, 95); this.selDoubleDamage.TabIndex = 31; // // selCrateSpy @@ -1900,7 +1900,7 @@ this.selCrateSpy.Dock = System.Windows.Forms.DockStyle.Top; this.selCrateSpy.Location = new System.Drawing.Point(108, 1035); this.selCrateSpy.Name = "selCrateSpy"; - this.selCrateSpy.Size = new System.Drawing.Size(547, 95); + this.selCrateSpy.Size = new System.Drawing.Size(40, 95); this.selCrateSpy.TabIndex = 30; // // selCrateShower @@ -1909,7 +1909,7 @@ this.selCrateShower.Dock = System.Windows.Forms.DockStyle.Top; this.selCrateShower.Location = new System.Drawing.Point(108, 932); this.selCrateShower.Name = "selCrateShower"; - this.selCrateShower.Size = new System.Drawing.Size(547, 95); + this.selCrateShower.Size = new System.Drawing.Size(40, 95); this.selCrateShower.TabIndex = 29; // // selSkipGo @@ -1918,7 +1918,7 @@ this.selSkipGo.Dock = System.Windows.Forms.DockStyle.Top; this.selSkipGo.Location = new System.Drawing.Point(108, 829); this.selSkipGo.Name = "selSkipGo"; - this.selSkipGo.Size = new System.Drawing.Size(547, 95); + this.selSkipGo.Size = new System.Drawing.Size(40, 95); this.selSkipGo.TabIndex = 27; // // lblArmour @@ -1982,7 +1982,7 @@ this.selSurrender.Dock = System.Windows.Forms.DockStyle.Top; this.selSurrender.Location = new System.Drawing.Point(108, 726); this.selSurrender.Name = "selSurrender"; - this.selSurrender.Size = new System.Drawing.Size(547, 95); + this.selSurrender.Size = new System.Drawing.Size(40, 95); this.selSurrender.TabIndex = 15; // // selGirder @@ -1991,7 +1991,7 @@ this.selGirder.Dock = System.Windows.Forms.DockStyle.Top; this.selGirder.Location = new System.Drawing.Point(108, 623); this.selGirder.Name = "selGirder"; - this.selGirder.Size = new System.Drawing.Size(547, 95); + this.selGirder.Size = new System.Drawing.Size(40, 95); this.selGirder.TabIndex = 14; // // selBubbleTrouble @@ -2000,7 +2000,7 @@ this.selBubbleTrouble.Dock = System.Windows.Forms.DockStyle.Top; this.selBubbleTrouble.Location = new System.Drawing.Point(108, 520); this.selBubbleTrouble.Name = "selBubbleTrouble"; - this.selBubbleTrouble.Size = new System.Drawing.Size(547, 95); + this.selBubbleTrouble.Size = new System.Drawing.Size(40, 95); this.selBubbleTrouble.TabIndex = 13; // // lblSurrender @@ -2042,7 +2042,7 @@ this.selIcarusPotion.Dock = System.Windows.Forms.DockStyle.Top; this.selIcarusPotion.Location = new System.Drawing.Point(108, 314); this.selIcarusPotion.Name = "selIcarusPotion"; - this.selIcarusPotion.Size = new System.Drawing.Size(547, 95); + this.selIcarusPotion.Size = new System.Drawing.Size(40, 95); this.selIcarusPotion.TabIndex = 9; // // selWormSelect @@ -2051,7 +2051,7 @@ this.selWormSelect.Dock = System.Windows.Forms.DockStyle.Top; this.selWormSelect.Location = new System.Drawing.Point(108, 417); this.selWormSelect.Name = "selWormSelect"; - this.selWormSelect.Size = new System.Drawing.Size(547, 95); + this.selWormSelect.Size = new System.Drawing.Size(40, 95); this.selWormSelect.TabIndex = 8; // // selNinjaRope @@ -2060,7 +2060,7 @@ this.selNinjaRope.Dock = System.Windows.Forms.DockStyle.Top; this.selNinjaRope.Location = new System.Drawing.Point(108, 211); this.selNinjaRope.Name = "selNinjaRope"; - this.selNinjaRope.Size = new System.Drawing.Size(547, 95); + this.selNinjaRope.Size = new System.Drawing.Size(40, 95); this.selNinjaRope.TabIndex = 7; // // lblWormSelector @@ -2102,7 +2102,7 @@ this.selParachute.Dock = System.Windows.Forms.DockStyle.Top; this.selParachute.Location = new System.Drawing.Point(108, 108); this.selParachute.Name = "selParachute"; - this.selParachute.Size = new System.Drawing.Size(547, 95); + this.selParachute.Size = new System.Drawing.Size(40, 95); this.selParachute.TabIndex = 3; // // lblParachute @@ -2133,7 +2133,7 @@ this.selJetpack.Dock = System.Windows.Forms.DockStyle.Top; this.selJetpack.Location = new System.Drawing.Point(108, 5); this.selJetpack.Name = "selJetpack"; - this.selJetpack.Size = new System.Drawing.Size(547, 95); + this.selJetpack.Size = new System.Drawing.Size(40, 95); this.selJetpack.TabIndex = 1; // // mysteryTab @@ -2144,7 +2144,7 @@ this.mysteryTab.Location = new System.Drawing.Point(4, 24); this.mysteryTab.Name = "mysteryTab"; this.mysteryTab.Padding = new System.Windows.Forms.Padding(3); - this.mysteryTab.Size = new System.Drawing.Size(687, 355); + this.mysteryTab.Size = new System.Drawing.Size(180, 40); this.mysteryTab.TabIndex = 1; this.mysteryTab.Text = "Mystery"; this.mysteryTab.UseVisualStyleBackColor = true; @@ -2205,7 +2205,7 @@ this.tblWeapMystery.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tblWeapMystery.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tblWeapMystery.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tblWeapMystery.Size = new System.Drawing.Size(660, 1547); + this.tblWeapMystery.Size = new System.Drawing.Size(153, 1547); this.tblWeapMystery.TabIndex = 1; // // selBadPoisonMystery @@ -2214,7 +2214,7 @@ this.selBadPoisonMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selBadPoisonMystery.Location = new System.Drawing.Point(130, 1344); this.selBadPoisonMystery.Name = "selBadPoisonMystery"; - this.selBadPoisonMystery.Size = new System.Drawing.Size(525, 95); + this.selBadPoisonMystery.Size = new System.Drawing.Size(18, 95); this.selBadPoisonMystery.TabIndex = 36; // // selGoodPoisonMystery @@ -2223,7 +2223,7 @@ this.selGoodPoisonMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selGoodPoisonMystery.Location = new System.Drawing.Point(130, 1447); this.selGoodPoisonMystery.Name = "selGoodPoisonMystery"; - this.selGoodPoisonMystery.Size = new System.Drawing.Size(525, 95); + this.selGoodPoisonMystery.Size = new System.Drawing.Size(18, 95); this.selGoodPoisonMystery.TabIndex = 35; // // lblTeamDisease @@ -2254,7 +2254,7 @@ this.selSpecialWeaponMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selSpecialWeaponMystery.Location = new System.Drawing.Point(130, 1241); this.selSpecialWeaponMystery.Name = "selSpecialWeaponMystery"; - this.selSpecialWeaponMystery.Size = new System.Drawing.Size(525, 95); + this.selSpecialWeaponMystery.Size = new System.Drawing.Size(18, 95); this.selSpecialWeaponMystery.TabIndex = 32; // // selSuperHealthMystery @@ -2263,7 +2263,7 @@ this.selSuperHealthMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selSuperHealthMystery.Location = new System.Drawing.Point(130, 1138); this.selSuperHealthMystery.Name = "selSuperHealthMystery"; - this.selSuperHealthMystery.Size = new System.Drawing.Size(525, 95); + this.selSuperHealthMystery.Size = new System.Drawing.Size(18, 95); this.selSuperHealthMystery.TabIndex = 31; // // selDamageMystery @@ -2272,7 +2272,7 @@ this.selDamageMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selDamageMystery.Location = new System.Drawing.Point(130, 1035); this.selDamageMystery.Name = "selDamageMystery"; - this.selDamageMystery.Size = new System.Drawing.Size(525, 95); + this.selDamageMystery.Size = new System.Drawing.Size(18, 95); this.selDamageMystery.TabIndex = 30; // // selHealthMystery @@ -2281,7 +2281,7 @@ this.selHealthMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selHealthMystery.Location = new System.Drawing.Point(130, 932); this.selHealthMystery.Name = "selHealthMystery"; - this.selHealthMystery.Size = new System.Drawing.Size(525, 95); + this.selHealthMystery.Size = new System.Drawing.Size(18, 95); this.selHealthMystery.TabIndex = 29; // // selDoubleTurnTimeMystery @@ -2290,7 +2290,7 @@ this.selDoubleTurnTimeMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selDoubleTurnTimeMystery.Location = new System.Drawing.Point(130, 829); this.selDoubleTurnTimeMystery.Name = "selDoubleTurnTimeMystery"; - this.selDoubleTurnTimeMystery.Size = new System.Drawing.Size(525, 95); + this.selDoubleTurnTimeMystery.Size = new System.Drawing.Size(18, 95); this.selDoubleTurnTimeMystery.TabIndex = 27; // // lblBigGuns @@ -2354,7 +2354,7 @@ this.selLowGravityMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selLowGravityMystery.Location = new System.Drawing.Point(130, 726); this.selLowGravityMystery.Name = "selLowGravityMystery"; - this.selLowGravityMystery.Size = new System.Drawing.Size(525, 95); + this.selLowGravityMystery.Size = new System.Drawing.Size(18, 95); this.selLowGravityMystery.TabIndex = 15; // // selQuickWalkMystery @@ -2363,7 +2363,7 @@ this.selQuickWalkMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selQuickWalkMystery.Location = new System.Drawing.Point(130, 623); this.selQuickWalkMystery.Name = "selQuickWalkMystery"; - this.selQuickWalkMystery.Size = new System.Drawing.Size(525, 95); + this.selQuickWalkMystery.Size = new System.Drawing.Size(18, 95); this.selQuickWalkMystery.TabIndex = 14; // // selTeleportMystery @@ -2372,7 +2372,7 @@ this.selTeleportMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selTeleportMystery.Location = new System.Drawing.Point(130, 520); this.selTeleportMystery.Name = "selTeleportMystery"; - this.selTeleportMystery.Size = new System.Drawing.Size(525, 95); + this.selTeleportMystery.Size = new System.Drawing.Size(18, 95); this.selTeleportMystery.TabIndex = 13; // // lblMoonPhysics @@ -2414,7 +2414,7 @@ this.selFloodMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selFloodMystery.Location = new System.Drawing.Point(130, 314); this.selFloodMystery.Name = "selFloodMystery"; - this.selFloodMystery.Size = new System.Drawing.Size(525, 95); + this.selFloodMystery.Size = new System.Drawing.Size(18, 95); this.selFloodMystery.TabIndex = 9; // // selDisarmMystery @@ -2423,7 +2423,7 @@ this.selDisarmMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selDisarmMystery.Location = new System.Drawing.Point(130, 417); this.selDisarmMystery.Name = "selDisarmMystery"; - this.selDisarmMystery.Size = new System.Drawing.Size(525, 95); + this.selDisarmMystery.Size = new System.Drawing.Size(18, 95); this.selDisarmMystery.TabIndex = 8; // // selBarrelTripletMystery @@ -2432,7 +2432,7 @@ this.selBarrelTripletMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selBarrelTripletMystery.Location = new System.Drawing.Point(130, 211); this.selBarrelTripletMystery.Name = "selBarrelTripletMystery"; - this.selBarrelTripletMystery.Size = new System.Drawing.Size(525, 95); + this.selBarrelTripletMystery.Size = new System.Drawing.Size(18, 95); this.selBarrelTripletMystery.TabIndex = 7; // // lblSabotageInventory @@ -2474,7 +2474,7 @@ this.selMineTripletMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selMineTripletMystery.Location = new System.Drawing.Point(130, 108); this.selMineTripletMystery.Name = "selMineTripletMystery"; - this.selMineTripletMystery.Size = new System.Drawing.Size(525, 95); + this.selMineTripletMystery.Size = new System.Drawing.Size(18, 95); this.selMineTripletMystery.TabIndex = 3; // // lblRandomDetonation @@ -2505,7 +2505,7 @@ this.selMineLayerMystery.Dock = System.Windows.Forms.DockStyle.Top; this.selMineLayerMystery.Location = new System.Drawing.Point(130, 5); this.selMineLayerMystery.Name = "selMineLayerMystery"; - this.selMineLayerMystery.Size = new System.Drawing.Size(525, 95); + this.selMineLayerMystery.Size = new System.Drawing.Size(18, 95); this.selMineLayerMystery.TabIndex = 1; // // SchemePanel @@ -2562,8 +2562,8 @@ private TextBox selLock; private CheckBox selPermanent; private Label lblArtiliaryMode; - private IntUpDown selArtilaryMode; - private IntUpDown selTeleportIn; + private YesNoComboBox selArtilaryMode; + private YesNoComboBox selTeleportIn; private Label lblTeleportIn; private TableLayoutPanel tblPermanatToggle; private Label lblNumRounds; @@ -2575,7 +2575,7 @@ private IntUpDown selTurnTime; private IntUpDown selWormHealth; private IntUpDown selRoundTime; - private IntUpDown selWormSelectAtGameStart; + private YesNoComboBox selWormSelectAtGameStart; private TabPage crateTab; private TableLayoutPanel tblCrate; private IntUpDown selHealthCrateAmount; @@ -2608,12 +2608,12 @@ private Label lblFallDamage; private Label lblHelpPanelDisplay; private Label lblDisplayTime; - private IntUpDown selDisplayTime; + private YesNoComboBox selDisplayTime; private IntUpDown selLandTime; private IntUpDown selRopeTime; - private IntUpDown selFallDamage; + private YesNoComboBox selFallDamage; private IntUpDown selHotSeat; - private IntUpDown selSpecial; + private YesNoComboBox selSpecial; private IntUpDown selHelpPanelDisplay; private TabPage weaponsTab; private TabControl weapTypeTabControl; diff --git a/W4Gui/Components/SchemePanel.cs b/W4Gui/Components/SchemePanel.cs index 1e360de..5417d56 100644 --- a/W4Gui/Components/SchemePanel.cs +++ b/W4Gui/Components/SchemePanel.cs @@ -181,20 +181,20 @@ namespace W4Gui.Components this.selSchemeName.Text = scheme.Name.Value; this.selLock.Text = scheme.Lock.Value; - this.selArtilaryMode.Value = scheme.ArtileryMode; - this.selTeleportIn.Value = scheme.TeleportIn; + //this.selArtilaryMode.Value = scheme.ArtileryMode; + //this.selTeleportIn.Value = scheme.TeleportIn; this.selNumRounds.Value = scheme.Wins; this.selWormSelectAtGameStart.Value = scheme.WormSelect; this.selWormHealth.Value = scheme.WormHealth; this.selRoundTime.Value = scheme.RoundTime; this.selTurnTime.Value = scheme.TurnTime; this.selStockpiling.SelectedIndex = (int)scheme.Stockpiling; - this.selDisplayTime.Value = scheme.DisplayTime; + //this.selDisplayTime.Value = scheme.DisplayTime; this.selLandTime.Value = scheme.LandTime; this.selRopeTime.Value = scheme.RopeTime; - this.selFallDamage.Value = scheme.FallDamage; + //this.selFallDamage.Value = scheme.FallDamage; this.selHotSeat.Value = scheme.HotSeat; - this.selSpecial.Value = scheme.Special; + //this.selSpecial.Value = scheme.Special; this.selHelpPanelDisplay.Value = scheme.HelpPanelDelay; this.selPermanent.Checked = scheme.Permanant; diff --git a/W4Gui/Components/YesNoComboBox.cs b/W4Gui/Components/YesNoComboBox.cs new file mode 100644 index 0000000..90ad22a --- /dev/null +++ b/W4Gui/Components/YesNoComboBox.cs @@ -0,0 +1,33 @@ +using LibW4M.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace W4Gui.Components +{ + public class YesNoComboBox : ComboBox + { + public YesNoComboBox() + { + this.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.FormattingEnabled = true; + this.Items.AddRange(new object[] { + "No", + "Yes"}); + } + + public YesNo Value + { + get + { + return (YesNo)this.SelectedIndex; + } + set + { + this.SelectedIndex = (int)value; + } + } + } +} diff --git a/W4Gui/W4Gui.csproj.user b/W4Gui/W4Gui.csproj.user index a2b4967..303c2d7 100644 --- a/W4Gui/W4Gui.csproj.user +++ b/W4Gui/W4Gui.csproj.user @@ -109,5 +109,8 @@ UserControl + + Component + \ No newline at end of file