Exemple #1
0
    public void CheckOutline()
    {
        if (outlinerOptimizationCounter >= 10 && isOutlineCheckActive)
        {
            if (!BIWUtils.IsPointerOverUIElement() && !BIWUtils.IsPointerOverMaskElement(BIWSettings.GIZMOS_LAYER))
            {
                BIWEntity entity = raycastController.GetEntityOnPointer();
                RemoveEntitiesOutlineOutsidePointerOrUnselected();

                if (entity != null && !entity.IsSelected)
                {
                    OutlineEntity(entity);
                }
            }
            else
            {
                CancelUnselectedOutlines();
            }

            outlinerOptimizationCounter = 0;
        }
        else
        {
            outlinerOptimizationCounter++;
        }
    }
    private void MouseClick(int buttonID, Vector3 position)
    {
        if (!isEditModeActive)
        {
            return;
        }

        if (Time.timeSinceLevelLoad < nexTimeToReceiveInput)
        {
            return;
        }

        if (!BIWUtils.IsPointerOverUIElement())
        {
            HUDController.i.builderInWorldMainHud.HideExtraBtns();
        }

        if (Utils.isCursorLocked || modeController.IsGodModeActive())
        {
            if (buttonID == 0)
            {
                MouseClickDetected();
                InputDone();
                return;
            }
            outlinerController.CheckOutline();
        }
    }
    private bool CanDrag()
    {
        if (!canInputBeMade ||
            currentClickIsOnUi ||
            BIWUtils.IsPointerOverUIElement())
        {
            return(false);
        }

        return(true);
    }
    private void MouseWheel(float axisValue)
    {
        if (!isEditModeActive)
        {
            return;
        }

        if (!canInputBeMade)
        {
            return;
        }
        if (!BIWUtils.IsPointerOverUIElement())
        {
            OnMouseWheel?.Invoke(axisValue);
        }
    }
    private void MouseDown(int buttonId, Vector3 mousePosition)
    {
        if (!isEditModeActive)
        {
            return;
        }

        lastTimeMouseDown  = Time.unscaledTime;
        lastMousePosition  = mousePosition;
        currentClickIsOnUi = BIWUtils.IsPointerOverUIElement();

        if (!canInputBeMade)
        {
            return;
        }
        if (!currentClickIsOnUi)
        {
            OnMouseDown?.Invoke(buttonId, mousePosition);
        }
    }
    private void MouseUp(int buttonId, Vector3 mousePosition)
    {
        if (!isEditModeActive)
        {
            return;
        }

        if (currentClickIsOnUi)
        {
            OnMouseClickOnUI?.Invoke(buttonId, mousePosition);
            currentClickIsOnUi = false;
            return;
        }

        if (!canInputBeMade)
        {
            return;
        }

        if (!BIWUtils.IsPointerOverUIElement())
        {
            OnMouseUp?.Invoke(buttonId, mousePosition);
            if (Vector3.Distance(mousePosition, lastMousePosition) >= MOVEMENT_CLICK_THRESHOLD)
            {
                return;
            }
            if (Time.unscaledTime >= lastTimeMouseDown + MS_CLICK_THRESHOLD / 1000)
            {
                return;
            }
            OnMouseClick?.Invoke(buttonId, mousePosition);
        }
        else
        {
            OnMouseUpOnUI?.Invoke(buttonId, mousePosition);
        }
    }