Exemplo n.º 1
0
        public void submitScore(Action <bool, string> callback)
        {
            submitScoreCallback = callback;
            string gameObjectName = "OpenKitSubmitScoreObject." + DateTime.Now.Ticks;

            callbackGameObjectName = gameObjectName;


            // Create a new OKScore gameobject (called scoreComponent) and give it a unique name
            // This allows us to track unique score submission requests and handle
            // async native code

#if !UNITY_EDITOR
            GameObject gameObject = new GameObject(gameObjectName);
            DontDestroyOnLoad(gameObject);

            OKScore scoreComponent = gameObject.AddComponent <OKScore>();
            scoreComponent.submitScoreCallback = callback;

            scoreComponent.scoreValue             = scoreValue;
            scoreComponent.OKLeaderboardID        = OKLeaderboardID;
            scoreComponent.displayString          = displayString;
            scoreComponent.metadata               = metadata;
            scoreComponent.callbackGameObjectName = gameObjectName;

            OKManager.SubmitScore(scoreComponent);
#endif
        }
Exemplo n.º 2
0
        public void SubmitScoreNatively(Action <bool, string> callback)
        {
            if (MetadataBuffer != null)
            {
                UnityEngine.Debug.LogError("A score with MetadataBuffer set cannot be submitted via native plugin");
                callback(false, null);
            }

            // Create a uniquely named GameObject, and keep it around between scene switches.
            string     gameObjectName = "OpenKitSubmitScoreObject." + DateTime.Now.Ticks;
            GameObject gameObject     = new GameObject(gameObjectName);

            UnityEngine.Object.DontDestroyOnLoad(gameObject);

            OKScoreSubmitComponent scoreSubmitComponent = gameObject.AddComponent <OKScoreSubmitComponent>();

            scoreSubmitComponent.submitScoreCallback    = callback;
            scoreSubmitComponent.callbackGameObjectName = gameObjectName;
            scoreSubmitComponent.scoreValue             = scoreValue;
            scoreSubmitComponent.OKLeaderboardID        = LeaderboardID;
            scoreSubmitComponent.displayString          = displayString;
            scoreSubmitComponent.metadata = metadata;
            scoreSubmitComponent.gameCenterLeaderboardCategory = gameCenterLeaderboardCategory;

            OKManager.SubmitScore(scoreSubmitComponent);
        }
        public void submitAchievementScore(Action <bool, string> callback)
        {
            submitAchievementScoreCallback = callback;
            string gameObjectName = "OpenKitSubmitAchievementScoreObject." + DateTime.Now.Ticks;

            callbackGameObjectName = gameObjectName;


            // Create a new OKAchievementScore gameobject (called scoreComponent) and give it a unique name
            // This allows us to track unique score submission requests and handle
            // async native code

#if !UNITY_EDITOR
            GameObject gameObject = new GameObject(gameObjectName);
            DontDestroyOnLoad(gameObject);

            OKAchievementScore achievementScoreComponent = gameObject.AddComponent <OKAchievementScore>();
            achievementScoreComponent.submitAchievementScoreCallback = callback;

            achievementScoreComponent.progress                             = progress;
            achievementScoreComponent.OKAchievementID                      = OKAchievementID;
            achievementScoreComponent.callbackGameObjectName               = gameObjectName;
            achievementScoreComponent.GameCenterAchievementIdentifier      = GameCenterAchievementIdentifier;
            achievementScoreComponent.GameCenterAchievementPercentComplete = GameCenterAchievementPercentComplete;

            OKManager.SubmitAchievementScore(achievementScoreComponent);
#endif
        }
Exemplo n.º 4
0
 public static void Configure(string appKey, string secretKey)
 {
     OKManager.Configure(appKey, secretKey, null);
 }
Exemplo n.º 5
0
 public static OKUser GetUser()
 {
     return(OKManager.GetCurrentUser());
 }
 public override void CallNativeFunction(OKNativeAsyncCall dynamicObject)
 {
     OKManager.GetFacebookFriendsList(dynamicObject);
 }