Ejemplo n.º 1
0
    private void EndGame()
    {
        for (int i = 0; i < 40; i++)
        {
            if (damageReceived < 1000000)
            {
                rewardLevel = 0;
                break;
            }

            if (damageReceived > 1000000 * Math.Pow(2, i))
            {
                rewardLevel++;
            }
        }

        DataController.Instance.highFaustDamage = damageReceived;

        if (Social.localUser.authenticated)
        {
            DataController.Instance.FaustAchievement();

            if (DataController.Instance.recordFaustDamage < damageReceived)
            {
                var user = new UserRankData
                {
                    userName     = Social.localUser.userName,
                    costumeIndex = DataController.Instance.costumeIndex,
                    skinIndex    = DataController.Instance.skinIndex,

                    playTime = PlayerPrefs.GetFloat("PlayTime", 0),

                    faustDamage   = -damageReceived,
                    inAppPurchase = DataController.Instance.inAppPurchase,

                    isHack = 0
                };

                var json = JsonUtility.ToJson(user);

                userReference.Child(PlayGamesPlatform.Instance.localUser.id)
                .SetRawJsonValueAsync(json).ContinueWith(
                    task1 =>
                {
                    if (task1.IsCompleted)
                    {
                        DataController.Instance.recordFaustDamage = damageReceived;
                    }
                });
            }
        }

        if (Social.localUser.authenticated)
        {
            // login success
            float  highScore     = damageReceived;
            string leaderBoardId = GPGSIds.leaderboard;

            Social.ReportScore((long)highScore, leaderBoardId, success =>
            {
                if (success)
                {
                    print("Success");
                }
            });
        }

        RewardManager.Instance.ShowBossRewardPanel(damageReceived, rewardLevel);
    }
Ejemplo n.º 2
0
 public override string ToString()
 {
     return($"User match data (UserGameProfileId: {UserGameProfileId.ToString()}), ratings: {UserRankData.ToString()}");
 }