UmengManager.cs 867 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // UmengManager.cs
  3. //
  4. // Created by ZhuCong on 1/1/14.
  5. // Copyright 2014 Umeng.com . All rights reserved.
  6. // Version 1.31
  7. using UnityEngine;
  8. using System.Collections;
  9. using Umeng;
  10. public class UmengManager : MonoBehaviour
  11. {
  12. bool isPause = true;
  13. void Start()
  14. {
  15. DontDestroyOnLoad(transform.gameObject);
  16. #if UNITY_ANDROID
  17. //Debug.Log("Umeng:Awake");
  18. GA.onResume(GA.AppKey, GA.ChannelId);
  19. #endif
  20. }
  21. #if UNITY_ANDROID
  22. void OnApplicationPause()
  23. {
  24. //Debug.Log("Umeng:OnApplicationPause" + isPause);
  25. if (isPause){
  26. //Debug.Log("Umeng:----onPause");
  27. GA.onPause();
  28. }
  29. else{
  30. //Debug.Log("Umeng:----onResume");
  31. GA.onResume(GA.AppKey, GA.ChannelId);
  32. }
  33. isPause =!isPause;
  34. }
  35. void OnApplicationQuit()
  36. {
  37. //Debug.Log("Umeng:OnApplicationQuit");
  38. GA.onKillProcess();
  39. }
  40. #endif
  41. }