Beispiel #1
0
        public static async Task IncreaseWin()
        {
            try
            {
                var wins = GetWins();
                if (wins != -1)
                {
                    SaveWins(wins + 1);
                }
                else
                {
                    SaveWins(1);
                }

                // Save New Win
                await GameService.SaveGame("SaveFile", new Save { WinCounts = GetWins() });

                wins = GetWins();
                Achievement achievement;
                switch (wins)
                {
                //Achievements Checker
                case 1:
                    achievement = await AchievementHandler.UnlockFirstWin();

                    NotificationUtils.NotifyUnlockAchievement(achievement);
                    break;

                case 10:
                    achievement = await AchievementHandler.UnlockProfessional();

                    NotificationUtils.NotifyUnlockAchievement(achievement);
                    break;

                case 50:
                    achievement = await AchievementHandler.UnlockMaster();

                    NotificationUtils.NotifyUnlockAchievement(achievement);
                    break;

                default:
                {
                    // SubmitScore To LeaderBoard
                    if (wins > 50)
                    {
                        var score = await LeaderBoardHandler.SubmitScore(wins);

                        NotificationUtils.NotifySubmitScore(score.Leaderboard, score.Score);
                    }
                    break;
                }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("IncreaseWin : " + e);
            }
        }