GameGlobal.cs 2.2 KB

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