ou can create new decision points and edit or delete existing ones in the decision point management tool. These can be found in the DEV environment under SETUP > Manage Decision Points
A decision point can be any arbitrary text string although it is recommended that they are meaningful descriptors.
You can also add parameters to a decision point so that the game can provide some further context sensitive detail to Engage. In the example above that the player has just failed a mission and decision point parameters are being used to tell Engage which mission the player failed and how many lives they have remaining. This would let us create multiple campaigns all running on the same justFailedMission decision point but provide different responses based on the mission name and remaining lives.
To implement a call to engage in your code, you must first create a new Engagement. Then you must request the engagement and handle the response from the engagement. Note, if you do not have a decision point created the response will return a “400” status code.
Unity:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
var engagement = new Engagement("justFailedMission") .AddParam("missionName", "Crystal Cavern") .AddParam("livesBalance", 2); DDNA.Instance.RequestEngagement(engagement, response => { if (response.JSON.ContainsKey("parameters")) { // Engage has responsed, and the response contains some paramters for the game client. object parameters; response.JSON.TryGetValue("parameters", out parameters); JSONObject p = parameters as JSONObject; Debug.Log(p) } }, exception => { Debug.Log("Engage encountered an error: " + exception.Message); }); |
For the Android SDK. You will need to implement an engagement listener.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
requestEngagement( new Engagement("justFailedMission") .putParam("missionName", "Crystal Cavern") .putParam("livesBalance", 2), new FailedMissionListener()); class FailedMissionListener implements EngageListener<Engagement> { public void onCompleted(Engagement engagement) { // do something with the result if (engagement.isSuccessful()) { JSONObject parameters = engagement.getJson() Log.i(parameters.toString()) } } public void onError(Throwable t) { //handle error } } |
1 2 3 4 5 6 7 |
DDNAEngagement *engagement = [DDNAEngagement engagementWithDecisionPoint:@"justFailedMission"]; [engagement setParam:@"Crystal Cavern" forKey:@"missionName"]; [engagement setParam:@2 forKey:@"livesBalance"]; [[DDNASDK sharedInstance] requestEngagement:engagement completionHandler:^(NSDictionary* parameters, NSInteger statusCode, NSError* error) { NSLog(@"Engagement request returned the following parameters:\n%@", parameters[@"parameters"]); }]; |