示例#1
0
    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();
    }
示例#2
0
 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();
     }
 }
示例#3
0
    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);
    }
示例#4
0
    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);
    }
示例#5
0
    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);
     }
 }
示例#7
0
    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;
    }
示例#8
0
    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");
            }
        });
    }
示例#9
0
    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();
        }
    }
示例#10
0
    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();
    }
示例#11
0
    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;
    }
示例#12
0
 public void HideFoundTrinketPanel()
 {
     ActorGameManager.ShowGroup(ActorGameManager.foundTrinketPanel, false);
 }
示例#13
0
 public void VoteForBoard()
 {
     ActorGameManager.ShowGroup(voteForBoardButton, false);
     Database.AddBoardMetric(metricType.vote);
 }
示例#14
0
 public void PurchaseFailed()
 {
     StoreResultText.text = "Your purchase was not successful.";
     ActorGameManager.ShowGroup(StoreResultPanelName, true);
 }
示例#15
0
 public void StoryNow()
 {
     ActorGameManager.ShowGroup(storyUnlockPanel, false);
     StartCoroutine("LoadLevel", "chapters");
 }
示例#16
0
 public void StoryLater()
 {
     ActorGameManager.ShowGroup(storyUnlockPanel, false);
 }
示例#17
0
    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);
    }
示例#18
0
 public void ShowSaveBoard()
 {
     ActorGameManager.ShowGroup(saveBoardPanelName, true);
     ActorGameManager.ShowGroup(helpPanelName, false);
 }
示例#19
0
 public void ShowHelp()
 {
     ActorGameManager.ShowGroup(helpPanelName, true);
     ScrollToTop(helpScrollView);
 }
示例#20
0
 public void SetSeedColor(int id)
 {
     ActorGameManager.SetSeedColor(id);
 }
示例#21
0
 public void ResultPanelOk()
 {
     ActorGameManager.ShowGroup(StoreResultPanelName, false);
 }
示例#22
0
 public void CloseStoryView()
 {
     ActorGameManager.ShowGroup("StoryScrollView", false);
 }
示例#23
0
 public void HideHelp()
 {
     ActorGameManager.ShowGroup(helpPanelName, false);
 }
示例#24
0
 public void GoNextBoard()
 {
     ActorGameManager.ShowGroup(nextBoardButton, false);
     ActorGameManager.GoNextBoard();
     StartCoroutine("LoadLevel", "play");
 }
示例#25
0
 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");
 }