public void RoundEnd(bool levelSuccess, int numActionsTaken)
    {
        Appointment _thisLevel     = gameManager.GetClipboard().GetNextLevelUp();
        bool        isSpecialLevel = false;

        if (_thisLevel.myLevel.isCantTouch || _thisLevel.myLevel.isFallToRed || _thisLevel.myLevel.isNoLines || _thisLevel.myLevel.isOneClick)
        {
            isSpecialLevel = true;
        }

        ScoreTrackerOneRound st = GetComponent <ScoreTrackerOneRound>();

        st.Reset();

        if (levelSuccess)
        {
            st.UpdateScore(gameManager.GetClipboard().currentLevelDifficulty, numActionsTaken, isSpecialLevel);
            numActions = numActionsTaken;

            // log event to game manager
            gameManager.Event_AppointmentEnd();
            // log metrics
            MetricsLogger.Instance.LogCustomEvent("Appointment", "NumActions", gameManager.FormatDayAndLevel(), numActionsTaken);
            MetricsLogger.Instance.LogCustomEvent("Appointment", "NumStars", gameManager.FormatDayAndLevel(), st.GetScore());
        }

        float waitTimeForClipboard = (levelSuccess ? 1.0f : 0.0f);

        gameManager.GetClipboard().Invoke("BringUpClipboard", waitTimeForClipboard);
        Invoke("DestroyOldLevel", waitTimeForClipboard);

        // display level end screen, etc.
        if (!hasDisplayedLevelEndScreen && levelSuccess)
        {
            // show score notifications on level end
            if (_thisLevel.GetMyDayIndex() == 0)
            {
                GameObject.Find("NotificationManager").GetComponent <NotificationManager>().DisplayNotification(3, false);
            }

            appointmentComplete = true;
            gameManager.GetClipboard().ShowClipboardAppointments(false);

            // show "restart" button if earned less than 3 stars
            if (st.GetScore() < 3)
            {
                gameManager.GetClipboard().ShowRestartButton(true);
            }
            else
            {
                // trigger star particle for 3 stars
                gameManager.GetClipboard().Invoke("TriggerStarParticles", waitTimeForClipboard + 0.5f);
            }

            int currentDayIndex = gameManager.GetClipboard().selectorRef.dayToGenerate.dayIndex;

            if (st.GetScore() > SaveGame.GetRoundStarCount(currentDayIndex, _thisLevel.levelIndex))
            {
                SaveGame.SetRoundStarCount(currentDayIndex, _thisLevel.levelIndex, st.GetScore());
            }

            // Check to see if all rounds in day received a star, and also tally stars for the day
            bool doAllRoundsInDayHaveStars = true;
            int  howManyStarsTotalDay      = 0;

            for (int i = 0; i < gameManager.GetClipboard().selectorRef.dayToGenerate.numAppointments; i++)
            {
                int thisDayStarCount = SaveGame.GetRoundStarCount(currentDayIndex, i);
                howManyStarsTotalDay += thisDayStarCount;
                if (thisDayStarCount < 1)
                {
                    doAllRoundsInDayHaveStars = false;
                }
            }

            // update day's star count
            SaveGame.SetDayStarCount(currentDayIndex, howManyStarsTotalDay);
            // if true, unlock next day
            if (doAllRoundsInDayHaveStars)
            {
                SaveGame.SetHasCompletedAllRoundsInDay(currentDayIndex, true);
            }
            SaveGame.UpdateGameStats();

            gameManager.UpdateCloudSaveFromLocal();

            hasDisplayedLevelEndScreen = true;
        }
        if (levelSuccess)
        {
            _thisLevel.UpdateStarCount(false);
        }
    }
    void OnGUI()
    {
#if (DEBUG_LEVEL_TESTER)
        if (GUI.Button(new Rect(0, Screen.height - 40, 40, 20), "Gen"))
        {
            isShowingDebugControls = true;
        }

        if (isShowingDebugControls)
        {
            // Buttons to load new level
            if (GUI.Button(new Rect(10, 10, 90, 25), "New 3"))
            {
                MakeNewTestLevel(3);
            }
            if (GUI.Button(new Rect(10, 40, 90, 25), "New 4"))
            {
                MakeNewTestLevel(4);
            }
            if (GUI.Button(new Rect(10, 70, 90, 25), "New 5"))
            {
                MakeNewTestLevel(5);
            }
            if (GUI.Button(new Rect(10, 100, 90, 25), "New 6"))
            {
                MakeNewTestLevel(6);
            }
            if (GUI.Button(new Rect(10, 130, 90, 25), "New 7"))
            {
                MakeNewTestLevel(7);
            }
            if (GUI.Button(new Rect(10, 160, 90, 25), "New 8"))
            {
                MakeNewTestLevel(8);
            }

            if (GUI.Button(new Rect(Screen.width - 300, Screen.height - 50, 75, 25), "run test"))
            {
                GetComponent <LevelTester>().RunLevelTests();
            }
        }
#endif

        if (appointmentComplete)
        {
            resultsPage.SetActive(true);
        }

        if (appointmentComplete && waitToShowResultsAfterFinishedCounter <= 0 && !isDisplayingScore)
        {
            isDisplayingScore = true;

            ScoreTrackerOneRound st = GetComponent <ScoreTrackerOneRound>();
            int resultActions       = numActions;
            int resultStars         = st.GetScore();

            foreach (TextMesh resultText in resultsPage.GetComponentsInChildren <TextMesh>())
            {
                if (resultText.gameObject.name == "actions")
                {
                    resultText.text = resultActions.ToString();
                }
                else if (resultText.gameObject.name == "stars")
                {
                    resultText.text = resultStars.ToString();
                }
            }
        }
    }