Beispiel #1
0
        [MenuItem("Help/将Dll放进来 %q")]                        //Ctrl + Q
        static void PullDllComeIn()
        {
            string savePath = Application.dataPath;
            string firstDllPath;

            if (OpenWindow.ChooseFile(@"F:\MyNewDll", out firstDllPath))
            {
                string fileName = MyAssetUtil.GetFileNameByFullName(firstDllPath);
                if (!MyAssetUtil.GetFileSuffix(fileName).Equals("dll"))
                {
                    MyLog.Orange("选择的文件不是dll ——" + fileName);
                    return;
                }
                string saveDllPath;
                if (OpenWindow.ChooseFloder(savePath, out saveDllPath))
                {
                    saveDllPath = saveDllPath + "/" + fileName;
                    MyIO.FileCopy(firstDllPath, saveDllPath);
                }
                else
                {
                    MyLog.Green("取消操作");
                }
            }
            else
            {
                MyLog.Green("取消操作");
            }
            AssetDatabase.Refresh();
        }
Beispiel #2
0
        private void DrawKey()                                  // 快捷键
        {
            MyCreate.Box(() =>
            {
                m_Tools.TextText_BL("Ctrl + W", "复制 UGUI 名到剪切版", -50);
                m_Tools.Text_G("使用它,再也不用烦找名字的痛苦了");
            });
            AddSpace();


            MyCreate.Box(() =>
            {
                m_Tools.Text_Y("先点击选择多个图片,给它们添加前缀");
                Texture2D[] texs = Selection.GetFiltered <Texture2D>(SelectionMode.Assets);
                bool isCanClick  = (null == texs || texs.Length <= 0);
                GUI.enabled      = !isCanClick;
                MyCreate.Button("    一键添加前缀", () =>
                {
                    foreach (Texture2D texture2 in texs)
                    {
                        string assetPath = AssetDatabase.GetAssetPath(texture2);
                        string fullPath  = MyAssetUtil.GetFullPath(assetPath);
                        string fileName  = MyAssetUtil.GetFileNameByFullName(fullPath);
                        MyIO.FileRename(fullPath, "EX_" + fileName);
                    }

                    AssetDatabase.Refresh();
                });


                GUI.enabled = true;
            });
        }
Beispiel #3
0
 private void SaveTu()                                    // 保存图片
 {
     foreach (string path in pathK_ImageV.Keys)
     {
         string resPath = Application.dataPath + "/GameAssets/Sprite/" + MyAssetUtil.GetFileNameByFullName(path);
         // 将图片复制 "/GameAssets/Sprite/" 文件夹下
         MyIO.FileCopy(path, resPath);
         string assetPath = MyAssetUtil.GetAssetsBackPath(resPath);
         AssetDatabase.Refresh();
         // 转化成 Sprite
         Texture2DChangeSprite(assetPath);
         ; Sprite sp = AssetDatabase.LoadAssetAtPath <Sprite>(assetPath);
         pathK_ImageV[path].sprite = sp;
     }
     pathK_ImageV.Clear();
 }
Beispiel #4
0
    private void AddTu()
    {
        l_Sprites.Clear();
        // 一般的动画图片都是放在一起,而且还是前缀相同的
        Sprite sp = Target.sprite;
        if (null == Target || null == sp)
        {
            MyLog.Red("先添加一个图片在 Image 上啊");
            return;
        }
        // 图片名:abc_01,abc_02,abc_03
        int lastIndex = sp.name.LastIndexOf("_", StringComparison.Ordinal);
        // 找到 abc_
        string sameName = sp.name.Substring(0, lastIndex+1);

        // Assets/GameAssets/_Sprite/Holo Atlas.png
        string aasetpath = AssetDatabase.GetAssetPath(sp);

        // 这个是加载图集中的
        Object[] objs = AssetDatabase.LoadAllAssetsAtPath(aasetpath);
        foreach (Object o in objs)
        {
            if (o.name.Contains(sameName))
            {
                Sprite spo = o as Sprite;
                if (null != spo)
                {
                    l_Sprites.Add(spo);
                }
            }
        }
        if (l_Sprites.Count > 1)       
        {
            return;

        }
        l_Sprites.Clear();
        // 表示还没有找到,那就在它的文件夹下面找
        lastIndex = aasetpath.LastIndexOf("/", StringComparison.Ordinal);
        string directionPath = aasetpath.Substring(0, lastIndex);

        string[] files = Directory.GetFiles(directionPath);

        foreach (string fileFullPath in files)
        {
            string fileName = MyAssetUtil.GetFileNameByFullName(fileFullPath);
            if (fileName.Contains(sameName) && !fileName.Contains(".meta"))
            {
                string assetPath = MyAssetUtil.GetAssetsBackPath(fileFullPath);
                Sprite objSp = AssetDatabase.LoadAssetAtPath<Sprite>(assetPath);
                l_Sprites.Add(objSp);
            }
        }


        /*        // 找到这个图片的 Asset 路径   
          

                // 找到目录路径
              
          
                Object[] objs = AssetDatabase.LoadAllAssetsAtPath(directionPath+"/");

                foreach (Object o in objs)
                {
                    MyLog.Red(o.name);
                }*/



    }