Implement insight level
This commit is contained in:
parent
ca16846f2a
commit
537538a6ca
4 changed files with 22 additions and 9 deletions
|
|
@ -31,9 +31,9 @@ public class BattlePlayerControls : MonoBehaviour
|
||||||
this.monsterDeck = monsterDeck;
|
this.monsterDeck = monsterDeck;
|
||||||
this.playArea = playArea;
|
this.playArea = playArea;
|
||||||
|
|
||||||
this.heroHandControls = new HandControls<HeroCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Bottom);
|
this.heroHandControls = new HandControls<HeroCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Bottom, int.MaxValue);
|
||||||
this.heroHandControls.OnCardClicked += OnHeroCardClicked;
|
this.heroHandControls.OnCardClicked += OnHeroCardClicked;
|
||||||
this.monsterHandControls = new HandControls<MonsterCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Top);
|
this.monsterHandControls = new HandControls<MonsterCard>(this.uiCanvas, this.cardPrefab, HandControlsPosition.Top, 1);
|
||||||
this.monsterHandControls.OnCardClicked += OnMonsterCardClicked;
|
this.monsterHandControls.OnCardClicked += OnMonsterCardClicked;
|
||||||
this.cardsInPlayUIs = new Dictionary<BaseCard, GameObject>();
|
this.cardsInPlayUIs = new Dictionary<BaseCard, GameObject>();
|
||||||
}
|
}
|
||||||
|
|
@ -51,10 +51,6 @@ public class BattlePlayerControls : MonoBehaviour
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetMonsterHand(List<MonsterCard> hand) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnHeroCardClicked(HeroCard card) {
|
private void OnHeroCardClicked(HeroCard card) {
|
||||||
if (this.singleTargeting == null) {
|
if (this.singleTargeting == null) {
|
||||||
if (this.battleController.CanUseHeroCard(card)) {
|
if (this.battleController.CanUseHeroCard(card)) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ public class VampireFangsMCard : MonsterCard
|
||||||
{
|
{
|
||||||
public VampireFangsMCard(BattleParticipant owner)
|
public VampireFangsMCard(BattleParticipant owner)
|
||||||
: base(owner, MCardId.VampireFangs, "VampireFangs", 2, CardType.Attack,
|
: base(owner, MCardId.VampireFangs, "VampireFangs", 2, CardType.Attack,
|
||||||
"Steals 2 HP from target.") {
|
"Steals 2 HP from target. Target: highest HP hero.") {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerator Use(IBattleEffectApplier effectApplier, MonsterViewpoint monsterViewpoint) {
|
public override IEnumerator Use(IBattleEffectApplier effectApplier, MonsterViewpoint monsterViewpoint) {
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,14 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
|
||||||
private HandControlsPosition position;
|
private HandControlsPosition position;
|
||||||
|
|
||||||
private List<GameObject> cardsInHandUIs;
|
private List<GameObject> cardsInHandUIs;
|
||||||
|
private int insightLevel;
|
||||||
|
|
||||||
public HandControls(GameObject uiCanvas, GameObject cardPrefab, HandControlsPosition position) {
|
public HandControls(GameObject uiCanvas, GameObject cardPrefab, HandControlsPosition position,
|
||||||
|
int insightLevel) {
|
||||||
this.uiCanvas = uiCanvas;
|
this.uiCanvas = uiCanvas;
|
||||||
this.cardPrefab = cardPrefab;
|
this.cardPrefab = cardPrefab;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
this.insightLevel = insightLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHand(List<BaseCardT> hand) {
|
public void SetHand(List<BaseCardT> hand) {
|
||||||
|
|
@ -39,7 +42,12 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
|
||||||
GameObject cardUI = GameObject.Instantiate(this.cardPrefab, this.uiCanvas.transform);
|
GameObject cardUI = GameObject.Instantiate(this.cardPrefab, this.uiCanvas.transform);
|
||||||
this.cardsInHandUIs.Add(cardUI);
|
this.cardsInHandUIs.Add(cardUI);
|
||||||
cardUI.transform.position = CalculateHandCardPosition(i, hand.Count);
|
cardUI.transform.position = CalculateHandCardPosition(i, hand.Count);
|
||||||
cardUI.GetComponent<CardUI>().Init(card);
|
CardUI cardUIScript = cardUI.GetComponent<CardUI>();
|
||||||
|
if (i < this.insightLevel) {
|
||||||
|
cardUIScript.Init(card);
|
||||||
|
} else {
|
||||||
|
cardUIScript.InitHidden();
|
||||||
|
}
|
||||||
int cardIndex = i;
|
int cardIndex = i;
|
||||||
cardUI.GetComponent<Button>().onClick.AddListener(delegate {OnCardClicked(card);});
|
cardUI.GetComponent<Button>().onClick.AddListener(delegate {OnCardClicked(card);});
|
||||||
}
|
}
|
||||||
|
|
@ -56,4 +64,6 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
|
||||||
|
|
||||||
return new Vector3(x, y, 0);
|
return new Vector3(x, y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int InsightLevel {get => this.insightLevel; set => this.insightLevel = value;}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,13 @@ public class CardUI : MonoBehaviour
|
||||||
this.effectText.text = card.GetEffectText();
|
this.effectText.text = card.GetEffectText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InitHidden() {
|
||||||
|
this.nameText.text = "????";
|
||||||
|
this.typeText.text = "????";
|
||||||
|
this.costText.text = "????";
|
||||||
|
this.effectText.text = "????";
|
||||||
|
}
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue