void _CardSystem_RequestUnitSelection(CardData c, int numSelection, Player p, CardAction action, EndCardAction done) { // assume P is going to be the current player UnitSelection flags = UnitSelection.None; if (c.Type == CardType.Healing_Card) { flags = flags | UnitSelection.Inactive; } if (c.Type == CardType.Upgrade_Card) { flags = flags | UnitSelection.Active; flags = flags | UnitSelection.NotUpgraded; } if (c.Type == CardType.Tactic_Card) { flags = flags | UnitSelection.Active; flags = flags | UnitSelection.NotTempUpgraded; } _OverworldUI.ShowUnitSelectionUI(flags); int selectedUnits = 0; UIPlayerUnitTypeIndexCallback selectUnit = null; selectUnit = (PlayerType pt, UnitType u, int i) => { Unit unit = _GameStateHolder._ActivePlayer.PlayerArmy.GetUnits(u)[i]; selectedUnits++; // perform the action each time something is selected. This will only effect healing. // we don't want the player to be stuck with no units to select action(c, p, unit); // we reached the total? if (selectedUnits == numSelection) { // don't listen for namy more and hide the UI _OverworldUI._ArmyUI.OnClickUnit -= selectUnit; _OverworldUI.HideUnitSelectionUI(); done(true, c, p, unit); } }; _OverworldUI._ArmyUI.OnClickUnit += selectUnit; }
void _CardSystem_RequestUnitSelection(CardData c, int numSelection, Player p, CardAction action, EndCardAction done) { // assume P is going to be the current player UnitSelection flags = UnitSelection.None; if (c.Type == CardType.Healing_Card) { flags = flags | UnitSelection.Inactive; } if (c.Type == CardType.Upgrade_Card) { flags = flags | UnitSelection.Active; flags = flags | UnitSelection.NotUpgraded; } if (c.Type == CardType.Tactic_Card) { flags = flags | UnitSelection.Active; flags = flags | UnitSelection.NotTempUpgraded; } _BattleUnitPositionManager.ShowUnitSelectionUI(flags); int selectedUnits = 0; UIPlayerUnitTypeIndexCallback selectUnit = null; selectUnit = (PlayerType pt, UnitType u, int i) => { Unit unit = _GameStateHolder._ActivePlayer.PlayerArmy.GetUnits(u)[i]; selectedUnits++; // perform the action each time something is selected. This will only effect healing. // we don't want the player to be stuck with no units to select action(c, p, unit); // we reached the total? if (selectedUnits == numSelection) { // don't listen for namy more and hide the UI _BattleUnitPositionManager._ArmyUI.OnClickUnit -= selectUnit; _BattleUnitPositionManager.HideUnitSelectionUI(); done(true, c, p, unit); } }; _BattleUnitPositionManager._ArmyUI.OnClickUnit += selectUnit; }
void _CardSystem_RequestBattle(CardData card, EndCardAction done) { BuildingType currentTile = _GameStateHolder._ActivePlayer.CommanderPosition.Building; BuildingType [] battleTiles = { BuildingType.Camp, BuildingType.Cave, BuildingType.Fortress }; if (Array.IndexOf(battleTiles, currentTile) == -1) { done(false, card, _GameStateHolder._ActivePlayer, null); return; } done(true, card, _GameStateHolder._ActivePlayer, null); startBattle (BattleType.Card); if (Debug.isDebugBuild) Debug.Log ("Battle card has started battle"); }