Example #1
0
    void DefendingUnitSelection(Player p, ModalPanel mp, UnityAction onDone)
    {
        //Only allow active units

        UnitSelection flags = UnitSelection.Active;

        flags = flags | UnitSelection.NotDefending;

        _OverworldUI.ShowUnitSelectionUI(flags);

        UIPlayerUnitTypeIndexCallback selectUnit = null;
        selectUnit = (PlayerType PlayerType, UnitType ut, int i) => {
            Unit unit = p.PlayerArmy.GetUnits(ut)[i];
            TileData tile = p.CommanderPosition;
            mp.ShowOKCancel("Confirm unit selection", "Leave behind " + unit.Type.ToString() + "?",
                () => SetupDefendedTile(unit, p, tile, onDone, selectUnit),
                () => DefendingUnitSelection(p, mp, onDone));
        };
        _OverworldUI._ArmyUI.OnClickUnit += selectUnit;
    }
Example #2
0
 void PromptForReturnPrisoner(Player p, Unit u, TileData t, ModalPanel mp, UnityAction onDone)
 {
     mp.ShowOKCancel("Unit reclaimed", "Should the unit go back to defending this tile?",
         () => {
             t.SetDefender(u);
             u.SetPosition(t);
             u.SetDefending(true);
             _Board.SetTileDefence(t);
             onDone();
         },
         () => StartCoroutine(PromptForDefendingUnit("Should another unit defend instead?", p, mp, onDone)));
 }
Example #3
0
 IEnumerator PromptToReplaceDefendingUnit(Player p, Unit u, ModalPanel mp, UnityAction onDone)
 {
     yield return new WaitForSeconds (0.5f);
     mp.ShowOKCancel("Replace defending unit", "This tile is currently defended by " + u.Type.ToString() + ". Would you like to send another unit in it's place?",
         () => RemoveDefendingUnit(p, u, () => DefendingUnitSelection(p, mp, onDone)),
         () => RemoveDefendingUnit(p, u, onDone));
 }
Example #4
0
 IEnumerator PromptForDefendingUnit(string promptString, Player p, ModalPanel mp, UnityAction onDone)
 {
     yield return new WaitForSeconds(0.5f);
     mp.ShowOKCancel ("Tile Defence", promptString, () =>
         DefendingUnitSelection(_GameStateHolder._ActivePlayer, mp, onDone),
         endTurn);
 }