GameGlobal.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 = GRoot.inst.GlobalToLocal(Stage.inst.touchPosition);
  56. comHolder.m_holder.visible = false;
  57. comHolder.m_holder.visible = true;
  58. comHolder.target.SetPosition(pos.x, pos.y, 0);
  59. }
  60. }
  61. }