Пример #1
0
        private void submit_Click(object sender, ImageClickEventArgs e)
        {
            string fleetName = _itemsTable.getSpecificText(_itemsTable.SelectedIndex, 0);

            Chronos.Core.Fleet fleet = _ruler.getFleet(fleetName);
            if (fleet == null)
            {
                throw new AlnitakException("Fleet é null no evento de Click @ ReadyForBattle::toBattle_Click");
            }

            Chronos.Core.Planet currentPlanet = Universe.instance.getPlanet(fleet.Coordinate);
            if (currentPlanet == null)
            {
                throw new AlnitakException("O planeta é null no evento de Click @ ReadyForBattle::toBattle_Click");
            }

            Ruler enemy = currentPlanet.Owner as Ruler;

            if (enemy == null)
            {
                throw new AlnitakException("O planeta onde a fleet " + fleetName + " está não tem dono");
            }

            if (!currentPlanet.IsInBattle)
            {
                Universe.instance.CreateBattle(_ruler, fleet, enemy, currentPlanet, BattleType.BATTLE, "totalannihilation");
                updateTable();
            }
        }
Пример #2
0
        /// <summary>
        /// actualiza a tabela depois de um click
        /// </summary>
        private void updateTable()
        {
            string name = _itemsTable.getSpecificText(_itemsTable.SelectedIndex, 0);

            IEnumerator iter = _itemsTable.Controls.GetEnumerator();

            while (iter.MoveNext())
            {
                ItemsTableLine line = (ItemsTableLine)iter.Current;
                string         str  = ((ItemsTableItem)line.Controls[0]).Item;
                if (str == name)
                {
                    _itemsTable.removeLine(line);
                    iter = _itemsTable.Controls.GetEnumerator();
                }
            }

            if (_itemsTable.Count == 0)
            {
                noResults();
            }
        }
Пример #3
0
        /// <summary>
        /// actualiza a tabela depois de um click
        /// </summary>
        private void updateTable()
        {
            string fleetName = itemsTable.getSpecificText(itemsTable.SelectedIndex, 0);

            IEnumerator iter = itemsTable.Controls.GetEnumerator();

            while (iter.MoveNext())
            {
                ItemsTableLine line = (ItemsTableLine)iter.Current;
                string         str  = ((ItemsTableItem)line.Controls[0]).Item;
                if (str == fleetName)
                {
                    itemsTable.removeLine(line);
                    iter = itemsTable.Controls.GetEnumerator();
                }
            }

            if (itemsTable.Count == 0)
            {
                addLine(info.getContent("fleet_noFleetsToMove"), 3);
                travel.Visible = false;
            }
        }