public void OnNoteWasChanged(CustomNote customNote) { if (string.IsNullOrWhiteSpace(customNote.ErrorMessage)) { noteDescription.SetText($"{customNote.Descriptor.NoteName}:\n\n{Utils.SafeUnescape(customNote.Descriptor.Description)}"); } else { noteDescription.SetText(string.Empty); } NotifyPropertyChanged(nameof(modEnabled)); NotifyPropertyChanged(nameof(noteSize)); NotifyPropertyChanged(nameof(hmdOnly)); NotifyPropertyChanged(nameof(autoDisable)); }
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(NoteController noteController, ref MeshRenderer ____arrowMeshRenderer, ref SpriteRenderer ____arrowGlowSpriteRenderer, ref SpriteRenderer ____circleGlowSpriteRenderer) { try { CustomNote activeNote = NoteAssetLoader.CustomNoteObjects[NoteAssetLoader.SelectedNote]; if (activeNote.FileName != "DefaultNotes") { // Check and activate/deactivate custom note objects attached to a pooled note object if (noteController.noteData.colorType == ColorType.ColorA || noteController.noteData.colorType == ColorType.ColorB) { Transform child = noteController.gameObject.transform.Find("NoteCube"); GameObject oldCustomNote = child.Find("customNoteArrow")?.gameObject; GameObject oldCustomNoteDot = child.Find("customNoteDot")?.gameObject; if (noteController.noteData.cutDirection == NoteCutDirection.Any) { Utils.ActivateGameObject(oldCustomNoteDot, true, oldCustomNote); } else { Utils.ActivateGameObject(oldCustomNote, true, oldCustomNoteDot); } } // Hide certain parts of the default note which is not required MeshRenderer noteMesh = noteController.gameObject.GetComponentInChildren <MeshRenderer>(); //noteMesh.enabled = false; noteMesh.forceRenderingOff = true; if (activeNote.Descriptor.DisableBaseNoteArrows) { ____arrowMeshRenderer.enabled = false; ____arrowGlowSpriteRenderer.enabled = false; ____circleGlowSpriteRenderer.enabled = false; } } } catch (Exception ex) { Logger.log.Error(ex); } }
protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { base.DidActivate(firstActivation, addedToHierarchy, screenSystemEnabling); if (fakeNoteArrows == null) { byte[] resource = Utils.LoadFromResource("CustomNotes.Resources.Notes.cn_arrowplaceholder.bloq"); fakeNoteArrows = new CustomNote(resource, "cn_arrowplaceholder.bloq"); } if (!preview) { preview = new GameObject(); preview.transform.Rotate(0.0f, 60.0f, 0.0f); preview.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); } Select(customListTableData.tableView, _noteAssetLoader.SelectedNote); }
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); } }
private void InitializePreviewNotes(CustomNote customNote, Transform transform) { // Position previewer based on the CustomNote having a NoteBomb preview.transform.position = customNote.NoteBomb ? new Vector3(2.1f, 0.9f, 1.60f) : new Vector3(2.25f, 0.9f, 1.45f); noteLeft = CreatePreviewNote(customNote.NoteLeft, transform, leftArrowPos); noteDotLeft = CreatePreviewNote(customNote.NoteDotLeft, transform, leftDotPos); noteRight = CreatePreviewNote(customNote.NoteRight, transform, rightArrowPos); noteDotRight = CreatePreviewNote(customNote.NoteDotRight, transform, rightDotPos); noteBomb = CreatePreviewNote(customNote.NoteBomb, transform, bombPos); // Fake the Note Dots if no CustomNote Dot existed in the CustomNote if (noteLeft && !noteDotLeft) { noteDotLeft = CreatePreviewNote(customNote.NoteLeft, transform, leftDotPos); } if (noteRight && !noteDotRight) { noteDotRight = CreatePreviewNote(customNote.NoteRight, transform, rightDotPos); } // Add arrows to arrowless notes if (!customNote.Descriptor.DisableBaseNoteArrows && fakeNoteArrows != null) { if (noteLeft && noteRight) { AddNoteArrows(fakeNoteArrows, transform); } } if (customNote.Descriptor.UsesNoteColor) { float colorStrength = customNote.Descriptor.NoteColorStrength; Color noteAColor = _gameplaySetupViewController.colorSchemesSettings.GetSelectedColorScheme().saberAColor; Color noteBColor = _gameplaySetupViewController.colorSchemesSettings.GetSelectedColorScheme().saberBColor; Utils.ColorizeCustomNote(noteAColor, colorStrength, noteLeft); Utils.ColorizeCustomNote(noteBColor, colorStrength, noteRight); Utils.ColorizeCustomNote(noteBColor, colorStrength, noteDotRight); Utils.ColorizeCustomNote(noteAColor, colorStrength, noteDotLeft); } }
public void OnNoteWasChanged(CustomNote customNote) { if (string.IsNullOrWhiteSpace(customNote.ErrorMessage)) { noteDescription.SetText($"{customNote.Descriptor.NoteName}:\n\n{Utils.SafeUnescape(customNote.Descriptor.Description)}"); } else { noteDescription.SetText(string.Empty); } if (sizeSlider != null) { sizeSlider.ReceiveValue(); } if (hmdCheckbox != null) { hmdCheckbox.ReceiveValue(); } }
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; } }
public void Initialize() { if (_noteAssetLoader.SelectedNote != 0) { CustomNote activeNote = _noteAssetLoader.CustomNoteObjects[_noteAssetLoader.SelectedNote]; if (activeNote.NoteBomb != null) { MaterialSwapper.ReplaceMaterialsForGameObject(activeNote.NoteBomb); } if (_gameplayCoreSceneSetupData.gameplayModifiers.ghostNotes) { _submission?.DisableScoreSubmission("Custom Notes", "Ghost Notes"); } if (_gameplayCoreSceneSetupData.gameplayModifiers.disappearingArrows) { _submission?.DisableScoreSubmission("Custom Notes", "Disappearing Arrows"); } } }
internal void Init(PluginConfig pluginConfig, NoteAssetLoader noteAssetLoader, [Inject(Id = "cn.left.arrow")] SiraPrefabContainer.Pool leftArrowNotePool, [Inject(Id = "cn.right.arrow")] SiraPrefabContainer.Pool rightArrowNotePool, [InjectOptional(Id = "cn.left.dot")] SiraPrefabContainer.Pool leftDotNotePool, [InjectOptional(Id = "cn.right.dot")] SiraPrefabContainer.Pool rightDotNotePool) { _pluginConfig = pluginConfig; _leftArrowNotePool = leftArrowNotePool; _rightArrowNotePool = rightArrowNotePool; _leftDotNotePool = leftDotNotePool ?? _leftArrowNotePool; _rightDotNotePool = rightDotNotePool ?? _rightArrowNotePool; _customNote = noteAssetLoader.CustomNoteObjects[noteAssetLoader.SelectedNote]; _gameNoteController = GetComponent <GameNoteController>(); _customNoteColorNoteVisuals = gameObject.AddComponent <CustomNoteColorNoteVisuals>(); _gameNoteController.didInitEvent.Add(this); _gameNoteController.noteWasMissedEvent.Add(this); _gameNoteController.noteWasCutEvent.Add(this); _customNoteColorNoteVisuals.didInitEvent += Visuals_DidInit; noteCube = _gameNoteController.gameObject.transform.Find("NoteCube"); MeshRenderer noteMesh = GetComponentInChildren <MeshRenderer>(); if (_pluginConfig.HMDOnly == false && LayerUtils.HMDOverride == false) { // only disable if custom notes display on both hmd and display noteMesh.forceRenderingOff = true; } else { noteMesh.gameObject.layer = (int)LayerUtils.NoteLayer.ThirdPerson; } }
public void Init(SliderType_BeatSaber _type) { type = _type; CustomNote cNote = BloqLoader.Load(); ColliderVisualizer.VisualizerColorType vColor = ColliderVisualizer.VisualizerColorType.Green; GameObject cubePrefab; Color boxColor; if (SliderType_BeatSaber.LEFT_BEGIN < type && type < SliderType_BeatSaber.LEFT_END) { cubePrefab = cNote.NoteLeft; cubePrefab.transform.rotation = Quaternion.Euler(new Vector3(0, 0, -45 * (int)(type - SliderType_BeatSaber.LEFT_BEGIN - 1))); vColor = ColliderVisualizer.VisualizerColorType.Red; boxColor = Color.red; } else if (SliderType_BeatSaber.RIGHT_BEGIN < type && type < SliderType_BeatSaber.RIGHT_END) { cubePrefab = cNote.NoteRight; cubePrefab.transform.rotation = Quaternion.Euler(new Vector3(0, 0, -45 * (int)(type - SliderType_BeatSaber.RIGHT_BEGIN - 1))); vColor = ColliderVisualizer.VisualizerColorType.Blue; boxColor = Color.blue; } else { cubePrefab = cNote.NoteDotLeft; vColor = ColliderVisualizer.VisualizerColorType.Green; boxColor = Color.green; } Init(cubePrefab, boxColor); InitVisualizer(vColor); }
public static void Postfix(ref ColorNoteVisuals __instance, NoteController noteController, ref MeshRenderer ____arrowMeshRenderer, ref SpriteRenderer ____arrowGlowSpriteRenderer, ref SpriteRenderer ____circleGlowSpriteRenderer, ref float ____arrowGlowIntensity, ref MaterialPropertyBlockController[] ____materialPropertyBlockControllers, ref int ____colorID, ref ColorManager ____colorManager) { try { var noteMesh = noteController.gameObject.GetComponentInChildren <MeshRenderer>(); // noteMesh.enabled = true; CustomNote activeNote = Plugin.customNotes[Plugin.selectedNote]; Transform child = noteController.gameObject.transform.Find("NoteCube"); GameObject.Destroy(child.Find("customNote")?.gameObject); if (activeNote.path != "DefaultNotes") { GameObject customNote; switch (noteController.noteData.noteType) { case NoteType.NoteA: if (noteController.noteData.cutDirection == NoteCutDirection.Any) { customNote = activeNote.noteDotLeft ?? activeNote.noteLeft; } else { customNote = activeNote.noteLeft; } break; case NoteType.NoteB: if (noteController.noteData.cutDirection == NoteCutDirection.Any) { customNote = activeNote.noteDotRight ?? activeNote.noteRight; } else { customNote = activeNote.noteRight; } break; default: return; } noteMesh.enabled = false; if (activeNote.noteDescriptor.UsesNoteColor) { Color noteColor = ____colorManager.ColorForNoteType(noteController.noteData.noteType) * activeNote.noteDescriptor.NoteColorStrength; for (int i = 0; i < customNote.GetComponentsInChildren <Transform>().Length; i++) { DisableNoteColorOnGameobject colorDisabled = customNote.GetComponentsInChildren <Transform>()[i].GetComponent <DisableNoteColorOnGameobject>(); if (!colorDisabled) { Renderer childRenderer = customNote.GetComponentsInChildren <Transform>()[i].GetComponent <Renderer>(); if (childRenderer) { childRenderer.material.SetColor("_Color", noteColor); } } } } if (activeNote.noteDescriptor.DisableBaseNoteArrows) { ____arrowMeshRenderer.enabled = false; ____arrowGlowSpriteRenderer.enabled = false; ____circleGlowSpriteRenderer.enabled = false; // if (noteController.noteData.cutDirection != NoteCutDirection.Any) // noteController.gameObject.transform.Find("NoteCube").Find("NoteArrow").GetComponent<MeshRenderer>().enabled = false; // noteController.gameObject.transform.Find("NoteCube").Find("NoteArrowGlow").GetComponent<SpriteRenderer>().enabled = false; // noteController.gameObject.transform.Find("NoteCube").Find("NoteCircleGlow").GetComponent<SpriteRenderer>().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); /*var field = ____colorManager.GetType().GetField("_colorA", BindingFlags.Instance | BindingFlags.NonPublic); * var leftColor = field.GetValue(____colorManager); * var field2 = ____colorManager.GetType().GetField("_colorB", BindingFlags.Instance | BindingFlags.NonPublic); * var rightColor = field2.GetValue(____colorManager); */ } } catch (Exception err) { Logger.log.Error(err); } }
public override void InstallBindings() { bool autoDisable = _pluginConfig.AutoDisable && (_gameplayCoreSceneSetupData.gameplayModifiers.ghostNotes || _gameplayCoreSceneSetupData.gameplayModifiers.disappearingArrows || _gameplayCoreSceneSetupData.gameplayModifiers.smallCubes || Utils.IsNoodleMap(_gameplayCoreSceneSetupData.difficultyBeatmap)); _shouldSetup = !autoDisable && (!(_gameplayCoreSceneSetupData.gameplayModifiers.ghostNotes || _gameplayCoreSceneSetupData.gameplayModifiers.disappearingArrows) || !Container.HasBinding <MultiplayerLevelSceneSetupData>()); if (_pluginConfig.Enabled && _noteAssetLoader.SelectedNote != 0 && _shouldSetup) { Container.BindInterfacesAndSelfTo <GameCameraManager>().AsSingle(); Container.Bind <IInitializable>().To <CustomNoteManager>().AsSingle(); CustomNote note = _noteAssetLoader.CustomNoteObjects[_noteAssetLoader.SelectedNote]; #region Note Setup if (_gameplayCoreSceneSetupData.gameplayModifiers.proMode) { // Use the pro mode decorator Container.RegisterRedecorator(new ProModeNoteRegistration(DecorateNote, DECORATION_PRIORITY)); } else { Container.RegisterRedecorator(new BasicNoteRegistration(DecorateNote, DECORATION_PRIORITY)); } MaterialSwapper.GetMaterials(); MaterialSwapper.ReplaceMaterialsForGameObject(note.NoteLeft); MaterialSwapper.ReplaceMaterialsForGameObject(note.NoteRight); MaterialSwapper.ReplaceMaterialsForGameObject(note.NoteDotLeft); MaterialSwapper.ReplaceMaterialsForGameObject(note.NoteDotRight); Utils.AddMaterialPropertyBlockController(note.NoteLeft); Utils.AddMaterialPropertyBlockController(note.NoteRight); Utils.AddMaterialPropertyBlockController(note.NoteDotLeft); Utils.AddMaterialPropertyBlockController(note.NoteDotRight); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.LeftArrowPool).WithInitialSize(25).FromComponentInNewPrefab(NotePrefabContainer(note.NoteLeft)); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.RightArrowPool).WithInitialSize(25).FromComponentInNewPrefab(NotePrefabContainer(note.NoteRight)); if (note.NoteDotLeft != null) { Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.LeftDotPool).WithInitialSize(10).FromComponentInNewPrefab(NotePrefabContainer(note.NoteDotLeft)); } if (note.NoteDotRight != null) { Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.RightDotPool).WithInitialSize(10).FromComponentInNewPrefab(NotePrefabContainer(note.NoteDotRight)); } #endregion #region Bomb Setup Container.RegisterRedecorator(new BombNoteRegistration(DecorateBombs, DECORATION_PRIORITY)); if (note.NoteBomb != null) { MaterialSwapper.GetMaterials(); MaterialSwapper.ReplaceMaterialsForGameObject(note.NoteBomb); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.BombPool).WithInitialSize(10).FromComponentInNewPrefab(NotePrefabContainer(note.NoteBomb)); } #endregion #region Burst Slider Setup Container.RegisterRedecorator(new BurstSliderNoteRegistration(DecorateBurstSliderFill, DECORATION_PRIORITY)); MaterialSwapper.ReplaceMaterialsForGameObject(note.BurstSliderLeft); MaterialSwapper.ReplaceMaterialsForGameObject(note.BurstSliderRight); Utils.AddMaterialPropertyBlockController(note.BurstSliderLeft); Utils.AddMaterialPropertyBlockController(note.BurstSliderRight); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.LeftBurstSliderPool).WithInitialSize(40).FromComponentInNewPrefab(NotePrefabContainer(note.BurstSliderLeft)); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.RightBurstSliderPool).WithInitialSize(40).FromComponentInNewPrefab(NotePrefabContainer(note.BurstSliderRight)); #endregion #region Burst Slider Head Setup Container.RegisterRedecorator(new BurstSliderHeadNoteRegistration(DecorateNote, DECORATION_PRIORITY)); MaterialSwapper.ReplaceMaterialsForGameObject(note.BurstSliderHeadLeft); MaterialSwapper.ReplaceMaterialsForGameObject(note.BurstSliderHeadRight); MaterialSwapper.ReplaceMaterialsForGameObject(note.BurstSliderHeadDotLeft); MaterialSwapper.ReplaceMaterialsForGameObject(note.BurstSliderHeadDotRight); Utils.AddMaterialPropertyBlockController(note.BurstSliderHeadLeft); Utils.AddMaterialPropertyBlockController(note.BurstSliderHeadRight); Utils.AddMaterialPropertyBlockController(note.BurstSliderHeadDotLeft); Utils.AddMaterialPropertyBlockController(note.BurstSliderHeadDotRight); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.LeftBurstSliderHeadPool).WithInitialSize(10).FromComponentInNewPrefab(NotePrefabContainer(note.BurstSliderHeadLeft)); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.RightBurstSliderHeadPool).WithInitialSize(10).FromComponentInNewPrefab(NotePrefabContainer(note.BurstSliderHeadRight)); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.LeftBurstSliderHeadDotPool).WithInitialSize(10).FromComponentInNewPrefab(NotePrefabContainer(note.BurstSliderHeadDotLeft)); Container.BindMemoryPool <SiraPrefabContainer, SiraPrefabContainer.Pool>().WithId(Protocol.RightBurstSliderHeadDotPool).WithInitialSize(10).FromComponentInNewPrefab(NotePrefabContainer(note.BurstSliderHeadDotRight)); #endregion #region Slider Layer if (_pluginConfig.HMDOnly || LayerUtils.HMDOverride) { Container.RegisterRedecorator(new ShortSliderNoteRegistration(DecorateSlider, DECORATION_PRIORITY)); Container.RegisterRedecorator(new MediumSliderNoteRegistration(DecorateSlider, DECORATION_PRIORITY)); Container.RegisterRedecorator(new LongSliderNoteRegistration(DecorateSlider, DECORATION_PRIORITY)); } #endregion } }