25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

41 lines
1.3 KiB

  1. using UnityEngine;
  2. using System.Collections;
  3. using System;
  4. namespace ETModel
  5. {
  6. namespace com.commsdk.unity3d
  7. {
  8. public class AndroidImpl : CommSDKImpl
  9. {
  10. private AndroidJavaObject currActivity;
  11. public AndroidImpl(string callbackObj, string callbackMethod)
  12. {
  13. currActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
  14. InitSDK(callbackObj, callbackMethod);
  15. }
  16. private string WxAppId = "wxe3784691d154266f";
  17. private string WxAppSecret = "e11c9277651822d48a00425d4ffc08e2";
  18. public override void InitSDK(string callbackObj, string callbackMethod)
  19. {
  20. if (currActivity != null)
  21. {
  22. currActivity.Call("initSdk", callbackObj, callbackMethod, WxAppId, WxAppSecret);
  23. }
  24. }
  25. /// <summary>
  26. /// Authorize the specified platform.
  27. /// </summary>
  28. public override void Authorize(int type, int reqID)
  29. {
  30. if (currActivity != null)
  31. {
  32. currActivity.Call("authorize", type, reqID);
  33. }
  34. }
  35. }
  36. }
  37. }