Esempio n. 1
0
        /// <summary>
        /// Create a leaderboard. This will be deprecated when the developer portal is available.
        /// </summary>
        /// <param name="index">The index of user</param>
        /// <param name="id">The ID of the new leaderboard.</param>
        /// <param name="type">The type of leaderboard to create.</param>
        /// <param name="rotationType">How often the leaderboard will rotate scores.</param>
        public async Task <RuyiNetResponse> CreateLeaderboard(int index, string id, RuyiNetLeaderboardType type, RuyiNetRotationType rotationType)
        {
            var data = new RuyiNetCreateLeaderboardRequest()
            {
                leaderboardId    = mClient.AppId + "_" + id,
                type             = type.ToString(),
                rotationType     = rotationType.ToString(),
                versionsToRetain = 1
            };

            var resp = await mClient.BCService.Script_RunParentScriptAsync("CreateLeaderboard", JsonConvert.SerializeObject(data), "RUYI", index, token);

            return(mClient.Process <RuyiNetResponse>(resp));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a leaderboard. This will be deprecated when the developer portal is available.
        /// </summary>
        /// <param name="index">The index of user</param>
        /// <param name="id">The ID of the new leaderboard.</param>
        /// <param name="type">The type of leaderboard to create.</param>
        /// <param name="rotationType">How often the leaderboard will rotate scores.</param>
        /// <param name="callback">The function to call when the data is retrieved.</param>
        public void CreateLeaderboard(int index, string id, RuyiNetLeaderboardType type,
                                      RuyiNetRotationType rotationType, RuyiNetTask <RuyiNetResponse> .CallbackType callback)
        {
            EnqueueTask(() =>
            {
                var data = new RuyiNetCreateLeaderboardRequest()
                {
                    leaderboardId    = mClient.AppId + "_" + id,
                    type             = type.ToString(),
                    rotationType     = rotationType.ToString(),
                    versionsToRetain = 1
                };

                return(mClient.BCService.Script_RunParentScriptAsync("CreateLeaderboard", JsonConvert.SerializeObject(data), "RUYI", index, token).Result);
            }, callback);
        }