コード例 #1
0
        public void SetCursor(CursorType cursorType)
        {
            if (DragItem.isDragging)
            {
                return;
            }
            if (currentCursor == cursorType)
            {
                return;
            }

            string cursorName = null;

            if (cursorNameDict.TryGetValue(cursorType, out cursorName))
            {
                if (UIAtlasManager.GetInstance().HasSprite(ResourceAtlasName, cursorName))
                {
                    currentCursor     = cursorType;
                    cursor.spriteName = cursorNameDict[cursorType];
                }
            }
            else
            {
                cursorType        = CursorType.ctNormal;
                cursor.spriteName = cursorNameDict[CursorType.ctNormal];
            }
            cursor.layer = 1000000;
            cursor.MakePixelPerfect();
        }
コード例 #2
0
 public static UIAtlasManager GetInstance()
 {
     if (instance == null)
     {
         instance = new UIAtlasManager();
     }
     return(instance);
 }
コード例 #3
0
ファイル: NGUIUtils.cs プロジェクト: moto2002/DinaGameClient
        public static UISprite AddUISprite(GameObject parentGo, string resourceName, string imageName)
        {
            GameObject go = new GameObject("UISprite");

            go.transform.parent = parentGo.transform;
            UISprite sprite = go.AddComponent <UISprite>();
            float    s      = 0.002857143f * 20f;

            go.transform.localScale    = new Vector3(s, s, s);
            go.transform.localPosition = Vector3.zero;
            sprite.atlas      = UIAtlasManager.GetInstance().GetUIAtlas(resourceName);
            sprite.spriteName = imageName;
            return(sprite);
        }
コード例 #4
0
        void Awake()
        {
            GameObject cursorLayer = LayerManager.GetInstance().CursorLayer;
            GameObject go          = new GameObject("cursor");

            GameObject.DontDestroyOnLoad(go);
            go.hideFlags        = HideFlags.DontSave;
            go.transform.parent = cursorLayer.transform;
            obj          = go;
            cursor       = go.AddComponent <UISprite>();
            cursor.layer = int.MaxValue;
            cursor.atlas = UIAtlasManager.GetInstance().GetUIAtlas(ResourceAtlasName);
            cursor.pivot = UIWidget.Pivot.TopLeft;

            ObjectUtil.SetLayerWithAllChildren(cursor.gameObject, "2D");
            mTrans = go.transform;
            RegisterCursor();
            SetCursor(CursorType.ctNormal);

            LayerManager.ResetDepth(cursorLayer);

            uiCamera = ViewCameraManager.GetInstance().UICamera;
        }
コード例 #5
0
 public void ClearDragCursor()
 {
     drawType          = DrawDataType.NONE;
     cursor.atlas      = UIAtlasManager.GetInstance().GetUIAtlas(ResourceAtlasName);
     cursor.spriteName = cursorNameDict[currentCursor];
 }