Пример #1
0
    protected override void OnConfigUpdated()
    {
        dotFillColor   = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotFillColor, SettingsConfig.Config.CursorDotFillOpacity);
        dotBorderColor = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotBorderColor, SettingsConfig.Config.CursorDotBorderOpacity);
        ringColor      = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorRingColor, SettingsConfig.Config.CursorRingOpacity);

        cursorDot.color     = dotBorderColor;
        cursorDotFill.color = dotFillColor;

        cursorDotSize = (GlobalSettings.ScreenHeight / PhysicalConfigurable.Config.ScreenHeightM) * SettingsConfig.Config.CursorDotSizeM / 100f;
        var dotSizeIsZero = Mathf.Approximately(cursorDotSize, 0f);

        cursorDotSize = dotSizeIsZero ? 1f : cursorDotSize;
        cursorDot.transform.localScale = new Vector3(cursorDotSize, cursorDotSize, cursorDotSize);
        SetCursorLocalScale(cursorDotSize);

        if (ringEnabled)
        {
            maxRingScale = (1f / cursorDotSize) * SettingsConfig.Config.CursorRingMaxScale;

            // This is a crude way of forcing the sprites to draw on top of the UI, without masking it.
            ringOuterSprite.sortingOrder = ringSpriteSortingOrder;
            ringMask.GetComponent <SpriteMask>().isCustomRangeActive = true;
            ringMask.GetComponent <SpriteMask>().frontSortingOrder   = ringSpriteSortingOrder + 1;
            ringMask.GetComponent <SpriteMask>().backSortingOrder    = ringSpriteSortingOrder - 1;
        }
    }
Пример #2
0
    protected override void OnConfigUpdated()
    {
        dotFillColor   = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotFillColor, SettingsConfig.Config.CursorDotFillOpacity);
        dotBorderColor = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotBorderColor, SettingsConfig.Config.CursorDotBorderOpacity);
        ringColor      = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorRingColor, SettingsConfig.Config.CursorRingOpacity);

        cursorDot.color            = dotBorderColor;
        cursorDotFill.color        = dotFillColor;
        cursorProgressBorder.color = dotBorderColor;
        cursorProgressFill.color   = ringColor;

        if (ringEnabled)
        {
            cursorRing.color = ringColor;
        }

        screenDistanceAtMaxScaleMeters = SettingsConfig.Config.CursorMaxRingScaleAtDistanceM;

        cursorDotSize = (GlobalSettings.ScreenHeight / PhysicalConfigurable.Config.ScreenHeightM) * SettingsConfig.Config.CursorDotSizeM / 100f;
        var dotSizeIsZero = Mathf.Approximately(cursorDotSize, 0f);

        cursorDotSize = dotSizeIsZero ? 1f : cursorDotSize;

        // Scale up the dot by a factor of 2 for this interaction due to the smaller dot
        cursorDotSize *= 2f;

        cursorDot.enabled                  = !dotSizeIsZero;
        cursorProgressBorder.enabled       = !dotSizeIsZero;
        cursorProgressFill.enabled         = !dotSizeIsZero;
        cursorDotTransform.localScale      = new Vector3(cursorDotSize, cursorDotSize, cursorDotSize);
        cursorProgressTransform.localScale = new Vector3(cursorDotSize, cursorDotSize, cursorDotSize);

        maxRingScale = (1f / cursorDotSize) * SettingsConfig.Config.CursorRingMaxScale;
    }
Пример #3
0
    protected override void OnConfigUpdated()
    {
        base.OnConfigUpdated();

        cursorDotSize *= 0.6f;

        UpdateLineRenderers();
        SetLineRendererWidthScale(1);

        Color fillColour   = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorRingColor, SettingsConfig.Config.CursorRingOpacity);
        Color borderColour = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotBorderColor, SettingsConfig.Config.CursorDotBorderOpacity);

        Gradient gradient = new Gradient();

        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(fillColour, 0.0f), new GradientColorKey(fillColour, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(fillColour.a, 0.0f), new GradientAlphaKey(fillColour.a, 1.0f) }
            );
        lineRenderer.colorGradient = gradient;

        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(borderColour, 0.0f), new GradientColorKey(borderColour, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(borderColour.a, 0.0f), new GradientAlphaKey(borderColour.a, 1.0f) }
            );

        lineRendererOutline.colorGradient = gradient;
    }
    protected override void OnConfigUpdated()
    {
        dotFillColor   = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotFillColor, SettingsConfig.Config.CursorDotFillOpacity);
        dotBorderColor = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotBorderColor, SettingsConfig.Config.CursorDotBorderOpacity);

        openHandImage.color   = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorRingColor, SettingsConfig.Config.CursorRingOpacity);
        closedHandImage.color = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorRingColor, SettingsConfig.Config.CursorRingOpacity);

        cursorDot.color     = dotBorderColor;
        cursorDotFill.color = dotFillColor;

        cursorDotSize = (GlobalSettings.ScreenHeight / PhysicalConfigurable.Config.ScreenHeightM) * SettingsConfig.Config.CursorDotSizeM / 100f;
        var dotSizeIsZero = Mathf.Approximately(cursorDotSize, 0f);

        cursorDotSize     = dotSizeIsZero ? 1f : cursorDotSize;
        cursorDot.enabled = !dotSizeIsZero;

        if (!hidingCursor)
        {
            cursorDot.transform.localScale = new Vector3(cursorDotSize, cursorDotSize, cursorDotSize);
        }
    }
    void DisplayCursorPreview()
    {
        var dotFillColor   = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotFillColor, SettingsConfig.Config.CursorDotFillOpacity);
        var dotBorderColor = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorDotBorderColor, SettingsConfig.Config.CursorDotBorderOpacity);
        var ringColor      = ScreenControlUtility.ParseColor(SettingsConfig.Config.CursorRingColor, SettingsConfig.Config.CursorRingOpacity);

        pushCursorPreview.SetActive(false);
        grabCursorPreview.SetActive(false);
        hoverCursorPreview.SetActive(false);

        switch (SettingsConfig.Config.InteractionSelection)
        {
        case InteractionSelection.Push:
        case InteractionSelection.Poke:
            pushCursorPreview.SetActive(true);
            pushCursorPreviewBorder.color = dotBorderColor;
            pushCursorPreviewDot.color    = dotFillColor;
            pushCursorPreviewRing.color   = ringColor;
            break;

        case InteractionSelection.Grab:
            grabCursorPreview.SetActive(true);
            grabCursorPreviewBorder.color = dotBorderColor;
            grabCursorPreviewDot.color    = dotFillColor;
            grabCursorPreviewLine.color   = ringColor;
            break;

        case InteractionSelection.Hover:
            hoverCursorPreview.SetActive(true);
            hoverCursorPreviewBorder.color     = dotBorderColor;
            hoverCursorPreviewDot.color        = dotFillColor;
            hoverCursorPreviewRingBorder.color = dotBorderColor;
            hoverCursorPreviewRing.color       = ringColor;
            break;
        }
    }