void init4Upgrade4Publish()
    {
        AssetDatabase.Refresh();
        Hashtable   tmpResVer      = ECLCreateVerCfg.create2Map("Assets/" + ECLProjectManager.data.name + "/upgradeRes4Publish");
        Hashtable   lastResVer     = ECLProjectManager.getLastUpgradeMd5Ver();
        string      key            = "";
        ECLResInfor ri             = null;
        Hashtable   needUpgradeRes = new Hashtable();

        foreach (DictionaryEntry cell in tmpResVer)
        {
            key = cell.Key.ToString().Replace("/upgradeRes/", "/upgradeRes4Publish/");
            if (lastResVer [key] == null || string.Compare(cell.Value.ToString(), lastResVer [key].ToString()) != 0)
            {
                needUpgradeRes [key] = true;
            }
        }

        int count = datas.Count;

        for (int i = 0; i < count; i++)
        {
            ri = (ECLResInfor)(datas [i]);
            if (needUpgradeRes [ri.relativePath] != null)
            {
                ri.selected = true;
            }
            else
            {
                ri.selected = false;
            }
        }
    }
    public static void show4Upgrade(string rootPath, Callback callback, Callback callback2)
    {
        ECLGUIResList window = ScriptableWizard.DisplayWizard <ECLGUIResList> ("Res List");

//		Rect rect = window.position;
//		rect.x = -Screen.width - Screen.width / 4;
//		rect.y = Screen.height / 2 - Screen.height / 4;
//		rect.width = Screen.width / 2;
//		rect.height = Screen.height / 2;

//		Vector2 size = Handles.GetMainGameViewSize ();
//		rect = new Rect (-size.x/2, size.y / 2 - size.y / 4, size.x / 2, size.y / 2);
//		window.position = rect;

        window.title      = "Upgrade资源列表";
        window.rootPath   = rootPath;
        window.callback   = callback;
        window.callback2  = callback2;
        window.totalFiles = 0;

        window.datas.Clear();
        window.selectedDatas.Clear();

        window.resLastUpgradeVer = ECLProjectManager.getLastUpgradeVer();
        window.initData(rootPath, 0);
        window.init4Upgrade4Publish();

        window.Show();
    }
    public static void show4PublishSeting(string rootPath, string publishConfig, Callback callback, Callback callback2)
    {
        ECLGUIResList window = ScriptableWizard.DisplayWizard <ECLGUIResList> ("Res List");

//		Rect rect = window.position;
//		//		rect = new Rect (-Screen.width/2, Screen.height / 2 - Screen.height / 4, Screen.width / 2, Screen.height / 2);
//		rect.x = -Screen.width - Screen.width / 4;
//		rect.y = Screen.height / 2 - Screen.height / 4;
//		rect.width = Screen.width / 2;
//		rect.height = Screen.height / 2;
//		window.position = rect;

        window.title      = "资源列表";
        window.rootPath   = rootPath;
        window.callback   = callback;
        window.callback2  = callback2;
        window.totalFiles = 0;

        window.datas.Clear();
        window.selectedDatas.Clear();

        window.resLastUpgradeVer = ECLProjectManager.getLastUpgradeVer();
        window.initData(rootPath, 0);
        window.init4PublishSetting(publishConfig);
//		window.ShowPopup ();
        window.Show();
    }
    public static void show(string rootPath, Callback callback, Callback callback2)
    {
        ECLGUIResList window = ScriptableWizard.DisplayWizard <ECLGUIResList> ("Res List");

//		if (window == null) {
//			window = new ECLGUIResList ();
//		}
//		window.position = new Rect (Screen.width / 2 - Screen.width / 4, Screen.height / 2 - Screen.height / 4, Screen.width / 2, Screen.height / 2);
        window.title      = "资源列表";
        window.rootPath   = rootPath;
        window.callback   = callback;
        window.callback2  = callback2;
        window.totalFiles = 0;

        window.datas.Clear();
        window.selectedDatas.Clear();

        window.resLastUpgradeVer = ECLProjectManager.getLastUpgradeVer();
        window.initData(rootPath, 0);
        window.Show();
    }
    void init4PublishSetting(string oldPublishPath)
    {
        AssetDatabase.Refresh();
        string publishVerPath = "";

        if (string.IsNullOrEmpty(oldPublishPath))
        {
            publishVerPath = Application.dataPath + "/" + ECLProjectManager.ver4Publish;
        }
        else
        {
            publishVerPath = oldPublishPath;
        }
        Hashtable   oldSettingCfg  = ECLProjectManager.fileToMap(publishVerPath);
        string      key            = "";
        ECLResInfor ri             = null;
        Hashtable   needUpgradeRes = new Hashtable();

        foreach (DictionaryEntry cell in oldSettingCfg)
        {
            key = cell.Key.ToString().Replace("/upgradeRes/", "/upgradeRes4Publish/");
            needUpgradeRes [key] = true;
        }

        int count = datas.Count;

        for (int i = 0; i < count; i++)
        {
            ri = (ECLResInfor)(datas [i]);
            if (needUpgradeRes [ri.relativePath] != null)
            {
                ri.selected = true;
            }
            else
            {
                ri.selected = false;
            }
        }
    }
Example #6
0
    static void doCreate(string path, Hashtable lastOtherVer, Hashtable lastPriorityVer, Hashtable lastCfgdataVer, ref Hashtable outMap)
    {
        string[] fileEntries = Directory.GetFiles(path);
        string   extension   = "";
        string   filePath    = "";
        string   md5Str      = "";

        foreach (string fileName in fileEntries)
        {
            extension = Path.GetExtension(fileName);
            if (ECLEditorUtl.isIgnoreFile(fileName))
            {
                continue;
            }
            filePath = filter(fileName);
            filePath = filePath.Replace("\\", "/");
            filePath = filePath.Replace("/upgradeRes4Publish/", "/upgradeRes/");

            if (ECLProjectManager.isModified(fileName))
            {
                md5Str = Utl.MD5Encrypt(File.ReadAllBytes(fileName));
            }
            else
            {
                md5Str = MapEx.getString(lastOtherVer, filePath);
                if (string.IsNullOrEmpty(md5Str))
                {
                    md5Str = MapEx.getString(lastPriorityVer, filePath);
                }
                else if (string.IsNullOrEmpty(md5Str))
                {
                    md5Str = MapEx.getString(lastCfgdataVer, filePath);
                }
            }
            outMap [filePath] = md5Str;
        }

        string[] dirEntries = Directory.GetDirectories(path);
        foreach (string dir in dirEntries)
        {
            //跳过不同平台的资源
                        #if UNITY_ANDROID
            if (Path.GetFileName(dir).Equals("IOS") || Path.GetFileName(dir).Equals("Standalone") || Path.GetFileName(dir).Equals("StandaloneOSX"))
            {
                continue;
            }
#elif UNITY_IOS
            if (Path.GetFileName(dir).Equals("Android") || Path.GetFileName(dir).Equals("Standalone") || Path.GetFileName(dir).Equals("StandaloneOSX"))
            {
                continue;
            }
#elif UNITY_STANDALONE_WIN
            if (Path.GetFileName(dir).Equals("Android") || Path.GetFileName(dir).Equals("IOS") || Path.GetFileName(dir).Equals("StandaloneOSX"))
            {
                continue;
            }
#elif UNITY_STANDALONE_OSX
            if (Path.GetFileName(dir).Equals("Android") || Path.GetFileName(dir).Equals("IOS") || Path.GetFileName(dir).Equals("Standalone"))
            {
                continue;
            }
#endif
            doCreate(dir, lastOtherVer, lastPriorityVer, lastCfgdataVer, ref outMap);
        }
    }