public void DrawNodeCurve(UnityEngine.UI.Windows.AttachItem attachItem, UnityEngine.UI.Windows.Plugins.Flow.Data.FlowWindow from, UnityEngine.UI.Windows.Plugins.Flow.Data.FlowWindow to, bool doubleSide) { if (from.IsEnabled() == false || to.IsEnabled() == false) { return; } var fromRect = from.rect; var toRect = to.rect; if (from != null && to != null) { var delta = Flow.OnDrawNodeCurveOffset(this.editor, attachItem, from, to, doubleSide); fromRect.center += delta; } Rect centerStart = fromRect; Rect centerEnd = toRect; var fromComponent = false; var toComponent = false; if (from.IsFunction() == true && from.IsContainer() == false) { var func = FlowSystem.GetWindow(from.GetFunctionId()); if (func != null) { var selected = FlowSystem.GetSelected(); var isSelected = selected.Contains(from.id) || (selected.Count == 0 && this.editor.focusedGUIWindow == from.id); if (isSelected == true) { var color = new Color(0f, 0f, 0f, 0.1f); var backColor = new Color(0.5f, 0.5f, 0.5f, 0.1f); this.DrawPolygon(new Vector3(from.rect.xMin, from.rect.yMin, 0f), new Vector3(func.rect.xMin, func.rect.yMin, 0f), new Vector3(func.rect.xMin, func.rect.yMax, 0f), new Vector3(from.rect.xMin, from.rect.yMax, 0f), backColor); this.DrawPolygon(new Vector3(from.rect.xMin, from.rect.yMin, 0f), new Vector3(func.rect.xMin, func.rect.yMin, 0f), new Vector3(func.rect.xMax, func.rect.yMin, 0f), new Vector3(from.rect.xMax, from.rect.yMin, 0f), backColor); this.DrawPolygon(new Vector3(from.rect.xMax, from.rect.yMin, 0f), new Vector3(func.rect.xMax, func.rect.yMin, 0f), new Vector3(func.rect.xMax, func.rect.yMax, 0f), new Vector3(from.rect.xMax, from.rect.yMax, 0f), backColor); this.DrawPolygon(new Vector3(from.rect.xMax, from.rect.yMax, 0f), new Vector3(func.rect.xMax, func.rect.yMax, 0f), new Vector3(func.rect.xMin, func.rect.yMax, 0f), new Vector3(from.rect.xMin, from.rect.yMax, 0f), backColor); this.DrawNodeCurveDotted(new Vector3(from.rect.xMin, from.rect.yMin, 0f), new Vector3(func.rect.xMin, func.rect.yMin, 0f), color ); this.DrawNodeCurveDotted(new Vector3(from.rect.xMin, from.rect.yMax, 0f), new Vector3(func.rect.xMin, func.rect.yMax, 0f), color ); this.DrawNodeCurveDotted(new Vector3(from.rect.xMax, from.rect.yMin, 0f), new Vector3(func.rect.xMax, func.rect.yMin, 0f), color ); this.DrawNodeCurveDotted(new Vector3(from.rect.xMax, from.rect.yMax, 0f), new Vector3(func.rect.xMax, func.rect.yMax, 0f), color ); } } } if (FlowSystem.GetData().HasView(FlowView.Layout) == true) { var comps = from.attachedComponents.Where((c) => c.targetWindowId == to.id && c.sourceComponentTag != LayoutTag.None); foreach (var comp in comps) { var component = from.GetLayoutComponent(comp.sourceComponentTag); if (component != null) { fromRect = centerStart; var rect = component.tempEditorRect; fromRect = new Rect(fromRect.x + rect.x, fromRect.y + rect.y, rect.width, rect.height); this.DrawNodeCurve(from.GetContainer(), to.GetContainer(), from, to, centerStart, centerEnd, fromRect, toRect, doubleSide, 0f); fromComponent = true; } } if (doubleSide == true) { comps = to.attachedComponents.Where((c) => c.targetWindowId == from.id && c.sourceComponentTag != LayoutTag.None); foreach (var comp in comps) { var component = to.GetLayoutComponent(comp.sourceComponentTag); if (component != null) { toRect = centerEnd; var rect = component.tempEditorRect; toRect = new Rect(toRect.x + rect.x, toRect.y + rect.y, rect.width, rect.height); this.DrawNodeCurve(from.GetContainer(), to.GetContainer(), from, to, centerStart, centerEnd, fromRect, toRect, doubleSide, 0f); toComponent = true; } } } } if (fromComponent == false && toComponent == false) { this.DrawNodeCurve(from.GetContainer(), to.GetContainer(), from, to, centerStart, centerEnd, fromRect, toRect, doubleSide); } }
public static Vector2 OnDrawNodeCurveOffset(FlowSystemEditorWindow flowEditor, UnityEngine.UI.Windows.AttachItem attachItem, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSide) { var offset = Vector2.zero; var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>(); foreach (var addon in flowAddons) { addon.flowEditor = flowEditor; offset += addon.OnFlowDrawNodeCurveOffset(attachItem, fromWindow, toWindow, doubleSide); } return(offset); }
public static T DoFlow <T>(IFunctionIteration screen, AttachItem item, bool hide, System.Action <T> onParametersPassCall, System.Action <T> onInstance = null, bool async = false) where T : WindowBase { return(WindowSystemFlow.DoFlow <T>(screen, item, hide, false, async, onParametersPassCall, onInstance)); }
public bool Hide(AttachItem transitionItem) { return(this.sourceWindow.Hide(transitionItem)); }
public virtual Vector2 OnFlowDrawNodeCurveOffset(UnityEngine.UI.Windows.AttachItem attachItem, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSide) { return(Vector2.zero); }
/// <summary> /// Shows window of T type. /// Returns null if window not registered. /// </summary> /// <param name="transition">Transition Item.</param> /// <param name="source">Source.</param> /// <param name="parameters">OnParametersPass() values.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public static T Show <T>(AttachItem transitionItem, T source, System.Action <T> onParametersPassCall, params object[] parameters) where T : WindowBase { return(WindowSystem.ShowWithParameters <T>(null, transitionItem, source, onParametersPassCall, parameters)); }
/// <summary> /// Shows window of T type. /// Returns null if window not registered. /// </summary> /// <param name="afterGetInstance">On create predicate.</param> /// <param name="transition">Transition Item.</param> /// <param name="parameters">OnParametersPass() values.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public static T Show <T>(System.Action <T> afterGetInstance, AttachItem transitionItem, System.Action <T> onParametersPassCall, params object[] parameters) where T : WindowBase { return(WindowSystem.ShowWithParameters <T>(afterGetInstance, transitionItem, null, onParametersPassCall, parameters)); }
/// <summary> /// Hide the specified onHideEnd with specific transition. /// Wait while all components, animations, events and modules return the callback. /// </summary> /// <param name="onHideEnd">On hide end.</param> /// <param name="transition">Transition.</param> /// <param name="transitionParameters">Transition parameters.</param> public bool Hide(System.Action onHideEnd, AttachItem transitionItem) { return(this.Hide_INTERNAL(onHideEnd, transitionItem)); }
private IEnumerator Hide_INTERNAL_YIELD(System.Action onHideEnd, AttachItem transitionItem) { while (this.paused == true) { yield return(false); } this.activeIteration = 0; this.SetInactive(); if (this.preferences.sendActiveState == true) { WindowSystem.SendActiveStateByWindow(this); } var parameters = AppearanceParameters.Default(); var counter = 0; System.Action callback = () => { if (this.currentState != WindowObjectState.Hiding) { return; } ++counter; if (counter < 6) { return; } WindowSystem.AddToHistory(this); #if UNITY_EDITOR Profiler.BeginSample("WindowBase::OnHideEnd()"); #endif this.DoLayoutHideEnd(parameters); this.modules.DoHideEnd(parameters); this.audio.DoHideEnd(parameters); this.events.DoHideEnd(parameters); this.transition.DoHideEnd(parameters); this.DoHideEnd(parameters); if (onHideEnd != null) { onHideEnd(); } #if UNITY_EDITOR Profiler.EndSample(); #endif this.currentState = WindowObjectState.Hidden; this.Recycle(setInactive: this.TurnOff()); }; parameters = parameters.ReplaceCallback(callback); #if UNITY_EDITOR Profiler.BeginSample("WindowBase::OnHideBegin()"); #endif this.DoLayoutHideBegin(parameters); this.modules.DoHideBegin(parameters); if (transitionItem != null && transitionItem.audioTransition != null) { this.audio.DoHideBegin(transitionItem.audioTransition, transitionItem.audioTransitionParameters, parameters); } else { this.audio.DoHideBegin(parameters); } this.events.DoHideBegin(parameters); if (transitionItem != null && transitionItem.transition != null) { this.transition.DoHideBegin(transitionItem.transition, transitionItem.transitionParameters, parameters); } else { this.transition.DoHideBegin(parameters); } this.DoHideBegin(parameters); #if UNITY_EDITOR Profiler.EndSample(); #endif }
/// <summary> /// Hide window with specific transition. /// </summary> /// <param name="transition">Transition.</param> /// <param name="transitionParameters">Transition parameters.</param> public bool Hide(AttachItem transitionItem) { return(this.Hide_INTERNAL(null, transitionItem)); }
private IEnumerator Show_INTERNAL_YIELD(System.Action onShowEnd, AttachItem transitionItem) { while (this.paused == true) { yield return(false); } this.TurnOn(); var parameters = AppearanceParameters.Default(); var counter = 0; System.Action callback = () => { if (this.currentState != WindowObjectState.Showing) { return; } ++counter; if (counter < 6) { return; } #if UNITY_EDITOR Profiler.BeginSample("WindowBase::OnShowEnd()"); #endif this.DoLayoutShowEnd(parameters); this.modules.DoShowEnd(parameters); this.audio.DoShowEnd(parameters); this.events.DoShowEnd(parameters); this.transition.DoShowEnd(parameters); this.DoShowEnd(parameters); if (onShowEnd != null) { onShowEnd(); } #if UNITY_EDITOR Profiler.EndSample(); #endif this.currentState = WindowObjectState.Shown; }; parameters = parameters.ReplaceCallback(callback); #if UNITY_EDITOR Profiler.BeginSample("WindowBase::OnShowBegin()"); #endif this.DoLayoutShowBegin(parameters); this.modules.DoShowBegin(parameters); if (transitionItem != null && transitionItem.audioTransition != null) { this.audio.DoShowBegin(transitionItem.audioTransition, transitionItem.audioTransitionParameters, parameters); } else { this.audio.DoShowBegin(parameters); } this.events.DoShowBegin(parameters); if (transitionItem != null && transitionItem.transition != null) { this.transition.DoShowBegin(transitionItem.transition, transitionItem.transitionParameters, parameters); } else { this.transition.DoShowBegin(parameters); } this.DoShowBegin(parameters); #if UNITY_EDITOR Profiler.EndSample(); #endif }
/// <summary> /// Show the specified onShowEnd. /// </summary> /// <param name="onShowEnd">On show end.</param> public void Show(System.Action onShowEnd, AttachItem transitionItem) { this.Show_INTERNAL(onShowEnd, transitionItem); }
/// <summary> /// Show window with specific transition. /// </summary> /// <param name="transition">Transition.</param> /// <param name="transitionParameters">Transition parameters.</param> public void Show(AttachItem transitionItem) { this.Show_INTERNAL(null, transitionItem); }
private IEnumerator Hide_INTERNAL_YIELD(System.Action onHideEnd, AttachItem transitionItem) { while (this.paused == true) { yield return(false); } var parameters = AppearanceParameters.Default(); var counter = 0; System.Action callback = () => { if (this.currentState != WindowObjectState.Hiding) { return; } ++counter; if (counter < 6) { return; } WindowSystem.AddToHistory(this); this.Recycle(); this.DoLayoutHideEnd(parameters); this.modules.DoHideEnd(parameters); this.audio.DoHideEnd(parameters); this.events.DoHideEnd(parameters); this.transition.DoHideEnd(parameters); this.DoHideEnd(parameters); if (onHideEnd != null) { onHideEnd(); } this.currentState = WindowObjectState.Hidden; if (this != null && this.gameObject != null) { this.gameObject.SetActive(false); } }; parameters = parameters.ReplaceCallback(callback); this.DoLayoutHideBegin(parameters); this.modules.DoHideBegin(parameters); if (transitionItem != null && transitionItem.audioTransition != null) { this.audio.DoHideBegin(transitionItem.audioTransition, transitionItem.audioTransitionParameters, parameters); } else { this.audio.DoHideBegin(parameters); } this.events.DoHideBegin(parameters); if (transitionItem != null && transitionItem.transition != null) { this.transition.DoHideBegin(transitionItem.transition, transitionItem.transitionParameters, parameters); } else { this.transition.DoHideBegin(parameters); } this.DoHideBegin(parameters); yield return(true); }