public void CardPlaced(UICard inPlacedCard, CardZoneType PlacedZone) { PlayingCard PlacedCard = (PlayingCard)inPlacedCard; if (!SecondSelect) { SendAction(new ActionOrder(new PlaceCard_Action(PlacedCard.GetEntity(), PlacedZone), null, null)); } UpdateUI(); if ((PlacedCard).IsPlaced() && PlacedCard.GetEntity().PAHolder.HasAction()) { StartPlacedAction(PlacedCard); } }
private void TestActionConditions() { ActionInfo CurrentActionInfo = CurrentPossibleActions[CurrentActionIndex]; if (SecondSelect) { int NumSel; NumSel = Selection.Count; if (NumSel <= CurrentActionInfo.Max && NumSel >= CurrentActionInfo.Min) { List <Entities.Entity> selectedEntities = new List <Entities.Entity>(); foreach (PlayingCard C in Selection) { selectedEntities.Add(C.GetEntity()); } if (CurrentActionInfo.mAction.CheckValidity(ActiveCard.GetEntity(), selectedEntities, TheTurnInformation)) { ActionButton.interactable = true; } else { ActionButton.interactable = false; } } else { ActionButton.interactable = false; } } else { if (CurrentPossibleActions[CurrentActionIndex].mAction.IsAvailable(Selection[0].GetEntity())) { ActionButton.interactable = true; } else { ActionButton.interactable = false; } } }
public void StartPlacedAction(PlayingCard PlacedCard) { if (PlacedCard.GetEntity().PAHolder.GetAction().Max == 0) { SendAction(new ActionOrder(PlacedCard.GetEntity().PAHolder.GetAction().mAction, PlacedCard.GetEntity(), new List <Entities.Entity>())); ResetActions(); ResetSelections(); UpdateUI(); } else { ResetActions(); ResetSelections(); PlacedCard.ToggleSelect(false); ActiveCard = PlacedCard; CurrentPossibleActions = new List <ActionInfo>(); CurrentPossibleActions.Add(PlacedCard.GetEntity().PAHolder.GetAction()); CurrentActionIndex = 0; ActionButton.GetComponentInChildren <Text>().text = CurrentPossibleActions[CurrentActionIndex].ActionName; StartSecondarySelect(); } }
private void SetActive(PlayingCard ActiveCard) { this.ActiveCard = ActiveCard; CurrentPossibleActions = ActiveCard.GetEntity().GetActions(); CurrentActionIndex = 0; if (CurrentPossibleActions.Count > 0) { ActionButton.GetComponentInChildren <Text>().text = CurrentPossibleActions[CurrentActionIndex].ActionName; TestActionConditions(); } if (CurrentPossibleActions.Count > 1) { CycleButton.interactable = true; } }
public void CardSelected(PlayingCard SelectedCard) { if (((PlayingCard)SelectedCard).IsPlaced() || TheTurnInformation.IsMulligan) { if (SecondSelect) { if (CurrentPossibleActions[CurrentActionIndex].SelectType == PlayerType.Ally && SelectedCard.GetEntity().GetOwnerIndex() != TheTurnInformation.GetCPI()) { return; } if (CurrentPossibleActions[CurrentActionIndex].SelectType == PlayerType.Enemy && SelectedCard.GetEntity().GetOwnerIndex() == TheTurnInformation.GetCPI()) { return; } if (SelectedCard == ActiveCard) { return; } if (SelectedCard.ToggleSelect(false)) { Selection.Add(SelectedCard); } else { Selection.Remove(SelectedCard); } TestActionConditions(); return; } if (SelectedCard.GetEntity().GetOwnerIndex() == TheTurnInformation.GetCPI()) { if (SelectedCard.ToggleSelect(false)) { Selection.Add(SelectedCard); } else { Selection.Remove(SelectedCard); } if (Selection.Count == 1) { if (TheTurnInformation.IsMulligan) { ActiveCard = Selection[0]; CurrentPossibleActions = mMulliganAction; CurrentActionIndex = 0; ActionButton.GetComponentInChildren <Text>().text = "Mulligan"; TestActionConditions(); } else { SetActive(Selection[0]); } } else { ResetActions(); } } } }