public virtual void PresentViewController(UIViewController viewController, bool animated, Action action) { GameObject gameObject = viewController.gameObject; GameObject parent = this.gameObject; if (parent != null) { Transform transform = gameObject.transform; transform.parent = parent.transform; transform.localPosition = new Vector3(0, 0, UINavigationController.Instance.ViewControllers.Count * -10); transform.localRotation = Quaternion.identity; transform.localScale = Vector3.one; gameObject.layer = parent.layer; } if (viewController is IMvxModalUnityView) { GameObject closeCollider = new GameObject("CloseCollider"); Transform transform = closeCollider.transform; transform.parent = gameObject.transform; transform.localPosition = new Vector3(0, 0, 1); transform.localRotation = Quaternion.identity; closeCollider.layer = LayerMask.NameToLayer("UI"); UIStretch uiStretch = closeCollider.AddComponent<UIStretch>(); uiStretch.style = UIStretch.Style.Both; BoxCollider collider = closeCollider.AddComponent<BoxCollider>(); collider.size = new Vector3(1f, 1f, 0f); collider.isTrigger = true; } Animate(gameObject, true, action); }
public void PushViewController(UIViewController viewController, bool animated) { var top = TopViewController; if (top != null) { top.DismissViewController(true, null, false); } _viewControllers.Push(viewController); viewController.gameObject.name = _viewControllers.Count + " - " + viewController.gameObject.name; this.PresentViewController(viewController, true, null); }
public virtual void PresentViewController(UIViewController viewController, bool animated, Action action) { GameObject go = viewController.gameObject; GameObject parent = this.gameObject; if (parent != null) { Transform transform = go.transform; transform.parent = parent.transform; #if NGUI_3 foreach( UIPanel panel in go.GetComponentsInChildren<UIPanel>()) { panel.depth = panel.depth + UINavigationController.Instance.ViewControllers.Count; } transform.localPosition = new Vector3(0, 0, 0 ); #else transform.localPosition = new Vector3(0, 0, UINavigationController.Instance.ViewControllers.Count * -10); #endif transform.localRotation = Quaternion.identity; transform.localScale = Vector3.one; go.layer = parent.layer; } if (viewController is IMvxModalUnityView) { GameObject closeCollider = new GameObject("CloseCollider"); Transform transform = closeCollider.transform; transform.parent = go.transform; #if NGUI_3 transform.localPosition = new Vector3(0, 0, 0); transform.localScale = new Vector3(1, 1, 1); #else transform.localPosition = new Vector3(0, 0, 1); #endif transform.localRotation = Quaternion.identity; closeCollider.layer = LayerMask.NameToLayer("UI"); BoxCollider collider = closeCollider.AddComponent<BoxCollider>(); collider.isTrigger = true; collider.size = new Vector3(Screen.width, Screen.height, 0f); #if NGUI_3 UIWidget uiWidget = closeCollider.AddComponent<UIWidget>(); uiWidget.width = Screen.width; uiWidget.height = Screen.height; #endif } Animate(go, true, action); }
public virtual bool PresentModalViewController(UIViewController viewController, bool animated) { return false; }
protected virtual void ShowFirstView(UIViewController viewController) { _masterNavigationController = CreateNavigationController(viewController); OnMasterNavigationControllerCreated(); }
protected virtual UINavigationController CreateNavigationController(UIViewController viewController) { GameObject go = NGUITools.AddChild(_applicationDelegate.uiCamera.gameObject); go.name = "UINavigationController"; UINavigationController _uiNavigationController = go.AddComponent<UINavigationController>(); _uiNavigationController.PushViewController(viewController, false); return _uiNavigationController; }
//Pops view controllers until the specified view controller is at the top of the navigation stack. public UIViewController PopToViewController(UIViewController viewController, bool animated) { UIViewController pop = null; var top = TopViewController; while (top != viewController) { pop = PopViewControllerAnimated(animated); top = TopViewController; } return pop; }