ViewGlobal.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using FairyGUI;
  2. using UI.Common;
  3. using UnityEngine;
  4. namespace GFGGame
  5. {
  6. public class ViewGlobal : MonoBehaviour
  7. {
  8. private static UI_ComHolder comHolder;
  9. private static GameObject _gameObj;
  10. private static GoWrapper _wrapper;
  11. public static void CreatClickEffect()
  12. {
  13. if (comHolder == null)
  14. {
  15. comHolder = UI_ComHolder.Create();
  16. comHolder.target.touchable = false;
  17. ViewManager.AddChildToTopLayer(comHolder.target);
  18. comHolder.target.SetPosition(-100, -100, 0);
  19. string resPath = ResPathUtil.GetViewEffectPath("ui_dj", "ui_dj");
  20. SceneController.AddObjectToView(_gameObj, _wrapper, comHolder.m_holder, resPath, out _gameObj, out _wrapper);
  21. GRoot.inst.onTouchBegin.Add(SetClickPos);
  22. }
  23. }
  24. private static void SetClickPos()
  25. {
  26. Vector2 pos = GRoot.inst.GlobalToLocal(Stage.inst.touchPosition);
  27. comHolder.m_holder.visible = false;
  28. comHolder.m_holder.visible = true;
  29. comHolder.target.SetPosition(pos.x, pos.y, 0);
  30. }
  31. }
  32. }