Example #1
0
        private void Cancel_Click(object sender, MouseEventArgs e)
        {
            //need to fix cancel button for: footman/archer and all buildings besides townhall (ex: lumber mill, blacksmith, etc...)

            if (this.mode == 1)
            { //building cancel
                cancelBuild();
            }
            else if (this.mode == 5 || this.mode == 4) //attack or patrol mode
            {
                cancelHumanMoveArmy();
            }
            else if (this.mode == 2)                                  //human move button is on both peasant and footman
            {
                unitPtr temp     = gameData.chosenUnits.ElementAt(0); //get the first selected unit
                Unit    unitTemp = allUnits[temp.owner][temp.index];
                if (unitTemp.unitType == gameData.nameTranslation("Peasant"))
                {
                    cancelHumanMove();
                }
                else //army unit
                {
                    cancelHumanMoveArmy();
                }
            }
            else
            { //normal cancel
                inGameButton_Show();
                BuildSimple_Hide();
                builder.buildCancel();
                this.mode = 0;
            }
            focus_form.Focus();
            this.ActiveControl = null;//prevent buttons block the input
        }