public void CreateTournament()

in Facebook.Unity.Windows/WindowsWrapper.cs [521:577]


        public void CreateTournament(int initialScore, string title, string imageBase64DataUrl, string sortOrder, string scoreFormat, Dictionary<string, string> data, string callbackId, CallbackManager callbackManager)
        {
            fbg.Tournaments.createTournament(
                initialScore,
                title,
                imageBase64DataUrl,
                sortOrder,
                scoreFormat,
                MiniJSON.Json.Serialize(data),
                (fbg.CreateTournamentResult tournamentData) =>
                {
                    Dictionary<string, object> resultDict = new Dictionary<string, object>() {
                        {Constants.CallbackIdKey,callbackId },
                    };

                    Dictionary<string, object> response = MiniJSON.Json.Deserialize(tournamentData.Raw) as Dictionary<string, object>;
                    Dictionary<string, object> success = null;
                    if (response.TryGetValue("success", out success))
                    {
                        string tournamentId;
                        if (success.TryGetValue("tournamentId", out tournamentId))
                        {
                            resultDict["tournament_id"] = tournamentId;
                        }
                        string contextId;
                        if (success.TryGetValue("contextId", out contextId))
                        {
                            resultDict["context_id"] = contextId;
                        }
                        int endTime;
                        if (success.TryGetValue("endTime", out endTime))
                        {
                            resultDict["end_time"] = endTime;
                        }
                        string tournamentTitle;
                        if (success.TryGetValue("tournamentTitle", out tournamentTitle))
                        {
                            resultDict["tournament_title"] = tournamentTitle;
                        }
                        IDictionary<string, string> payload;
                        if (success.TryGetValue("payload", out payload))
                        {
                            resultDict["payload"] = payload;
                        }
                    }
                    else
                    {
                        resultDict[Constants.ErrorKey] = "ERROR: Wrong Tournament Data";
                    }
                    callbackManager.OnFacebookResponse(new TournamentResult(new ResultContainer(resultDict)));
                },
                (fbg.Error error) =>
                {
                    TournamentResult result = new TournamentResult(WindowsParserBase.SetError(error, callbackId));
                    callbackManager.OnFacebookResponse(result);
                });
        }