public static void InitValues(this PlayCardChoice playCardChoice, string _eventText, string[] eventValues, string _nextCard) { playCardChoice.Score = new FeatureVector(); playCardChoice.Text = _eventText; int nextCard; if (int.TryParse(_nextCard, out nextCard)) { playCardChoice.NextCardID = int.Parse(_nextCard); } else { playCardChoice.NextCardID = -1; } for (int i = 0; i < 20; i++) { int scoreValue; if (!int.TryParse(eventValues[i], out scoreValue)) { if (string.IsNullOrWhiteSpace(eventValues[i])) { scoreValue = 0; } else { Debug.LogWarning("Could not parse the value"); } } playCardChoice.Score[i] = scoreValue; } }
/// <summary> /// Handle swipe event for card choices /// </summary> /// <param name="direction"></param> public void SwipeEvent(Swipe.HoldDirection direction) { PlayCardChoice playCardChoice = CardManager.Instance.GetCard(GameManager.Instance.GetCurrentCardIndex()).GetSwipeEvents()[randomSwipeDir[(int)direction]]; PlayerManager.Instance.ChangeStats(playCardChoice.Score); GUIManager.Instance.RunSwipeAnimation((int)direction); PlayerManager.Instance.SavePlayerStats(); }
/// <summary> /// Check if you have earned a new badge, if so, inject a badge event card, show video, etc /// </summary> public void CheckForEarnedBadge(int direction) { print("Checking for badge"); // Check card specific requirements PlayCardChoice playCardChoice = CardManager.Instance.GetCard(GameManager.Instance.GetCurrentCardIndex()).GetSwipeEvents()[randomSwipeDir[(int)direction]]; int badgeCardID = playCardChoice.BadgeId; if (CardManager.Instance.GetBadgeCardList() != null && badgeCardID > 0) { foreach (BadgeCard badgeCard in CardManager.Instance.GetBadgeCardList()) { print("This badge ID: " + badgeCardID + " this card's ID: " + badgeCard.BadgeCardId); // Check draw specific requirements if (badgeCardID == badgeCard.BadgeCardId) { print("Hi, found a match, BadgeID: " + badgeCardID); AddBadge(badgeCardID); } } } }
/// <summary> /// Check if the last choice made specified a specific card ID to jump to /// </summary> public bool CheckForNextCard(int direction) { PlayCardChoice playCardChoice = CardManager.Instance.GetCurrentActiveCard().GetSwipeEvents()[randomSwipeDir[(int)direction]]; print("The current card is: " + CardManager.Instance.GetCurrentActiveCard().CardID); if (playCardChoice.NextCardID > 0) { print("The Followup card to the choice made is " + playCardChoice.NextCardID); //List<PlayCard> playCardList = CardManager.Instance.GetPlayCardList(); List <PlayCard> substoryCardList = CardManager.Instance.GetSubstoryCardList(); if (substoryCardList != null) { for (int i = 0; i < substoryCardList.Count; i++) { if (substoryCardList[i].CardID == playCardChoice.NextCardID) { GameManager.Instance.DrawSpecificSubstoryCard(substoryCardList[i].CardID); return(true); } } } // TODO: Checking normal card stack as well for now List <PlayCard> playCardList = CardManager.Instance.GetPlayCardList(); for (int i = 0; i < playCardList.Count; i++) { if (playCardList[i].CardID == playCardChoice.NextCardID) { GameManager.Instance.DrawSpecificCard(playCardList[i].CardID); return(true); } } print("Couldn't find card id " + playCardChoice.NextCardID + " in the substory card list."); } return(false); }