Ejemplo n.º 1
0
        internal static void Prefix(ref BeatmapObjectsInstaller __instance, ref GameNoteController ____normalBasicNotePrefab, ref BombNoteController ____bombNotePrefab)
        {
            var         mib       = __instance as MonoInstallerBase;
            DiContainer Container = Accessors.GetDiContainer(ref mib);

            _staticGameNotePrefab = ____normalBasicNotePrefab;
            _staticBombNotePrefab = ____bombNotePrefab;

            if (_staticGameNotePrefab != null)
            {
                ____normalBasicNotePrefab = _staticGameNotePrefab;
            }
            if (_staticBombNotePrefab != null)
            {
                ____bombNotePrefab = _staticBombNotePrefab;
            }

            var normal = InstallModelProviderSystem(Container, ____normalBasicNotePrefab);
            var bomb   = InstallModelProviderSystem(Container, ____bombNotePrefab);

            if (normal != null)
            {
                normal.gameObject.SetActive(false);
                ____normalBasicNotePrefab.gameObject.SetActive(false);
                ____normalBasicNotePrefab = normal;
            }
            if (bomb != null)
            {
                bomb.gameObject.SetActive(false);
                ____bombNotePrefab.gameObject.SetActive(false);
                ____bombNotePrefab = bomb;
            }
        }
        private static void Prefix(ref BombNoteController __instance)
        {
            try
            {
                CustomNote activeNote = NoteAssetLoader.CustomNoteObjects[NoteAssetLoader.SelectedNote];
                Transform  child      = __instance.gameObject.transform.Find("Mesh");

                // Only instantiate a new CustomNote if one is not already attached to this object
                // and we are not using the default ones
                if (activeNote.FileName != "DefaultNotes" &&
                    activeNote.NoteBomb &&
                    !child.Find("customNote")?.gameObject)
                {
                    GameObject fakeMesh = UnityEngine.Object.Instantiate(activeNote.NoteBomb);
                    fakeMesh.name = "customNote";
                    fakeMesh.transform.SetParent(child);
                    fakeMesh.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
                    fakeMesh.transform.localScale    = new Vector3(0.4f, 0.4f, 0.4f);
                    fakeMesh.transform.Rotate(new Vector3(0f, 0f, 90f), Space.Self);
                }
            }
            catch (Exception ex)
            {
                Logger.log.Error(ex);
            }
        }
Ejemplo n.º 3
0
 private void Colorize(BombNoteController __instance, NoteData noteData)
 {
     _manager.GlobalColorize(TechnicolorController.GetTechnicolor(
                                 true,
                                 noteData.time + __instance.GetInstanceID(),
                                 TechnicolorConfig.Instance.TechnicolorBombsStyle));
 }
 public static void Postfix(ref BombNoteController __instance)
 {
     try
     {
         var bombMesh = __instance.gameObject.GetComponentInChildren <MeshRenderer>();
         bombMesh.enabled = true;
         CustomNote activeNote = Plugin.customNotes[Plugin.selectedNote];
         Transform  child      = __instance.gameObject.transform.Find("Mesh");
         GameObject.Destroy(child.Find("customNote")?.gameObject);
         if (activeNote.path != "DefaultNotes")
         {
             GameObject customNote;
             if (activeNote.noteBomb)
             {
                 customNote = activeNote.noteBomb;
             }
             else
             {
                 return;
             }
             bombMesh.enabled = false;
             GameObject fakeMesh = GameObject.Instantiate(customNote);
             fakeMesh.name = "customNote";
             fakeMesh.transform.SetParent(child);
             fakeMesh.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
             fakeMesh.transform.localScale    = new Vector3(0.4f, 0.4f, 0.4f);
             fakeMesh.transform.Rotate(new Vector3(0, 0, 0), Space.Self);
         }
     }
     catch (Exception err)
     {
         Logger.log.Error(err);
     }
 }
Ejemplo n.º 5
0
            internal static BNCColorManager GetBNCColorManager(BombNoteController nc)
            {
                if (_bncColorManagers.TryGetValue(nc, out BNCColorManager colorManager))
                {
                    return(colorManager);
                }

                return(null);
            }
Ejemplo n.º 6
0
        public BombNoteController DecorateBombs(BombNoteController original)
        {
            if (!_shouldSetup)
            {
                return(original);
            }

            original.gameObject.AddComponent <CustomBombController>();
            return(original);
        }
Ejemplo n.º 7
0
            private BNCColorManager(BombNoteController nc)
            {
                _nc = nc;

                _bombMaterial = nc.noteTransform.gameObject.GetComponent <Renderer>().material;

                _color_Original = _bombMaterial.GetColor("_SimpleColor");
                if (_globalColor.HasValue)
                {
                    _bombMaterial.SetColor("_SimpleColor", _globalColor.Value);
                }
            }
Ejemplo n.º 8
0
        private static void Postfix(BombNoteController __instance, NoteData noteData)
        {
            // They said it couldn't be done, they called me a madman
            ChromaObjectData?chromaData = TryGetObjectData <ChromaObjectData>(noteData);

            if (chromaData == null)
            {
                return;
            }

            __instance.ColorizeBomb(chromaData.Color);
        }
Ejemplo n.º 9
0
            internal static BNCColorManager CreateBNCColorManager(BombNoteController nc)
            {
                if (GetBNCColorManager(nc) != null)
                {
                    return(null);
                }

                BNCColorManager bnccm;

                bnccm = new BNCColorManager(nc);
                _bncColorManagers.Add(nc, bnccm);
                return(bnccm);
            }
Ejemplo n.º 10
0
        private static void Prefix(BombNoteController __instance, NoteData noteData)
        {
            // They said it couldn't be done, they called me a madman
            ChromaObjectData chromaData = ChromaObjectDatas[noteData];
            Color?           color      = chromaData.Color;

            if (color.HasValue)
            {
                __instance.SetBombColor(color);
            }
            else
            {
                __instance.Reset();
            }
        }
Ejemplo n.º 11
0
        internal void Init(PluginConfig pluginConfig, NoteAssetLoader noteAssetLoader, [Inject(Id = "cn.bomb")] SiraPrefabContainer.Pool bombContainerPool)
        {
            _pluginConfig = pluginConfig;

            _customNote         = noteAssetLoader.CustomNoteObjects[noteAssetLoader.SelectedNote];
            _bombNoteController = GetComponent <BombNoteController>();
            _noteMovement       = GetComponent <NoteMovement>();
            _bombNoteController.didInitEvent     += Controller_Init;
            _noteMovement.noteDidFinishJumpEvent += DidFinish;
            bombMesh = gameObject.transform.Find("Mesh");
            bombPool = bombContainerPool;

            MeshRenderer bm = GetComponentInChildren <MeshRenderer>();

            bm.enabled = false;
        }
        private static void Postfix(ref BombNoteController __instance)
        {
            try
            {
                CustomNote activeNote = NoteAssetLoader.CustomNoteObjects[NoteAssetLoader.SelectedNote];

                if (activeNote.FileName != "DefaultNotes" &&
                    activeNote.NoteBomb)
                {
                    // Hide certain parts of the default bomb which is not required
                    MeshRenderer bombMesh = __instance.gameObject.GetComponentInChildren <MeshRenderer>();
                    bombMesh.enabled = false;
                }
            }
            catch (Exception ex)
            {
                Logger.log.Error(ex);
            }
        }
        internal void Init(PluginConfig pluginConfig, NoteAssetLoader noteAssetLoader, [InjectOptional(Id = "cn.bomb")] SiraPrefabContainer.Pool bombContainerPool)
        {
            _pluginConfig = pluginConfig;

            _customNote = noteAssetLoader.CustomNoteObjects[noteAssetLoader.SelectedNote];
            bombPool    = bombContainerPool;

            _bombNoteController = GetComponent <BombNoteController>();
            _noteMovement       = GetComponent <NoteMovement>();

            if (bombPool != null)
            {
                _bombNoteController.didInitEvent.Add(this);
                _noteMovement.noteDidFinishJumpEvent += DidFinish;
            }

            bombMesh = gameObject.transform.Find("Mesh");


            MeshRenderer bm = GetComponentInChildren <MeshRenderer>();

            if ((_pluginConfig.HMDOnly || LayerUtils.HMDOverride))
            {
                if (bombPool == null)
                {
                    // create fake bombs for Custom Notes without Custom Bombs
                    fakeFirstPersonBombMesh                  = UnityEngine.Object.Instantiate(bombMesh.gameObject);
                    fakeFirstPersonBombMesh.name             = "FakeFirstPersonBomb";
                    fakeFirstPersonBombMesh.transform.parent = bombMesh;

                    fakeFirstPersonBombMesh.transform.localScale    = Vector3.one;
                    fakeFirstPersonBombMesh.transform.localPosition = Vector3.zero;
                    fakeFirstPersonBombMesh.transform.rotation      = Quaternion.identity;
                    fakeFirstPersonBombMesh.layer = (int)LayerUtils.NoteLayer.FirstPerson;
                }
            }
            else if (bombPool != null)
            {
                bm.enabled = false;
            }
        }
Ejemplo n.º 14
0
        private static void Prefix(BombNoteController __instance, NoteData noteData)
        {
            // They said it couldn't be done, they called me a madman
            Color?color = null;

            if (noteData is CustomNoteData customData)
            {
                dynamic dynData = customData.customData;

                color = ChromaUtils.GetColorFromData(dynData) ?? color;
            }

            if (color.HasValue)
            {
                __instance.SetBombColor(color);
            }
            else
            {
                __instance.Reset();
            }
        }
Ejemplo n.º 15
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Prefix(BombNoteController __instance, NoteData noteData)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            // They said it couldn't be done, they called me a madman
            Color?color = null;

            if (noteData is CustomNoteData customData)
            {
                dynamic dynData = customData.customData;

                color = ChromaUtils.GetColorFromData(dynData) ?? color;
            }

            if (color.HasValue)
            {
                __instance.SetBombColor(color);
            }
            else
            {
                __instance.Reset();
            }
        }
Ejemplo n.º 16
0
 internal static BNCColorManager GetBNCColorManager(BombNoteController nc)
 {
     return(_bncColorManagers.FirstOrDefault(n => n._nc == nc));
 }
Ejemplo n.º 17
0
        /*
         * NC ColorSO holders
         */

        internal static void BNCStart(BombNoteController bnc)
        {
            BNCColorManager.CreateBNCColorManager(bnc);
        }
Ejemplo n.º 18
0
 public static void SetBombColor(this BombNoteController bnc, Color?color)
 {
     BNCColorManager.GetBNCColorManager(bnc)?.SetBombColor(color);
 }
Ejemplo n.º 19
0
 private static void Prefix(BombNoteController __instance)
 {
     BombColorizer.BNCStart(__instance);
 }
Ejemplo n.º 20
0
 private static void Postfix(BombNoteController __instance, NoteData noteData)
 {
     __instance.ColorizeBomb(TechnicolorController.GetTechnicolor(true, noteData.time + __instance.GetInstanceID(), TechnicolorConfig.Instance.TechnicolorBombsStyle));
 }
Ejemplo n.º 21
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Prefix(BombNoteController __instance)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            BombColorizer.BNCStart(__instance);
        }
Ejemplo n.º 22
0
 public static void Reset(this BombNoteController bnc)
 {
     BNCColorManager.GetBNCColorManager(bnc)?.Reset();
 }
Ejemplo n.º 23
0
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Prefix(BombNoteController __instance, NoteData noteData)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            __instance.SetBombColor(TechnicolorController.GetTechnicolor(true, noteData.time + __instance.GetInstanceID(), TechnicolorConfig.Instance.TechnicolorBombsStyle));
        }