public static void Save() { reader.Put(DiService.ENABLED, DiService.enableDi); reader.Save(FILE_PATH); AssetDatabase.ImportAsset(FILE_PATH, ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUpdate); DiService.LoadPreference(); }
// [RuntimeInitializeOnLoadMethod] public static DiService Create() { LoadPreference(); if (enableDi) { DiService di = UnityEngine.Object.FindObjectOfType <DiService>(); if (di == null) { GameObject go = new GameObject("_di"); di = go.AddComponent <DiService>(); } return(di); } return(null); }
public static void InjectDependency() { if (!Application.isEditor || !DiService.enableDi) { return; } DiService di = UnityEngine.Object.FindObjectOfType <DiService>(); if (di == null) { di = DiService.Create(); } var changeList = di.ResolveScene(allScripts); foreach (var m in changeList) { EditorUtil.SetDirty(m); } if (!changeList.IsEmpty()) { EditorUtil.SetDirty(di); } }
public static bool IsInjectDependency() { DiService.LoadPreference(); return(DiService.enableDi); }