internal void PropagateStage() { if (Parent is Stage) { // if Owner is Stage... Stage = (Stage)Parent; } else // else look for parents Stage (Owner should already be InternalStructureBuilt) { if (Parent.Stage != null) { Stage = Parent.Stage; } } }
public static void InitStageStyles(Stage stage) { //LogUtil.PrintCurrentMethod(); try { stage.RegenerateStyleCache(true); stage.StyleChanged(null); stage.NotifyStyleChangeInChildren(null, null, true); stage.StylesInitialized(); } catch (Exception ex) { //Debug.LogError(ex.Message); throw new Exception("Couldn't init Stage styles for stage: " + stage, ex); } }
// ReSharper disable UnusedMember.Local void OnEnable() // ReSharper restore UnusedMember.Local { //Debug.Log("Gui started."); if (!enabled) return; // do not register this stage #if DEBUG if (DebugMode) Debug.Log("Gui started."); #endif Stage = new Stage // moved before OnStart() on 20120414 { MouseEnabled = MouseEnabled, Enabled = enabled, ZIndex = ZIndex, Matrix = Matrix, Id = Id }; // NOTE: calling OnStart() here OnStart(); if (null != _layout) Stage.Layout = _layout; // TODO: use AddEventListener notation internally! Stage.AddEventListener(FrameworkEvent.PREINITIALIZE, PreinitializeHandler, EventPhase.Target); Stage.AddEventListener(FrameworkEvent.INITIALIZE, InitializeHandler, EventPhase.Target); Stage.AddEventListener(FrameworkEvent.CREATION_COMPLETE, CreationCompleteHandler, EventPhase.Target); // subscribe to when ready to have children :) Stage.AddEventListener(FrameworkEvent.PREINITIALIZE, delegate { //Debug.Log("*preinitialize"); CreateChildren(); // run CreateChildren method from Gui }, EventPhase.Target); Stage.Register(); // if in editor, monitor the GUI state (this is an optimization) if (Application.isEditor) SystemManager.Instance.UpdateSignal.Connect(InEditorUpdateSlot); }
public void UnregisterStage(Stage stage) { #if DEBUG if (DebugMode) { Debug.Log("Unregistering stage: " + stage); Debug.Log("Contains: " + _stageListDesc.Contains(stage)); } #endif _stageListDesc.Remove(stage); _stageListAsc.Remove(stage); }
private static void InitStageStyles(Stage stage/*, bool fireStylesInitialized*/) { try { stage.RegenerateStyleCache(true); stage.StyleChanged(null); stage.NotifyStyleChangeInChildren(null, null, true); /*if (fireStylesInitialized) */ stage.StylesInitialized(); } catch (Exception ex) { //Debug.LogError(ex.Message); throw new Exception("Couldn't init Stage styles", ex); } }
public void RegisterStage(Stage stage) { #if DEBUG if (DebugMode) Debug.Log(string.Format("Registering stage [{0}] at depth {1}", stage, stage.ZIndex)); #endif if (_stageListDesc.Contains(stage)) { Debug.LogWarning(string.Format("Multiple registration of the same Stage [{0}]", stage)); return; } if (_stageListDesc.Exists(delegate(Stage s) { return s.ZIndex == stage.ZIndex; })) Debug.LogWarning(string.Format("Note: Duplicated stage Z-index: {0} [{1}]", stage.ZIndex, stage)); // add it to the collection (it has to be done prior to running the StyleInitializer, because the initializer uses this list _stageListDesc.Add(stage); // resize to screen size /*stage.Width = _size.X; stage.Height = _size.Y;*/ stage.SetActualSize(_size.X, _size.Y); // NOTE: without the explicit sizing, loading mask doesn't center itself (?) (20131217) // (also should be done on screen resize) stage.Width = _size.X; stage.Height = _size.Y; StyleInitializer.Run(); InitStageStyles(stage); // initialize (create children etc.) stage.Initialize(); // sort stage list by depth on each addition Sort(); }
/// <summary> /// Add the stage to the exclude list /// </summary> /// <param name="stage"></param> public static void ExcludeStage(Stage stage) { if (!ExcludedStages.Contains(stage)) ExcludedStages.Add(stage); }
/// <summary> /// Creates a new instance of Stage /// </summary> /// <returns></returns> public override Component NewInstance() { Stage = new Stage(); return Stage; }