Example #1
0
    /// Leave the current team that the player is a member of. Invokes the ChilliConnect
    /// Cloud Code script to leave teams.
    ///
    public void LeaveTeam()
    {
        var runScriptRequest = new RunScriptRequestDesc(SCRIPT_LEAVE_TEAM);

        m_chilliConnect.CloudCode.RunScript(runScriptRequest,
                                            (request, response) => LeaveTeamCallBack(response.Output.AsDictionary()),
                                            (request, error) => Debug.LogError(error.ErrorDescription));
    }
Example #2
0
    /// Join the provided team. Invokes the ChilliConnect Join Team Cloud Code script,
    /// passing the ID of the provided team to the script.
    ///
    /// @oaram team
    ///     The team to join
    ///
    public void JoinTeam(Team team)
    {
        var scriptParams = new Dictionary <string, SdkCore.MultiTypeValue> ();

        scriptParams.Add("TeamID", team.ID);

        var runScriptRequest = new RunScriptRequestDesc(SCRIPT_JOIN_TEAM);

        runScriptRequest.Params = scriptParams;

        m_chilliConnect.CloudCode.RunScript(runScriptRequest,
                                            (request, response) => JoinTeamCallBack(response.Output.AsDictionary(), team),
                                            (request, error) => Debug.LogError(error.ErrorDescription));
    }
Example #3
0
    /// Invokes ChilliConnect to run the SPAWN_CHARACTER script with the recipe key from
    /// the clicked recipe on the UI.
    ///
    public void CookRecipe(Recipe recipeKey)
    {
        var scriptParams = new Dictionary <string, SdkCore.MultiTypeValue> ();

        scriptParams.Add("Recipe", recipeKey.RecipeKey);

        var runScriptRequest = new RunScriptRequestDesc(SPAWN_CHARACTER);

        runScriptRequest.Params = scriptParams;

        m_chilliConnect.CloudCode.RunScript(runScriptRequest,
                                            (request, response) => PostCharacterCreationActions(response),
                                            (request, error) => Debug.LogError(error.ErrorDescription));
    }
Example #4
0
    /// Create a new team. Invokes the ChilliConnect Create Team Cloud Code script,
    /// passing the name of the team to be created.
    ///
    /// @oaram team
    ///     The name of the new team to create
    ///
    public void CreateTeam(string teamName)
    {
        var scriptParams = new Dictionary <string, SdkCore.MultiTypeValue> ();

        scriptParams.Add("Name", teamName);

        var runScriptRequest = new RunScriptRequestDesc(SCRIPT_CREATE_TEAM);

        runScriptRequest.Params = scriptParams;

        m_chilliConnect.CloudCode.RunScript(runScriptRequest,
                                            (request, response) => TeamCreatedCallBack(response.Output.AsDictionary()),
                                            (request, error) => Debug.LogError(error.ErrorDescription));
    }
    private void RemoteCampaign(string decisionPoint, string parameters)
    {
        var scriptParams = new Dictionary <string, SdkCore.MultiTypeValue>();

        scriptParams.Add("decisionPoint", decisionPoint);
        scriptParams.Add("locale", "en_GB");
        scriptParams.Add("platform", DDNA.Instance.Platform);
        if (!string.IsNullOrEmpty(parameters))
        {
            scriptParams.Add("parameters", parameters);
        }

        var runScriptRequest = new RunScriptRequestDesc("ENGAGE_DECISION_POINT_CAMPAIGN");

        runScriptRequest.Params = scriptParams;

        Debug.Log("Running Engage Campaign Script for decisionPoint : " + decisionPoint);
        chilliConnect.CloudCode.RunScript(runScriptRequest
                                          , (request, response) => {
            var engageResponse = response.Output.AsDictionary();

            if (engageResponse.ContainsKey("parameters"))
            {
                var p = engageResponse["parameters"].AsDictionary();
                foreach (var i in p)
                {
                    //Debug.Log("Response Parameter : " + i.Key + " Value : " + i.Value);

                    if (i.Key == "placementType")
                    {
                        placementManager.type = i.Value.AsString();
                    }

                    if (i.Key == "placementPosition")
                    {
                        placementManager.position = i.Value.AsString();
                    }

                    if (i.Key == "placementFrequency")
                    {
                        placementManager.frequency = i.Value.AsInt();
                    }

                    if (i.Key == "placementSessionCap")
                    {
                        placementManager.limit = i.Value.AsInt();
                    }

                    if (i.Key == "placementType")
                    {
                        placementManager.type = i.Value.AsString();
                    }

                    if (i.Key == "placementPromoID")
                    {
                        placementManager.promoID = i.Value.AsInt();
                    }
                }
            }
        }
                                          , (request, error) => Debug.LogError(error.ErrorDescription));
    }