| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 | using System;using System.Collections.Generic;using UnityEditor;#if UNITY_EDITORusing UnityEngine;#endifnamespace UnityEngine.UI{    public class UGUIIamgeTool    {        public static ISpriteLoad SpriteLoad;        public static int minDepth =-1;        public static int renderOrder =0;                    public static void Load(string assetName, Action<UILoadSpriteHand> callBack)        {            if (!Application.isPlaying)            {#if UNITY_EDITOR                string[] assetsPath = AssetDatabase.FindAssets(assetName);                for (int j = 0; j < assetsPath.Length; j++)                {                    string assetPath = AssetDatabase.GUIDToAssetPath(assetsPath[j]);                    if (assetPath.Contains(".png"))                    {                        Sprite texture = AssetDatabase.LoadAssetAtPath<Sprite>(assetPath);                        EditoUILoadSpriteHand editoUILoadSpriteHand = new EditoUILoadSpriteHand();                        editoUILoadSpriteHand.Sprite = texture;                        callBack?.Invoke(editoUILoadSpriteHand);                    }                }#endif            }            else            {                if (SpriteLoad != null)                {                    SpriteLoad.Load(assetName, callBack);                }                else                {                    Debug.LogError("没有找到Load的工具" + assetName);                }            }        }    }}
 |