Пример #1
0
    public static void DestoryResOnCompents(GameObject obj)
    {
        Component[] objArray = GameObjectUtils.GetAllComponentsInChildren(obj, typeof(UITexture), true);
        if (!objArray.IsNullOrEmpty())
        {
            for (int i = 0; i < objArray.Length; ++i)
            {
                if (ResourceManager.Instance != null && objArray[i] != null)
                {
                    ResourceManager.Instance.UnLoadIcon(((UITexture)objArray[i]).mainTexture);
                }
            }
        }
        objArray = null;

        Component[] objArray2 = GameObjectUtils.GetAllComponentsInChildren(obj, typeof(UISprite), true);
        if (!objArray2.IsNullOrEmpty())
        {
            for (int i = 0; i < objArray2.Length; ++i)
            {
                if (ResourceManager.Instance != null && objArray2[i] != null)
                {
                    ResourceManager.Instance.UnLoadIcon(((UISprite)objArray2[i]).atlas);
                    ResourceManager.Instance.UnLoadIcon(((UISprite)objArray2[i]).mainTexture);
                }
            }
        }
        objArray2 = null;
    }
Пример #2
0
    public static void DestroyImmediateResOnCompents(GameObject obj)
    {
        Component[] objArray = GameObjectUtils.GetAllComponentsInChildren(obj, typeof(UITexture), true);
        if (!objArray.IsNullOrEmpty())
        {
            for (int i = 0; i < objArray.Length; ++i)
            {
                UnityEngine.Object.DestroyImmediate(((UITexture)objArray[i]).mainTexture, true);
            }
        }
        objArray = null;

        Component[] objArray2 = GameObjectUtils.GetAllComponentsInChildren(obj, typeof(UISprite), true);
        if (!objArray2.IsNullOrEmpty())
        {
            for (int i = 0; i < objArray2.Length; ++i)
            {
                UnityEngine.Object.DestroyImmediate(((UISprite)objArray2[i]).atlas, true);
                UnityEngine.Object.DestroyImmediate(((UISprite)objArray2[i]).mainTexture, true);
            }
        }
        objArray2 = null;

        Component[] objArray3 = GameObjectUtils.GetAllComponentsInChildren(obj, typeof(UILabel), true);
        if (!objArray3.IsNullOrEmpty())
        {
            for (int i = 0; i < objArray3.Length; ++i)
            {
                UnityEngine.Object.DestroyImmediate(((UILabel)objArray3[i]).ambigiousFont, true);
            }
        }
        objArray3 = null;
    }
 static public int GetAllComponentsInChildren_s(IntPtr l)
 {
     try {
         UnityEngine.GameObject a1;
         checkType(l, 1, out a1);
         System.Type a2;
         checkType(l, 2, out a2);
         System.Boolean a3;
         checkType(l, 3, out a3);
         var ret = GameObjectUtils.GetAllComponentsInChildren(a1, a2, a3);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }