GameGlobal.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using FairyGUI;
  2. using UnityEngine;
  3. using ET;
  4. using UI.Common;
  5. namespace GFGGame
  6. {
  7. public class GameGlobal
  8. {
  9. public static bool isVisitor = false;
  10. public static bool isFirstEntry = false;
  11. //防沉迷开关
  12. public static bool antiAddiction = true;
  13. public static long userId = 0;
  14. public static int userAge = 0;
  15. public static bool skipGuide;
  16. public static bool skipCheckOpen;//跳过功能开启检查
  17. public static string loginApiUrl;
  18. public static string gameApiUrl;
  19. public static string gameApiUrlTest;
  20. //ET
  21. public static Scene zoneScene;
  22. public static Unit myUnit;
  23. public static NumericComponent myNumericComponent;
  24. private static UI_ComHolder comHolder;
  25. private static GameObject _gameObj;
  26. private static GoWrapper _wrapper;
  27. public static void Init()
  28. {
  29. loginApiUrl = LauncherConfig.loginApiUrl;
  30. gameApiUrl = loginApiUrl;//外网
  31. gameApiUrlTest = "http://localhost:8081/api/";
  32. CreatClickEffect();
  33. }
  34. public static string version
  35. {
  36. get
  37. {
  38. return Application.version + "." + VEngine.Versions.ManifestsVersion;
  39. }
  40. }
  41. private static void CreatClickEffect()
  42. {
  43. if (comHolder == null)
  44. {
  45. comHolder = UI_ComHolder.Create();
  46. comHolder.target.touchable = false;
  47. ViewManager.AddChildToTopLayer(comHolder.target);
  48. string resPath = ResPathUtil.GetViewEffectPath("ui_dj", "ui_dj");
  49. SceneController.AddObjectToView(_gameObj, _wrapper, comHolder.m_holder, resPath, out _gameObj, out _wrapper);
  50. GRoot.inst.onTouchBegin.Add(SetClickPos);
  51. }
  52. }
  53. private static void SetClickPos()
  54. {
  55. // Vector2 pos = Stage.inst.touchPosition;
  56. Vector2 pos = GRoot.inst.GlobalToLocal(Stage.inst.touchPosition);
  57. Debug.Log("pos:" + pos);
  58. comHolder.m_holder.visible = false;
  59. comHolder.m_holder.visible = true;
  60. comHolder.target.SetPosition(pos.x, pos.y, 0);
  61. }
  62. }
  63. }