Пример #1
0
        private void checkBox_CheckedChange(object sender)
        {
            FlatCheckBox fcb = sender as FlatCheckBox;

            bot.cfgData[fcb.Tag.ToString().Split(':')[0]][fcb.Tag.ToString().Split(':')[1]] = fcb.Checked.ToString();
            bot.SaveConfig();
        }
Пример #2
0
        private void flatCheckBoxAttackSide_CheckedChanged(object sender)
        {
            FlatCheckBox fcb = sender as FlatCheckBox;

            if (!flatCheckBox_attackTopLeft.Checked && !flatCheckBox_attackTopRight.Checked &&
                !flatCheckBox_attackBottomLeft.Checked && !flatCheckBox_attackBottomRight.Checked)
            {
                fcb.Checked = true;
                MessageBox.Show("You need to select at least one side to attack !");
            }

            bot.cfgData["attack"][fcb.Tag.ToString()] = fcb.Checked.ToString();
            bot.SaveConfig();
        }
Пример #3
0
 public static void Load(FlatComboBox comboBoxBarrack1, FlatComboBox comboBoxBarrack2, 
     FlatComboBox comboBoxBarrack3, FlatComboBox comboBoxBarrack4,
     FlatTextBox textboxGold, FlatTextBox textboxElixir,
     FlatTextBox textboxDark, FlatTextBox textboxTrophy,
     FlatCheckBox checkboxGold, FlatCheckBox checkboxElixir,
     FlatCheckBox checkboxDark, FlatCheckBox checkboxTrophy,
     FlatCheckBox checkboxAlert, FlatComboBox comboBoxAttackSides,
     FlatCheckBox checkboxMaxTrophy, FlatTextBox textboxMaxTrophy,
     FlatComboBox comboBoxAttackMode, FlatNumeric numericDeployTime)
 {
     FileIniDataParser parser = new FileIniDataParser();
     IniData data = parser.ReadFile("config.ini");
     int intBarrack1 = Convert.ToInt32(data["troops"]["barrack1"]);
     int intBarrack2 = Convert.ToInt32(data["troops"]["barrack2"]);
     int intBarrack3 = Convert.ToInt32(data["troops"]["barrack3"]);
     int intBarrack4 = Convert.ToInt32(data["troops"]["barrack4"]);
     Action action1 = () => comboBoxBarrack1.SelectedIndex = intBarrack1;
     comboBoxBarrack1.Invoke(action1);
     Action action2 = () => comboBoxBarrack2.SelectedIndex = intBarrack2;
     comboBoxBarrack2.Invoke(action2);
     Action action3 = () => comboBoxBarrack3.SelectedIndex = intBarrack3;
     comboBoxBarrack3.Invoke(action3);
     Action action4 = () => comboBoxBarrack4.SelectedIndex = intBarrack4;
     comboBoxBarrack4.Invoke(action4);
     int gold = Convert.ToInt32(data["search"]["gold"]);
     int elixir = Convert.ToInt32(data["search"]["elixir"]);
     int dark = Convert.ToInt32(data["search"]["dark"]);
     int trophy = Convert.ToInt32(data["search"]["trophy"]);
     Action action5 = () => textboxGold.Text = gold.ToString();
     textboxGold.Invoke(action5);
     Action action6 = () => textboxElixir.Text = elixir.ToString();
     textboxElixir.Invoke(action6);
     Action action7 = () => textboxDark.Text = dark.ToString();
     textboxDark.Invoke(action7);
     Action action8 = () => textboxTrophy.Text = trophy.ToString();
     textboxTrophy.Invoke(action8);
     bool bgold = Convert.ToBoolean(data["search"]["bgold"]);
     bool belixir = Convert.ToBoolean(data["search"]["belixir"]);
     bool bdark = Convert.ToBoolean(data["search"]["bdark"]);
     bool btrophy = Convert.ToBoolean(data["search"]["btrophy"]);
     bool alert = Convert.ToBoolean(data["search"]["alert"]);
     Action action9 = () => checkboxGold.Checked = bgold;
     checkboxGold.Invoke(action9);
     Action action10 = () => checkboxElixir.Checked = belixir;
     checkboxElixir.Invoke(action10);
     Action action11 = () => checkboxDark.Checked = bdark;
     checkboxDark.Invoke(action11);
     Action action12 = () => checkboxTrophy.Checked = btrophy;
     checkboxTrophy.Invoke(action12);
     Action action13 = () => checkboxAlert.Checked = alert;
     checkboxAlert.Invoke(action13);
     int attackSides = Convert.ToInt32(data["attack"]["sides"]);
     Action action14 = () => comboBoxAttackSides.SelectedIndex = attackSides;
     comboBoxAttackSides.Invoke(action14);
     bool bmaxtrophy = Convert.ToBoolean(data["attack"]["bmaxtrophy"]);
     int maxtrophy = Convert.ToInt32(data["attack"]["maxtrophy"]);
     Action action15 = () => checkboxMaxTrophy.Checked = bmaxtrophy;
     checkboxMaxTrophy.Invoke(action15);
     Action action16 = () => textboxMaxTrophy.Text = maxtrophy.ToString();
     textboxMaxTrophy.Invoke(action16);
     int attackMode = Convert.ToInt32(data["attack"]["mode"]);
     Action action17 = () => comboBoxAttackMode.SelectedIndex = attackMode;
     comboBoxAttackMode.Invoke(action17);
     int deployTime = Convert.ToInt32(data["attack"]["deploytime"]);
     Action action18 = () => numericDeployTime.Value = deployTime;
     numericDeployTime.Invoke(action18);
 }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cb"></param>
 /// <param name="value"></param>
 public static void setCheckBox(FlatCheckBox cb, bool value)
 {
     cb         = (FlatCheckBox)getControl(cb);
     cb.Checked = value;
 }
Пример #5
0
        private void InitializeCatalog()
        {
            Action ShipTypeInitializer = null;

            ShipTypeInitializer = () =>
            {
                if (layoutShipTypeList.InvokeRequired)
                {
                    layoutShipTypeList.Invoke(ShipTypeInitializer);
                    return;
                }

                ShipTypeCheckeds.Clear();
                layoutShipTypeList.Controls.Clear();
                foreach (var type in DataStorage.Instance.Master.ShipTypes)
                {
                    var chkCheck = new FlatCheckBox();
                    chkCheck.Text            = type.Value.Name;
                    chkCheck.Checked         = true;
                    chkCheck.AutoSize        = true;
                    chkCheck.CheckedChanged += (s, e) => ShipTypeUpdate(false);

                    layoutShipTypeList.Controls.Add(chkCheck);
                    ShipTypeCheckeds.Add(type.Value.Id, chkCheck);
                }
            };

            ShipTypeInitializer();
            chkShipTypeAll.CheckedChanged += (s, e) => ShipTypeUpdate(true);

            this.SuspendLayout();
            BuildShipTypePreset("구축함", new int[] { 2 });
            BuildShipTypePreset("경순・뇌순", new int[] { 3, 4 });
            BuildShipTypePreset("중순・항순", new int[] { 5, 6 });
            BuildShipTypePreset("전함", new int[] { 8, 9, 10, 12 });
            BuildShipTypePreset("항전・항순", new int[] { 6, 10 });
            BuildShipTypePreset("항공모함", new int[] { 7, 11, 18 });
            BuildShipTypePreset("잠수함", new int[] { 13, 14 });
            this.ResumeLayout();

            #region Level
            #region KeyPress Processing
            this.textLevelFrom.KeyPress += (s, e) =>
            {
                int isNumber = 0;
                e.Handled = !int.TryParse(e.KeyChar.ToString(), out isNumber);
            };
            this.textLevelTo.KeyPress += (s, e) =>
            {
                int isNumber = 0;
                e.Handled = !int.TryParse(e.KeyChar.ToString(), out isNumber);
            };
            #endregion

            #region Value Processing
            this.textLevelFrom.TextChanged += (s, e) =>
            {
                int value = 2;
                int.TryParse(this.textLevelFrom.Text, out value);
                shipListTable.LevelFrom = value;
            };
            this.textLevelTo.TextChanged += (s, e) =>
            {
                int value = 155;
                int.TryParse(this.textLevelTo.Text, out value);
                shipListTable.LevelTo = value;
            };
            #endregion

            #region Button Processing
            this.btnLevelAll.Click += (s, e) =>
            {
                this.textLevelFrom.Text = "1";
                this.textLevelTo.Text   = "155";
            };
            this.btnLevel1.Click += (s, e) =>
            {
                this.textLevelFrom.Text = "1";
                this.textLevelTo.Text   = "1";
            };
            this.btnLevelAbove2.Click += (s, e) =>
            {
                this.textLevelFrom.Text = "2";
                this.textLevelTo.Text   = "155";
            };
            #endregion
            #endregion

            #region Lock
            this.radioLockAll.CheckedChanged += (s, e) =>
            {
                if (radioLockAll.Checked)
                {
                    shipListTable.LockFilter = ShipListTable.FilterValues.Both;
                }
            };
            this.radioLockYes.CheckedChanged += (s, e) =>
            {
                if (radioLockYes.Checked)
                {
                    shipListTable.LockFilter = ShipListTable.FilterValues.Yes;
                }
            };
            this.radioLockNo.CheckedChanged += (s, e) =>
            {
                if (radioLockNo.Checked)
                {
                    shipListTable.LockFilter = ShipListTable.FilterValues.No;
                }
            };
            #endregion

            this.chkExceptExpedition.CheckedChanged += (s, e) =>
                                                       shipListTable.ExceptExpedition = this.chkExceptExpedition.Checked;

            #region Speed
            this.chkSpeedSuperfast.CheckedChanged += (s, e) =>
            {
                if (chkSpeedSuperfast.Checked)
                {
                    shipListTable.SpeedFilter |= ShipListTable.FilterValues.SuperFast;
                }
                else
                {
                    shipListTable.SpeedFilter &= ~ShipListTable.FilterValues.SuperFast;
                }
            };
            this.chkSpeedFastPlus.CheckedChanged += (s, e) =>
            {
                if (chkSpeedFastPlus.Checked)
                {
                    shipListTable.SpeedFilter = ShipListTable.FilterValues.FastPlus;
                }
                else
                {
                    shipListTable.SpeedFilter &= ~ShipListTable.FilterValues.FastPlus;
                }
            };
            this.chkSpeedFast.CheckedChanged += (s, e) =>
            {
                if (chkSpeedFast.Checked)
                {
                    shipListTable.SpeedFilter = ShipListTable.FilterValues.Fast;
                }
                else
                {
                    shipListTable.SpeedFilter &= ~ShipListTable.FilterValues.Fast;
                }
            };
            this.chkSpeedSlow.CheckedChanged += (s, e) =>
            {
                if (chkSpeedSlow.Checked)
                {
                    shipListTable.SpeedFilter = ShipListTable.FilterValues.Slow;
                }
                else
                {
                    shipListTable.SpeedFilter &= ~ShipListTable.FilterValues.Slow;
                }
            };
            #endregion

            #region Powerup
            this.radioPowerUpAll.CheckedChanged += (s, e) =>
            {
                if (radioPowerUpAll.Checked)
                {
                    shipListTable.PowerupFilter = ShipListTable.FilterValues.Both;
                }
            };
            this.radioPowerUpEnd.CheckedChanged += (s, e) =>
            {
                if (radioPowerUpEnd.Checked)
                {
                    shipListTable.PowerupFilter = ShipListTable.FilterValues.End;
                }
            };
            this.radioPowerUpNotEnd.CheckedChanged += (s, e) =>
            {
                if (radioPowerUpNotEnd.Checked)
                {
                    shipListTable.PowerupFilter = ShipListTable.FilterValues.NotEnd;
                }
            };
            #endregion

            this.shipListTable.LevelFrom        = 2;
            this.shipListTable.LevelTo          = 155;
            this.shipListTable.LockFilter       = ShipListTable.FilterValues.Both;
            this.shipListTable.ExceptExpedition = false;
            this.shipListTable.SpeedFilter      = ShipListTable.FilterValues.Both;
            this.shipListTable.PowerupFilter    = ShipListTable.FilterValues.Both;
        }
Пример #6
0
 public FlatCheckBoxBinding(FlatCheckBox target) : base(target)
 {
     target.CheckValueChanged += HandleSelectedChanged;
 }