示例#1
0
        private void SetScreen(FlowCoordinator _activeFlowCoordinator, CustomViewController newViewController, VRUIViewController origViewController, bool right, bool immediately)
        {
            string        method     = right ? "SetRightScreenViewController" : "SetLeftScreenViewController";
            Action <bool> backAction = (immediate) => { _activeFlowCoordinator.InvokePrivateMethod(method, new object[] { PopViewControllerStack(right), immediate }); };

            _dismissCustom += backAction;  // custom back button behavior
            if (!newViewController.isActivated)
            {
                if (right)
                {
                    _rightViewControllerStack.Add(origViewController);
                }
                else
                {
                    _leftViewControllerStack.Add(origViewController);
                }

                if (newViewController.includeBackButton)
                {
                    newViewController.ClearBackButtonCallbacks();
                    newViewController.backButtonPressed += () => { backAction.Invoke(false); }; // default back button behavior
                }
                _activeFlowCoordinator.InvokePrivateMethod(method, new object[] { newViewController, immediately });
            }
        }
        private void SetScreen(FlowCoordinator _activeFlowCoordinator, CustomViewController newViewController, VRUIViewController origViewController, ViewControllerPosition pos, bool immediately)
        {
            Action <bool> backAction = (immediate) => SetViewController(_activeFlowCoordinator, PopViewControllerStack(pos), pos, immediate);

            _dismissCustom += backAction;  // custom back button behavior
            if (!newViewController.isActivated)
            {
                if (!_viewControllerStacks.ContainsKey(pos))
                {
                    _viewControllerStacks[pos] = new List <VRUIViewController>();
                }

                _viewControllerStacks[pos].Add(origViewController);
                if (newViewController.includeBackButton)
                {
                    newViewController.ClearBackButtonCallbacks();
                    newViewController.backButtonPressed += () => { backAction.Invoke(false); }; // default back button behavior
                }
                SetViewController(_activeFlowCoordinator, newViewController, pos, immediately);
            }
        }