private void AwardThirdPartyAchievements(string in_achievements)
        {
#if !(DOT_NET)
            // only do it for logged in players
            if (!UnityEngine.Social.localUser.authenticated)
            {
                Debug.Log("Couldnt award Unity Social achievement because localUser was not authenticated");
                return;
            }

            IAchievement achievement = UnityEngine.Social.CreateAchievement();
            achievement.id = in_achievements;
            achievement.percentCompleted = 100.0; //progress as double
            achievement.ReportProgress(result =>
            {
                if (result)
                {
                    Debug.Log("AwardThirdPartyAchievements Success");
                }
                else
                {
                    Debug.Log("AwardThirdPartyAchievements Failed");
                }
            });
#endif
        }
示例#2
0
        private void AwardThirdPartyAchievements(string in_achievements)
        {
#if !(DOT_NET)
            // only do it for logged in players
            UnityEngine.Social.localUser.Authenticate(success =>
            {
                if (success)
                {
                    IAchievement achievement     = UnityEngine.Social.CreateAchievement();
                    achievement.id               = in_achievements;
                    achievement.percentCompleted = 100.0; //progress as double
                    achievement.ReportProgress(result =>
                    {
                        if (result)
                        {
                            Console.Write("AwardThirdPartyAchievements Success");
                        }
                        else
                        {
                            Console.Write("AwardThirdPartyAchievements Failed");
                        }
                    });
                }
            });
#endif
        }
示例#3
0
        public override void ReportProgress(Action <bool> _onCompletion)
        {
            base.ReportProgress(_onCompletion);

            if (Description == null)
            {
                return;
            }

            // Report progress to GameCenter
            m_achievementData.ReportProgress(OnReportProgressFinished);
        }
示例#4
0
    public void UnlockAchivement(string id)
    {
        //PlayGamesPlatform.Instance.UnlockAchievement(id, (bool success) => {
        // handle success or failure
        //});
        IAchievement achievement = Social.CreateAchievement();

        achievement.id = id;
        achievement.percentCompleted = 100.0;
        achievement.ReportProgress(result => {
            if (result)
            {
                Debug.Log("Successfully reported progress");
            }
            else
            {
                Debug.Log("Failed to report progress");
            }
        });
    }
示例#5
0
    /// <summary>
    /// 実績の進捗状況を送信する
    /// </summary>
    public static void ReportProgress(string achievementKey, float percent, Action <bool> callBack = null)
    {
        //アチーブメントのインスタンスを作成し、keyと進捗率を設定
        IAchievement achievement = Social.CreateAchievement();

        achievement.id = achievementKey;
        achievement.percentCompleted = percent;

        //コールバックが設定されていない場合はログを設定
        if (callBack == null)
        {
            callBack = (success) => {
                Debug.Log(success ? "進捗送信成功" : "進捗送信失敗");
            };
        }

        //エディター上で送信すると、エラーが出るので、送信が成功したことにする
#if UNITY_EDITOR
        callBack(true);
#else
        //送信
        achievement.ReportProgress(callBack);
#endif
    }