public static void OneKeyClear() { CSHotFixCLRBinding.GenerateCLRBinding1a(); CSHotFixCLRBinding.GenerateCLRBinding2a(); InjectEditor.RemoveHotfixInject(); Debug.Log("一键清理完毕"); }
public static void OnScriptsReloaded() { int step = PlayerPrefs.GetInt("CodeManager_OneKeyGen_Step", -1); if (step < 0) { return; } if (step == 1) { try { InjectEditor.HotfixGenDelegate(); step++; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); var definesList = GetDefineSymbols(); if (definesList.Contains("CSHotFix") == false) { definesList.Add("CSHotFix"); ChangeDefineSymbol(definesList); } } catch (System.Exception e) { step = -1; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); Debug.LogError("一键生成注入导出失败," + e.Message); } } else if (step == 2) { try { InjectEditor.HotfixGenStaticField(); step++; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); } catch (System.Exception e) { step = -1; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); Debug.LogError("一键生成注入导出失败," + e.Message); } } else if (step == 0) { try { CSHotFixCLRBinding.GenerateCLRBinding1a(); CSHotFixCLRBinding.GenerateCLRBinding1b(); step++; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); } catch (System.Exception e) { step = -1; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); Debug.LogError("一键生成注入导出失败," + e.Message); } } else if (step == 3) { try { CSHotFixCLRBinding.GenerateCLRBinding2a(); step++; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); //让代码强制编译一次 AssetDatabase.ImportAsset(GenConfigEditor.CSHotFixReCompileFile); AssetDatabase.Refresh(); } catch (System.Exception e) { step = -1; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); Debug.LogError("一键生成注入导出失败," + e.Message); } } else if (step == 4) { try { CSHotFixCLRBinding.GenerateCLRBinding2b(); step++; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); } catch (System.Exception e) { step = -1; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); Debug.LogError("一键生成注入导出失败," + e.Message); } } else if (step == 5) { Debug.Log("一键生成注入导出成功"); step = -1; PlayerPrefs.SetInt("CodeManager_OneKeyGen_Step", step); } }