Example #1
0
 private void LoadedPlatform(PlatformDescriptor obj)
 {
     platform          = obj;
     oldPlatformColorR = platform.RedColor;
     oldPlatformColorB = platform.BlueColor;
     if (redNote.color == BeatSaberSong.DEFAULT_LEFTNOTE)
     {
         SetColorIfNotEqual(ref redNote, platform.RedNoteColor);
     }
     if (blueNote.color == BeatSaberSong.DEFAULT_RIGHTNOTE)
     {
         SetColorIfNotEqual(ref blueNote, platform.BlueNoteColor);
     }
     if (redLight.color == BeatSaberSong.DEFAULT_LEFTCOLOR)
     {
         SetColorIfNotEqual(ref redLight, platform.RedColor);
     }
     if (blueLight.color == BeatSaberSong.DEFAULT_RIGHTCOLOR)
     {
         SetColorIfNotEqual(ref blueLight, platform.BlueColor);
     }
     if (obstacle.color == BeatSaberSong.DEFAULT_LEFTCOLOR)
     {
         SetColorIfNotEqual(ref obstacle, platform.ObstacleColor);
     }
 }
Example #2
0
 private void Start()
 {
     startRotation = transform.localRotation;
     if (OverrideLightGroup)
     {
         PlatformDescriptor descriptor = GetComponentInParent <PlatformDescriptor>();
         descriptor?.LightingManagers[OverrideLightGroupID].RotatingLights.Add(this);
     }
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     LightMaterial             = GetComponentInChildren <Renderer>().material;
     LightMaterial.renderQueue = LightingEventRenderQueue;
     if (OverrideLightGroup)
     {
         PlatformDescriptor descriptor = GetComponentInParent <PlatformDescriptor>();
         descriptor?.LightingManagers[OverrideLightGroupID].ControllingLights.Add(this);
     }
 }
Example #4
0
 private void Start()
 {
     startRotation = transform.localRotation;
     if (OverrideLightGroup)
     {
         PlatformDescriptor descriptor = GetComponentInParent <PlatformDescriptor>();
         descriptor?.LightingManagers[OverrideLightGroupID].RotatingLights.Add(this);
     }
     Settings.NotifyBySettingName("SongSpeed", UpdateSongSpeed);
 }
 private void LoadedPlatform(PlatformDescriptor obj)
 {
     platform          = obj;
     oldPlatformColorR = platform.RedColor;
     oldPlatformColorB = platform.BlueColor;
     SetColorIfNotEqual(ref redNote, platform.RedNoteColor);
     SetColorIfNotEqual(ref blueNote, platform.BlueNoteColor);
     SetColorIfNotEqual(ref redLight, platform.RedColor);
     SetColorIfNotEqual(ref blueLight, platform.BlueColor);
     SetColorIfNotEqual(ref obstacle, platform.ObstacleColor);
 }
Example #6
0
    void PlatformLoaded(PlatformDescriptor descriptor)
    {
        for (int i = 0; i < 16; i++)
        {
            int        modified    = BeatmapEventContainer.EventTypeToModifiedType(i);
            GameObject instantiate = Instantiate(LayerInstantiate, LayerInstantiate.transform.parent);
            instantiate.transform.localPosition = new Vector3(modified, 0, 0);
            try
            {
                switch (i)
                {
                case 8:
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().text = "Ring Rotation";
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().font = UtilityAsset;
                    break;

                case 9:
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().text = "Small Ring Zoom";
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().font = UtilityAsset;
                    break;

                case 12:
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().text = "Left Laser Speed";
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().font = UtilityAsset;
                    break;

                case 13:
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().text = "Right Laser Speed";
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().font = UtilityAsset;
                    break;

                case 14:
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().text = "Rotation (Include Current Time)";
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().font = UtilityAsset;
                    break;

                case 15:
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().text = "Rotation (Exclude Current Time)";
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().font = UtilityAsset;
                    break;

                default:
                    LightsManager e = descriptor.LightingManagers[i];
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().text = e?.gameObject.name;
                    instantiate.GetComponentInChildren <TextMeshProUGUI>().font = AvailableAsset;
                    break;
                }
            }
            catch { }
        }
        LayerInstantiate.SetActive(false);
    }
    private void LoadedPlatform(PlatformDescriptor obj)
    {
        platform = obj;

        SetColorIfNotEqual(ref redNote, platform.colors.RedNoteColor, BeatSaberSong.DEFAULT_LEFTNOTE, BeatSaberSongContainer.Instance.difficultyData.colorLeft);
        SetColorIfNotEqual(ref blueNote, platform.colors.BlueNoteColor, BeatSaberSong.DEFAULT_RIGHTNOTE, BeatSaberSongContainer.Instance.difficultyData.colorRight);
        SetColorIfNotEqual(ref redLight, platform.colors.RedColor, BeatSaberSong.DEFAULT_LEFTCOLOR, BeatSaberSongContainer.Instance.difficultyData.envColorLeft);
        SetColorIfNotEqual(ref blueLight, platform.colors.BlueColor, BeatSaberSong.DEFAULT_RIGHTCOLOR, BeatSaberSongContainer.Instance.difficultyData.envColorRight);
        SetColorIfNotEqual(ref redBoost, platform.colors.RedBoostColor, BeatSaberSong.DEFAULT_LEFTCOLOR, BeatSaberSongContainer.Instance.difficultyData.boostColorLeft);
        SetColorIfNotEqual(ref blueBoost, platform.colors.BlueBoostColor, BeatSaberSong.DEFAULT_RIGHTCOLOR, BeatSaberSongContainer.Instance.difficultyData.boostColorRight);
        SetColorIfNotEqual(ref obstacle, platform.colors.ObstacleColor, BeatSaberSong.DEFAULT_LEFTCOLOR, BeatSaberSongContainer.Instance.difficultyData.obstacleColor);

        platform.colors.RedColor                = eventAppearance.RedColor = redLight.color;
        platform.colors.BlueColor               = eventAppearance.BlueColor = blueLight.color;
        platform.colors.RedBoostColor           = eventAppearance.RedBoostColor = redBoost.color;
        platform.colors.BlueBoostColor          = eventAppearance.BlueBoostColor = blueBoost.color;
        obstacleAppearance.defaultObstacleColor = obstacle.color;
    }
Example #8
0
 public void SetObstacleAppearance(BeatmapObstacleContainer obj, PlatformDescriptor platform = null)
 {
     if (platform != null)
     {
         defaultObstacleColor = platform.ObstacleColor;
     }
     Renderer[] renderers = obj.GetComponentsInChildren <Renderer>();
     foreach (Renderer renderer in renderers)
     {
         Material mat = renderer.material;
         if (obj.obstacleData._duration < 0 && Settings.Instance.ColorFakeWalls)
         {
             mat.SetColor(ColorTint, negativeDurationColor);
         }
         else
         {
             if (obj.obstacleData._customData != null)
             {
                 Vector2 wallSize = obj.obstacleData._customData["_scale"]?.ReadVector2() ?? Vector2.one;
                 if (wallSize.x < 0 || wallSize.y < 0 && Settings.Instance.ColorFakeWalls)
                 {
                     mat.SetColor(ColorTint, negativeWidthColor);
                 }
                 else
                 {
                     mat.SetColor(ColorTint, defaultObstacleColor);
                 }
                 if (obj.obstacleData._customData["_color"] != null)
                 {
                     mat.SetColor(ColorTint, obj.obstacleData._customData["_color"].ReadColor(defaultObstacleColor));
                 }
             }
             else if (obj.obstacleData._width < 0 && Settings.Instance.ColorFakeWalls)
             {
                 mat.SetColor(ColorTint, negativeWidthColor);
             }
             else
             {
                 mat.SetColor(ColorTint, defaultObstacleColor);
             }
         }
     }
 }
 public void SetObstacleAppearance(BeatmapObstacleContainer obj, PlatformDescriptor platform = null)
 {
     if (platform != null)
     {
         defaultObstacleColor = platform.colors.ObstacleColor;
     }
     foreach (Material mat in obj.ModelMaterials)
     {
         if (obj.obstacleData._duration < 0 && Settings.Instance.ColorFakeWalls)
         {
             mat.SetColor(ColorTint, negativeDurationColor);
         }
         else
         {
             if (obj.obstacleData._customData != null)
             {
                 Vector2 wallSize = obj.obstacleData._customData["_scale"]?.ReadVector2() ?? Vector2.one;
                 if (wallSize.x < 0 || wallSize.y < 0 && Settings.Instance.ColorFakeWalls)
                 {
                     mat.SetColor(ColorTint, negativeWidthColor);
                 }
                 else
                 {
                     mat.SetColor(ColorTint, defaultObstacleColor);
                 }
                 if (obj.obstacleData._customData.HasKey("_color"))
                 {
                     mat.SetColor(ColorTint, obj.obstacleData._customData["_color"].ReadColor(defaultObstacleColor));
                 }
             }
             else if (obj.obstacleData._width < 0 && Settings.Instance.ColorFakeWalls)
             {
                 mat.SetColor(ColorTint, negativeWidthColor);
             }
             else
             {
                 mat.SetColor(ColorTint, defaultObstacleColor);
             }
         }
     }
 }
Example #10
0
    public IEnumerator LoadMap()
    {
        if (BeatSaberSongContainer.Instance == null)
        {
            yield break;
        }
        PersistentUI.Instance.LevelLoadSlider.gameObject.SetActive(true);
        yield return(new WaitUntil(() => atsc.gridStartPosition != -1)); //I need a way to find out when Start has been called.

        song = BeatSaberSongContainer.Instance.song;
        float offset        = 0;
        int   environmentID = 0;
        int   batchSize     = Settings.Instance.InitialLoadBatchSize;
        bool  customPlat    = false;

        environmentID = SongInfoEditUI.GetEnvironmentIDFromString(song.environmentName);
        if (song.customData != null && song.customData["_customEnvironment"] != null && song.customData["_customEnvironment"].Value != "")
        {
            environmentID = SongInfoEditUI.GetCustomPlatformsIndexFromString(song.customData["_customEnvironment"]);
            customPlat    = true;
        }
        GameObject         platform    = (customPlat ? CustomPlatformPrefabs[environmentID] : PlatformPrefabs[environmentID]) ?? PlatformPrefabs[0];
        GameObject         instantiate = Instantiate(platform, new Vector3(0, -0.5f, -1.5f), Quaternion.identity);
        PlatformDescriptor descriptor  = instantiate.GetComponent <PlatformDescriptor>();

        BeatmapEventContainer.ModifyTypeMode = descriptor.SortMode;
        PlatformLoadedEvent.Invoke(descriptor);
        descriptor.RedColor  = BeatSaberSongContainer.Instance.difficultyData.colorLeft;
        descriptor.BlueColor = BeatSaberSongContainer.Instance.difficultyData.colorRight;
        map    = BeatSaberSongContainer.Instance.map;
        offset = (song.beatsPerMinute / 60) * (BeatSaberSongContainer.Instance.song.songTimeOffset / 1000);
        int noteLaneSize  = 2;                                        //Half of it, anyways
        int noteLayerSize = 3;
        Queue <BeatmapObject> queuedData = new Queue <BeatmapObject>( //Take all of our object data and combine them for batch loading.
            map._notes.Concat <BeatmapObject>(map._obstacles).Concat(map._events).Concat(map._BPMChanges));

        totalObjectsToLoad = queuedData.Count;
        if (map != null)
        {
            while (queuedData.Count > 0)
            {
                for (int i = 0; i < batchSize; i++)
                {
                    if (queuedData.Count == 0)
                    {
                        break;
                    }
                    BeatmapObject data = queuedData.Dequeue();
                    if (data is BeatmapNote noteData)
                    {
                        BeatmapNoteContainer beatmapNote = notesContainer.SpawnObject(noteData) as BeatmapNoteContainer;
                        if (noteData._lineIndex >= 1000 || noteData._lineIndex <= -1000 || noteData._lineLayer >= 1000 || noteData._lineLayer <= -1000)
                        {
                            continue;
                        }
                        if (2 - noteData._lineIndex > noteLaneSize)
                        {
                            noteLaneSize = 2 - noteData._lineIndex;
                        }
                        if (noteData._lineIndex - 1 > noteLaneSize)
                        {
                            noteLaneSize = noteData._lineIndex - 1;
                        }
                        if (noteData._lineLayer + 1 > noteLayerSize)
                        {
                            noteLayerSize = noteData._lineLayer + 1;
                        }
                    }
                    else if (data is BeatmapObstacle obstacleData)
                    {
                        BeatmapObstacleContainer beatmapObstacle = obstaclesContainer.SpawnObject(obstacleData) as BeatmapObstacleContainer;
                        if (obstacleData._lineIndex >= 1000 || obstacleData._lineIndex <= -1000)
                        {
                            continue;
                        }
                        if (2 - obstacleData._lineIndex > noteLaneSize)
                        {
                            noteLaneSize = 2 - obstacleData._lineIndex;
                        }
                        if (obstacleData._lineIndex - 1 > noteLaneSize)
                        {
                            noteLaneSize = obstacleData._lineIndex - 1;
                        }
                    }
                    else if (data is MapEvent eventData)
                    {
                        eventsContainer.SpawnObject(eventData);
                    }
                    else if (data is BeatmapBPMChange bpmData)
                    {
                        bpmContainer.SpawnObject(bpmData);
                    }
                }
                UpdateSlider(batchSize);
                yield return(new WaitForEndOfFrame());
            }
            notesContainer.SortObjects();
            obstaclesContainer.SortObjects();
            eventsContainer.SortObjects();
            bpmContainer.SortObjects();
            noteGrid.localScale = new Vector3((float)(noteLaneSize * 2) / 10 + 0.01f, 1, 1);
        }
        PersistentUI.Instance.LevelLoadSlider.gameObject.SetActive(false);
    }
    void PlatformLoaded(PlatformDescriptor descriptor)
    {
        LightingManagers = descriptor.LightingManagers;

        UpdateLabels(EventsContainer.PropMode.Off, MapEvent.EVENT_TYPE_RING_LIGHTS);
    }
Example #12
0
    public IEnumerator LoadMap()
    {
        if (BeatSaberSongContainer.Instance == null)
        {
            yield break;
        }
        PersistentUI.Instance.LevelLoadSlider.gameObject.SetActive(true);
        PersistentUI.Instance.LevelLoadSliderLabel.text = "";
        yield return(new WaitUntil(() => atsc.gridStartPosition != -1)); //I need a way to find out when Start has been called.

        song = BeatSaberSongContainer.Instance.song;                     //Grab songe data
        diff = BeatSaberSongContainer.Instance.difficultyData;

        //Set up some local variables
        int  environmentID = 0;
        int  batchSize     = Settings.Instance.InitialLoadBatchSize;
        bool customPlat    = false;

        environmentID = SongInfoEditUI.GetEnvironmentIDFromString(song.environmentName); //Grab platform by name (Official or Custom)
        if (song.customData != null && song.customData["_customEnvironment"] != null && song.customData["_customEnvironment"].Value != "")
        {
            if (SongInfoEditUI.GetCustomPlatformsIndexFromString(song.customData["_customEnvironment"]) >= 0)
            {
                environmentID = SongInfoEditUI.GetCustomPlatformsIndexFromString(song.customData["_customEnvironment"]);
                customPlat    = true;
            }
        }

        //Instantiate platform, grab descriptor
        GameObject         platform    = (customPlat ? CustomPlatformPrefabs[environmentID] : PlatformPrefabs[environmentID]) ?? PlatformPrefabs[0];
        GameObject         instantiate = Instantiate(platform, new Vector3(0, -0.5f, -1.5f), Quaternion.identity);
        PlatformDescriptor descriptor  = instantiate.GetComponent <PlatformDescriptor>();

        BeatmapEventContainer.ModifyTypeMode = descriptor.SortMode; //Change sort mode

        //Update Colors
        Color leftNote = BeatSaberSong.DEFAULT_LEFTNOTE; //Have default note as base

        if (descriptor.RedColor != BeatSaberSong.DEFAULT_LEFTCOLOR)
        {
            leftNote = descriptor.RedColor;                                                         //Prioritize platforms
        }
        if (diff.colorLeft != BeatSaberSong.DEFAULT_LEFTNOTE)
        {
            leftNote = diff.colorLeft;                                                   //Then prioritize custom colors
        }
        Color rightNote = BeatSaberSong.DEFAULT_RIGHTNOTE;

        if (descriptor.BlueColor != BeatSaberSong.DEFAULT_RIGHTCOLOR)
        {
            rightNote = descriptor.BlueColor;
        }
        if (diff.colorRight != BeatSaberSong.DEFAULT_RIGHTNOTE)
        {
            rightNote = diff.colorRight;
        }

        notesContainer.UpdateColor(leftNote, rightNote);
        obstaclesContainer.UpdateColor(diff.obstacleColor);
        if (diff.colorLeft != BeatSaberSong.DEFAULT_LEFTNOTE)
        {
            descriptor.RedColor = diff.colorLeft;
        }
        if (diff.colorRight != BeatSaberSong.DEFAULT_RIGHTNOTE)
        {
            descriptor.BlueColor = diff.colorRight;
        }
        if (diff.envColorLeft != BeatSaberSong.DEFAULT_LEFTCOLOR)
        {
            descriptor.RedColor = diff.envColorLeft;
        }
        if (diff.envColorRight != BeatSaberSong.DEFAULT_RIGHTCOLOR)
        {
            descriptor.BlueColor = diff.envColorRight;
        }

        PlatformLoadedEvent.Invoke(descriptor);    //Trigger event for classes that use the platform

        map = BeatSaberSongContainer.Instance.map; //Grab map info, do some stuff
        int noteLaneSize  = 2;                     //Half of it, anyways
        int noteLayerSize = 3;

        Queue <BeatmapObject> queuedData = new Queue <BeatmapObject>( //Take all of our object data and combine them for batch loading.
            map._notes.Concat <BeatmapObject>(map._obstacles).Concat(map._events).Concat(map._BPMChanges).Concat(map._customEvents));

        totalObjectsToLoad = queuedData.Count;
        if (map != null)
        {
            while (queuedData.Count > 0)
            { //Batch loading is loading a certain amount of objects (Batch Size) every frame, so at least ChroMapper remains active.
                for (int i = 0; i < batchSize; i++)
                {
                    if (queuedData.Count == 0)
                    {
                        break;
                    }
                    BeatmapObject data = queuedData.Dequeue(); //Dequeue and load them into ChroMapper.
                    if (data is BeatmapNote noteData)
                    {
                        BeatmapNoteContainer beatmapNote = notesContainer.SpawnObject(noteData, out _) as BeatmapNoteContainer;
                        if (noteData._lineIndex >= 1000 || noteData._lineIndex <= -1000 || noteData._lineLayer >= 1000 || noteData._lineLayer <= -1000)
                        {
                            continue;
                        }
                        if (2 - noteData._lineIndex > noteLaneSize)
                        {
                            noteLaneSize = 2 - noteData._lineIndex;
                        }
                        if (noteData._lineIndex - 1 > noteLaneSize)
                        {
                            noteLaneSize = noteData._lineIndex - 1;
                        }
                        if (noteData._lineLayer + 1 > noteLayerSize)
                        {
                            noteLayerSize = noteData._lineLayer + 1;
                        }
                    }
                    else if (data is BeatmapObstacle obstacleData)
                    {
                        BeatmapObstacleContainer beatmapObstacle = obstaclesContainer.SpawnObject(obstacleData, out _) as BeatmapObstacleContainer;
                        if (obstacleData._lineIndex >= 1000 || obstacleData._lineIndex <= -1000)
                        {
                            continue;
                        }
                        if (2 - obstacleData._lineIndex > noteLaneSize)
                        {
                            noteLaneSize = 2 - obstacleData._lineIndex;
                        }
                        if (obstacleData._lineIndex - 1 > noteLaneSize)
                        {
                            noteLaneSize = obstacleData._lineIndex - 1;
                        }
                    }
                    else if (data is MapEvent eventData)
                    {
                        eventsContainer.SpawnObject(eventData, out _);
                    }
                    else if (data is BeatmapBPMChange bpmData)
                    {
                        bpmContainer.SpawnObject(bpmData, out _);
                    }
                    else if (data is BeatmapCustomEvent customData)
                    {
                        customEventsContainer.SpawnObject(customData, out _);
                    }
                }
                UpdateSlider(batchSize);
                yield return(new WaitForEndOfFrame());
            }
            notesContainer.SortObjects(); //Sort these boyes.
            obstaclesContainer.SortObjects();
            eventsContainer.SortObjects();
            bpmContainer.SortObjects();
            customEventsContainer.SortObjects();
            noteGrid.localScale = new Vector3((float)(noteLaneSize * 2) / 10 + 0.01f, 1, 1); //Set note lanes appropriately
        }
        PersistentUI.Instance.LevelLoadSlider.gameObject.SetActive(false);                   //Disable progress bar
        LevelLoadedEvent?.Invoke();
    }
    void PlatformLoaded(PlatformDescriptor descriptor)
    {
        LightingManagers = descriptor.LightingManagers;

        UpdateLabels(false);
    }
Example #14
0
    public IEnumerator LoadMap()
    {
        if (BeatSaberSongContainer.Instance == null)
        {
            yield break;
        }
        PersistentUI.Instance.LevelLoadSliderLabel.text = "";
        yield return(new WaitUntil(() => atsc.gridStartPosition != -1)); //I need a way to find out when Start has been called.

        song = BeatSaberSongContainer.Instance.song;                     //Grab songe data
        diff = BeatSaberSongContainer.Instance.difficultyData;

        //Set up some local variables
        int  environmentID = 0;
        bool customPlat    = false;
        bool directional   = false;

        environmentID = SongInfoEditUI.GetEnvironmentIDFromString(song.environmentName); //Grab platform by name (Official or Custom)
        if (song.customData != null && ((song.customData["_customEnvironment"] != null && song.customData["_customEnvironment"].Value != "")))
        {
            if (CustomPlatformsLoader.Instance.GetAllEnvironmentIds().IndexOf(song.customData["_customEnvironment"] ?? "") >= 0)
            {
                customPlat = true;
            }
        }
        if (rotationController.IsActive && diff.parentBeatmapSet.beatmapCharacteristicName != "Lawless")
        {
            environmentID = SongInfoEditUI.GetDirectionalEnvironmentIDFromString(song.allDirectionsEnvironmentName);
            customPlat    = false;
            directional   = true;
        }

        //Instantiate platform, grab descriptor
        GameObject platform = (customPlat ? CustomPlatformsLoader.Instance.LoadPlatform(song.customData["_customEnvironment"], (PlatformPrefabs[environmentID]) ?? PlatformPrefabs[0], null) : PlatformPrefabs[environmentID]) ?? PlatformPrefabs[0];

        if (directional)
        {
            platform = DirectionalPlatformPrefabs[environmentID];
        }
        GameObject instantiate = null;

        if (customPlat)
        {
            instantiate = platform;
        }
        else
        {
            Debug.Log("Instanciate nonCustomPlat");
            instantiate = Instantiate(platform, PlatformOffset, Quaternion.identity) as GameObject;
        }
        PlatformDescriptor descriptor = instantiate.GetComponent <PlatformDescriptor>();

        BeatmapEventContainer.ModifyTypeMode = descriptor.SortMode; //Change sort mode

        //Update Colors
        Color leftNote = BeatSaberSong.DEFAULT_LEFTNOTE; //Have default note as base

        if (descriptor.RedColor != BeatSaberSong.DEFAULT_LEFTCOLOR)
        {
            leftNote = descriptor.RedColor;                                                         //Prioritize platforms
        }
        if (diff.colorLeft != BeatSaberSong.DEFAULT_LEFTNOTE)
        {
            leftNote = diff.colorLeft;                                                   //Then prioritize custom colors
        }
        Color rightNote = BeatSaberSong.DEFAULT_RIGHTNOTE;

        if (descriptor.BlueColor != BeatSaberSong.DEFAULT_RIGHTCOLOR)
        {
            rightNote = descriptor.BlueColor;
        }
        if (diff.colorRight != BeatSaberSong.DEFAULT_RIGHTNOTE)
        {
            rightNote = diff.colorRight;
        }

        notesContainer.UpdateColor(leftNote, rightNote);
        obstaclesContainer.UpdateColor(diff.obstacleColor);
        if (diff.colorLeft != BeatSaberSong.DEFAULT_LEFTNOTE)
        {
            descriptor.RedColor = diff.colorLeft;
        }
        if (diff.colorRight != BeatSaberSong.DEFAULT_RIGHTNOTE)
        {
            descriptor.BlueColor = diff.colorRight;
        }
        if (diff.envColorLeft != BeatSaberSong.DEFAULT_LEFTCOLOR)
        {
            descriptor.RedColor = diff.envColorLeft;
        }
        if (diff.envColorRight != BeatSaberSong.DEFAULT_RIGHTCOLOR)
        {
            descriptor.BlueColor = diff.envColorRight;
        }

        PlatformLoadedEvent.Invoke(descriptor); //Trigger event for classes that use the platform

        loader.UpdateMapData(BeatSaberSongContainer.Instance.map);
        yield return(StartCoroutine(loader.HardRefresh()));

        LevelLoadedEvent?.Invoke();
    }
    public void SetEventAppearance(BeatmapEventContainer e, bool final = true, PlatformDescriptor platform = null)
    {
        if (platform != null)
        {
            RedColor  = platform.RedColor;
            BlueColor = platform.BlueColor;
        }
        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;
        }
        if (e.eventData._customData?["_color"] != null && e.eventData._value > 0)
        {
            e.ChangeColor(e.eventData._customData["_color"]);
        }
    }
Example #16
0
 private void PlatformLoaded(PlatformDescriptor obj)
 {
     descriptor = obj;
 }
Example #17
0
 private void PlatformLoaded(PlatformDescriptor platform)
 {
     descriptor = platform;
 }
Example #18
0
 void PlatformLoaded(PlatformDescriptor descriptor)
 {
     platform = descriptor;
 }
 private void LoadedPlatform(PlatformDescriptor obj)
 {
     platform          = obj;
     oldPlatformColorR = platform.RedColor;
     oldPlatformColorB = platform.BlueColor;
 }
Example #20
0
 private void LoadPlatform(PlatformDescriptor obj)
 {
     descriptor = obj;
 }
Example #21
0
 void PlatformLoaded(PlatformDescriptor descriptor)
 {
     platformDescriptor = descriptor;
     labels.UpdateLabels(false, 16);
     eventPlacement.SetGridSize(6 + descriptor.LightingManagers.Count(s => s != null));
 }
    public GameObject LoadPlatform(string customEnvironmentString, GameObject defaultEnvironment = null, string customPlatformString = null)
    {
        try
        {
            GameObject defaultEnvironmentInstance = null;
            if (defaultEnvironment != null)
            {
                defaultEnvironmentInstance = Instantiate(defaultEnvironment, LoadInitialMap.PlatformOffset, Quaternion.identity);
                platformDescriptor         = defaultEnvironmentInstance.GetComponentInParent <PlatformDescriptor>();
            }
            GameObject[]   customEnvironments = customPlatformSettings.LoadPlatform(customEnvironmentString);
            GameObject     customEnvironment  = null;
            CustomPlatform environmentCP      = null;
            foreach (GameObject g in customEnvironments)
            {
                environmentCP = FindCustomPlatformScript(g);
                if (environmentCP != null)
                {
                    customEnvironment = g;
                    RemoveHiddenElementsFromEnvironment(defaultEnvironmentInstance, environmentCP);
                    break;
                }
            }

            GameObject[] customPlatforms = null;
            GameObject   customPlatform  = null;
            if (customPlatformString != null)
            {
                customPlatforms = customPlatformSettings.LoadPlatform(customPlatformString);

                CustomPlatform platformCP = null;
                foreach (GameObject g in customPlatforms)
                {
                    platformCP = FindCustomPlatformScript(g);
                    if (platformCP != null)
                    {
                        customPlatform = g;
                        RemoveHiddenElementsFromEnvironment(defaultEnvironmentInstance, platformCP);
                        break;
                    }
                }

                GameObject customPlatformInstance = Instantiate(customPlatform, LoadInitialMap.PlatformOffset, Quaternion.identity);
                DisableElementsFromEnvironmentRecursive(customPlatformInstance, "Camera");
                customPlatformInstance.transform.SetParent(defaultEnvironmentInstance.transform);
                foreach (GameObject g in customPlatforms)
                {
                    if (g != customPlatform)
                    {
                        GameObject customPlatformInstance2 = Instantiate(g, LoadInitialMap.PlatformOffset, Quaternion.identity);
                        customPlatformInstance2.transform.SetParent(customPlatformInstance.transform);
                    }
                }
            }

            if (defaultEnvironment != null)
            {
                GameObject customEnvironmentInstance = Instantiate(customEnvironment, LoadInitialMap.PlatformOffset, Quaternion.identity);
                DisableElementsFromEnvironmentRecursive(customEnvironmentInstance, "Camera");
                customEnvironmentInstance.transform.SetParent(defaultEnvironmentInstance.transform);
                foreach (GameObject g in customEnvironments)
                {
                    if (g != customEnvironment)
                    {
                        GameObject customEnvironmentInstance2 = Instantiate(g, LoadInitialMap.PlatformOffset, Quaternion.identity);
                        customEnvironmentInstance2.transform.SetParent(customEnvironmentInstance.transform);
                    }
                }

                ReplaceBetterBlack(defaultEnvironmentInstance);
                foreach (Renderer renderer in defaultEnvironmentInstance.GetComponentsInChildren <Renderer>())
                {
                    SetShadersCorrectly(renderer);
                }

                //Set LightsManager Size correctly
                SetLightsManagerSize(defaultEnvironmentInstance);

                //Rings
                int          ringCount  = 0;
                TrackRings[] trackRings = defaultEnvironmentInstance.GetComponentsInChildren <TrackRings>();
                foreach (TrackRings trackRing in trackRings)
                {
                    SetRings(trackRing.gameObject, trackRing, ringCount);
                    ringCount++;
                }

                //TubeLights

                SetLightingEventsForTubeLights(defaultEnvironmentInstance);

                return(defaultEnvironmentInstance);
            }


            return(customEnvironment);
        }
        catch
        {
            return(Instantiate(defaultEnvironment, LoadInitialMap.PlatformOffset, Quaternion.identity));
        }
    }
 private void LoadPlatform(PlatformDescriptor descriptor)
 {
     platform = descriptor;
 }
Example #24
0
 private void SetupColors(PlatformDescriptor descriptor)
 {
     platform = descriptor;
     UpdateColors();
 }
    void PlatformLoaded(PlatformDescriptor descriptor)
    {
        LightingManagers = descriptor.LightingManagers;

        UpdateLabels(false, MapEvent.EVENT_TYPE_RING_LIGHTS);
    }