public static void PushController(string controllerPath, ControllerDelegate onAppear, ControllerDelegate onAppeared) { if (navigationController != null) { navigationController.pushController(controllerPath, onAppear, onAppeared); } }
public static void PushControllerAsFirst(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) { if (navigationController != null) { navigationController.pushController(controller, onAppear, onAppeared); } }
public static void PushController(System.Type controllerType, ControllerDelegate onAppear, ControllerDelegate onAppeared) { if (navigationController != null) { navigationController.pushController(controllerType, null, null); } }
private void InitializeController(Frame frame) { if (_frame == frame) { return; } _frame = frame; frame.Navigated += (s, e) => UpdateNavigationStack(); if (frame.BackStack is ObservableCollection <PageStackEntry> backStack) { backStack.CollectionChanged += (s, e) => UpdateNavigationStack(); } NavigationController.View.AutoresizingMask = UIViewAutoresizing.All; NavigationController.View.Frame = Frame; AddSubview(NavigationController.View); if (_frame.Content is Page startPage) { var viewController = new PageViewController(startPage); NavigationController.PushViewController(viewController, false); } _controllerDelegate = new ControllerDelegate(this); NavigationController.Delegate = _controllerDelegate; }
public static void DismissController(ControllerDelegate onDisappear, ControllerDelegate onDisappeared) { if (navigationController != null) { navigationController.dismissController(onDisappear, onDisappeared); } }
public void dismissToFirstController(ControllerDelegate onDisappear, ControllerDelegate onDisappeared) { if (controllerStacks.Count == 0) { Debug.LogWarning("Controller Stacks is 0"); return; } var current = controllerStacks.Count > 0 ? controllerStacks.Pop() : null; AnimationClip showAnimClip = null, hideAnimClip = null; if (current != null) { GetNavigationAnimation(current.viewController, false, out showAnimClip, out hideAnimClip); } if (current != null) { Animation currentTarget = current.viewController.GetComponent <Animation>(); if (currentTarget != null && hideAnimClip != null) { var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); if (onDisappear != null) { onDisappear(current.viewController); } if (onDisappeared != null && anim != null) { anim.onFinished = (a) => { onDisappeared(current.viewController); }; } } } if (firstActiveController != null) { controllerStacks.Clear(); foreach (var firstController in firstActiveController) { PushToStack(firstController, ""); Animation oldTarget = firstController.GetComponent <Animation>(); if (oldTarget != null && showAnimClip != null) { ActiveAnimation.Play(oldTarget, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); } currentController = firstController; } } PrintControllerStacks(); }
public void PushImageButton() { if (controllerDelegate != null) { controllerDelegate(); } controllerDelegate = null; imageSelector.GetComponent <Animator>().enabled = true; }
public void PushDrawButton() { if (controllerDelegate != null) { controllerDelegate(); } controllerDelegate = null; target.GetComponentInChildren(typeof(Drawer), true).gameObject.SetActive(true); ToggleDrawing(true); StopTransformChange(true); controllerDelegate += Draw; }
public void PushAnimationButton() { if (controllerDelegate != null) { controllerDelegate(); } controllerDelegate = null; animationController = target.GetComponentInChildren <AnimationController>(); animationController.enabled = true; animationController.CreateAnimation(0); ToggleDrawing(false); //StopTransformChange(false); controllerDelegate += Animation; }
public void SetImageNumber(int number) { selectedImageNumber = number; imageSelector.SetActive(false); // Continue PushImageButton imageController = target.GetComponentInChildren <ImageController>(); imageController.enabled = true; imageController.CreateImage(selectedImageNumber); ToggleDrawing(false); StopTransformChange(false); controllerDelegate += Image; }
public void PushTextButton() { if (controllerDelegate != null) { controllerDelegate(); } controllerDelegate = null; GameObject textController = target.GetComponentInChildren(typeof(Texter), true).gameObject; textController.SetActive(true); //! bool textPostButton allows to open the keyboard textController.GetComponent <KeyBoardController>().textPostButton = true; ToggleDrawing(false); StopTransformChange(true); controllerDelegate += Write; }
private void InitializeController(Frame frame) { if (_frame == frame) { return; } _frame = frame; frame.Navigating += OnFrameNavigating; frame.Navigated += OnFrameNavigated; frame.NavigationStopped += OnFrameNavigationStopped; if (frame.BackStack is ObservableCollection <PageStackEntry> backStack) { backStack.CollectionChanged += OnFrameBackStackChanged; } NavigationController.View.AutoresizingMask = UIViewAutoresizing.All; NavigationController.View.Frame = Frame; AddSubview(NavigationController.View); if (_frame.Content is Page startPage) { // When the frame already has content, we add a NavigationRequest in the PageViewController's AssociatedRequests. // Not doing this results in log errors from WillShowViewController and DidShowViewController (the ones about AssociatedRequests being empty). // Then, we push the PageViewController without animations (because the page is already present in the Frame). var pageViewController = new PageViewController(startPage); var navigationEventArgs = new NavigationEventArgs( _frame.CurrentEntry.Instance, NavigationMode.New, _frame.CurrentEntry.NavigationTransitionInfo, _frame.CurrentEntry.Parameter, _frame.CurrentEntry.SourcePageType, null ); pageViewController.AssociatedRequests.Add(new NavigationRequest(_frame, navigationEventArgs)); NavigationController.PushViewController(pageViewController, false); } _controllerDelegate = new ControllerDelegate(this); NavigationController.Delegate = _controllerDelegate; }
public void pushController(string controllerPath, ControllerDelegate onAppear, ControllerDelegate onAppeared) { string[] paths = controllerPath.Split('?'); var path = GetControllerPathUrl(controllerPath); if (paths.Length > 0) { if (mapControllerPath.ContainsKey(path)) { var view = mapControllerPath[path]; if (view != null) { view.controllerParameters = GetControllerPathParams(controllerPath); var navData = pushController(view, onAppear, onAppeared); if (navData != null) { navData.parameter = controllerPath; } } } } }
public void dismissController(ControllerDelegate onDisappear, ControllerDelegate onDisappeared) { if (controllerStacks.Count == 0) { Debug.LogWarning("Controller Stacks is 0"); return; } var current = controllerStacks.Count > 0 ? controllerStacks.Pop() : null; var previous = controllerStacks.Count > 0 ? controllerStacks.Peek() : null; AnimationClip showAnimClip = null, hideAnimClip = null; if (current != null) { GetNavigationAnimation(current.viewController, false, out showAnimClip, out hideAnimClip); } if (current != null && previous != null) { Animation currentTarget = current.viewController.GetComponent<Animation>(); if (currentTarget != null && hideAnimClip != null) { var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); if (onDisappear != null) { onDisappear(current.viewController); } current.viewController.OnDissapear(); anim.onFinished.Add(new EventDelegate(() => { if (onDisappeared != null) { onDisappeared(current.viewController); } current.viewController.OnDisappeared(); })); } } if (previous != null) { Animation oldTarget = previous.viewController.GetComponent<Animation>(); if (oldTarget != null && showAnimClip != null) { var anim = ActiveAnimation.Play(oldTarget, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (string.IsNullOrEmpty(current.parameter) == false) { var param = GetControllerPathParams(previous.parameter); previous.viewController.controllerParameters = param;//.OnControllerParams(param); Debug.LogWarning("===> Prev Param: " + previous.parameter); } previous.viewController.OnAppear(); anim.onFinished.Add(new EventDelegate(() => { previous.viewController.OnAppeared(); })); } currentController = previous.viewController; } PrintControllerStacks(); }
public static void Popup(string controllerPath, float duration, ControllerDelegate onAppear, ControllerDelegate onAppeared) { if (navigationController != null) { navigationController.popup(controllerPath, duration, onAppear, onAppeared); } }
/* public void pushControllerAsFirst(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) { AnimationClip showAnimClip, hideAnimClip; GetNavigationAnimation(true, out showAnimClip, out hideAnimClip); if (controller != null) { if (currentController != null) { Animation currentTarget = currentController.GetComponent<Animation>(); if (currentTarget != null && hideAnimClip != null) { var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); currentController.OnDissapear(); anim.onFinished = (a) => { currentController.OnDisappeared(); }; } } Animation target = controller.GetComponent<Animation>(); if (target != null && showAnimClip != null) { ActiveAnimation animation = ActiveAnimation.Play(target, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (onAppear != null) { onAppear(controller); } controller.OnAppear(); animation.onFinished = (anim) => { if (onAppeared != null) { onAppeared(controller); } controller.OnAppeared(); }; } currentController = controller; PushToStack(controller); } PrintControllerStacks(); }*/ public void pushControllerAsFirst(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) { controllerStacks.Clear(); pushController(controller, onAppear, onAppeared); }
public NavigationData popup(UIPopupViewController controller, float duration, ControllerDelegate onAppear, ControllerDelegate onAppeared) { AnimationClip showAnimClip = null, hideAnimClip = null; if (currentPopup != null) { GetNavigationAnimation(currentController, true, out showAnimClip, out hideAnimClip); } NavigationData navData = null; if (controller != null) { if (currentPopup != null) { currentPopup.gameObject.SetActive(false); currentPopup.OnDissapear(); currentPopup.OnDisappeared(); } /*Animation target = controller.GetComponent<Animation>(); if (target != null && showAnimClip != null) { ActiveAnimation animation = ActiveAnimation.Play(target, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (onAppear != null) { onAppear(controller); } controller.OnAppear(); animation.onFinished.Add(new EventDelegate(() => { if (onAppeared != null) { onAppeared(controller); } controller.OnAppeared(); })); }*/ controller.gameObject.SetActive(true); controller.OnAppear(); controller.OnAppeared(); currentPopup = controller; if (duration > 0) { controller.popupDuration = duration; } StartCoroutine(controller.DismissAutomatically()); } return navData; }
public void pushControllerAsFirst(System.Type controllerType, ControllerDelegate onAppear, ControllerDelegate onAppeared) { controllerStacks.Clear(); pushController(controllerType, onAppear, onAppeared); }
/* * public void pushControllerAsFirst(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) * { * AnimationClip showAnimClip, hideAnimClip; * GetNavigationAnimation(true, out showAnimClip, out hideAnimClip); * * if (controller != null) * { * if (currentController != null) * { * Animation currentTarget = currentController.GetComponent<Animation>(); * if (currentTarget != null && hideAnimClip != null) * { * var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); * currentController.OnDissapear(); * * anim.onFinished = (a) => * { * currentController.OnDisappeared(); * }; * } * } * * Animation target = controller.GetComponent<Animation>(); * if (target != null && showAnimClip != null) * { * ActiveAnimation animation = ActiveAnimation.Play(target, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); * * if (onAppear != null) * { * onAppear(controller); * } * controller.OnAppear(); * * animation.onFinished = (anim) => * { * if (onAppeared != null) * { * onAppeared(controller); * } * controller.OnAppeared(); * }; * } * * currentController = controller; * * PushToStack(controller); * } * * PrintControllerStacks(); * }*/ public void pushControllerAsFirst(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) { controllerStacks.Clear(); pushController(controller, onAppear, onAppeared); }
public NavigationData pushController(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) { AnimationClip showAnimClip = null, hideAnimClip = null; if (controller != null) { GetNavigationAnimation(controller, true, out showAnimClip, out hideAnimClip); } if (currentController != null) { currentController.animation.AddClip(hideAnimClip, hideAnimClip.name); } NavigationData navData = null; if (controller != null) { if (currentController != null) { Animation currentTarget = currentController.GetComponent <Animation>(); if (currentTarget != null && hideAnimClip != null) { //Debug.Log("currentTarget: " + currentTarget); //Debug.Log("hideAnim: " + hideAnimClip); var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); currentController.OnDissapear(); if (anim != null) { anim.onFinished = (a) => { currentController.OnDisappeared(); }; } } } Animation target = controller.GetComponent <Animation>(); if (target != null && showAnimClip != null) { ActiveAnimation animation = ActiveAnimation.Play(target, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (onAppear != null) { onAppear(controller); } controller.OnAppear(); animation.onFinished = (anim) => { if (onAppeared != null) { onAppeared(controller); } controller.OnAppeared(); }; } currentController = controller; navData = PushToStack(controller, ""); } PrintControllerStacks(); return(navData); }
public NavigationData pushController(System.Type controllerType, ControllerDelegate onAppear, ControllerDelegate onAppeared) { var controller = findControllerByType(controllerType); return(pushController(controller, onAppear, onAppeared)); }
public void dismissToFirstController(ControllerDelegate onDisappear, ControllerDelegate onDisappeared) { if (controllerStacks.Count == 0) { Debug.LogWarning("Controller Stacks is 0"); return; } var current = controllerStacks.Count > 0 ? controllerStacks.Pop() : null; AnimationClip showAnimClip = null, hideAnimClip = null; if (current != null) { GetNavigationAnimation(current.viewController, false, out showAnimClip, out hideAnimClip); } if (current != null) { Animation currentTarget = current.viewController.GetComponent<Animation>(); if (currentTarget != null && hideAnimClip != null) { var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); if (onDisappear != null) { onDisappear(current.viewController); } if (onDisappeared != null && anim != null) { anim.onFinished.Add(new EventDelegate(() => { onDisappeared(current.viewController); })); } } } if (firstActiveController != null) { controllerStacks.Clear(); foreach (var firstController in firstActiveController) { PushToStack(firstController, ""); Animation oldTarget = firstController.GetComponent<Animation>(); if (oldTarget != null && showAnimClip != null) { ActiveAnimation.Play(oldTarget, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); } currentController = firstController; } } PrintControllerStacks(); }
public NavigationData pushController(UIViewController controller, ControllerDelegate onAppear, ControllerDelegate onAppeared) { AnimationClip showAnimClip = null, hideAnimClip = null; if (currentController != null) { GetNavigationAnimation(currentController, true, out showAnimClip, out hideAnimClip); } NavigationData navData = null; if (controller != null) { if (currentController != null) { Animation currentTarget = currentController.GetComponent<Animation>(); if (currentTarget != null && hideAnimClip != null) { var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); currentController.OnDissapear(); anim.onFinished.Add(new EventDelegate(() => { currentController.OnDisappeared(); })); } } Animation target = controller.GetComponent<Animation>(); if (target != null && showAnimClip != null) { ActiveAnimation animation = ActiveAnimation.Play(target, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (onAppear != null) { onAppear(controller); } controller.OnAppear(); animation.onFinished.Add(new EventDelegate(() => { if (onAppeared != null) { onAppeared(controller); } controller.OnAppeared(); })); } currentController = controller; navData = PushToStack(controller, ""); } PrintControllerStacks(); return navData; }
public void popup(string controllerPath, float duration, ControllerDelegate onAppear, ControllerDelegate onAppeared) { string[] paths = controllerPath.Split('?'); var path = GetControllerPathUrl(controllerPath); if (paths.Length > 0) { if (mapControllerPath.ContainsKey(path)) { var view = mapControllerPath[path]; if (view != null) { view.controllerParameters = GetControllerPathParams(controllerPath); var navData = popup(view as UIPopupViewController, duration, onAppear, onAppeared); if (navData != null) { navData.parameter = controllerPath; } } } else { string keys = ""; foreach (string key in mapControllerPath.Keys) { keys += key + ", "; } Debug.LogWarning("UINavigationController: Popup Controller '"+controllerPath+"' is not found on paths: " + keys); } } }
public NavigationData pushController(System.Type controllerType, ControllerDelegate onAppear, ControllerDelegate onAppeared) { var controller = findControllerByType(controllerType); return pushController(controller, onAppear, onAppeared); }
public void pushController(string controllerPath, ControllerDelegate onAppear, ControllerDelegate onAppeared) { string[] paths = controllerPath.Split('?'); var path = GetControllerPathUrl(controllerPath); if (paths.Length > 0) { if (mapControllerPath.ContainsKey(path)) { var view = mapControllerPath[path]; if (view != null) { view.controllerParameters = GetControllerPathParams(controllerPath); var navData = pushController(view, onAppear, onAppeared); if (navData != null) { navData.parameter = controllerPath; Debug.Log(string.Format("Saving Controller: {0}, Param: {1}", view.name, navData.parameter)); } } } else { string keys = ""; foreach (string key in mapControllerPath.Keys) { keys += key + ", "; } Debug.LogWarning("UINavigationController: Controller '"+controllerPath+"' is not found on paths: " + keys); } } }
public void dismissController(ControllerDelegate onDisappear, ControllerDelegate onDisappeared) { if (controllerStacks.Count == 0) { Debug.LogWarning("Controller Stacks is 0"); return; } var current = controllerStacks.Count > 0 ? controllerStacks.Pop() : null; var previous = controllerStacks.Count > 0 ? controllerStacks.Peek() : null; AnimationClip showAnimClip = null, hideAnimClip = null; /*if (current != null) * { * GetNavigationAnimation(current.viewController, false, out showAnimClip, out hideAnimClip); * }*/ if (current != null) { GetNavigationAnimation(current.viewController, false, out showAnimClip, out hideAnimClip); } if (previous != null) { previous.viewController.animation.AddClip(showAnimClip, showAnimClip.name); } if (current != null && previous != null) { Animation currentTarget = current.viewController.GetComponent <Animation>(); if (currentTarget != null && hideAnimClip != null) { var anim = ActiveAnimation.Play(currentTarget, hideAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.DoNothing, AnimationOrTween.DisableCondition.DisableAfterForward); if (onDisappear != null) { onDisappear(current.viewController); } current.viewController.OnDissapear(); anim.onFinished = (a) => { if (onDisappeared != null) { onDisappeared(current.viewController); } current.viewController.OnDisappeared(); }; } } if (previous != null) { Animation oldTarget = previous.viewController.GetComponent <Animation>(); if (oldTarget != null && showAnimClip != null) { var anim = ActiveAnimation.Play(oldTarget, showAnimClip.name, AnimationOrTween.Direction.Forward, AnimationOrTween.EnableCondition.EnableThenPlay, AnimationOrTween.DisableCondition.DoNotDisable); if (string.IsNullOrEmpty(current.parameter) == false) { var param = GetControllerPathParams(previous.parameter); previous.viewController.controllerParameters = param;//.OnControllerParams(param); } previous.viewController.OnAppear(); anim.onFinished = (a) => { previous.viewController.OnAppeared(); }; } currentController = previous.viewController; } PrintControllerStacks(); }