Ejemplo n.º 1
0
    public void SetEventAppearance(BeatmapEventContainer e)
    {
        Color color = Color.white;

        foreach (TextMeshProUGUI t in e.GetComponentsInChildren <TextMeshProUGUI>())
        {
            Destroy(t.transform.parent.gameObject);
        }
        if (e.eventData._type == MapEvent.EVENT_TYPE_LEFT_LASERS_SPEED || e.eventData._type == MapEvent.EVENT_TYPE_RIGHT_LASERS_SPEED)
        {
            GameObject instantiate = Instantiate(LaserSpeedPrefab, e.transform);
            instantiate.transform.localPosition = new Vector3(0, 0.25f, 0);
            instantiate.GetComponentInChildren <TextMeshProUGUI>().text = e.eventData._value.ToString();
            instantiate.GetComponentInChildren <TextMeshProUGUI>().rectTransform.localScale = Vector3.one * (2f / 3);
        }
        if (e.eventData.IsUtilityEvent())
        {
            if (e.eventData._type == MapEvent.EVENT_TYPE_RINGS_ROTATE || e.eventData._type == MapEvent.EVENT_TYPE_RINGS_ZOOM)
            {
                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(0.75f);
            }
            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)
            {
                if (BeatSaberSongContainer.Instance.difficultyData.envColorLeft != BeatSaberSong.DEFAULT_LEFTCOLOR)
                {
                    color = BeatSaberSongContainer.Instance.difficultyData.envColorLeft;
                }
                else
                {
                    color = RedColor;
                }
            }
        }
        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_FLASH:
            e.UpdateOffset(FlashShaderOffset);
            break;

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

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

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

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

        case MapEvent.LIGHT_VALUE_BLUE_ON:
            e.UpdateOffset(Vector3.zero);
            break;
        }
    }
Ejemplo n.º 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);
        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;
        }
    }