Esempio n. 1
0
        /// <summary>
        ///     用户分享
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <OperationResult <GameUserShareResponse> > GameUserShareAsync(
            GameUserShareRequest request)
        {
            try
            {
                var manager = GameManagerFactory.GetGameManager(request.GameVersion);
                if (manager == null)
                {
                    // 未实现
                    return(OperationResult.FromError <GameUserShareResponse>("-3", Resource.Invalid_Game_NotImpl));
                }

                var result = await manager.GameUserShareAsync(request);

                if (string.IsNullOrWhiteSpace(result.errCode) && result.response != null)
                {
                    return(OperationResult.FromResult(result.response));
                }

                return(OperationResult.FromError <GameUserShareResponse>(result.errCode, result.errMsg));
            }
            catch (NotImplementedException e)
            {
                // 未实现
                return(OperationResult.FromError <GameUserShareResponse>("-3", Resource.Invalid_Game_NotImpl));
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     获取 里程碑信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <OperationResult <GetGameMilepostInfoResponse> > GetGameMilepostInfoAsync(
            GetGameMilepostInfoRequest request)
        {
            var manager = GameManagerFactory.GetGameManager(request.GameVersion);

            if (manager == null)
            {
                // 未实现
                return(OperationResult.FromError <GetGameMilepostInfoResponse>("-3", Resource.Invalid_Game_NotImpl));
            }

            return(OperationResult.FromResult(await manager.GetGameMilepostInfoAsync(request)));
        }
Esempio n. 3
0
        /// <summary>
        /// 获取某天之前的积分排行
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <OperationResult <GetRankListBeforeDayResponse> > GetRankListBeforeDayAsync(GetRankListBeforeDayRequest request)
        {
            try
            {
                var manager = GameManagerFactory.GetGameManager(request.GameVersion);
                if (manager == null)
                {
                    // 未实现
                    return(OperationResult.FromError <GetRankListBeforeDayResponse>("-3", Resource.Invalid_Game_NotImpl));
                }

                return(await manager.GetRankListBeforeDayAsync(request));
            }
            catch (NotImplementedException e)
            {
                // 未实现
                return(OperationResult.FromError <GetRankListBeforeDayResponse>("-3", Resource.Invalid_Game_NotImpl));
            }
        }
Esempio n. 4
0
        /// <summary>
        ///  用户进入游戏
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <OperationResult <UserParticipateGameResponse> > UserParticipateGameAsync(UserParticipateGameRequest request)
        {
            try
            {
                var manager = GameManagerFactory.GetGameManager(request.GameVersion);
                if (manager == null)
                {
                    // 未实现
                    return(OperationResult.FromError <UserParticipateGameResponse>("-3", Resource.Invalid_Game_NotImpl));
                }

                return(await manager.UserParticipateGameAsync(request));
            }
            catch (NotImplementedException e)
            {
                // 未实现
                return(OperationResult.FromError <UserParticipateGameResponse>("-3", Resource.Invalid_Game_NotImpl));
            }
        }
Esempio n. 5
0
        /// <summary>
        ///    小游戏 - 删除游戏的人员数据 - 内部用
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public static async Task <OperationResult <bool> > DeleteGameUserDataAsync(DeleteGameUserDataRequest request)
        {
            try
            {
                var manager = GameManagerFactory.GetGameManager(request.GameVersion);
                if (manager == null)
                {
                    // 未实现
                    return(OperationResult.FromError <bool>("-3", Resource.Invalid_Game_NotImpl));
                }

                var result = await manager.DeleteGameUserDataAsync(request);

                return(OperationResult.FromResult(result));
            }
            catch (NotImplementedException e)
            {
                // 未实现
                return(OperationResult.FromError <bool>("-3", Resource.Invalid_Game_NotImpl));
            }
        }
Esempio n. 6
0
        /// <summary>
        ///     获取 用户助力信息【剩余助力次数】
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <OperationResult <GetGameUserSupportInfoResponse> > GetGameUserSupportInfoAsync(
            GetGameUserSupportInfoRequest request)
        {
            try
            {
                var manager = GameManagerFactory.GetGameManager(request.GameVersion);
                if (manager == null)
                {
                    // 未实现
                    return(OperationResult.FromError <GetGameUserSupportInfoResponse>("-3", Resource.Invalid_Game_NotImpl));
                }

                var result = await manager.GetGameUserSupportInfoAsync(request);

                return(OperationResult.FromResult(result));
            }
            catch (NotImplementedException e)
            {
                // 未实现
                return(OperationResult.FromError <GetGameUserSupportInfoResponse>("-3", Resource.Invalid_Game_NotImpl));
            }
        }
Esempio n. 7
0
        /// <summary>
        ///     小游戏 - 订单状态跟踪
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <OperationResult <GameOrderTrackingResponse> > GameOrderTrackingAsync(GameOrderTackingRequest request)
        {
            try
            {
                var gameVersion = request.GameVersion;

                IList <DefaultGameManager> gameManagers;
                if (gameVersion == GameVersionEnum.None)
                {
                    gameManagers = GameManagerFactory.GetAllGameManagers();
                }
                else
                {
                    gameManagers = new List <DefaultGameManager>()
                    {
                        GameManagerFactory.GetGameManager(gameVersion)
                    };
                }

                foreach (var defaultGameManager in gameManagers)
                {
                    try
                    {
                        await defaultGameManager.GameOrderTrackingAsync(request);
                    }
                    catch (NotImplementedException e)
                    {
                    }
                }

                return(OperationResult.FromResult(new GameOrderTrackingResponse()));
            }
            catch (NotImplementedException e)
            {
                // 未实现
                return(OperationResult.FromError <GameOrderTrackingResponse>("-3", Resource.Invalid_Game_NotImpl));
            }
        }