//--------------------------------------------------------------------- public void RecoverSettings(AllControllers allControllers) { this.BasicSettingController = allControllers.basicSettingController; this.FilterSettingController = allControllers.filterSettingController; this.ImportExportSettingController = allControllers.importExportSettingController; this.MiscellaneousSettingController = allControllers.miscellaneousSettingController; }
private void OnDestroy() { // Remove. AllControllers.Remove(this); // Try to unregister events UnRegisterEvents(); }
public static T GetController <T>() where T : class, IController { T result = default; if (AllControllers.TryGetValue(typeof(T), out var controller)) { result = controller as T; } return(result); }
//--------------------------------------------------------------------- public void UpdateSettings(ProjectSelectionKind kind) { if (this.StartUpProjectSettingsBuilder == null) { throw new InvalidOperationException("StartUpProjectSettingsBuilder should be set."); } if (File.Exists(settingsFile)) { AllControllers allControllers = JsonConvert.DeserializeObject <AllControllers>(File.ReadAllText(settingsFile)); if (allControllers.basicSettingController.CurrentProject.Equals(this.StartUpProjectSettingsBuilder.ComputeSettings(kind).ProjectName)) { RecoverSettings(allControllers); return; } } UpdateStartUpProject(kind); }
private void Awake() => AllControllers.Add(this);