public AdvancedTools() { InitializeComponent(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; _advanced = new AdvancedOperations(); LoadAccents(); LoadBackupTypes(); CheckDeviceConnection.Click += delegate { new DeviceWindow().Show(); }; }
private LoadOperation LoadAssetInternal <TAssetType, TParam>(string varBundleName, string varAssetName, bool varPriority, LoadAssetCallback <TAssetType> varCallBack, TParam varBackParam) where TAssetType : UnityEngine.Object { LoadOperation tempOperation = AnalysisEnvAssetOperation <TAssetType>(varBundleName, varAssetName, varCallBack); tempOperation.CallbackParam = new ResourceLoadParam <TParam>(varBundleName, varAssetName, varBackParam); if (varPriority) { AdvancedOperations.Add(tempOperation); } else { WaitingOperations.Add(tempOperation); } AutoPrepareEnv(); return(tempOperation); }
public static void ComparePerformance(decimal value, AdvancedOperations function) { var result = value; Stopwatch stopwatch = new Stopwatch(); for (var j = 0; j < TestsCount; j++) { var testNumber = value; stopwatch.Start(); for (var i = 0; i < RepeatFunctionsCount; i++) { switch (function) { case AdvancedOperations.SqrRoot: testNumber = (decimal)Math.Sqrt((double)value); break; case AdvancedOperations.Logarithm: testNumber = (decimal)Math.Log((double)value); break; case AdvancedOperations.Sinus: testNumber = (decimal)Math.Sin((double)value); break; } } stopwatch.Stop(); } Console.WriteLine(value.GetType().ToString() + " time in milliseconds: " + stopwatch.Elapsed.Milliseconds / TestsCount); }
private IEnumerator LoadLooper() { while (true) { if (AdvancedOperations.Count > 0) { mEmptyRunTimes = 0; for (int i = 0; i < AdvancedOperations.Count; i++) { LoadOperation tempOper = AdvancedOperations[0]; #if LogFlag DateTime tempBegin = DateTime.Now; Debug.Log(string.Format("ResourceManager.cs Looper yield return new coroutine [{0}.{1}] .", tempOper.CallbackParam.AssetBundleName, tempOper.CallbackParam.AssetName)); #endif if (false == tempOper.Execute()) { yield return(mGameService.StartCoroutine(tempOper)); } #if LogFlag Debug.Log(string.Format("ResourceManager.cs Looper success [{0}.{1}] Cost second : {2}ms." , tempOper.CallbackParam.AssetBundleName, tempOper.CallbackParam.AssetName , DateTime.Now.Subtract(tempBegin).TotalMilliseconds)); #endif try { tempOper.Finish(); } catch (Exception e) { #if LogFlag string tempError = string.Format("ResourceManager.cs Looper success,but some exception occuried. LoadOperation : [{0}],Asset : [{1}|{2}] \n Exception : {3} \n StackTrace : {4}", tempOper, tempOper.CallbackParam.AssetBundleName, tempOper.CallbackParam.AssetName, e.Message, e.StackTrace); Debug.LogError(tempError); #endif } AdvancedOperations.RemoveAt(0); i--; } } if (WaitingOperations.Count > 0) { mEmptyRunTimes = 0; LoadOperation tempOper = WaitingOperations[0]; #if LogFlag DateTime tempBegin = DateTime.Now; Debug.Log(string.Format("ResourceManager.cs Looper yield return new coroutine [{0}.{1}] .", tempOper.CallbackParam.AssetBundleName, tempOper.CallbackParam.AssetName)); #endif if (false == tempOper.Execute()) { yield return(mGameService.StartCoroutine(tempOper)); } #if LogFlag Debug.Log(string.Format("ResourceManager.cs Looper success [{0}.{1}] Cost second : {2}ms." , tempOper.CallbackParam.AssetBundleName, tempOper.CallbackParam.AssetName , DateTime.Now.Subtract(tempBegin).TotalMilliseconds)); #endif try { tempOper.Finish(); } catch (Exception e) { #if LogFlag string tempError = string.Format("ResourceManager.cs Looper success,but some exception occuried. LoadOperation : [{0}],Asset : [{1}|{2}] \n Exception : {3} \n StackTrace : {4}", tempOper, tempOper.CallbackParam.AssetBundleName, tempOper.CallbackParam.AssetName, e.Message, e.StackTrace); Debug.LogError(tempError); #endif } WaitingOperations.RemoveAt(0); } mEmptyRunTimes++; #if EditorVersion ShowWaitOpertionNum(); #endif if (mEmptyRunTimes >= ResConfig.EmptyRunLimit) { yield break; } yield return(null); } }