diff --git a/assets/ConfigMenuSelectionViewController.bsml b/assets/ConfigMenuSelectionViewController.bsml
new file mode 100644
index 0000000..525247f
--- /dev/null
+++ b/assets/ConfigMenuSelectionViewController.bsml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/SoundSettingsViewController.bsml b/assets/SoundSettingsViewController.bsml
index e1aa5cb..3aabd48 100644
--- a/assets/SoundSettingsViewController.bsml
+++ b/assets/SoundSettingsViewController.bsml
@@ -1,21 +1,28 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/include/UI/ConfigMenuSelectionViewController.hpp b/include/UI/ConfigMenuSelectionViewController.hpp
new file mode 100644
index 0000000..8b8829f
--- /dev/null
+++ b/include/UI/ConfigMenuSelectionViewController.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "custom-types/shared/macros.hpp"
+#include "bsml/shared/macros.hpp"
+
+#include "HMUI/ViewController.hpp"
+
+DECLARE_CLASS_CODEGEN(QuestSounds::UI, ConfigMenuSelectionViewController, HMUI::ViewController,
+ // DECLARE_INSTANCE_FIELD(ListW, _menus);
+ // DECLARE_INSTANCE_FIELD(BSML::CustomListTableData*, menuList);
+
+ DECLARE_OVERRIDE_METHOD_MATCH(void, DidActivate, &HMUI::ViewController::DidActivate, bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling);
+ // DECLARE_OVERRIDE_METHOD_MATCH(void, DidDeactivate, &HMUI::ViewController::DidDeactivate, bool removedFromHierarchy, bool screenSystemDisabling);
+
+ DECLARE_INSTANCE_METHOD(void, MenuMusicButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, LobbyMusicButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, MenuClickButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, HitSoundButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, BadHitSoundButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, MissSoundButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, LevelClearedButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, LevelFailedButtonPressed);
+ DECLARE_INSTANCE_METHOD(void, FireworkButtonPressed);
+
+ DECLARE_CTOR(ctor);
+
+public:
+ void set_selectCallback(std::function callback);
+ std::function callback;
+)
\ No newline at end of file
diff --git a/include/UI/QuestSoundsFlowCoordinator.hpp b/include/UI/QuestSoundsFlowCoordinator.hpp
index 7f4700d..60366f8 100644
--- a/include/UI/QuestSoundsFlowCoordinator.hpp
+++ b/include/UI/QuestSoundsFlowCoordinator.hpp
@@ -5,6 +5,7 @@
#include "HMUI/FlowCoordinator.hpp"
+#include "UI/ConfigMenuSelectionViewController.hpp"
#include "UI/SoundSettingsViewController.hpp"
#include "GlobalNamespace/MainFlowCoordinator.hpp"
@@ -13,11 +14,15 @@
DECLARE_CLASS_CODEGEN(QuestSounds::UI, QuestSoundsFlowCoordinator, HMUI::FlowCoordinator,
+ DECLARE_INSTANCE_FIELD(QuestSounds::UI::ConfigMenuSelectionViewController*, configMenuSelectionViewController);
DECLARE_INSTANCE_FIELD(QuestSounds::UI::SoundSettingsViewController*, soundSettingsViewController);
DECLARE_INSTANCE_METHOD(void, Awake);
DECLARE_OVERRIDE_METHOD_MATCH(void, DidActivate, &HMUI::FlowCoordinator::DidActivate, bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling);
DECLARE_OVERRIDE_METHOD_MATCH(void, DidDeactivate, &HMUI::FlowCoordinator::DidDeactivate, bool removedFromHierarchy, bool screenSystemDisabling);
DECLARE_OVERRIDE_METHOD_MATCH(void, BackButtonWasPressed, &HMUI::FlowCoordinator::BackButtonWasPressed, HMUI::ViewController* topViewController);
+
+ DECLARE_INSTANCE_METHOD(void, SubMenuButtonPressed, int index);
+
DECLARE_DEFAULT_CTOR();
)
\ No newline at end of file
diff --git a/include/UI/SoundSettingsViewController.hpp b/include/UI/SoundSettingsViewController.hpp
index e8627a4..e0625a2 100644
--- a/include/UI/SoundSettingsViewController.hpp
+++ b/include/UI/SoundSettingsViewController.hpp
@@ -2,12 +2,16 @@
#include "custom-types/shared/macros.hpp"
#include "bsml/shared/macros.hpp"
+#include "bsml/shared/BSML/Components/Settings/ToggleSetting.hpp"
#include "bsml/shared/BSML/Components/Settings/IncrementSetting.hpp"
#include "bsml/shared/BSML/Components/Settings/SliderSetting.hpp"
+#include "bsml/shared/BSML/Components/CustomListTableData.hpp"
#include "Config.hpp"
#include "Utils/AsyncAudioClipLoader.hpp"
+#include "UnityEngine/UI/HorizontalLayoutGroup.hpp"
+
#include "HMUI/ViewController.hpp"
DECLARE_CLASS_CODEGEN(QuestSounds::UI, SoundSettingsViewController, HMUI::ViewController,
@@ -19,9 +23,16 @@ DECLARE_CLASS_CODEGEN(QuestSounds::UI, SoundSettingsViewController, HMUI::ViewCo
DECLARE_BSML_PROPERTY(float, VolumeOffset);
DECLARE_BSML_PROPERTY(float, BeatOffset);
DECLARE_BSML_PROPERTY(bool, HasSoundFiles);
+ DECLARE_BSML_PROPERTY(bool, IsSetup);
+
+ DECLARE_INSTANCE_FIELD(ListW, _Sounds);
+ DECLARE_INSTANCE_METHOD(ListW, get_Sounds);
+ DECLARE_INSTANCE_FIELD(BSML::CustomListTableData*, soundList);
+ DECLARE_INSTANCE_FIELD(BSML::ToggleSetting*, SoundEnabled);
DECLARE_INSTANCE_FIELD(BSML::SliderSetting*, SoundVolumeOffset);
DECLARE_INSTANCE_FIELD(BSML::SliderSetting*, SoundBeatOffset);
+ DECLARE_INSTANCE_FIELD(UnityEngine::UI::HorizontalLayoutGroup*, NotSetupHorizontal);
DECLARE_INSTANCE_FIELD(bool, showSoundVolumeOffset);
DECLARE_INSTANCE_FIELD(bool, showSoundBeatOffset);
@@ -29,6 +40,8 @@ DECLARE_CLASS_CODEGEN(QuestSounds::UI, SoundSettingsViewController, HMUI::ViewCo
DECLARE_OVERRIDE_METHOD_MATCH(void, DidActivate, &HMUI::ViewController::DidActivate, bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling);
DECLARE_OVERRIDE_METHOD_MATCH(void, DidDeactivate, &HMUI::ViewController::DidDeactivate, bool removedFromHierarchy, bool screenSystemDisabling);
+ DECLARE_CTOR(ctor);
+
public:
void Setup(std::string name, QuestSounds::Sound* sound, QuestSounds::Utils::AsyncAudioClipLoader* loader);
)
\ No newline at end of file
diff --git a/include/assets.hpp b/include/assets.hpp
index c277377..93df0c6 100644
--- a/include/assets.hpp
+++ b/include/assets.hpp
@@ -1,4 +1,5 @@
#pragma once
#include "kaleb/shared/kaleb.hpp"
+DECLARE_FILE(_binary_ConfigMenuSelectionViewController_bsml, Assets, ConfigMenuSelectionViewController_bsml);
DECLARE_FILE(_binary_SoundSettingsViewController_bsml, Assets, SoundSettingsViewController_bsml);
diff --git a/src/UI/ConfigMenuSelectionViewController.cpp b/src/UI/ConfigMenuSelectionViewController.cpp
new file mode 100644
index 0000000..a947a6c
--- /dev/null
+++ b/src/UI/ConfigMenuSelectionViewController.cpp
@@ -0,0 +1,92 @@
+#include "UI/ConfigMenuSelectionViewController.hpp"
+#include "assets.hpp"
+#include "logging.hpp"
+
+#include "bsml/shared/BSML.hpp"
+
+DEFINE_TYPE(QuestSounds::UI, ConfigMenuSelectionViewController);
+
+namespace QuestSounds::UI {
+ void ConfigMenuSelectionViewController::ctor() {
+ // _menus = ListW();
+ getLogger().info("ctor");
+ return;
+ }
+
+ void ConfigMenuSelectionViewController::DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) {
+ getLogger().info("DidActivate");
+ if (firstActivation) {
+ getLogger().info("DidActivate firstActivation");
+ BSML::parse_and_construct(Assets::ConfigMenuSelectionViewController_bsml, get_transform(), this);
+ }
+ return;
+ }
+
+ void ConfigMenuSelectionViewController::set_selectCallback(std::function callback) {
+ getLogger().info("Setting selectCallback");
+ this->callback = callback;
+ }
+
+ void ConfigMenuSelectionViewController::MenuMusicButtonPressed() {
+ getLogger().info("MenuMusicButtonPressed");
+ if (callback) {
+ callback(0);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::LobbyMusicButtonPressed() {
+ getLogger().info("LobbyMusicButtonPressed");
+ if (callback) {
+ callback(1);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::MenuClickButtonPressed() {
+ getLogger().info("MenuClickButtonPressed");
+ if (callback) {
+ callback(2);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::HitSoundButtonPressed() {
+ getLogger().info("HitSoundButtonPressed");
+ if (callback) {
+ callback(3);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::BadHitSoundButtonPressed() {
+ getLogger().info("BadHitSoundButtonPressed");
+ if (callback) {
+ callback(4);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::MissSoundButtonPressed() {
+ getLogger().info("MissSoundButtonPressed");
+ if (callback) {
+ callback(5);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::LevelClearedButtonPressed() {
+ getLogger().info("LevelClearedButtonPressed");
+ if (callback) {
+ callback(6);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::LevelFailedButtonPressed() {
+ getLogger().info("LevelFailedButtonPressed");
+ if (callback) {
+ callback(7);
+ }
+ }
+
+ void ConfigMenuSelectionViewController::FireworkButtonPressed() {
+ getLogger().info("FireworkButtonPressed");
+ if (callback) {
+ callback(8);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/UI/QuestSoundsFlowCoordinator.cpp b/src/UI/QuestSoundsFlowCoordinator.cpp
index ca9a716..f7b07cf 100644
--- a/src/UI/QuestSoundsFlowCoordinator.cpp
+++ b/src/UI/QuestSoundsFlowCoordinator.cpp
@@ -10,19 +10,25 @@ DEFINE_TYPE(QuestSounds::UI, QuestSoundsFlowCoordinator);
namespace QuestSounds::UI {
void QuestSoundsFlowCoordinator::Awake() {
getLogger().info("Awake");
+ if (!configMenuSelectionViewController) {
+ getLogger().info("Awake ViewController null, Creating ConfigMenuSelectionViewController");
+ configMenuSelectionViewController = BSML::Helpers::CreateViewController();
+ configMenuSelectionViewController->set_selectCallback(std::bind(&QuestSoundsFlowCoordinator::SubMenuButtonPressed, this, std::placeholders::_1));
+ }
+
if (!soundSettingsViewController) {
getLogger().info("Awake ViewController null, Creating SoundSettingsViewController");
soundSettingsViewController = BSML::Helpers::CreateViewController();
// TODO: Implement iteration through all sounds in the Config and switching between them also possible use some sort of safeptr for the config and loader
// Testing using HitSounds for now
- soundSettingsViewController->Setup("HitSound", &QuestSounds::Config.Sounds.HitSound, &QuestSounds::AudioClips::hitSoundLoader);
+ // soundSettingsViewController->Setup("HitSound", &QuestSounds::Config.Sounds.HitSound, &QuestSounds::AudioClips::hitSoundLoader);
}
}
void QuestSoundsFlowCoordinator::DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) {
getLogger().info("DidActivate");
if (firstActivation) {
- ProvideInitialViewControllers(soundSettingsViewController, nullptr, nullptr, nullptr, nullptr);
+ ProvideInitialViewControllers(soundSettingsViewController, configMenuSelectionViewController, nullptr, nullptr, nullptr);
}
SetTitle("QuestSounds", HMUI::ViewController::AnimationType::In);
showBackButton = true;
@@ -36,4 +42,71 @@ namespace QuestSounds::UI {
getLogger().info("BackButtonWasPressed");
_parentFlowCoordinator->DismissFlowCoordinator(this, HMUI::ViewController::AnimationDirection::Horizontal, nullptr, false);
}
+
+ void QuestSoundsFlowCoordinator::SubMenuButtonPressed(int index) {
+ getLogger().info("SubMenuButtonPressed");
+ getLogger().info("Index: {}", index);
+
+ switch (index) {
+ case 0:
+ getLogger().info("MenuMusicButtonPressed");
+ soundSettingsViewController->Setup("MenuMusic", &QuestSounds::Config.Sounds.MenuMusic, &QuestSounds::AudioClips::menuMusicLoader);
+ SetTitle("Menu Music", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 1:
+ getLogger().info("LobbyMusicButtonPressed");
+ soundSettingsViewController->Setup("LobbyMusic", &QuestSounds::Config.Sounds.LobbyMusic, &QuestSounds::AudioClips::lobbyAmbienceLoader);
+ SetTitle("Lobby Music", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 2:
+ getLogger().info("MenuClickButtonPressed");
+ soundSettingsViewController->Setup("MenuClicks", &QuestSounds::Config.Sounds.MenuClick, &QuestSounds::AudioClips::menuClickLoader);
+ SetTitle("Menu Clicks", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 3:
+ getLogger().info("HitSoundButtonPressed");
+ soundSettingsViewController->Setup("HitSounds", &QuestSounds::Config.Sounds.HitSound, &QuestSounds::AudioClips::hitSoundLoader);
+ SetTitle("Hit Sounds", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 4:
+ getLogger().info("BadHitSoundButtonPressed");
+ soundSettingsViewController->Setup("BadHitSounds", &QuestSounds::Config.Sounds.BadHitSound, &QuestSounds::AudioClips::badHitSoundLoader);
+ SetTitle("Bad Hit Sounds", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 5:
+ getLogger().info("MissSoundButtonPressed");
+ soundSettingsViewController->Setup("NoteMissedSound", &QuestSounds::Config.Sounds.NoteMissedSound, &QuestSounds::AudioClips::noteMissedSoundLoader);
+ SetTitle("Note Miss Sound", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 6:
+ getLogger().info("LevelClearedButtonPressed");
+ soundSettingsViewController->Setup("LevelCleared", &QuestSounds::Config.Sounds.LevelCleared, &QuestSounds::AudioClips::levelClearedLoader);
+ SetTitle("Level Cleared", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 7:
+ getLogger().info("LevelFailedButtonPressed");
+ soundSettingsViewController->Setup("LevelFailed", &QuestSounds::Config.Sounds.LevelFailed, &QuestSounds::AudioClips::levelFailedLoader);
+ SetTitle("Level Failed", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ case 8:
+ getLogger().info("FireworkButtonPressed");
+ soundSettingsViewController->Setup("Firework", &QuestSounds::Config.Sounds.Firework, &QuestSounds::AudioClips::fireworkSoundLoader);
+ SetTitle("Firework", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ default:
+ getLogger().error("Invalid index");
+ SetTitle("QuestSounds", HMUI::ViewController::AnimationType::In);
+ // ReplaceTopViewController(soundSettingsViewController, nullptr, HMUI::ViewController::AnimationType::In, HMUI::ViewController::AnimationDirection::Horizontal);
+ break;
+ }
+ }
}
\ No newline at end of file
diff --git a/src/UI/SoundSettingsViewController.cpp b/src/UI/SoundSettingsViewController.cpp
index 91c9137..c5453ac 100644
--- a/src/UI/SoundSettingsViewController.cpp
+++ b/src/UI/SoundSettingsViewController.cpp
@@ -4,24 +4,35 @@
#include "assets.hpp"
#include "bsml/shared/BSML.hpp"
+#include "bsml/shared/BSML-Lite.hpp"
DEFINE_TYPE(QuestSounds::UI, SoundSettingsViewController);
namespace QuestSounds::UI {
+ void SoundSettingsViewController::ctor() {
+ _Sounds = ListW();
+ getLogger().info("ctor");
+ }
+
void SoundSettingsViewController::DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) {
if (firstActivation) {
getLogger().info("DidActivate firstActivation");
BSML::parse_and_construct(Assets::SoundSettingsViewController_bsml, get_transform(), this);
}
+ if (SoundEnabled) {
+ SoundEnabled->set_Value(Sound->Active);
+ }
if (SoundVolumeOffset) {
getLogger().info("DidActivate SoundVolumeOffset");
SoundVolumeOffset->gameObject->SetActive(showSoundVolumeOffset);
- SoundVolumeOffset->set_Value(Sound->VolumeOffset.value());
+ if (showSoundVolumeOffset)
+ SoundVolumeOffset->set_Value(Sound->VolumeOffset.value());
}
if (SoundBeatOffset) {
getLogger().info("DidActivate SoundBeatOffset");
SoundBeatOffset->gameObject->SetActive(showSoundBeatOffset);
- SoundBeatOffset->set_Value(Sound->BeatOffset.value());
+ if (showSoundBeatOffset)
+ SoundBeatOffset->set_Value(Sound->BeatOffset.value());
}
getLogger().info("DidActivate");
}
@@ -39,12 +50,35 @@ namespace QuestSounds::UI {
showSoundVolumeOffset = sound->VolumeOffset.has_value();
showSoundBeatOffset = sound->BeatOffset.has_value();
- if (SoundVolumeOffset && showSoundVolumeOffset) {
- SoundVolumeOffset->set_Value(sound->VolumeOffset.value());
+ if (SoundEnabled) {
+ SoundEnabled->set_Value(sound->Active);
}
- if (SoundBeatOffset && showSoundBeatOffset) {
- SoundBeatOffset->set_Value(sound->BeatOffset.has_value());
+ if (SoundVolumeOffset) {
+ SoundVolumeOffset->gameObject->SetActive(showSoundVolumeOffset);
+ if (showSoundVolumeOffset)
+ SoundVolumeOffset->set_Value(sound->VolumeOffset.value());
+ }
+
+ if (SoundBeatOffset) {
+ SoundBeatOffset->gameObject->SetActive(showSoundBeatOffset);
+ if (showSoundBeatOffset)
+ SoundBeatOffset->set_Value(sound->BeatOffset.value());
+ }
+
+ if (wasActivatedBefore && !_IsSetup) {
+ set_IsSetup(true);
+ getLogger().info("Disabling NotSetupHorizontal");
+ NotSetupHorizontal->gameObject->SetActive(false);
+ // // Destroying UI
+ // auto t = get_transform();
+ // int childCount = t->get_childCount();
+ // for (int i = 0; i < childCount; i++)
+ // Object::DestroyImmediate(t->GetChild(0)->get_gameObject());
+
+ // Recreating UI
+ getLogger().info("Recreating UI");
+ DidActivate(true, false, false);
}
}
@@ -90,4 +124,19 @@ namespace QuestSounds::UI {
getLogger().info("Getting HasSoundFiles for sound: '{}' as '{}'", Name, _HasSoundFiles);
return _HasSoundFiles;
}
+
+ void SoundSettingsViewController::set_IsSetup(bool value) {
+ getLogger().info("Setting IsSetup for sound: '{}' to '{}'", Name, value);
+ _IsSetup = value;
+ }
+
+ bool SoundSettingsViewController::get_IsSetup() {
+ getLogger().info("Getting IsSetup for sound: '{}' as '{}'", Name, _IsSetup);
+ return _IsSetup;
+ }
+
+ ListW SoundSettingsViewController::get_Sounds() {
+ getLogger().info("Getting Sounds for sound: '{}'", Name);
+ return _Sounds;
+ }
}
\ No newline at end of file