Beispiel #1
0
    private void Update()
    {
        if (_getInputEnabled() && Input.GetKeyDown(KeyCode.Escape))
        {
            NguiView focusView = _viewController.GetFocusView();
            if (focusView != null)
            {
                focusView.OnBackClick();
            }
        }

        // When this define is set, we toggle the visibility of
        // the UI when we detect a transition to device face down.
                #if UI_HIDE_ENABLED
        if (++_checkDeviceOrientationFrameCount > CHECK_DEVICE_ORIENTATION_FRAME_INTERVAL)
        {
            CheckDeviceOrientation();
        }
                #endif

        // in debug mode, handle tap input to show debug console or menu
        // debug finger input should take precedence over any other processing

/*
 #if DEVELOPMENT_BUILD || UNITY_EDITOR
 *      if ( _client.IsDebug() ) {
 #if UNITY_EDITOR
 *                      if ( Input.GetKey(KeyCode.RightShift) && Input.GetKeyDown(KeyCode.BackQuote) ) {
 *                              _uiCamera.cachedCamera.enabled = !_uiCamera.cachedCamera.enabled;
 *                              return;
 *                      } else if ( Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.BackQuote) ) {
 #if !PRODUCTION
 *              _debugMenu.Toggle();
 #endif
 *              return;
 *          } else if ( Input.GetKeyDown(KeyCode.BackQuote) ) {
 #if !PRODUCTION
 *              if (!_console.IsVisible()) {
 *                  _console.Show();
 *                  return;
 *              }
 #endif
 *          }
 #endif
 *
 #if !PRODUCTION
 *          if ( Input.touchCount == DEBUG_MENU_OPEN_TOUCH_COUNT ) {
 *                              if ( !_debugMenu.IsVisible() ) _debugMenu.Show();
 *          } else if ( Input.touchCount == DEBUG_CONSOLE_OPEN_TOUCH_COUNT ) {
 *                              if ( !_console.IsVisible() ) _console.Show();
 *          }
 #endif
 *
 *      }
 #endif
 */
    }
 public void Shutdown()
 {
     if (_updateCoroutine != null)
     {
         _associatedView.StopCoroutine(_updateCoroutine);
         _updateCoroutine = null;
     }
     _associatedView = null;
 }
Beispiel #3
0
    // Updates depth values in _views list order
    public void UpdateViewDepths()
    {
        int   currentDepth = 0;
        float currentZ     = 0.0f;

        for (int i = 0; i < _views.Count; ++i)
        {
            NguiView view = _views[i];
            currentDepth += view._setDepth(currentDepth);
            view._setPosition(new Vector3(0.0f, 0.0f, -currentZ));
            currentZ += view.ZSeparation;
        }
    }
Beispiel #4
0
    public void _registerView(NguiView view)
    {
        // Iterate until we find a view whose depth is higher than the new view and insert
        int insertAtIndex = 0;

        for (; insertAtIndex < _views.Count; ++insertAtIndex)
        {
            if (view.InitialDepth < _views[insertAtIndex].InitialDepth)
            {
                break;
            }
        }
        _views.Insert(insertAtIndex, view);
    }
Beispiel #5
0
    public NguiView GetFocusView(HashSet <Type> excludeViews = null)
    {
        for (int i = _views.Count - 1; i >= 0; --i)
        {
            NguiView view = _views[i];

            if (excludeViews != null && excludeViews.Contains(view.GetType()))
            {
                continue;
            }

            if (view.CanGainFocus && view.ViewActive)
            {
                return(view);
            }
        }
        return(null);
    }
Beispiel #6
0
    // Moves a view to reside in the list immediately after the other
    public void MoveViewOnTopOfOther(NguiView viewToMove, NguiView other)
    {
        if (viewToMove == null || other == null)
        {
            this.LogError(string.Format("MoveViewOnTopOfOther was passed a null argument - viewToMove null? {0}, other null? {1}", viewToMove == null, other == null));
            return;
        }

        for (int i = 0; i < _views.Count; ++i)
        {
            if (_views[i] == other)
            {
                _views.Remove(viewToMove);
                _views.Insert(Math.Min(i + 1, _views.Count), viewToMove);
                UpdateViewDepths();
                return;
            }
        }
    }
Beispiel #7
0
 public void _unregisterView(NguiView view)
 {
     // no need to update view depths on removal
     _views.Remove(view);
 }
 public void Initialize(NguiView associatedView)
 {
     _associatedView = associatedView;
 }