Exemplo n.º 1
0
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            var result = base.GizmoOnGUI(topLeft, maxWidth);

            if (Event.current.type == EventType.Repaint)
            {
                AllowToolUtility.DrawRightClickIcon(topLeft.x + overlayIconOffset.x, topLeft.y + overlayIconOffset.y);
            }
            return(result);
        }
Exemplo n.º 2
0
        // draws the "rightclickable" icon over compatible designator buttons
        public static void DrawCommandOverlayIfNeeded(Command command, Vector2 topLeft)
        {
            var designator = TryResolveCommandToDesignator(command);

            if (designator != null)
            {
                try {
                    if (!AllowToolController.Instance.Handles.ContextOverlaySetting.Value)
                    {
                        return;
                    }
                    if (designatorMenuProviders.ContainsKey(designator))
                    {
                        AllowToolUtility.DrawRightClickIcon(topLeft.x + overlayIconOffset.x, topLeft.y + overlayIconOffset.y);
                    }
                } catch (Exception e) {
                    designatorMenuProviders.Remove(designator);
                    AllowToolController.Logger.ReportException(e);
                }
            }
        }
        // draws the "rightclickable" icon over compatible designator buttons
        public static void DrawCommandOverlayIfNeeded(Command command, Vector2 topLeft)
        {
            var designator = TryResolveCommandToDesignator(command);

            if (designator != null)
            {
                try {
                    if (!AllowToolController.Instance.Handles.ContextOverlaySetting.Value)
                    {
                        return;
                    }
                    if (designatorMenuProviders.ContainsKey(designator))
                    {
                        var verticalOffset = command is Command_Toggle ?
                                             56f : 0f;            // checkmark/cross is in the way, use lower right corner
                        AllowToolUtility.DrawRightClickIcon(topLeft.x + overlayIconOffset.x,
                                                            topLeft.y + overlayIconOffset.y + verticalOffset);
                    }
                } catch (Exception e) {
                    designatorMenuProviders.Remove(designator);
                    AllowToolController.Logger.ReportException(e);
                }
            }
        }