예제 #1
0
        public const int TYPE_SELECTABLE_BIT    = 4;    // 按钮
        public static void RemoveOtherCs(GameObject go, int type)
        {
            SpriteBigLoader             bigLoader           = go.GetComponent <SpriteBigLoader>();
            SpriteAtlasLoader           altasLoader         = go.GetComponent <SpriteAtlasLoader>();
            SpriteSelectableAltasLoader selectableLoader    = go.GetComponent <SpriteSelectableAltasLoader>();
            SpriteSelectableBigLoader   selectableBigLoader = go.GetComponent <SpriteSelectableBigLoader>();

            if (bigLoader != null && type != TYPE_BIG_SPRITE)
            {
                UnityEngine.Object.DestroyImmediate(bigLoader);
            }

            if (altasLoader != null && type != TYPE_SPRITE)
            {
                UnityEngine.Object.DestroyImmediate(altasLoader);
            }

            if (selectableLoader != null && type != TYPE_SELECTABLE_SPRITE)
            {
                UnityEngine.Object.DestroyImmediate(selectableLoader);
            }

            if (selectableBigLoader != null && type != TYPE_SELECTABLE_BIT)
            {
                UnityEngine.Object.DestroyImmediate(selectableBigLoader);
            }
        }
예제 #2
0
        // 处理Sprite中的大图
        private static void ExcuteBigImg(Image img, string imgPath)
        {
            SpriteBigLoader loader = GameObjectHelper.AddComponent <SpriteBigLoader>(img.gameObject);

            RemoveOtherCs(img.gameObject, TYPE_BIG_SPRITE);
            img.sprite         = null;
            loader._isComplete = false;
            loader._resPath    = imgPath;
        }