public void MakeEventChoice(Choice choice, bool gameOver) { //choices_.transform.DetachChildren (); foreach (ChoiceUI choiceUI in choices_.GetComponentsInChildren <ChoiceUI>()) { if (!choiceUI.IsChoice(choice)) { GameObject.Destroy(choiceUI.gameObject); } } resultUI_.SetActive(true); if (choice.LastChallengeResultString != "") { resultTitle_.gameObject.SetActive(true); resultTitle_.text = choice.LastChallengeResultString; } else { resultTitle_.gameObject.SetActive(false); } Result result = choice.LastResult; resultDesc_.text = result.Desc.Replace("\\n", "\n"); string otherText = ""; string lastString = ""; List <ResultEffect> effects = result.Effects; if (effects != null) { for (int i = 0; i < effects.Count; ++i) { ResultEffect effect = effects [i]; if (lastString != "") { otherText += "\n"; } lastString = effect.ReadableString(); otherText += lastString; } } resultOtherDesc_.text = otherText; GameEventManager.Instance.SetEventCompleted(gameEvent_, choice); gameOver_ = gameOver; }
public override string ToString(Card card, bool capitalize = false) { StringBuilder toStringBuilder = new StringBuilder(); if (capitalize) { toStringBuilder.Append("If "); } else { toStringBuilder.Append("if "); } switch (Target) { case Target.This: toStringBuilder.Append(card.Title); toStringBuilder.Append(" "); break; case Target.None: break; default: throw new InvalidOperationException("Unsupported Target for StateCheckEffect."); } List <string> checkStrings = new List <string>(); foreach (StateCheck check in Checks) { switch (check.State) { case CheckStateType.CouldHaveAttackedThisTurn: if (check.Test) { checkStrings.Add("could have attacked this turn"); } else { checkStrings.Add("couldn't have attacked this turn"); } break; case CheckStateType.SummoningSick: if (check.Test) { checkStrings.Add("didn't start the turn under your control"); } else { checkStrings.Add("started the turn under your control"); } break; case CheckStateType.AttackedThisTurn: if (check.Test) { checkStrings.Add("attacked this turn"); } else { checkStrings.Add("didn't attack this turn"); } break; case CheckStateType.YourTurn: if (check.Test) { checkStrings.Add("it's your turn"); } else { checkStrings.Add("it's not your turn"); } break; default: throw new InvalidOperationException("Unsupported StateCheck for StateCheckEffect."); } } toStringBuilder.Append(string.Join(" and ", checkStrings)); toStringBuilder.Append(", "); toStringBuilder.Append(ResultEffect.ToString(card, false)); if (AlternateEffect != null) { toStringBuilder.Append(", otherwise "); toStringBuilder.Append(AlternateEffect.ToString(card, false)); } return(toStringBuilder.ToString()); }