using Thousandto.Core.Framework; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEngine; namespace Thousandto.Profiler.Editor { /// /// 打包工具的额外菜单,比如fls操作,在dll里面不方便定菜单,挪到这里 /// public class ProfilerEditorUtils { public static Texture WhiteBlank; public static Texture BlackBlank; static ProfilerEditorUtils() { InitTexBlank(); } //标题栏内容 public static string[] TitleArray = new string[] { "开始加载", "结束加载", "加载耗时", "使用次数", "卸载时间", "卸载次数", "生存时间", }; public static void GetProfilerInformation() { var info = AssetsProfiler.Information(); SaveInfo("../info.txt", info); UnityEngine.Debug.Log(info); } public static void GetHistoryInformation() { var info = AssetsProfiler.HistoryInformation(); SaveInfo("../historyInfo.txt", info); UnityEngine.Debug.Log(info); } public static void SaveInfo(string path, string info) { File.WriteAllText(path, info); } public static Texture2D CreateColorTex(Color color, int w, int h) { Texture2D tex = new Texture2D(w, h); for (int i = 0; i < w; ++i) { for (int n = 0; n < h; ++n) { tex.SetPixel(i, n, color); } } tex.Apply(); return tex; } private static void InitTexBlank() { WhiteBlank = CreateColorTex(new Color(1, 1, 1, 0.01f), 10, 10); BlackBlank = CreateColorTex(new Color(0, 0, 0, 0.1f), 10, 10); } } }