Show playable cards in enemy hand
This commit is contained in:
parent
d513657396
commit
b654419966
5 changed files with 22 additions and 7 deletions
|
|
@ -136,7 +136,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
||||||
|
|
||||||
this.battlePlayerControls.Init(
|
this.battlePlayerControls.Init(
|
||||||
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
|
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
|
||||||
this.heroHandPlayability, this.uiCanvas.transform.localScale.x);
|
this.heroHandPlayability, this.monsterHandPlayability,
|
||||||
|
this.uiCanvas.transform.localScale.x);
|
||||||
this.insightLevel.OnChanged += this.battlePlayerControls.NotifyInsightLevelChanged;
|
this.insightLevel.OnChanged += this.battlePlayerControls.NotifyInsightLevelChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,9 +156,13 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
||||||
{
|
{
|
||||||
StartCoroutine(RunBattleRounds());
|
StartCoroutine(RunBattleRounds());
|
||||||
|
|
||||||
new GameObject("CheatBattle").AddComponent<CheatBattle>().OnWinCode += delegate {
|
CheatBattle cheat = new GameObject("CheatBattle").AddComponent<CheatBattle>();
|
||||||
|
cheat.OnWinCode += delegate {
|
||||||
BattleResult.FinishBattle(new BattleResult(true));
|
BattleResult.FinishBattle(new BattleResult(true));
|
||||||
};
|
};
|
||||||
|
cheat.OnInsightCode += delegate {
|
||||||
|
this.insightLevel.Modify(+5);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ public class BattlePlayerControls : MonoBehaviour
|
||||||
|
|
||||||
public void Init(
|
public void Init(
|
||||||
BattleDeck<HeroCard> heroDeck, BattleDeck<MonsterCard> monsterDeck, PlayArea playArea,
|
BattleDeck<HeroCard> heroDeck, BattleDeck<MonsterCard> monsterDeck, PlayArea playArea,
|
||||||
InsightLevel insightLevel, HandPlayability<HeroCard> heroHandPlayability, float scale) {
|
InsightLevel insightLevel, HandPlayability<HeroCard> heroHandPlayability,
|
||||||
|
HandPlayability<MonsterCard> monsterHandPlayability, float scale) {
|
||||||
this.heroDeck = heroDeck;
|
this.heroDeck = heroDeck;
|
||||||
this.monsterDeck = monsterDeck;
|
this.monsterDeck = monsterDeck;
|
||||||
this.playArea = playArea;
|
this.playArea = playArea;
|
||||||
|
|
@ -38,7 +39,7 @@ public class BattlePlayerControls : MonoBehaviour
|
||||||
this.heroHandControls.OnCardClicked += OnHeroCardClicked;
|
this.heroHandControls.OnCardClicked += OnHeroCardClicked;
|
||||||
this.monsterHandControls = new HandControls<MonsterCard>(
|
this.monsterHandControls = new HandControls<MonsterCard>(
|
||||||
monsterDeck, this.uiCanvas, this.cardPrefab, HandControlsPosition.Top,
|
monsterDeck, this.uiCanvas, this.cardPrefab, HandControlsPosition.Top,
|
||||||
TeamChoice.Monsters, 1, null, this.scale);
|
TeamChoice.Monsters, 1, monsterHandPlayability, this.scale);
|
||||||
this.monsterHandControls.OnCardClicked += OnMonsterCardClicked;
|
this.monsterHandControls.OnCardClicked += OnMonsterCardClicked;
|
||||||
this.cardsInPlayUIs = new Dictionary<BaseCard, GameObject>();
|
this.cardsInPlayUIs = new Dictionary<BaseCard, GameObject>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ public class CheatBattle: MonoBehaviour
|
||||||
|
|
||||||
public delegate void CheatAction();
|
public delegate void CheatAction();
|
||||||
public event CheatAction OnWinCode;
|
public event CheatAction OnWinCode;
|
||||||
|
public event CheatAction OnInsightCode;
|
||||||
|
|
||||||
private string lastCommands = "";
|
private string lastCommands = "";
|
||||||
|
|
||||||
|
|
@ -89,6 +90,8 @@ public class CheatBattle: MonoBehaviour
|
||||||
|
|
||||||
if (this.lastCommands.EndsWith("win")) {
|
if (this.lastCommands.EndsWith("win")) {
|
||||||
this.OnWinCode();
|
this.OnWinCode();
|
||||||
|
} else if (this.lastCommands.EndsWith("insight")) {
|
||||||
|
this.OnInsightCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
|
||||||
get => this.insightLevel;
|
get => this.insightLevel;
|
||||||
set {
|
set {
|
||||||
this.insightLevel = value;
|
this.insightLevel = value;
|
||||||
RenderHand();
|
UpdateState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@ public class CardUI : MonoBehaviour
|
||||||
public Image artImage;
|
public Image artImage;
|
||||||
public Text effectText;
|
public Text effectText;
|
||||||
|
|
||||||
|
private bool hidden;
|
||||||
|
|
||||||
public void Init(BaseCard card) {
|
public void Init(BaseCard card) {
|
||||||
|
this.hidden = false;
|
||||||
this.nameText.text = card.GetDisplayName();
|
this.nameText.text = card.GetDisplayName();
|
||||||
this.typeText.text = card.GetDisplayType();
|
this.typeText.text = card.GetDisplayType();
|
||||||
if (card.Type != CardType.Emotion) {
|
if (card.Type != CardType.Emotion) {
|
||||||
|
|
@ -25,6 +28,7 @@ public class CardUI : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitHidden() {
|
public void InitHidden() {
|
||||||
|
this.hidden = true;
|
||||||
Color BROWN = new Color(0.14f, 0.09f, 0.04f);
|
Color BROWN = new Color(0.14f, 0.09f, 0.04f);
|
||||||
this.nameText.text = "????";
|
this.nameText.text = "????";
|
||||||
this.typeText.text = "????";
|
this.typeText.text = "????";
|
||||||
|
|
@ -53,8 +57,10 @@ public class CardUI : MonoBehaviour
|
||||||
|
|
||||||
public bool Playable {
|
public bool Playable {
|
||||||
set {
|
set {
|
||||||
|
if (!this.hidden) {
|
||||||
this.GetComponent<Image>().color = value ? Color.white : Color.grey;
|
this.GetComponent<Image>().color = value ? Color.white : Color.grey;
|
||||||
this.artImage.color = value ? Color.white : Color.grey;
|
this.artImage.color = value ? Color.white : Color.grey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue