Ejemplo n.º 1
0
        ////////////////

        private void UpdateInteractionsForEditModeDrag_If(bool isEditMode, bool mouseLeft)
        {
            if (this.IsInteractingWithControls)
            {
                return;
            }
            if (this.IsDragLocked())
            {
                return;
            }

            //

            HUDElement currDrag = HUDElementsLibAPI.GetDraggingElement();

            if (currDrag == null || currDrag == this)
            {
                bool isInteracting = mouseLeft && isEditMode;

                if (isInteracting)
                {
                    if (this.IsDraggingSinceLastTick || this.IsMouseHoveringEditableBox)
                    {
                        this.ApplyDrag();
                    }
                }
                else
                {
                    this.DesiredDragPosition = null;
                }
            }
        }
Ejemplo n.º 2
0
        ////////////////

        private void UpdateInteractionsForEditModeControls_If(bool isEditMode, bool mouseLeft)
        {
            if (this.IsInteractingWithControls)
            {
                bool isInteracting = mouseLeft && isEditMode;                   //&& this.IsMouseHovering_Custom;

                this.IsInteractingWithControls   = isInteracting;
                Main.LocalPlayer.mouseInterface |= isInteracting;                       // Repeatably locks control for this element, if needed
//if( Main.LocalPlayer.mouseInterface ) {
//	Main.NewText( "HUD_UpdIntForCtrlIf 1" );
//}

                return;                 // Only the first tick of interaction matters
            }

            //

            if (!isEditMode)
            {
                return;
            }
            if (!mouseLeft)
            {
                return;
            }
            if (!this.IsMouseHoveringEditableBox)
            {
                return;
            }
            if (HUDElementsLibAPI.GetDraggingElement() != null)
            {
                return;
            }

            //

            Point     mouse = Main.MouseScreen.ToPoint();
            Rectangle area  = this.GetHUDComputedArea(false);

            Rectangle toggler = HUDElement.GetCollisionTogglerArea(area);
            Rectangle reset   = HUDElement.GetResetButtonArea(area);
            Rectangle anchorR = HUDElement.GetRightAnchorButtonArea(area);
            Rectangle anchorB = HUDElement.GetBottomAnchorButtonArea(area);
            bool      pressed = false;

            if (toggler.Contains(mouse) && this.IsCollisionToggleable())
            {
                pressed = this.ApplyCollisionsToggleControlPress_If();
            }
            else if (reset.Contains(mouse) && !this.IsDragLocked())
            {
                pressed = true;
                this.ResetPositionToDefault();
            }
            else if (this.IsAnchorsToggleable())
            {
                if (anchorR.Contains(mouse))
                {
                    pressed = this.ApplyRightAnchorToggleControlPress_If();
                }
                else if (anchorB.Contains(mouse))
                {
                    pressed = this.ApplyBottomAnchorToggleControlPress_If();
                }
            }

            this.IsInteractingWithControls   = pressed;
            Main.LocalPlayer.mouseInterface |= pressed;
//if( Main.LocalPlayer.mouseInterface ) {
//	Main.NewText( "HUD_UpdIntForCtrlIf 2" );
//}
        }