protected void SetGUIWrapperState(GUIWrapperState state) { int clickCount = 0; if (state.mouseDownButton >= 0) { clickCount = Mathf.Max(1, state.clickCount); } m_GUIWrapper.mouseButton.Returns(state.mouseButton); m_GUIWrapper.clickCount.Returns(clickCount); m_GUIWrapper.isShiftDown.Returns(state.isShiftDown); m_GUIWrapper.isAltDown.Returns(state.isAltDown); m_GUIWrapper.isActionKeyDown.Returns(state.isActionKeyDown); m_GUIWrapper.IsMouseDown(state.mouseDownButton).Returns(true); m_GUIWrapper.IsMouseUp(state.mouseUpButton).Returns(true); if (state.keyDown != KeyCode.None) { m_GUIWrapper.IsKeyDown(state.keyDown).Returns(true); } m_HotControl = state.hotControl; m_GUIWrapper.IsMultiStepControlHot(state.multiStepHotControl).Returns(true); m_GUIWrapper.IsViewToolActive().Returns(x => state.viewToolActive); }
public bool DoCancelMultistepAction(bool force) { if (force) { m_GUIWrapper.SetMultiStepControlHot(0); return(true); } if ((!m_GUIWrapper.IsMultiStepControlHot(0) && (m_GUIWrapper.IsMouseDown(1) || m_GUIWrapper.IsKeyDown(KeyCode.Escape)))) { m_GUIWrapper.SetMultiStepControlHot(0); m_GUIWrapper.UseCurrentEvent(); return(true); } return(false); }