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 IsActionActive(Transform boneTransform, BoneGizmoAction action) { if (m_GUIWapper.IsViewToolActive() || !IsActionHot(BoneGizmoAction.None) || m_HoveredBoneTransform != boneTransform) { return(action == BoneGizmoAction.None); } if (action == BoneGizmoAction.Select) { return(m_GUIWapper.IsControlNearest(m_HoveredBoneHeadControlID) || m_GUIWapper.IsControlNearest(m_HoveredBoneBodyControlID)); } if (action == BoneGizmoAction.Rotate) { return(m_GUIWapper.IsControlNearest(m_HoveredBoneBodyControlID)); } if (action == BoneGizmoAction.Move) { return(m_GUIWapper.IsControlNearest(m_HoveredBoneHeadControlID)); } if (action == BoneGizmoAction.None) { return(true); } return(false); }