void Update() { isDrawPhase = false; if (FlashResources.isPlatformReloadingEnabled) { FlashResources.reloadPendingResources(); } if (_shaderDirty) { sceneBatch.shader = shader; debugBatch.shader = shader; _shaderDirty = false; } if (_resourceDirty) { UpdateContent(); _resourceDirty = false; } isDrawPhase = true; debugBatch.Begin(GetGlobalMatrix()); root.Draw(); drawEvent.Dispatch(); debugBatch.renderQueue = sceneBatch.renderQueue + 1; debugBatch.End(); isDrawPhase = false; }
protected DisplayObject[] ConstructFromResource() { var count = _timeLine.instances.Length; var instances = new DisplayObject[count]; for (int i = 0; i < count; i++) { var instName = _timeLine.instances[i].name; var resourcePath = _timeLine.GetResourcePath(i); var resource = FlashResources.GetResource <IDisplayResource>(resourcePath); DisplayObject instance; if (resource != null) { instance = resource.CreateInstance(); } else if (resourcePath == "flash/text/TextField") { instance = new TextLabel() { text = ":-)" }; } else { var className = resourcePath .Replace("Placeholders/", "") .Replace("/", "."); var type = Type.GetType(className); if (type != null) { instance = (DisplayObject)Activator.CreateInstance(type); } else { throw new Exception("Resource not found: " + resourcePath); } } instance.name = instName; instances[i] = instance; var field = GetType().GetField(instName); if (field != null && field.FieldType.IsInstanceOfType(instance)) { field.SetValue(this, instance); } } return(instances); }
private void Reload() { if (FlashResources.logLevel <= LogLevel.DEBUG) { Debug.LogWarning("Reloading..."); } _descriptions = null; FlashResources.UnloadBundle(this); FlashResources.LoadBundle(this); AddBundleWatcher(); }
void UpdateContent() { root.RemoveChildren(); if (resourcePath.IsNullOrEmpty()) { return; } var bundleName = resourcePath.Split("/")[0]; var bundle = FlashResources.GetBundleInstance(bundleName); if (bundle == null) { Debug.Log("Bundle not found: " + bundleName); return; } if (!bundle.isLoaded) { FlashResources.LoadBundle(bundle); } var resource = FlashResources.GetResource <IDisplayResource>(resourcePath); if (resource == null) { Debug.Log("Resource not found: " + resourcePath); return; } var instance = resource.CreateInstance(); root.AddChild(instance); if (isPlaying) { if (instance.totalFrames > 1) { instance.Play(); } else { var displayContainer = instance as DisplayContainer; if (displayContainer != null) { displayContainer.PlayAllChildren(); } } } }
/// <summary> /// Calls FlashResources.UnloadBundle(this); /// </summary> public void Unload() { FlashResources.UnloadBundle(this); }
/// <summary> /// Calls FlashResources.LoadBundle(this); /// </summary> public void Load() { FlashResources.LoadBundle(this); }