-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from CGray1234/ui-rewrite
UI rewrite
- Loading branch information
Showing
21 changed files
with
558 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include "custom-types/shared/macros.hpp" | ||
#include "custom-types/shared/register.hpp" | ||
#include "questui/shared/BeatSaberUI.hpp" | ||
#include "questui/shared/QuestUI.hpp" | ||
#include "ViewController.hpp" | ||
#include "main.hpp" | ||
|
||
DECLARE_CLASS_CODEGEN(InGameText, InGameTextFlowCoordinator, HMUI::FlowCoordinator, | ||
DECLARE_INSTANCE_FIELD(InGameText::InGameTextViewController*, inGameTextViewController); | ||
DECLARE_INSTANCE_FIELD(HMUI::ViewController*, currentViewController); | ||
|
||
DECLARE_OVERRIDE_METHOD(void, DidActivate, il2cpp_utils::FindMethodUnsafe("HMUI", "FlowCoordinator", "DidActivate", 3), bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling); | ||
DECLARE_OVERRIDE_METHOD(void, BackButtonWasPressed, il2cpp_utils::FindMethodUnsafe("HMUI", "FlowCoordinator", "BackButtonWasPressed", 1), HMUI::ViewController* topViewController); | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include "custom-types/shared/macros.hpp" | ||
#include "UnityEngine/MonoBehaviour.hpp" | ||
|
||
#include "questui/shared/CustomTypes/Components/Settings/ColorSetting.hpp" | ||
#include "questui/shared/CustomTypes/Components/Settings/IncrementSetting.hpp" | ||
|
||
#include "HMUI/InputFieldView.hpp" | ||
|
||
using namespace UnityEngine; | ||
|
||
DECLARE_CLASS_CODEGEN(InGameText, gameplaySetupView, UnityEngine::MonoBehaviour, | ||
//Misc | ||
DECLARE_INSTANCE_FIELD(QuestUI::ColorSetting*, QolorPicker); | ||
DECLARE_INSTANCE_FIELD(HMUI::InputFieldView*, TextSetting); | ||
DECLARE_INSTANCE_FIELD(QuestUI::IncrementSetting*, SizeSetting); | ||
|
||
//Pos | ||
DECLARE_INSTANCE_FIELD(QuestUI::IncrementSetting*, PosX); | ||
DECLARE_INSTANCE_FIELD(QuestUI::IncrementSetting*, PosY); | ||
DECLARE_INSTANCE_FIELD(QuestUI::IncrementSetting*, PosZ); | ||
|
||
//Rot | ||
DECLARE_INSTANCE_FIELD(QuestUI::IncrementSetting*, RotX); | ||
DECLARE_INSTANCE_FIELD(QuestUI::IncrementSetting*, RotY); | ||
DECLARE_INSTANCE_FIELD(QuestUI::IncrementSetting*, RotZ); | ||
|
||
DECLARE_INSTANCE_METHOD(void, DidActivate, bool firstActivation); | ||
|
||
|
||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include "main.hpp" | ||
|
||
#include "custom-types/shared/register.hpp" | ||
#include "custom-types/shared/macros.hpp" | ||
#include "HMUI/ViewController.hpp" | ||
|
||
#define GET_FIND_METHOD(mPtr) il2cpp_utils::il2cpp_type_check::MetadataGetter<mPtr>::get() | ||
|
||
DECLARE_CLASS_CODEGEN(InGameText, MiscViewController, HMUI::ViewController, | ||
DECLARE_OVERRIDE_METHOD(void, DidActivate, GET_FIND_METHOD(&ViewController::DidActivate), bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling); | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include "main.hpp" | ||
|
||
#include "custom-types/shared/register.hpp" | ||
#include "custom-types/shared/macros.hpp" | ||
#include "HMUI/ViewController.hpp" | ||
|
||
#define GET_FIND_METHOD(mPtr) il2cpp_utils::il2cpp_type_check::MetadataGetter<mPtr>::get() | ||
|
||
DECLARE_CLASS_CODEGEN(InGameText, PositionViewController, HMUI::ViewController, | ||
DECLARE_OVERRIDE_METHOD(void, DidActivate, GET_FIND_METHOD(&ViewController::DidActivate), bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling); | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include "main.hpp" | ||
|
||
#include "custom-types/shared/register.hpp" | ||
#include "custom-types/shared/macros.hpp" | ||
#include "HMUI/ViewController.hpp" | ||
|
||
#define GET_FIND_METHOD(mPtr) il2cpp_utils::il2cpp_type_check::MetadataGetter<mPtr>::get() | ||
|
||
DECLARE_CLASS_CODEGEN(InGameText, RotationViewController, HMUI::ViewController, | ||
DECLARE_OVERRIDE_METHOD(void, DidActivate, GET_FIND_METHOD(&ViewController::DidActivate), bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling); | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
#pragma once | ||
|
||
#include "custom-types/shared/register.hpp" | ||
#include "custom-types/shared/macros.hpp" | ||
#include "HMUI/ViewController.hpp" | ||
#include "custom-types/shared/register.hpp" | ||
#include "questui/shared/BeatSaberUI.hpp" | ||
#include "questui/shared/QuestUI.hpp" | ||
|
||
DECLARE_CLASS_CODEGEN(InGameText, InGameTextViewController, HMUI::ViewController, | ||
DECLARE_INSTANCE_FIELD(HMUI::FlowCoordinator*, flowCoordinator); | ||
|
||
DECLARE_INSTANCE_FIELD(UnityEngine::UI::Button*, positionButton); | ||
DECLARE_INSTANCE_FIELD(UnityEngine::UI::Button*, miscButton); | ||
DECLARE_INSTANCE_FIELD(UnityEngine::UI::Button*, rotationButton); | ||
|
||
DECLARE_OVERRIDE_METHOD(void, DidActivate, il2cpp_utils::FindMethodUnsafe("HMUI", "ViewController", "DidActivate", 3), bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling); | ||
|
||
#define GET_FIND_METHOD(mPtr) il2cpp_utils::il2cpp_type_check::MetadataGetter<mPtr>::get() | ||
public: | ||
|
||
DECLARE_CLASS_CODEGEN(InGameText, TextViewController, HMUI::ViewController, | ||
DECLARE_OVERRIDE_METHOD(void, DidActivate, GET_FIND_METHOD(&ViewController::DidActivate), bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling); | ||
DECLARE_OVERRIDE_METHOD(void, DidDeactivate, GET_FIND_METHOD(&ViewController::DidDeactivate), bool removedFromHierarchy, bool screenSystemDisabling); | ||
UnityEngine::UI::Button* CreateViewControllerButton(UnityEngine::Transform* parent, std::string title, std::string description, HMUI::ViewController* viewController); | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "UI/FlowCoordinator.hpp" | ||
#include "UI/ViewController.hpp" | ||
#include "GlobalNamespace/MenuTransitionsHelper.hpp" | ||
#include "HMUI/ViewController_AnimationDirection.hpp" | ||
#include "HMUI/ViewController_AnimationType.hpp" | ||
|
||
DEFINE_TYPE(InGameText, InGameTextFlowCoordinator); | ||
|
||
void InGameText::InGameTextFlowCoordinator::DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { | ||
using namespace HMUI; | ||
|
||
if (firstActivation) { | ||
SetTitle(ID, ViewController::AnimationType::Out); | ||
|
||
showBackButton = true; | ||
|
||
inGameTextViewController = QuestUI::BeatSaberUI::CreateViewController<InGameText::InGameTextViewController*>(); | ||
inGameTextViewController->flowCoordinator = this; | ||
|
||
currentViewController = nullptr; | ||
|
||
ProvideInitialViewControllers(inGameTextViewController, nullptr, nullptr, nullptr, nullptr); | ||
} | ||
} | ||
|
||
void InGameText::InGameTextFlowCoordinator::BackButtonWasPressed( | ||
HMUI::ViewController* topViewController | ||
) { | ||
using namespace HMUI; | ||
using namespace UnityEngine; | ||
|
||
if (currentViewController) { | ||
SetTitle(ID, ViewController::AnimationType::In); | ||
ReplaceTopViewController(inGameTextViewController, this, this, nullptr, ViewController::AnimationType::Out, ViewController::AnimationDirection::Horizontal); | ||
|
||
currentViewController = nullptr; | ||
} else { | ||
parentFlowCoordinator->DismissFlowCoordinator(this, ViewController::AnimationDirection::Horizontal, nullptr, false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#include "questui/shared/BeatSaberUI.hpp" | ||
#include "questui/shared/QuestUI.hpp" | ||
#include "Config.hpp" | ||
#include "UI/GameplaySetupView.hpp" | ||
|
||
#include "UnityEngine/RectOffset.hpp" | ||
|
||
DEFINE_TYPE(InGameText, gameplaySetupView); | ||
|
||
using namespace UnityEngine::UI; | ||
using namespace UnityEngine; | ||
using namespace QuestUI::BeatSaberUI; | ||
|
||
void InGameText::gameplaySetupView::DidActivate(bool firstActivation) { | ||
if (!firstActivation) return; | ||
|
||
auto verticalLayoutGroup = CreateVerticalLayoutGroup(get_transform()); | ||
verticalLayoutGroup->get_rectTransform()->set_anchoredPosition({0.0f, 0.0f}); | ||
verticalLayoutGroup->set_padding(RectOffset::New_ctor(2, 2, 2, 2)); | ||
auto verticalLayoutGroupElement = verticalLayoutGroup->GetComponent<LayoutElement*>(); | ||
verticalLayoutGroupElement->set_preferredHeight(65.0f); | ||
verticalLayoutGroupElement->set_preferredWidth(70.0f); | ||
auto verticalLayoutGroupFitter = verticalLayoutGroup->GetComponent<ContentSizeFitter*>(); | ||
verticalLayoutGroupFitter->set_verticalFit(ContentSizeFitter::FitMode::PreferredSize); | ||
verticalLayoutGroupFitter->set_horizontalFit(ContentSizeFitter::FitMode::PreferredSize); | ||
|
||
CreateText(verticalLayoutGroup->get_transform(), "----Miscellaneous Settings----")->set_alignment(TMPro::TextAlignmentOptions::Center); | ||
|
||
InGameText::gameplaySetupView::TextSetting = CreateStringSetting(verticalLayoutGroup->get_transform(), "In-Game Text", getModConfig().InGameText.GetValue(), | ||
[](std::string value) { | ||
getModConfig().InGameText.SetValue(value); | ||
} | ||
); | ||
|
||
InGameText::gameplaySetupView::QolorPicker = CreateColorPicker(verticalLayoutGroup->get_transform(), "Text Color", getModConfig().TextQolor.GetValue(), | ||
[=](UnityEngine::Color value) { | ||
getModConfig().TextQolor.SetValue(value); | ||
} | ||
); | ||
|
||
InGameText::gameplaySetupView::SizeSetting = CreateIncrementSetting(verticalLayoutGroup->get_transform(), "Text Size", 1, 0.5, getModConfig().TextSize.GetValue(), | ||
[=](float value) { | ||
getModConfig().TextSize.SetValue(value); | ||
} | ||
); | ||
|
||
CreateText(verticalLayoutGroup->get_transform(), "----Position Settings----")->set_alignment(TMPro::TextAlignmentOptions::Center); | ||
|
||
InGameText::gameplaySetupView::PosX = CreateIncrementSetting(verticalLayoutGroup->get_transform(), "Text Position X", 1, 0.1, getModConfig().PositionX.GetValue(), | ||
[=](float value) { | ||
getModConfig().PositionX.SetValue(value); | ||
} | ||
); | ||
|
||
InGameText::gameplaySetupView::PosY = CreateIncrementSetting(verticalLayoutGroup->get_transform(), "Text Position Y", 1, 0.1, getModConfig().PositionY.GetValue(), | ||
[=](float value) { | ||
getModConfig().PositionY.SetValue(value); | ||
} | ||
); | ||
|
||
InGameText::gameplaySetupView::PosZ = CreateIncrementSetting(verticalLayoutGroup->get_transform(), "Text Position Z", 1, 0.1, getModConfig().PositionZ.GetValue(), | ||
[=](float value) { | ||
getModConfig().PositionZ.SetValue(value); | ||
} | ||
); | ||
|
||
CreateText(verticalLayoutGroup->get_transform(), "----Rotation Settings----")->set_alignment(TMPro::TextAlignmentOptions::Center); | ||
|
||
InGameText::gameplaySetupView::RotX = CreateIncrementSetting(verticalLayoutGroup->get_transform(), "Text Rotation X", 1, 1, getModConfig().RotationX.GetValue(), | ||
[=](float value) { | ||
getModConfig().RotationX.SetValue(value); | ||
} | ||
); | ||
|
||
InGameText::gameplaySetupView::RotX = CreateIncrementSetting(verticalLayoutGroup->get_transform(), "Text Rotation Y", 1, 1, getModConfig().RotationY.GetValue(), | ||
[=](float value) { | ||
getModConfig().RotationY.SetValue(value); | ||
} | ||
); | ||
|
||
InGameText::gameplaySetupView::RotX = CreateIncrementSetting(verticalLayoutGroup->get_transform(), "Text Rotation Z", 1, 1, getModConfig().RotationZ.GetValue(), | ||
[=](float value) { | ||
getModConfig().RotationZ.SetValue(value); | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include "Config.hpp" | ||
#include "UI/MiscViewController.hpp" | ||
|
||
#include "TMPro/TextMeshProUGUI.hpp" | ||
|
||
#include "questui/shared/BeatSaberUI.hpp" | ||
#include "questui/shared/QuestUI.hpp" | ||
|
||
#include "Images/MiscSettingsIcon.hpp" | ||
|
||
#include "GlobalNamespace/SimpleLevelStarter.hpp" | ||
#include "GlobalNamespace/BeatmapLevelSO.hpp" | ||
#include "GlobalNamespace/GameplayModifiers.hpp" | ||
|
||
DEFINE_TYPE(InGameText, MiscViewController); | ||
|
||
void StartTestLevel(InGameText::MiscViewController* self) { | ||
ArrayW<GlobalNamespace::SimpleLevelStarter*> levelStartArray = UnityEngine::Resources::FindObjectsOfTypeAll<GlobalNamespace::SimpleLevelStarter*>(); | ||
for (int i = 0; i < sizeof(levelStartArray); i++) | ||
{ | ||
GlobalNamespace::SimpleLevelStarter* start = (GlobalNamespace::SimpleLevelStarter*)levelStartArray->values[i]; | ||
if (start->get_gameObject()->get_name()->Contains("PerformanceTestLevelButton")) | ||
{ | ||
start->gameplayModifiers->zenMode = true; | ||
start->level->songName = ("In-Game Text Config Test"); | ||
start->StartLevel(); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
void InGameText::MiscViewController::DidActivate( | ||
bool firstActivation, | ||
bool addedToHierarchy, | ||
bool screenSystemEnabling | ||
) { | ||
using namespace UnityEngine; | ||
using namespace QuestUI::BeatSaberUI; | ||
using namespace UnityEngine::UI; | ||
|
||
if (firstActivation) { | ||
GameObject* container = CreateScrollableSettingsContainer(get_transform()); | ||
|
||
UnityEngine::Sprite* MiscImage = Base64ToSprite(MiscSettingsIcon); | ||
|
||
CreateImage(container->get_transform(), MiscImage, Vector2::get_zero(), Vector2(75.0f, 75.0f)); | ||
|
||
QuestUI::BeatSaberUI::CreateStringSetting(container->get_transform(), "In-Game Text", getModConfig().InGameText.GetValue(), | ||
[=](std::string value) { | ||
getModConfig().InGameText.SetValue(value); | ||
} | ||
); | ||
|
||
QuestUI::BeatSaberUI::CreateColorPicker(container->get_transform(), "Text Color", getModConfig().TextQolor.GetValue(), | ||
[=](UnityEngine::Color value) { | ||
getModConfig().TextQolor.SetValue(value); | ||
} | ||
); | ||
|
||
QuestUI::BeatSaberUI::CreateIncrementSetting(container->get_transform(), "Text Size", 1, 0.5, getModConfig().TextSize.GetValue(), | ||
[=](float value) { | ||
getModConfig().TextSize.SetValue(value); | ||
} | ||
); | ||
|
||
QuestUI::BeatSaberUI::CreateText(container->get_transform(), ""); | ||
|
||
auto testButton = QuestUI::BeatSaberUI::CreateUIButton(container->get_transform(), "Test Configuration", "PlayButton", | ||
[&]() { | ||
StartTestLevel(this); | ||
} | ||
); | ||
} | ||
} |
Oops, something went wrong.