Exemplo n.º 1
0
        private void Awake()
        {
            _loadingAnimation = _leaders.gameObject.GetComponent <Animator>();

            _leaderboardHelper = new LeaderboardHelper();
            _leaderboardHelper = JsonUtility.FromJson <LeaderboardHelper>(PlayerPrefs.GetString("leaders"));
        }
Exemplo n.º 2
0
    public static Entity StartGameOver(this Pool pool)
    {
        var e = pool.CreateEntity()
                .IsGameOver(true);

        return(e.AddCoroutine(LeaderboardHelper.GetCoroutine(pool, e)));
    }
Exemplo n.º 3
0
        private void Awake()
        {
            _leaders = new LeaderboardHelper();

            var json = ReadJsonFile("leaderboard");

            // Преобразовываем json в объект
            ConvertToObject(ref _leaders, json);
        }
Exemplo n.º 4
0
        // SAVE THE USER'S NAME:
        void btnSave_Tap(object sender, EventArgs e)
        {
            // GET NEW SCORE:
            int score = int.Parse(PhoneApplicationService.Current.State["MemorySquared_NewScore"].ToString());

            // ADD THIS NEW RECORD TO THE LEADERBOARD:
            LeaderboardHelper.AddToLeaderboard(Globals.Data, txtName.Text, score);

            // RESET OUR VARIABLES, AND TAKE THE USER TO VIEW THE LEADERBOARD:
            Globals.bIncorrect       = false;
            Globals.bGameIsStarted   = false;
            Globals.nSequenceCounter = 0;
            NavigationService.Navigate(new Uri("/Pages/Leaderboard.xaml", UriKind.Relative));
        }
Exemplo n.º 5
0
        void LoadIncorrect(object sender, EventArgs e)
        {
            // SETUP ADVERTISEMENT:
            if (Globals.bDisplayAds)
            {
                Advertising.GetAdForGrid(LayoutRoot, 2, 0, 0);
            }

            int nNewScore = 0, nOldScore = 0;

            // GET THEIR CURRENT SCORE FROM THIS ROUND:
            if (PhoneApplicationService.Current.State.ContainsKey("MemorySquared_NewScore"))
            {
                nNewScore = int.Parse(PhoneApplicationService.Current.State["MemorySquared_NewScore"].ToString());
            }

            // GET THEIR CURRENTLY SAVED HIGH SCORE:
            if (PhoneApplicationService.Current.State.ContainsKey("MemorySquared_OldScore"))
            {
                nOldScore = int.Parse(PhoneApplicationService.Current.State["MemorySquared_OldScore"].ToString());
            }

            // NEW HIGH SCORE?
            if (nNewScore > nOldScore)
            {
                // SHOW THE USER "NEW HIGH SCORE!":
                lblNewHighScore.Visibility = Visibility.Visible;

                // SAVE:
                Globals.Data.SaveGameData();
            }

            // If the new score is greater than the tenth (or last) score on the
            // leaderboard, and also greater than 0, we'll let them add this score to the leaderboard:
            if (nNewScore > 0 && LeaderboardHelper.CanAddToLeaderboard(Globals.Data, nNewScore) == true)
            {
                btnAddScore.Visibility = Visibility.Visible;
            }

            // SHOW THEM THE RESULTS:
            lblYourScore.Text         = AppResources.YourScore + ": " + nNewScore.ToString();
            lblPreviousHighScore.Text = AppResources.PreviousHighScore + ": " + nOldScore.ToString();
        }