GameGlobal.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 bool isEnterGame = false;
  18. public static string loginApiUrl;
  19. public static string gameApiUrl;
  20. public static string gameApiUrlTest;
  21. //ET
  22. public static Scene zoneScene;
  23. public static Unit myUnit;
  24. public static NumericComponent myNumericComponent;
  25. private static UI_ComHolder comHolder;
  26. private static GameObject _gameObj;
  27. private static GoWrapper _wrapper;
  28. public static void Init()
  29. {
  30. loginApiUrl = LauncherConfig.loginApiUrl;
  31. gameApiUrl = loginApiUrl;//外网
  32. gameApiUrlTest = "http://localhost:8081/api/";
  33. CreatClickEffect();
  34. }
  35. public static string version
  36. {
  37. get
  38. {
  39. return Application.version + "." + VEngine.Versions.ManifestsVersion;
  40. }
  41. }
  42. private static void CreatClickEffect()
  43. {
  44. if (comHolder == null)
  45. {
  46. comHolder = UI_ComHolder.Create();
  47. comHolder.target.touchable = false;
  48. ViewManager.AddChildToTopLayer(comHolder.target);
  49. string resPath = ResPathUtil.GetViewEffectPath("ui_dj", "ui_dj");
  50. SceneController.AddObjectToView(_gameObj, _wrapper, comHolder.m_holder, resPath, out _gameObj, out _wrapper);
  51. GRoot.inst.onTouchBegin.Add(SetClickPos);
  52. }
  53. }
  54. private static void SetClickPos()
  55. {
  56. Vector2 pos = GRoot.inst.GlobalToLocal(Stage.inst.touchPosition);
  57. comHolder.m_holder.visible = false;
  58. comHolder.m_holder.visible = true;
  59. comHolder.target.SetPosition(pos.x, pos.y, 0);
  60. }
  61. }
  62. }