GameGlobal.cs 2.1 KB

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