ATMsgTools.cs 785 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using UnityEngine;
  2. using System.Collections;
  3. #if UNITY_ANDROID
  4. public class ATMsgTools
  5. {
  6. private AndroidJavaObject _Plugin;
  7. public ATMsgTools ()
  8. {
  9. try{
  10. if (Application.platform != RuntimePlatform.Android)
  11. return;
  12. _Plugin = new AndroidJavaObject ("com.anythink.unitybridge.MsgTools");
  13. }catch(System.Exception e)
  14. {
  15. System.Console.WriteLine("Exception caught: {0}", e);
  16. }
  17. }
  18. public void printLogI (string msg)
  19. {
  20. try{
  21. _Plugin.Call ("printLogI",msg);
  22. }catch(System.Exception e)
  23. {
  24. System.Console.WriteLine("Exception caught: {0}", e);
  25. }
  26. }
  27. public void printMsg (string msg)
  28. {
  29. try{
  30. _Plugin.Call ("pirntMsg",msg);
  31. }catch(System.Exception e)
  32. {
  33. System.Console.WriteLine("Exception caught: {0}", e);
  34. }
  35. }
  36. }
  37. #endif