日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

GameFramework框架——辅助工具

發布時間:2024/1/18 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 GameFramework框架——辅助工具 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在生成新的AB包后,輔助生成version.txt工具,代碼很簡單 找出最新的AB包版本的BuildReport文件讀取最新的length,hashcode,zip_length, zip hash code設置到桌面上的version.txt。

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; using StarForce; using UnityGameFramework.Editor.ResourceTools; using System.IO;//------------------------------------------------------------ // Game Framework // Copyright ? 2013-2020 Jiang Yin. All rights reserved. // Homepage: https://gameframework.cn/ // Feedback: mailto:ellan@gameframework.cn //------------------------------------------------------------[System.Serializable] public class GameVersionInfo {// 是否需要強制更新游戲應用public bool ForceUpdateGame;// 最新的游戲版本號public string LatestGameVersion;// 最新的游戲內部版本號public int InternalGameVersion;// 最新的資源內部版本號public int InternalResourceVersion;// 資源更新下載地址public string UpdatePrefixUri;// 資源版本列表長度public int VersionListLength;// 資源版本列表哈希值public int VersionListHashCode;// 資源版本列表壓縮后長度public int VersionListZipLength;// 資源版本列表壓縮后哈希值public int VersionListZipHashCode; }public static class HotfixHelperEditor {static string BuildReportPath = @"E:\UnityIndieGame\GameDemo\AssetBundle\BuildReport\";[MenuItem("Tools/UpdateVersionConfig")]static void UpdateVersionConfig(){string[] allDirectories = Directory.GetDirectories(BuildReportPath);int maxNum = -1;string maxPath = "";foreach (var v in allDirectories){string[] arr = v.Split('_');int num = int.Parse(arr[arr.Length - 1]);if (num > maxNum){maxNum = num;maxPath = v;}}if (!string.IsNullOrEmpty(maxPath)){//Debug.LogError("maxPath:" + maxPath);string path = @"C:\Users\lenovo\Desktop\version.txt";//Debug.LogError(path);string versionStr = File.ReadAllText(path);//Debug.Log(versionStr);string[] buildLogLines = File.ReadAllLines(maxPath + "/BuildLog.txt");int length, zip_length, hash_code, zip_hash_code;length = 0;zip_length = 0;hash_code = 0;zip_hash_code = 0;foreach (var v in buildLogLines){if (v.IndexOf("length is '") != -1){string temp1 = v.Substring(v.IndexOf("length is '"));length = int.Parse(temp1.Split('\'')[1]);}if (v.IndexOf("zip length is '") != -1){string temp1 = v.Substring(v.IndexOf("zip length is '"));zip_length = int.Parse(temp1.Split('\'')[1]);}if (v.IndexOf("hash code is '") != -1){string temp1 = v.Substring(v.IndexOf("hash code is '"));temp1 = temp1.Split('\'')[1];hash_code = int.Parse(temp1.Split('[')[0]);}if (v.IndexOf("zip hash code is '") != -1){string temp1 = v.Substring(v.IndexOf("zip hash code is '"));temp1 = temp1.Split('\'')[1];zip_hash_code = int.Parse(temp1.Split('[')[0]);}}//Debug.LogError("maxNum:" + maxNum);//Debug.LogError("length:" + length);//Debug.LogError("hash_code:" + hash_code);//Debug.LogError("zip_length:" + zip_length);//Debug.LogError("zip_hash_code:" + zip_hash_code);GameVersionInfo versionConfig = JsonUtility.FromJson<GameVersionInfo>(versionStr);versionConfig.InternalResourceVersion = maxNum;versionConfig.VersionListLength = length;versionConfig.VersionListHashCode = hash_code;versionConfig.VersionListZipLength = zip_length;versionConfig.VersionListZipHashCode = zip_hash_code;File.WriteAllText(path, JsonUtility.ToJson(versionConfig, true));AssetDatabase.SaveAssets();AssetDatabase.Refresh();}else{Debug.LogError("完全沒有任何文件");}} }

?

總結

以上是生活随笔為你收集整理的GameFramework框架——辅助工具的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。