예제 #1
0
        /// <summary>
        /// Instructs the PlayFab game server hosting service to instantiate a new Game Server Instance
        /// </summary>
        public static void StartGame(StartGameRequest request, ProcessApiCallback <StartGameResponse> resultCallback, ErrorCallback errorCallback, object customData = null)
        {
            if (PlayFabSettings.DeveloperSecretKey == null)
            {
                throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
            }

            string serializedJson = SimpleJson.SerializeObject(request, Util.ApiSerializerStrategy);
            Action <CallRequestContainer> callback = delegate(CallRequestContainer requestContainer)
            {
                ResultContainer <StartGameResponse> .HandleResults(requestContainer, resultCallback, errorCallback, null);
            };

            PlayFabHTTP.Post("/Matchmaker/StartGame", serializedJson, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback, request, customData);
        }
        /// <summary>
        /// Instructs the PlayFab game server hosting service to instantiate a new Game Server Instance
        /// </summary>
        public static void StartGame(StartGameRequest request, StartGameCallback resultCallback, ErrorCallback errorCallback, object customData = null)
        {
            if (PlayFabSettings.DeveloperSecretKey == null)
            {
                throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
            }

            string serializedJson = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings);
            Action <CallRequestContainer> callback = delegate(CallRequestContainer requestContainer)
            {
                StartGameResponse result = ResultContainer <StartGameResponse> .HandleResults(requestContainer, resultCallback, errorCallback);

                if (result != null)
                {
                }
            };

            PlayFabHTTP.Post("/Matchmaker/StartGame", serializedJson, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback, request, customData);
        }