Exemplo n.º 1
0
        private void SetWinner(ItemsTable itemsTable, int i, int span)
        {
            if (itemsTable.SelectedIndex != -1)
            {
                int   battleId = int.Parse(itemsTable.getSpecificText(itemsTable.SelectedIndex, 0));
                Ruler r        = GetRuler();
                if (null == r)
                {
                    Information.AddError(info.getContent("battleAdminUser_norulerid"));
                    return;
                }

                BattleInfo battleInfo = Universe.instance.GetBattle(battleId);

                if (r.GetBattle(battleId, battleInfo.BattleType) == null)
                {
                    Information.AddError(info.getContent("battleAdminUser_invalidBattleOwner"));
                    return;
                }

                string winner = "";
                if (i == 1)
                {
                    Ruler enemy = Universe.instance.getRuler(battleInfo.GetEnemyBattleInfo(r).OwnerId);
                    battleInfo.ForceEndBattle(enemy);
                    winner = itemsTable.getSpecificText(itemsTable.SelectedIndex, 3);
                }
                else
                {
                    battleInfo.ForceEndBattle(r);
                    winner = itemsTable.getSpecificText(itemsTable.SelectedIndex, 4);
                }

                Information.AddInformation(string.Format(info.getContent("battleAdminUser_setWinnerDone"), battleId, winner));

                UpdateTable(itemsTable, battleId, span);
            }
        }
Exemplo n.º 2
0
 private void giveUp_Click(object sender, EventArgs e)
 {
     bInfo.ForceEndBattle(_ruler);
     Redirect();
 }