protected override void DidActivate(bool firstActivation, ActivationType type) { if (!string.IsNullOrEmpty(ContentFilePath)) { if (ContentChanged && !firstActivation) { ContentChanged = false; ParseWithFallback(); } else if (firstActivation) { ParseWithFallback(); } bool registered = WatcherGroup.RegisterViewController(this); #if HRVC_DEBUG if (registered) { Logger.log.Info($"Registered {this.name}"); } else { Logger.log.Error($"Failed to register {this.name}"); } #endif } else { ParseWithFallback(); } didActivate?.Invoke(firstActivation, type); }
public static bool RegisterViewController(IHotReloadableController controller) { string contentFile = controller.ContentFilePath; if (string.IsNullOrEmpty(contentFile)) { return(false); } string contentDirectory = Path.GetDirectoryName(contentFile); if (!Directory.Exists(contentDirectory)) { return(false); } WatcherGroup watcherGroup; if (!WatcherDictionary.TryGetValue(contentDirectory, out watcherGroup)) { watcherGroup = new WatcherGroup(contentDirectory); WatcherDictionary.Add(contentDirectory, watcherGroup); } watcherGroup.BindController(controller); return(true); }
protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { if (ContentChanged && !firstActivation) { ContentChanged = false; ParseWithFallback(); } else if (firstActivation) { ParseWithFallback(); } bool registered = WatcherGroup.RegisterViewController(this); #if HRVC_DEBUG if (registered) { Logger.log.Info($"Registered {this.name}"); } else { Logger.log.Error($"Failed to register {this.name}"); } #endif didActivate?.Invoke(firstActivation, addedToHierarchy, screenSystemEnabling); }
protected override void DidDeactivate(DeactivationType deactivationType) { _content = null; #if HRVC_DEBUG Logger.log.Warn($"DidDeactive: {GetInstanceID()}:{name}"); #endif if (!WatcherGroup.UnregisterViewController(this)) { #if HRVC_DEBUG Logger.log.Warn($"Failed to Unregister {GetInstanceID()}:{name}"); #endif } base.DidDeactivate(deactivationType); }
protected override void DidDeactivate(bool removedFromHierarchy, bool screenSystemDisabling) { _content = null; #if HRVC_DEBUG Logger.log.Warn($"DidDeactive: {GetInstanceID()}:{name}"); #endif if (!WatcherGroup.UnregisterViewController(this)) { #if HRVC_DEBUG Logger.log.Warn($"Failed to Unregister {GetInstanceID()}:{name}"); #endif } base.DidDeactivate(removedFromHierarchy, screenSystemDisabling); }