Exemplo n.º 1
0
        public static bool Prefix(ref Saber.SaberType type, ref Color __result)
        {
            if (ColourManager.TechnicolourSabers)
            {
                __result = ColourManager.GetTechnicolour(type == Saber.SaberType.SaberA, Time.time, ChromaConfig.TechnicolourSabersStyle);
                return(false);
            }

            if (type == Saber.SaberType.SaberA)
            {
                if (ColourManager.A != Color.clear)
                {
                    __result = ColourManager.A;
                    return(false);
                }
            }
            else
            {
                if (ColourManager.B != Color.clear)
                {
                    __result = ColourManager.B;
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 public static void ActivateTechnicolour(BeatmapEventData baseData, LightSwitchEventEffect lse, BeatmapEventType type)
 {
     BSLight[] lights = lse.GetField <BSLight[]>("_lights");
     for (int i = 0; i < lights.Length; i++)
     {
         lights[i].color = ColourManager.GetTechnicolour(baseData.value > 3, baseData.time + lights[i].GetInstanceID(), ColourManager.TechnicolourStyle.PURE_RANDOM);
     }
 }
Exemplo n.º 3
0
        // Colour Events
        //   - Stores two colour values, A and B
        //   - These events have two purposes
        //     - Used to recolour any lighting events placed after them, unless...
        //     - if used immediately after a "data event", their values will influence the data event.
        // 1,900,000,001 = 1900000001 = A/B
        // 1,900,000,002 = 1900000002 = AltA/AltB
        // 1,900,000,003 = 1900000003 = White/Half White
        // 1,900,000,004 = 1900000004 = Technicolor/Technicolor
        // 1,900,000,005 = 1900000005 = RandomColor/RandomColor

        // Data Events
        //   - Require Colour Events before them
        //   - Remember Unity colour uses 0-1, not 0-255
        // 1,950,000,001 = 1950000001 = Note Scale Event        - Scales all future spawned notes by (A.red * 1.5f)
        // 1,950,000,002 = 1950000002 = Health Event            - Alters the player's health by ((A.red - 0.5f) * 2)
        // 1,950,000,003 = 1950000003 = Rotate Event            - Rotates the player on all three axes by (A.red * 360 on x axis, A.green * 360 on y axis, A.blue * 360 on z axis)
        // 1,950,000,004 = 1950000004 = Ambient Light Event     - Immediately changes the colour of ambient lights to (A)
        // 1,950,000,005 = 1950000005 = Barrier Colour Event    - Changes all future spawned barrier colours to (A)

        // > 2,000,000,000 = >2000000000 = RGB (see ColourManager.ColourFromInt)

        public static ChromaEvent ApplyCustomEvent(BeatmapEventData bev, ref ChromaColourEvent unfilledColourEvent)
        {
            //ChromaLogger.Log("Checking BEV ||| " + bev.time + "s : " + bev.value + "v");

            Color a, b;

            if (bev.value >= ColourManager.RGB_INT_OFFSET)   // > 2,000,000,000 = >2000000000 = RGB (see ColourManager.ColourFromInt)
            {
                a = ColourManager.ColourFromInt(bev.value);
                b = a;
                if (FillColourEvent(bev, ref unfilledColourEvent, a))
                {
                    return(unfilledColourEvent);
                }
            }
            else
            {
                switch (bev.value)
                {
                case ChromaLightEvent.CHROMA_LIGHT_OFFSET + 1:     // 1,900,000,001 = 1900000001 = A/B
                    a = ColourManager.LightA;
                    b = ColourManager.LightB;
                    break;

                case ChromaLightEvent.CHROMA_LIGHT_OFFSET + 2:     // 1,900,000,002 = 1900000002 = AltA/AltB
                    a = ColourManager.LightAltA;
                    b = ColourManager.LightAltB;
                    break;

                case ChromaLightEvent.CHROMA_LIGHT_OFFSET + 3:     // 1,900,000,003 = 1900000003 = White/Half White
                    a = ColourManager.LightWhite;
                    b = ColourManager.LightGrey;
                    break;

                case ChromaLightEvent.CHROMA_LIGHT_OFFSET + 4:     // 1,900,000,004 = 1900000004 = Technicolor/Technicolor
                    a = ColourManager.GetTechnicolour(true, bev.time, ColourManager.TechnicolourStyle.WARM_COLD);
                    b = ColourManager.GetTechnicolour(false, bev.time, ColourManager.TechnicolourStyle.WARM_COLD);
                    break;

                case ChromaLightEvent.CHROMA_LIGHT_OFFSET + 5:     // 1,900,000,005 = 1900000005 = RandomColor/RandomColor
                    a = UnityEngine.Random.ColorHSV(); a.a = 1;
                    b = UnityEngine.Random.ColorHSV(); b.a = 1;
                    break;

                /*
                 *
                 */
                case ChromaEvent.CHROMA_EVENT_SCALE:     //1,950,000,001 = 1950000001 = Note Scale Event
                    unfilledColourEvent = new ChromaNoteScaleEvent(bev);
                    return(null);

                case ChromaEvent.CHROMA_EVENT_HEALTH:     //1,950,000,002 = 1950000002 = Health Event
                    unfilledColourEvent = new ChromaHealthEvent(bev);
                    return(null);

                case ChromaEvent.CHROMA_EVENT_ROTATE:     //1,950,000,003 = 1950000003 = Rotate Event
                    unfilledColourEvent = new ChromaRotateEvent(bev);
                    return(null);

                case ChromaEvent.CHROMA_EVENT_AMBIENT_LIGHT:     //1,950,000,004 = 1950000004 = Ambient Light Event
                    unfilledColourEvent = new ChromaAmbientLightEvent(bev);
                    return(null);

                case ChromaEvent.CHROMA_EVENT_BARRIER_COLOUR:     //1,950,000,005 = 1950000005 = Barrier Colour Event
                    unfilledColourEvent = new ChromaBarrierColourEvent(bev);
                    return(null);

                case ChromaEvent.CHROMA_EVENT_RING_SPEED_MULT:     //1,950,000,006 = 1950000006 = Ring Speed Event
                    unfilledColourEvent = new ChromaRingSpeedEvent(bev);
                    return(null);

                case ChromaEvent.CHROMA_EVENT_RING_PROPAGATION_MULT:     //1,950,000,007 = 1950000007 = Ring Prop Event
                    unfilledColourEvent = new ChromaRingPropagationEvent(bev);
                    return(null);

                case ChromaEvent.CHROMA_EVENT_RING_STEP_MULT:     //1,950,000,008 = 1950000008 = Ring Step Event
                    unfilledColourEvent = new ChromaRingStepEvent(bev);
                    return(null);

                default: return(null);
                }
                if (FillColourEvent(bev, ref unfilledColourEvent, a, b))
                {
                    return(unfilledColourEvent);
                }
            }

            if (unfilledColourEvent != null)
            {
                unfilledColourEvent = null;
            }

            return(ChromaEvent.SetChromaEvent(bev, new ChromaLightEvent(bev, a, b)));
        }
 static void Prefix(ref NoteController noteController)
 {
     if (ColourManager.TechnicolourBlocks)
     {
         ColourManager.SetNoteTypeColourOverride(noteController.noteData.noteType, ColourManager.GetTechnicolour(noteController.noteData.noteType == NoteType.NoteA, noteController.noteData.time, ChromaConfig.TechnicolourBlocksStyle));
     }
 }
Exemplo n.º 5
0
        static bool Prefix(LightSwitchEventEffect __instance, ref BeatmapEventData beatmapEventData, ref BeatmapEventType ____event)
        {
            if (beatmapEventData.value == ChromaJSONEventData.GLOBAL_DO_NOTHING_VALUE)
            {
                return(false);
            }

            try {
                // https://docs.google.com/spreadsheets/d/1vCTlDvx0ZW8NkkZBYW6ecvXaVRxDUKX7QIoah9PCp_c/edit#gid=0
                if (ColourManager.TechnicolourLights && (int)____event <= 4)   //0-4 are actual lighting events, we don't want to bother with anything else like ring spins or custom events
                                                                               //System.Random noteRandom = new System.Random(Mathf.FloorToInt(beatmapEventData.time * 408));
                {
                    if (techniLightRandom.NextDouble() < ChromaConfig.TechnicolourLightsFrequency)
                    {
                        if (beatmapEventData.value <= 3)   //Blue events are 1, 2 and 3
                        {
                            switch (ChromaConfig.TechnicolourLightsGrouping)
                            {
                            case ColourManager.TechnicolourLightsGrouping.ISOLATED:
                                //LightsIsolatedTechnicolour.Activate(__instance, ____event, ChromaConfig.TechnicolourLightsStyle, false, beatmapEventData.time);
                                MayhemEvent.ActivateTechnicolour(beatmapEventData, __instance, ____event);
                                return(false);

                            case ColourManager.TechnicolourLightsGrouping.ISOLATED_GROUP:
                                __instance.SetLightingColourB(ColourManager.GetTechnicolour(false, beatmapEventData.time, ChromaConfig.TechnicolourLightsStyle));
                                break;

                            default:
                                ColourManager.RecolourAllLights(Color.clear, ColourManager.GetTechnicolour(false, beatmapEventData.time, ChromaConfig.TechnicolourLightsStyle));
                                break;
                            }
                        }
                        else
                        {
                            switch (ChromaConfig.TechnicolourLightsGrouping)
                            {
                            case ColourManager.TechnicolourLightsGrouping.ISOLATED:
                                //LightsIsolatedTechnicolour.Activate(__instance, ____event, ChromaConfig.TechnicolourLightsStyle, true, beatmapEventData.time);
                                MayhemEvent.ActivateTechnicolour(beatmapEventData, __instance, ____event);
                                return(false);

                            case ColourManager.TechnicolourLightsGrouping.ISOLATED_GROUP:
                                __instance.SetLightingColourA(ColourManager.GetTechnicolour(true, beatmapEventData.time, ChromaConfig.TechnicolourLightsStyle));
                                break;

                            default:
                                ColourManager.RecolourAllLights(ColourManager.GetTechnicolour(true, beatmapEventData.time, ChromaConfig.TechnicolourLightsStyle), Color.clear);
                                break;
                            }
                        }
                    }
                }
            } catch (Exception e) {
                ChromaLogger.Log("Exception handling technicolour lights!", ChromaLogger.Level.WARNING);
                ChromaLogger.Log(e);
            }

            try {
                if (ChromaEvent.SimpleEventActivate(__instance, ref beatmapEventData, ref ____event))
                {
                    return(false);
                }

                if (beatmapEventData.type == ____event)
                {
                    //CustomLightBehaviour customLight = CustomLightBehaviour.GetCustomLightColour(beatmapEventData);
                    ChromaEvent customEvent = ChromaEvent.GetChromaEvent(beatmapEventData);
                    if (customEvent != null)
                    {
                        if (customEvent.RequiresColourEventsEnabled && !ChromaConfig.CustomColourEventsEnabled)
                        {
                            return(false);
                        }
                        if (customEvent.RequiresSpecialEventsEnabled && !ChromaConfig.CustomSpecialEventsEnabled)
                        {
                            return(false);
                        }
                        customEvent.Activate(ref __instance, ref beatmapEventData, ref ____event);
                        return(false);
                    }

                    ChromaJSONEventData chromaEvent = ChromaJSONEventData.GetChromaEvent(beatmapEventData);
                    if (chromaEvent != null)
                    {
                        chromaEvent.Activate(beatmapEventData, __instance, ____event);
                    }
                }
            } catch (Exception e) {
                ChromaLogger.Log("Exception handling lights!", ChromaLogger.Level.WARNING);
                ChromaLogger.Log(e);
            }

            return(true);
        }
Exemplo n.º 6
0
 static void Prefix(ref NoteController noteController)
 {
     if (ColourManager.TechnicolourBlocks)
     {
         try {
             //ColourManager.SetNoteTypeColourOverride(noteController.noteData.noteType, Color.green);
             ColourManager.SetNoteTypeColourOverride(noteController.noteData.noteType, ColourManager.GetTechnicolour(noteController.noteData, ChromaConfig.TechnicolourBlocksStyle));
         } catch (Exception e) {
             ChromaLogger.Log(e);
         }
     }
 }