コード例 #1
0
    public void SetEventAppearance(BeatmapEventContainer e)
    {
        Color color = Color.white;

        if (e.GetComponentInChildren <TextMeshProUGUI>())
        {
            Destroy(e.GetComponentInChildren <TextMeshProUGUI>().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 = new Vector3((2f / 3), (2f / 3), (2f / 3));
        }
        if (e.eventData.IsUtilityEvent())
        {
            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)
                {
                    color = BlueColor;
                }
                else if (e.eventData._value <= 7)
                {
                    color = RedColor;
                }
                else if (e.eventData._value >= ColourManager.RGB_INT_OFFSET) // not quite sure why this is here, but ill leave it
                {
                    color = ColourManager.ColourFromInt(e.eventData._value);
                    e.UpdateAlpha(0.75f);
                }
            }
        }
        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;
        }
    }