public void DrawCardAt(int slot) { if (slot == 0 || Hand.GetCardAtSlot(slot) != null) { return; } var newcard = Deck.Draw(); if (newcard == null) { // play error tone, display empty deck DeselectAll(); return; } Debug.Log($"Drawing card into {slot}"); if (slot == 0) { // play error tone return; } Hand.InsertCardAtSlot(slot, newcard); RedrawAll(); DeselectAll(); }
public void SelectCombineSlot(int slot) { if (SelectedHandSlot == 0 || Combines.GetCardAtSlot(slot) != null) { return; } Debug.Log($"Combine Select ({slot})"); var card = Hand.RemoveCardAtSlot(SelectedHandSlot); Combines.InsertCardAtSlot(slot, card); DeselectAll(); RedrawAll(); }
public void SelectHandSlot(int slot) { Debug.Log($"Hand Select ({slot})"); DeselectAll(); var card = GetHandCard(slot); if (card == null) { DrawCardAt(slot); } else { SelectedHandSlot = slot; EventSystem.SetSelectedGameObject(GetHandDisplay(slot).SelectionButton.gameObject); switch (card.CardType) { case CardType.None: break; case CardType.Gene: Debug.Log("Selecting a gene card from hand"); if (Infuses.Slot2 == null) { InfuseSlot2.EnableSelection(); } if (Combines.GetAllActiveCards().Any(x => x.CardType == CardType.Part)) { break; } if (Combines.Slot1 == null) { CombineSlot1.EnableSelection(); } if (Combines.Slot2 == null) { CombineSlot2.EnableSelection(); } if (Combines.Slot3 == null) { CombineSlot3.EnableSelection(); } break; case CardType.Part: if (Infuses.Slot1 == null) { InfuseSlot1.EnableSelection(); } if (Equips.Slot1 == null) { EquipSlot.EnableSelection(); } //if(Combines.IsEmpty() || !Combines.GetAllActiveCards().Any(x => x.CardType == CardType.Gene)) //{ // var partcard = card as PartCard; // if(partcard.Tier == GeneTier.Alpha || partcard.Tier == GeneTier.Beta || partcard.Tier == GeneTier.Gamma) // { // if (Combines.Slot1 == null) // { // CombineSlot1.EnableSelection(); // } // if (Combines.Slot2 == null) // { // CombineSlot2.EnableSelection(); // } // if (Combines.Slot3 == null) // { // CombineSlot3.EnableSelection(); // } // } //} break; case CardType.Blessing: if (Equips.Slot1 != null) { EquipButton.gameObject.SetActive(true); } if (Combines.Slot1 != null && Combines.Slot2 != null && Combines.Slot3 != null) { //var combines = Combines.GetAllActiveCards().Select(x => x as PartCard); //if (!combines.Any(x => x.CardType == CardType.Part) || // ( // combines.Any(x => x.Tier == GeneTier.Alpha) && combines.Any(x => x.Tier == GeneTier.Beta) && combines.Any(x => x.Tier == GeneTier.Gamma) // ) // ) CombineButton.gameObject.SetActive(true); } if (Infuses.Slot1 != null && Infuses.Slot2 != null) { var oldPart = Infuses.GetCardAtSlot(1) as PartCard; var oldGene = Infuses.GetCardAtSlot(2) as GeneCard; if (oldPart.Tier < oldGene.Tier) { InfuseButton.gameObject.SetActive(true); } } break; default: break; } } //GetHandDisplay(slot).ShowCard(card); }