UnlockMedalService.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. using UnityEngine;
  3. namespace Newgrounds.Services {
  4. public class UnlockMedalService:BasicService {
  5. // ================================================================================================================
  6. // CONSTRUCTOR ----------------------------------------------------------------------------------------------------
  7. public UnlockMedalService(ServiceCallback __callback = null) : base(__callback) {
  8. }
  9. // ================================================================================================================
  10. // PUBLIC INTERFACE -----------------------------------------------------------------------------------------------
  11. // ================================================================================================================
  12. // INTERNAL INTERFACE ---------------------------------------------------------------------------------------------
  13. /*
  14. protected override WWW createService() {
  15. WWWForm form = new WWWForm();
  16. // The command
  17. form.AddField("command_id", "getMedals");
  18. // The tracker ID of your game
  19. form.AddField("tracker_id", apiId);
  20. // The ID of the publisher hosting the game (optional, used to mark unlocked medals)
  21. if (connectionPublisherId != null) form.AddField("publisher_id", connectionPublisherId);
  22. // The user ID of the current player (optional, used to mark unlocked medals)
  23. if (connectionUserId != null) form.AddField("user_id", connectionUserId);
  24. // Send
  25. WWW w = new WWW(API_URL, form);
  26. return w;
  27. }
  28. * */
  29. /*
  30. Posts a high score to a score board. This command is sent as a secure packet (see securePacket command)
  31. POST Values
  32. command_id = securePacket
  33. tracker_id - The tracker ID of your game
  34. secure - An encrypted object (see Encryption Process) containing the following properties:
  35. command_id = unlockMedal
  36. publisher_id - The ID of the publisher hosting the game
  37. session_id - The current player session ID
  38. medal_id - The ID of the medal
  39. Return Object
  40. command_id = unlockMedal
  41. medal_id - The ID of the medal
  42. medal_name - The name of the medal
  43. medal_value - The point value of the medal
  44. medal_difficulty - 1=Easy, 2=Moderate, 3=Challenging, 4=Difficult, 5=Brutal
  45. success = 1
  46. **/
  47. }
  48. }
  49. /*
  50. * GetMedals(() => medalsDone());
  51. public static void GetMedals(Action __callback) {
  52. // http://docs.unity3d.com/Documentation/ScriptReference/WWWForm.html
  53. WWWForm form = new WWWForm();
  54. // The command
  55. form.AddField("command_id", "getMedals");
  56. // The tracker ID of your game
  57. form.AddField("tracker_id", _apiId);
  58. // The ID of the publisher hosting the game (optional, used to mark unlocked medals)
  59. if (_connectionPublisherId != null) form.AddField("publisher_id", _connectionPublisherId);
  60. // The user ID of the current player (optional, used to mark unlocked medals)
  61. if (_connectionUserId != null) form.AddField("user_id", _connectionUserId);
  62. // Send
  63. WWW w = new WWW(API_URL, form);
  64. Debug.Log("getting medals from " + API_URL + ", form = " + form);
  65. _surrogate.doPost(w, __callback);
  66. }*/