internal void KeyUpHandler(UnityEngine.Event e) { #if DEBUG if (DebugMode) { Debug.Log("GuiInspector->KeyUpHandler"); } #endif if (e.keyCode == KeyCode.Escape) { if (null != _currentComponent) { // clear all //_stack.Clear(); _currentComponent = null; Sticky = false; HideOverlay(); } } }
//private readonly Stack<DisplayListMember> _stack = new Stack<DisplayListMember>(); internal void KeyDownHandler(UnityEngine.Event e) { #if DEBUG if (DebugMode) { Debug.Log("GuiInspector->KeyDownHandler"); } #endif if (!(e.control || e.shift)) { return; } bool recognized = false; if (e.keyCode == KeyCode.LeftArrow) { if (null != _currentComponent && null != _currentComponent.Parent) { //Debug.Log(string.Format("Pushing {0} to stack", _currentComponent)); //_stack.Push(_currentComponent); _currentComponent = _currentComponent.Parent; recognized = true; } } else if (e.keyCode == KeyCode.RightArrow) { //if (_stack.Count > 0) //{ // _currentComponent = _stack.Pop(); // recognized = true; //} //else //{ //Container container = _currentComponent as Container; DisplayObjectContainer container = _currentComponent as DisplayObjectContainer; // 20121212 if (null != container && container.QNumberOfChildren > 0) { //_currentComponent = container.GetChildAt(0); _currentComponent = container.QGetChildAt(0); recognized = true; } //} } else if (e.keyCode == KeyCode.UpArrow) { if (null != _currentComponent && null != _currentComponent.Parent) { var index = _currentComponent.Parent.QGetChildIndex(_currentComponent); if (index > 0) { index--; _currentComponent = _currentComponent.Parent.QGetChildAt(index); //_stack.Clear(); } recognized = true; } } else if (e.keyCode == KeyCode.DownArrow) { if (null != _currentComponent && null != _currentComponent.Parent) { var index = _currentComponent.Parent.QGetChildIndex(_currentComponent); if (index < _currentComponent.Parent.QNumberOfChildren - 1) { index++; _currentComponent = _currentComponent.Parent.QGetChildAt(index); //_stack.Clear(); } recognized = true; } } if (recognized) { HideOverlay(); //Debug.Log("Showing: " + _currentComponent); ShowOverlay(_currentComponent); } }