IEnumerator ShowMyBoards() { yield return(null); State.gameBoardCategory = GameBoardCategory.mine; State.gameBoardMine = true; State.gameSource = GameSource.remote; State.gameActivity = GameActivity.play; ActorGameManager.ShowGroup(pageUpButton, false); ActorGameManager.ShowGroup(pageDownButton, false); Database.GetMyBoards(); }
public void UndoTurn() { // only charge gems when in normal play mode (not when in edit or test) if (Identity.GetGems() < 1 && State.gameActivity == GameActivity.play) { ActorGameManager.ShowGroup(getHintPanel, true); } else { ActorGameManager.UndoTurn(); } }
public void GrantCredits(int credits) { Debug.Log(string.Format("ProcessPurchase: PASS. Gems: '{0}'", credits)); int currentGems = Identity.GetGems(); screen.SetGemCountDisplay(currentGems + credits); Identity.AddGems(credits); StoreResultText.text = "You successfully purchased " + credits.ToString() + " Gems!"; ActorGameManager.ShowGroup(StoreResultPanelName, true); }
IEnumerator ShowPopularBoards() { yield return(null); State.gameBoardCategory = GameBoardCategory.popular; State.gameBoardMine = false; State.gameSource = GameSource.remote; State.gameActivity = GameActivity.play; ActorGameManager.ShowGroup(pageUpButton, true); ActorGameManager.ShowGroup(pageDownButton, true); Database.GetPopularBoards(true); }
IEnumerator ShowBeginnerBoards() { yield return(null); Debug.LogWarning("Showing Story Boards for BoardList"); State.gameBoardCategory = GameBoardCategory.campaign; State.gameBoardMine = false; State.gameSource = GameSource.local; State.gameActivity = GameActivity.play; ActorGameManager.ShowGroup(pageUpButton, false); ActorGameManager.ShowGroup(pageDownButton, false); Database.GetLocalBoards(); }
void Update() { if (State.gameState == GameState.boardList) { // the board list has been returned // so the board buttons can be built now // set the state back to boards to prevent re-building State.gameState = GameState.boards; Debug.LogWarning("Boardlist returned, building board buttons..."); ActorGameManager.ShowGroup(yardButtonsPanelTag, State.gameSource == GameSource.remote); StartCoroutine("BuildBoardButtons", State.gameBoardList); } }
public void PlantSeed() { if (State.gameState == GameState.win || State.gameState == GameState.loss) { return; } ColorID seedColorID = ActorGameManager.currentPlayerColorID; if (seedColorID == ColorID.white) { // erasing if (hexagonColor == ColorID.white) { return; } SetColor(6, seedColorID); if (State.gameState == GameState.play) { GameObject.FindGameObjectWithTag("AudioManager").GetComponentInChildren <ActorAudioManager>().playPlanted(); } } else { // planting if (hexagonColor != ColorID.white) { return; } SetColor(6, seedColorID); foreach (KeyValuePair <int, ActorHexagon> p in petals) { p.Value.GrowPetal(p.Key, seedColorID); } ActorGameManager.AddScore(ActorGameManager.seedsPlanted, 1); ActorGameManager.RecordSeedPlanted(hexagonID, seedColorID); ActorGameManager.CheckWinLose(); if (State.gameState == GameState.play) { GameObject.FindGameObjectWithTag("AudioManager").GetComponentInChildren <ActorAudioManager>().playPlanted(); } } return; }
public static void SaveUserBoard(Board myBoard, string userBoardName) { State.TaskAdd("SaveUserBoard"); userBoardName = userBoardName.ToLower(); // Create DynamoDB wrapper BoardDDB ddbBoard = new BoardDDB(); string identityID = Identity.Credentials.GetIdentityId(); ddbBoard.IdentityID = identityID; ddbBoard.BoardID = System.Guid.NewGuid() + delimiter + userBoardName; ddbBoard.BoardName = userBoardName; ddbBoard.UserBoard = myBoard; ddbBoard.Votes_A = 0; ddbBoard.Votes_D = 0; // the plays are set initially to 1 because // the board is always played once during creation // this also prevents divide-by-zero errors ddbBoard.Plays_A = 1; ddbBoard.Plays_D = -1; ddbBoard.Wins_A = 0; ddbBoard.Wins_D = 0; ddbBoard.VotesPlaysRatio = 0f; ddbBoard.WinsPlaysRatio = 0f; string printJSON = ActorGameManager.SerializeGameBoard(myBoard); Debug.Log("Saving Board: " + printJSON); // Save the board Context.SaveAsync(ddbBoard, (result) => { if (result.Exception == null) { Debug.Log("Board saved to UserBoards table"); State.gameState = GameState.boards; SceneManager.LoadScene("boards"); State.TaskDone("SaveUserBoard"); } else { Debug.LogWarning("Board save to UserBoards table failed."); State.TaskDone("SaveUserBoard"); } }); }
public void GetHint() { if (Identity.GetGems() < 1) { ActorGameManager.ShowGroup(getHintPanel, true); // Send Analytics Event Analytics.CustomEvent("Funnel", new Dictionary <string, object> { { State.GetBoardDisplayName(), 1 }, { "HintOutOfGems", 1 } }); } else { ActorGameManager.ShowHint(); } }
private void Start() { audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponentInChildren <ActorAudioManager>(); audioManager.playScreenLoaded(); // only show voting button when the board is not mine ActorGameManager.ShowGroup(voteForBoardButton, !State.gameBoardMine); // update sub-panels based on activity UpdateSubPanels(); // only show the social buttons when the player is age 15 or older ActorGameManager.ShowGroup(twitterButton, State.GetAgeFifteenOrOlder()); ActorGameManager.ShowGroup(facebookButton, State.GetAgeFifteenOrOlder()); Language.TranslateScreen(); // set board name GameObject.Find(boardNameText).GetComponent <Text>().text = State.GetBoardDisplayName(); // cache board number boardNumber = State.GetBoardNumber(); }
public void GrowPetal(int rotation, ColorID seedColorID) { // early exit if hexagon color is already this color so no points are scored if (hexagonColor == seedColorID) { return; } if (hexagonColor == ColorID.white) { SetColor(rotation, seedColorID); ActorGameManager.AddScore(ActorGameManager.petalCount, 1); } else { SetColor(0, ColorID.white); ActorGameManager.AddScore(ActorGameManager.petalCount, -1); ActorGameManager.AddScore(ActorGameManager.petalExplosions, 1); SpawnPetalExplosion(); } return; }
public void HideFoundTrinketPanel() { ActorGameManager.ShowGroup(ActorGameManager.foundTrinketPanel, false); }
public void VoteForBoard() { ActorGameManager.ShowGroup(voteForBoardButton, false); Database.AddBoardMetric(metricType.vote); }
public void PurchaseFailed() { StoreResultText.text = "Your purchase was not successful."; ActorGameManager.ShowGroup(StoreResultPanelName, true); }
public void StoryNow() { ActorGameManager.ShowGroup(storyUnlockPanel, false); StartCoroutine("LoadLevel", "chapters"); }
public void StoryLater() { ActorGameManager.ShowGroup(storyUnlockPanel, false); }
public void SocialTwitter() { string url = "https://twitter.com/intent/tweet?text=" + UnityWebRequest.EscapeURL("I solved " + State.GetBoardDisplayName() + " using just " + ActorGameManager.GetScore(ActorGameManager.seedsPlanted) + " seeds - can you beat my Bitter Plants score?") + "&url=" + UnityWebRequest.EscapeURL("https://www.lakehomegames.com/games/bitterplants"); Application.OpenURL(url); }
public void ShowSaveBoard() { ActorGameManager.ShowGroup(saveBoardPanelName, true); ActorGameManager.ShowGroup(helpPanelName, false); }
public void ShowHelp() { ActorGameManager.ShowGroup(helpPanelName, true); ScrollToTop(helpScrollView); }
public void SetSeedColor(int id) { ActorGameManager.SetSeedColor(id); }
public void ResultPanelOk() { ActorGameManager.ShowGroup(StoreResultPanelName, false); }
public void CloseStoryView() { ActorGameManager.ShowGroup("StoryScrollView", false); }
public void HideHelp() { ActorGameManager.ShowGroup(helpPanelName, false); }
public void GoNextBoard() { ActorGameManager.ShowGroup(nextBoardButton, false); ActorGameManager.GoNextBoard(); StartCoroutine("LoadLevel", "play"); }
public void PrintCurrentBoard() { // defaults to current game mode ActorGameManager.PrintCurrentBoard(); }
public void ShowChapter(string chapterName) { ActorGameManager.ShowGroup("StoryScrollView", true); storyText.text = Database.GetChapterText(chapterName); StartCoroutine("ScrollToTop"); }