示例#1
0
    public void SetEventAppearance(BeatmapEventContainer e, bool final = true)
    {
        Color color = Color.white;

        e.UpdateAlpha(final ? 1.0f : 0.6f);
        e.UpdateScale(final ? 0.75f : 0.6f);
        foreach (TextMeshProUGUI t in e.GetComponentsInChildren <TextMeshProUGUI>())
        {
            Destroy(t.transform.parent.gameObject);
        }
        if (e.eventData.IsRotationEvent || e.eventData.IsLaserSpeedEvent)
        {
            GameObject instantiate = Instantiate(LaserSpeedPrefab, e.transform);
            Canvas     canvas      = instantiate.GetComponentInChildren <Canvas>();
            canvas.sortingLayerName             = "Default";
            instantiate.transform.localPosition = new Vector3(0, 0.25f, 0);
            TextMeshProUGUI text = instantiate.GetComponentInChildren <TextMeshProUGUI>();
            if (e.eventData.IsRotationEvent)
            {
                int?rotation = e.eventData.GetRotationDegreeFromValue();
                text.text = rotation != null ? $"{rotation}°" : "Invalid Rotation";
            }
            else
            {
                text.text = e.eventData._value.ToString();
            }
            text.rectTransform.localScale = Vector3.one * (2f / 3);
        }
        if (e.eventData.IsUtilityEvent)
        {
            if (e.eventData.IsRingEvent)
            {
                e.ChangeColor(RingEventsColor);
            }
            else
            {
                e.ChangeColor(OtherColor);
            }
            e.UpdateOffset(Vector3.zero);
            return;
        }
        else
        {
            if (e.eventData._value >= ColourManager.RGB_INT_OFFSET)
            {
                color = ColourManager.ColourFromInt(e.eventData._value);
                e.UpdateAlpha(final ? 0.9f : 0.6f);
            }
            else if (e.eventData._value <= 3)
            {
                if (BeatSaberSongContainer.Instance.difficultyData.envColorRight != BeatSaberSong.DEFAULT_RIGHTCOLOR)
                {
                    color = BeatSaberSongContainer.Instance.difficultyData.envColorRight;
                }
                else
                {
                    color = BlueColor;
                }
            }
            else if (e.eventData._value <= 7 && e.eventData._value >= 5)
            {
                if (BeatSaberSongContainer.Instance.difficultyData.envColorLeft != BeatSaberSong.DEFAULT_LEFTCOLOR)
                {
                    color = BeatSaberSongContainer.Instance.difficultyData.envColorLeft;
                }
                else
                {
                    color = RedColor;
                }
            }
            else if (e.eventData._value == 4)
            {
                color = OffColor;
            }
        }
        e.ChangeColor(color);
        switch (e.eventData._value)
        {
        case MapEvent.LIGHT_VALUE_OFF:
            e.ChangeColor(OffColor);
            e.UpdateOffset(Vector3.zero);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_ON:
            e.UpdateOffset(Vector3.zero);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_FLASH:
            e.UpdateOffset(FlashShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_FADE:
            e.UpdateOffset(FadeShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_RED_ON:
            e.UpdateOffset(Vector3.zero);
            break;

        case MapEvent.LIGHT_VALUE_RED_FLASH:
            e.UpdateOffset(FlashShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_RED_FADE:
            e.UpdateOffset(FadeShaderOffset);
            break;
        }
    }
示例#2
0
    public void SetEventAppearance(BeatmapEventContainer e, bool final = true)
    {
        Color color = Color.white;

        e.UpdateAlpha(final ? 1.0f : 0.6f);
        e.UpdateScale(final ? 0.75f : 0.6f);
        if (e.eventData.IsRotationEvent || e.eventData.IsLaserSpeedEvent)
        {
            if (e.eventData.IsRotationEvent)
            {
                int?rotation = e.eventData.GetRotationDegreeFromValue();
                e.UpdateTextDisplay(true, rotation != null ? $"{rotation}°" : "Invalid Rotation");
            }
            else
            {
                e.UpdateTextDisplay(true, e.eventData._value.ToString());
            }
        }
        else
        {
            e.UpdateTextDisplay(false);
        }
        if (e.eventData.IsUtilityEvent)
        {
            if (e.eventData.IsRingEvent)
            {
                e.ChangeColor(RingEventsColor);
            }
            else
            {
                e.ChangeColor(OtherColor);
            }
            e.UpdateOffset(Vector3.zero);
            return;
        }
        else
        {
            if (e.eventData._value >= ColourManager.RGB_INT_OFFSET)
            {
                color = ColourManager.ColourFromInt(e.eventData._value);
                e.UpdateAlpha(final ? 0.9f : 0.6f);
            }
            else if (e.eventData._value <= 3)
            {
                if (BeatSaberSongContainer.Instance.difficultyData.envColorRight != BeatSaberSong.DEFAULT_RIGHTCOLOR)
                {
                    color = BeatSaberSongContainer.Instance.difficultyData.envColorRight;
                }
                else
                {
                    color = BlueColor;
                }
            }
            else if (e.eventData._value <= 7 && e.eventData._value >= 5)
            {
                if (BeatSaberSongContainer.Instance.difficultyData.envColorLeft != BeatSaberSong.DEFAULT_LEFTCOLOR)
                {
                    color = BeatSaberSongContainer.Instance.difficultyData.envColorLeft;
                }
                else
                {
                    color = RedColor;
                }
            }
            else if (e.eventData._value == 4)
            {
                color = OffColor;
            }
        }
        e.ChangeColor(color);
        switch (e.eventData._value)
        {
        case MapEvent.LIGHT_VALUE_OFF:
            e.ChangeColor(OffColor);
            e.UpdateOffset(Vector3.zero);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_ON:
            e.UpdateOffset(Vector3.zero);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_FLASH:
            e.UpdateOffset(FlashShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_FADE:
            e.UpdateOffset(FadeShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_RED_ON:
            e.UpdateOffset(Vector3.zero);
            break;

        case MapEvent.LIGHT_VALUE_RED_FLASH:
            e.UpdateOffset(FlashShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_RED_FADE:
            e.UpdateOffset(FadeShaderOffset);
            break;
        }
    }
示例#3
0
    public void SetEventAppearance(BeatmapEventContainer e, bool final = true, bool boost = false)
    {
        Color color = Color.white;

        e.UpdateOffset(Vector3.zero);
        e.UpdateAlpha(final ? 1.0f : 0.6f);
        e.UpdateScale(final ? 0.75f : 0.6f);
        e.ChangeSpotlightSize(1f);
        if (e.eventData.IsRotationEvent || e.eventData.IsLaserSpeedEvent)
        {
            if (e.eventData.IsRotationEvent)
            {
                int?rotation = e.eventData.GetRotationDegreeFromValue();
                e.UpdateTextDisplay(true, rotation != null ? $"{rotation}°" : "Invalid Rotation");
            }
            else if (e.eventData.IsLaserSpeedEvent)
            {
                float speed = e.eventData._value;
                if (e.eventData._customData != null && e.eventData._customData.HasKey("_preciseSpeed"))
                {
                    speed = e.eventData._customData["_preciseSpeed"].AsFloat;
                }
                e.UpdateTextDisplay(true, speed.ToString());
            }
        }
        else
        {
            e.UpdateTextDisplay(false);
        }
        if (e.eventData.IsUtilityEvent)
        {
            e.UsePyramidModel = false;
            if (e.eventData.IsRingEvent)
            {
                e.ChangeColor(RingEventsColor);
                e.ChangeBaseColor(RingEventsColor);
            }
            else if (e.eventData._type == MapEvent.EVENT_TYPE_BOOST_LIGHTS)
            {
                if (e.eventData._value == 1)
                {
                    e.ChangeBaseColor(RedBoostColor);
                    e.ChangeColor(BlueBoostColor);
                }
                else
                {
                    e.ChangeBaseColor(RedColor);
                    e.ChangeColor(BlueColor);
                }
                e.UpdateOffset(Vector3.forward * 1.05f);
                e.ChangeFadeSize(cubeBoostEventFadeSize);
                return;
            }
            else
            {
                e.ChangeColor(OtherColor);
                e.ChangeBaseColor(OtherColor);
            }
            e.UpdateOffset(Vector3.zero);
            e.UpdateGradientRendering();
            return;
        }
        else
        {
            if (e.eventData._value >= ColourManager.RGB_INT_OFFSET)
            {
                color = ColourManager.ColourFromInt(e.eventData._value);
                e.UpdateAlpha(final ? 0.9f : 0.6f);
            }
            else if (e.eventData._value <= 3)
            {
                color = boost ? BlueBoostColor : BlueColor;
            }
            else if (e.eventData._value <= 7 && e.eventData._value >= 5)
            {
                color = boost ? RedBoostColor : RedColor;
            }
            else if (e.eventData._value == 4)
            {
                color = OffColor;
            }

            if (e.eventData._customData?["_color"] != null && e.eventData._value > 0)
            {
                color = e.eventData._customData["_color"];
            }
        }
        e.UsePyramidModel = Settings.Instance.PyramidEventModels;
        e.ChangeColor(color);
        e.ChangeBaseColor(Color.black);
        switch (e.eventData._value)
        {
        case MapEvent.LIGHT_VALUE_OFF:
            e.ChangeColor(OffColor);
            e.ChangeBaseColor(OffColor);
            e.UpdateOffset(Vector3.zero);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_ON:
            e.UpdateOffset(Vector3.zero);
            e.ChangeBaseColor(color);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_FLASH:
            e.UpdateOffset(e.UsePyramidModel ? pyramidFlashShaderOffset : cubeFlashShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_BLUE_FADE:
            e.UpdateOffset(e.UsePyramidModel ? pyramidFadeShaderOffset : cubeFadeShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_RED_ON:
            e.UpdateOffset(Vector3.zero);
            e.ChangeBaseColor(color);
            break;

        case MapEvent.LIGHT_VALUE_RED_FLASH:
            e.UpdateOffset(e.UsePyramidModel ? pyramidFlashShaderOffset : cubeFlashShaderOffset);
            break;

        case MapEvent.LIGHT_VALUE_RED_FADE:
            e.UpdateOffset(e.UsePyramidModel ? pyramidFadeShaderOffset : cubeFadeShaderOffset);
            break;
        }

        e.ChangeFadeSize(e.UsePyramidModel ? pyramidDefaultFadeSize : cubeDefaultFadeSize);

        if (Settings.Instance.VisualizeChromaGradients)
        {
            e.UpdateGradientRendering();
        }
    }