123456789101112131415161718192021222324252627282930313233343536 |
- using FairyGUI;
- using UI.Common;
- using UnityEngine;
- namespace GFGGame
- {
- public class ViewGlobal : MonoBehaviour
- {
- private static UI_ComHolder comHolder;
- private static GameObject _gameObj;
- private static GoWrapper _wrapper;
- public static void CreatClickEffect()
- {
- if (comHolder == null)
- {
- comHolder = UI_ComHolder.Create();
- comHolder.target.touchable = false;
- ViewManager.AddChildToTopLayer(comHolder.target);
- comHolder.target.SetPosition(-100, -100, 0);
- string resPath = ResPathUtil.GetViewEffectPath("ui_dj", "ui_dj");
- SceneController.AddObjectToView(_gameObj, _wrapper, comHolder.m_holder, resPath, out _gameObj, out _wrapper);
- GRoot.inst.onTouchBegin.Add(SetClickPos);
- }
- }
- private static void SetClickPos()
- {
- Vector2 pos = GRoot.inst.GlobalToLocal(Stage.inst.touchPosition);
- comHolder.m_holder.visible = false;
- comHolder.m_holder.visible = true;
- comHolder.target.SetPosition(pos.x, pos.y, 0);
- }
- }
- }
|