public static void DumpAll() { LogUtil.Debug("BundleManager.DumpAll:"); DumpBundleRefs(); DumpBundleLoadHistories(); DumpBundleLists(); }
public static void DumpBundleLists() { LogUtil.Debug("---------------------------------------------------------"); LogUtil.Debug("listAssetBundleUris:"); foreach (string uri in listAssetBundleUris) { LogUtil.Debug("uri=" + uri); } LogUtil.Debug("---------------------------------------------------------"); LogUtil.Debug("loadingBundles:"); foreach (string uri in loadingBundles) { LogUtil.Debug("uri=" + uri); } LogUtil.Debug("---------------------------------------------------------"); LogUtil.Debug("tempUriList:"); foreach (string uri in tempUriList) { LogUtil.Debug("uri=" + uri); } LogUtil.Debug("curUnloadIndex=" + curUnloadIndex); }
public void Dump() { foreach (var pair in _sprites) { LogUtil.Debug(pair.Key); LogUtil.Debug(pair.Value.name); } }
/* ====================================================== */ private static void selfTest() { byte[][] testData = new byte[4][]; testData[0] = new byte[] { 0xDE, 0xAD, 0xBE, // EF }; testData[1] = new byte[] { 0x00, 0x01, 0xA2, 0xB3, 0xC4, 0xD5, 0xE6, 0xF7, }; testData[2] = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, }; testData[3] = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xFF, }; foreach (Encoding enc in Enum.GetValues(typeof(Encoding))) { if (enc == Encoding.Unity || enc == Encoding.Unknown) { continue; } var testLength = testData.Length; for (int j = 0; j < testLength; j++) { byte[] data = testData[j]; var dataLength = data.Length; byte[] temp = new byte[dataLength]; Array.Copy(data, temp, dataLength); MemoryStream ms = new MemoryStream(); EncodeStream(ms, temp, enc); byte[] decrypted = DecodeData(ms.GetBuffer(), 0, ms.Length); ms.Close(); for (int i = 0; i < dataLength; i++) { if (data[i] != decrypted[i]) { throw new Exception("BundlerEncoder selfTest: fail at " + enc + " data " + j + " index " + i); } } LogUtil.Debug("BundleEncoder selfTest: success with " + enc + " data " + j); } } }
// Prepare the path of asset bundle file in file system // Android just needs to modify the path a bit when loading bundle from streaming assets public static string PrepareBundleFile(string path) { #if PROFILE_FILE Profiler.BeginSample("FileUtils.PrepareBundleFile"); #endif var length = searchPaths.Count; for (int i = 0; i < length; ++i) { string p = searchPaths[i]; string fullpath = p + path; string actualPath = null; #if UNITY_ANDROID && !UNITY_EDITOR // For android, copy bundle from streaming assets to update path if (IsFileExistsInPersistentData(fullpath, out actualPath)) { LogUtil.Debug("PrepareBundleFile: found in persistent path " + fullpath); #if PROFILE_FILE Profiler.EndSample(); #endif return(actualPath); } else if (IsFileExistsInStreamingAssets(fullpath)) { string fixedPath = Application.dataPath + "!assets/" + fullpath; LogUtil.Debug("PrepareBundleFile: found in streaming assets " + fullpath + " fixed: " + fixedPath); #if PROFILE_FILE Profiler.EndSample(); #endif return(fixedPath); } else if (IsFileExistsInRawPath(fullpath, out actualPath)) { LogUtil.Debug("PrepareBundleFile: found in raw path " + fullpath); #if PROFILE_FILE Profiler.EndSample(); #endif return(actualPath); } #else if (IsFileExistsNoSearching(fullpath, out actualPath)) { #if PROFILE_FILE Profiler.EndSample(); #endif return(actualPath); } #endif // UNITY_ANDROID } throw new Exception("PrepareBundleFile: cannot find file " + path); }
public static void DumpBundleLoadHistories() { LogUtil.Debug("---------------------------------------------------------"); LogUtil.Debug("BundleLoadHistories:"); foreach (KeyValuePair <string, AssetBundleLoadHistory> pair in dictAssetBundleLoadHistories) { var abLoadHistory = pair.Value; LogUtil.Debug("key=" + pair.Key + " uri=" + abLoadHistory.uri + " loadTimes=" + abLoadHistory.loadTimes + " unloadTimes=" + abLoadHistory.unloadTimes); } }
public static void DumpBundleRefs() { LogUtil.Debug("---------------------------------------------------------"); LogUtil.Debug("BundleRefs:"); foreach (KeyValuePair <string, AssetBundleRef> pair in dictAssetBundleRefs) { var abRef = pair.Value; LogUtil.Debug("key=" + pair.Key + " uri=" + abRef.uri + " endTime=" + abRef.EndTime + " secondsToLive=" + abRef.SecondsToLive); } }
public void OnApplicationPause(bool pauseStatus) { LogUtil.Debug("== App paused: " + pauseStatus); paused = pauseStatus; if (paused) { AppLifecycle.PauseApp(); } else { AppLifecycle.ResumeApp(); } }
void Start() { LogUtil.Debug("Start ShowStats"); f_LastInterval = Time.realtimeSinceStartup; i_Frames = 0; DontDestroyOnLoad(this.gameObject); if (!Debug.isDebugBuild) { this.enabled = false; } }
public IEnumerator waitForDebugConnection(Action complete) { lgo.skipDebugger = false; LogUtil.Debug("Waiting for debug connection"); while (true) { yield return(new WaitForSeconds(0.1f)); if (lgo.skipDebugger) { break; } } complete(); }
public static Encoding GetEncodingOfFile(string filepath) { #if MULTI_ENCODING LogUtil.Debug("GetEncodingOfFile: MULTI_ENCODING enabled"); const long headerSize = 2; long bytesRead = 0; byte [] data = FileUtils.GetDataFromFile(filepath, 0, headerSize, out bytesRead); if (bytesRead == headerSize) { return(GetEncodingOfData(data)); } return(Encoding.Unknown); #else return(Encoding.Unity); #endif // MULTI_ENCODING }
public static bool CopyFileFromAppJar(string srcfile, string dstfile, bool overwrite) { if (!overwrite && File.Exists(dstfile)) { LogUtil.Debug("FileUtilsAndroid: copyDataFromAppJarFile dstfile already exists! " + dstfile); return(false); } int res = copyDataFromAppJarFile(srcfile, dstfile, 0, 0); if (res == 0) { return(true); } else { LogUtil.Error("FileUtilsAndroid: copyDataFromAppJarFile failed! res=" + res); return(false); } }
// TODO avoid coping data from C heap to managed heap // maybe optimize by getting file length and preallocate in C# public static byte [] ReadDataFromAppJar(string path, long readOffset, long readSize, out long bytesRead) { #if PROFILE_FILE Profiler.BeginSample("FileUtilsAndroid.ReadDataFromAppJar"); #endif IntPtr L = IntPtr.Zero; try { L = readDataFromAppJarFile(path, readOffset, readSize); if (L != IntPtr.Zero) { long size = Marshal.ReadInt64(L); LogUtil.Debug("read from jar, size is " + size + " readOffset is " + readOffset + " readSize is " + readSize); byte [] data = new byte[size]; Marshal.Copy(new IntPtr(L.ToInt64() + sizeof(Int64)), data, 0, (int)size); bytesRead = size; #if PROFILE_FILE Profiler.EndSample(); #endif return(data); } else { LogUtil.Error("FileUtilsAndroid: read from jar failed! " + path); bytesRead = 0; #if PROFILE_FILE Profiler.EndSample(); #endif return(null); } } finally { if (L != IntPtr.Zero) { freeData(L); } } }
//------------------ Sync Interfaces ------------------// public bool Connect() { if (sock != null) { LogUtil.Debug("ClientSocket.Connect: close first"); return(false); } IPEndPoint remoteEP = null; initSocket(out remoteEP); try { sock.Connect(remoteEP); return(true); } catch (SocketException e) { LogUtil.ErrorFormat("ClientSocket.Connect: {0}", e.ToString()); } return(false); }
void StartLua() { ComponentReflectionExt.Init(); var luaBridge = LBootApp.luaBridge; var runDebugScript = luaBridge.DoString("return rawget(_G, 'SCRIPT') == 'debug'"); if (true.Equals(runDebugScript)) { LogUtil.Debug("running debug scripts"); var fname = "debug.lua"; byte[] scriptSource = FileUtils.GetDataFromStreamingAssets(fname); luaBridge.DoBuffer(scriptSource, fname); } else { LogUtil.Debug("running compiled scripts"); var fname = "cl.lc"; byte[] scriptSource = FileUtils.GetDataFromStreamingAssets(fname); luaBridge.DoAesBuffer(scriptSource, fname, LBootApp.LUA_KEY, LBootApp.LUA_IV); luaBridge.Call("__main", new object[1] { "" }); } // 4 times faster for FastGetter FastSetter than using reflection // var go = new GameObject("hello"); // var t = go.transform; // t.position = Vector3.one; // var startTime = Time.realtimeSinceStartup; // object value = null; // for (var i = 0; i < 1000; i++) // { // var positionProperty = ReflectionHelper.GetProperty(t.GetType(), "position"); // value = positionProperty.GetValue(t, null); // } // Debug.LogError("Reflection getter position=" + value.ToString()); // var time = Time.realtimeSinceStartup; // Debug.LogError("reflection getter duration = " + ((time - startTime) * 1000).ToString() + "(ms)"); // // startTime = Time.realtimeSinceStartup; // // for (var i = 0; i < 1000; i++) // { // value = ComponentReflectionExt.FastGetter(t, "position"); // } // Debug.LogError("FastGetter position=" + value.ToString()); // // time = Time.realtimeSinceStartup; // Debug.LogError("Component FastGetter duration = " + ((time - startTime) * 1000).ToString() + "(ms)"); // // var angle = Vector3.one * 100; // startTime = Time.realtimeSinceStartup; // for (var i = 0; i < 1000; i++) // { // var positionProperty = ReflectionHelper.GetProperty(t.GetType(), "localEulerAngles"); // positionProperty.SetValue(t, angle, null); // } // // time = Time.realtimeSinceStartup; // Debug.LogError("reflection setter localEulerAngles=" + t.localEulerAngles.ToString()); // Debug.LogError("reflection setter duration = " + ((time - startTime) * 1000).ToString() + "(ms)"); // t.localEulerAngles = Vector3.one; // angle = new Vector3(199, 199, 199); // startTime = Time.realtimeSinceStartup; // for (var i = 0; i < 1000; i++) // { // ComponentReflectionExt.FastSetter(t, "localEulerAngles", angle); // } // // time = Time.realtimeSinceStartup; // Debug.LogError("FastGetter localEulerAngles=" + t.localEulerAngles.ToString()); // Debug.LogError("Component FastSetter duration = " + ((time - startTime) * 1000).ToString() + "(ms)"); }
public static void RestartApp(bool withUpdate) { LogUtil.Debug("== RestartApp"); new RestartApp(withUpdate).Restart(); }
public static void PauseApp() { LogUtil.Debug("== PauseApp"); new PauseApp().Pause(); }
public static void ResumeApp() { LogUtil.Debug("== ResumeApp"); new ResumeApp().Resume(); }
public void ReceivedMemoryWarning(string message) { LogUtil.Debug("== App ReceivedMemoryWarning: " + message); AppLifecycle.ReceivedMemoryWarning(); }
public void OnApplicationQuit() { LogUtil.Debug("== App quit: "); AppLifecycle.ShutdownApp(); }
public static void ShutdownApp() { LogUtil.Debug("== ShutdownApp"); new ShutdownApp().Shutdown(); }
// public void OnLevelWasLoaded(int levelId) // { // LogUtil.Debug("== Level Loaded: " + Application.loadedLevelName); // } public void OnDestroy() { LBootApp.Instance = null; LogUtil.Debug("== App destroy: "); }
public void Start() { LogUtil.Debug("== App start: "); AppLifecycle.BootstrapApp(this.gameObject); }
public static void ReceivedMemoryWarning() { LogUtil.Debug("== ReceivedMemoryWarning"); new ReceivedMemoryWarning().Notify(); }
public static void BootstrapApp(GameObject initGameObject) { LogUtil.Debug("== BootstrapApp"); new BootstrapApp(initGameObject).Bootstrap(); }