少年修仙传客户端代码仓库
hch
2024-05-17 81312e057b1803fee4042dacc79bbddc7da7fd79
0312 资源不混淆,还原
4个文件已修改
180 ■■■■ 已修改文件
Core/GameEngine/Login/LoginStage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/ResModule/AssetBundle/AssetBundleInfo.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/ResModule/AssetBundle/AssetBundleUtility.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/AssetVersion/AssetVersionUtility.cs 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Core/GameEngine/Login/LoginStage.cs
@@ -126,7 +126,7 @@
            if (check && VersionUtility.Instance.NeedDownAsset())
            {
                checkAssetVersionTimer += Time.time + 10f;
                var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/AVersion.txt");
                var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/AssetsVersion.txt");
                HttpRequest.Instance.RequestHttpGet(assetVersionUrl, HttpRequest.defaultHttpContentType, 3, OnGetAssetVersionFile);
            }
        }
Core/ResModule/AssetBundle/AssetBundleInfo.cs
@@ -1,21 +1,16 @@
using UnityEngine;
public class AssetBundleInfo {
    public string name = null;
    public Hash128 hash;
    public string[] dependentBundles = null;
    public AssetBundleInfo(string bundleName, Hash128 hash128, string[] dependentBundleArray) {
        name = AssetVersionUtility.DecodeFileName(bundleName);
        hash = hash128;
        //dependentBundles 存储 dependentBundleArray 的字符串倒序后存储
        for (int i = 0; i < dependentBundleArray.Length; i++)
        {
            dependentBundleArray[i] = AssetVersionUtility.DecodeFileName(dependentBundleArray[i]);
        }
        dependentBundles = dependentBundleArray;
    }
}
using UnityEngine;
public class AssetBundleInfo
{
    public string name = null;
    public Hash128 hash;
    public string[] dependentBundles = null;
    public AssetBundleInfo(string bundleName, Hash128 hash128, string[] dependentBundleArray)
    {
        name = bundleName;
        hash = hash128;
        dependentBundles = dependentBundleArray;
    }
}
Core/ResModule/AssetBundle/AssetBundleUtility.cs
@@ -19,7 +19,7 @@
    public void InitBuiltInAsset()
    {
        var path = AssetVersionUtility.GetBuiltInAssetFilePath(StringUtility.Contact(AssetVersionUtility.EncodeFileName("builtin"), "_abundle"), false);
        var path = AssetVersionUtility.GetBuiltInAssetFilePath(StringUtility.Contact(AssetVersionUtility.EncodeFileName("builtin"), "_assetbundle"), false);
        var assetBundle = AssetBundle.LoadFromFile(path);
        if (assetBundle == null)
        {
@@ -51,7 +51,7 @@
        CloseAllIgnoreWindowConfig.Release();
        UnloadAssetBundle("builtin/scriptableobjects", true, false);
        var path = AssetVersionUtility.GetBuiltInAssetFilePath(StringUtility.Contact(AssetVersionUtility.EncodeFileName("builtin"), "_abundle"), false);
        var path = AssetVersionUtility.GetBuiltInAssetFilePath(StringUtility.Contact(AssetVersionUtility.EncodeFileName("builtin"), "_assetbundle"), false);
        var assetBundle = AssetBundle.LoadFromFile(path);
        if (assetBundle == null)
        {
@@ -115,7 +115,7 @@
    private IEnumerator Co_LoadMainfestFile(string _category)
    {
        var path = AssetVersionUtility.GetAssetFilePath(StringUtility.Contact(AssetVersionUtility.EncodeFileName(_category), "_abundle"), false);
        var path = AssetVersionUtility.GetAssetFilePath(StringUtility.Contact(AssetVersionUtility.EncodeFileName(_category), "_assetbundle"), false);
        var _assetBundle = AssetBundle.LoadFromFile(path);
        if (_assetBundle == null)
System/AssetVersion/AssetVersionUtility.cs
@@ -6,7 +6,6 @@
using vnxbqy.UI;
using System.Threading;
using System.Linq;
using UnityEditor;
public class AssetVersionUtility
{
@@ -87,7 +86,7 @@
    {
        checkAssetCompleted = false;
        Debug.LogFormat("开始获取资源版本文件:时间 {0}", DateTime.Now);
        var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/AVersion.txt");
        var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/AssetsVersion.txt");
        assetVerUrl = assetVersionUrl;
        Debug.Log("http地址:assetVersionUrl  " + assetVersionUrl);
        HttpRequest.Instance.RequestHttpGet(assetVersionUrl, HttpRequest.defaultHttpContentType, 3, OnGetAssetVersionFile);
@@ -193,7 +192,7 @@
    static void InitPackageVersionInfo()
    {
        var text = Resources.Load<TextAsset>("AVersionCmp");
        var text = Resources.Load<TextAsset>("AssetsVersionCmp");
        if (text != null)
        {
            var lines = text.text.Split(new string[] { FileExtersion.lineSplit }, StringSplitOptions.RemoveEmptyEntries);
@@ -290,75 +289,77 @@
    //将文件名倒序,加上_aop后缀
    public static string EncodeFileName(string name)
    {
        name = name.Replace("\\", "/");
        int index = name.LastIndexOf("/");
        string headString;
        if (index >= 0)
        {
            int dotLastIndex = name.LastIndexOf(".");
            if (dotLastIndex == -1)
            {
                headString = name.Substring(0, index);
                name = name.Substring(index + 1);
                return StringUtility.Contact(headString, "/", new string(name.Reverse().ToArray()), "_aop");
            }
            else
            {
                headString = name.Substring(0, index);
                var ext = name.Substring(dotLastIndex);
                name = name.Substring(index + 1, dotLastIndex - index - 1);
                return StringUtility.Contact(headString, "/", new string(name.Reverse().ToArray()), "_aop", ext);
            }
        }
        else
        {
            int dotLastIndex = name.LastIndexOf(".");
            if (dotLastIndex == -1)
                return StringUtility.Contact(new string(name.Reverse().ToArray()), "_aop");
            else
            {
                var ext = name.Substring(dotLastIndex);
                name = name.Substring(0, dotLastIndex);
                return StringUtility.Contact(new string(name.Reverse().ToArray()), "_aop", ext);
            }
        }
        return name;
        //name = name.Replace("\\", "/");
        //int index = name.LastIndexOf("/");
        //string headString;
        //if (index >= 0)
        //{
        //    int dotLastIndex = name.LastIndexOf(".");
        //    if (dotLastIndex == -1)
        //    {
        //        headString = name.Substring(0, index);
        //        name = name.Substring(index + 1);
        //        return StringUtility.Contact(headString, "/", new string(name.Reverse().ToArray()), "_aop");
        //    }
        //    else
        //    {
        //        headString = name.Substring(0, index);
        //        var ext = name.Substring(dotLastIndex);
        //        name = name.Substring(index + 1, dotLastIndex - index - 1);
        //        return StringUtility.Contact(headString, "/", new string(name.Reverse().ToArray()), "_aop", ext);
        //    }
        //}
        //else
        //{
        //    int dotLastIndex = name.LastIndexOf(".");
        //    if (dotLastIndex == -1)
        //        return StringUtility.Contact(new string(name.Reverse().ToArray()), "_aop");
        //    else
        //    {
        //        var ext = name.Substring(dotLastIndex);
        //        name = name.Substring(0, dotLastIndex);
        //        return StringUtility.Contact(new string(name.Reverse().ToArray()), "_aop", ext);
        //    }
        //}
    }
    public static string DecodeFileName(string name)
    {
        name = name.Replace("\\", "/");
        int index = name.LastIndexOf("/");
        string headString;
        if (index >= 0)
        {
            int dotLastIndex = name.LastIndexOf(".");
            if (dotLastIndex == -1)
            {
                headString = name.Substring(0, index);
                name = name.Substring(index + 1);
                return StringUtility.Contact(headString, "/", new string(name.Replace("_aop", "").Reverse().ToArray()));
            }
            else
            {
                headString = name.Substring(0, index);
                var ext = name.Substring(dotLastIndex);
                name = name.Substring(index + 1, dotLastIndex - index - 1);
                return StringUtility.Contact(headString, "/", new string(name.Replace("_aop", "").Reverse().ToArray()), ext);
            }
        }
        else
        {
            int dotLastIndex = name.LastIndexOf(".");
            if (dotLastIndex == -1)
                return new string(name.Replace("_aop", "").Reverse().ToArray());
            else
            {
                var ext = name.Substring(dotLastIndex);
                name = name.Substring(0, dotLastIndex);
                return new string(name.Replace("_aop", "").Reverse().ToArray()) + ext;
            }
        }
        return name;
        //name = name.Replace("\\", "/");
        //int index = name.LastIndexOf("/");
        //string headString;
        //if (index >= 0)
        //{
        //    int dotLastIndex = name.LastIndexOf(".");
        //    if (dotLastIndex == -1)
        //    {
        //        headString = name.Substring(0, index);
        //        name = name.Substring(index + 1);
        //        return StringUtility.Contact(headString, "/", new string(name.Replace("_aop", "").Reverse().ToArray()));
        //    }
        //    else
        //    {
        //        headString = name.Substring(0, index);
        //        var ext = name.Substring(dotLastIndex);
        //        name = name.Substring(index + 1, dotLastIndex - index - 1);
        //        return StringUtility.Contact(headString, "/", new string(name.Replace("_aop", "").Reverse().ToArray()), ext);
        //    }
        //}
        //else
        //{
        //    int dotLastIndex = name.LastIndexOf(".");
        //    if (dotLastIndex == -1)
        //        return new string(name.Replace("_aop", "").Reverse().ToArray());
        //    else
        //    {
        //        var ext = name.Substring(dotLastIndex);
        //        name = name.Substring(0, dotLastIndex);
        //        return new string(name.Replace("_aop", "").Reverse().ToArray()) + ext;
        //    }
        //}
    }