Skip to content

Commit

Permalink
Lots of bug fixes & changes, update to 1.25.1
Browse files Browse the repository at this point in the history
  • Loading branch information
CGray1234 committed Oct 20, 2022
1 parent b75e1f8 commit 7d7fc5e
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 32 deletions.
Binary file modified cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"name": "In-Game Text",
"id": "InGameText",
"author": "CGray1234",
"version": "0.2.0",
"version": "0.3.0",
"packageId": "com.beatgames.beatsaber",
"packageVersion": "1.24.0",
"packageVersion": "1.25.1",
"description": "Add in some text in-game while you're playing a level! Like ImageFactory, but text",
"coverImage": "cover.png",
"dependencies": [],
"modFiles": [
"libInGameText.so"
],
"libraryFiles": [
"libbeatsaber-hook_3_13_0.so"
"libbeatsaber-hook_3_14_0.so"
],
"fileCopies": []
}
12 changes: 6 additions & 6 deletions qpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"info": {
"name": "In-Game Text",
"id": "InGameText",
"version": "0.2.0",
"version": "0.3.0",
"url": null,
"additionalData": {
"overrideSoName": "libInGameText.so"
Expand All @@ -13,7 +13,7 @@
"dependencies": [
{
"id": "beatsaber-hook",
"versionRange": "*",
"versionRange": "3.14.0",
"additionalData": {
"extraFiles": [
"src/inline-hook"
Expand All @@ -27,22 +27,22 @@
},
{
"id": "codegen",
"versionRange": "^0.26.1",
"versionRange": "0.28.0",
"additionalData": {}
},
{
"id": "custom-types",
"versionRange": "^0.15.19",
"versionRange": "0.15.21",
"additionalData": {}
},
{
"id": "config-utils",
"versionRange": "^0.8.0",
"versionRange": "0.8.0",
"additionalData": {}
},
{
"id": "questui",
"versionRange": "^0.16.5",
"versionRange": "0.17.4",
"additionalData": {}
}
],
Expand Down
46 changes: 25 additions & 21 deletions src/UI/ViewController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@ using namespace InGameText;

UnityEngine::GameObject *floatingScreen;

void StartTestLevel(InGameText::TextViewController* 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->level->songName = ("In-Game Text Config Test");
start->StartLevel();
return;
}
}
}
// void StartTestLevel(InGameText::TextViewController* 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 TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) {
Expand All @@ -44,7 +45,7 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy

UnityEngine::GameObject *container = CreateScrollView(get_transform());

floatingScreen = CreateFloatingScreen(UnityEngine::Vector2(1.0f, 1.0f), UnityEngine::Vector3(getModConfig().PositionX.GetValue(), getModConfig().PositionY.GetValue(), getModConfig().PositionZ.GetValue()), UnityEngine::Vector3(getModConfig().RotationX.GetValue(), getModConfig().RotationY.GetValue(), getModConfig().RotationZ.GetValue()), 0.0f, false, false);
floatingScreen = CreateFloatingScreen(UnityEngine::Vector2(0.0f, 0.0f), UnityEngine::Vector3(getModConfig().PositionX.GetValue(), getModConfig().PositionY.GetValue(), getModConfig().PositionZ.GetValue()), UnityEngine::Vector3(getModConfig().RotationX.GetValue(), getModConfig().RotationY.GetValue(), getModConfig().RotationZ.GetValue()), 0.0f, false, false);

auto Text = CreateText(floatingScreen->get_transform(), getModConfig().InGameText.GetValue());

Expand Down Expand Up @@ -74,7 +75,10 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy

CreateText(container->get_transform(), "");

auto testConfigButton = CreateUIButton(container->get_transform(), "Test Configuration", "PlayButton", [&]() { StartTestLevel(this); });
UnityEngine::UI::Button* testConfigButton = CreateUIButton(container->get_transform(), "Test Configuration", "PlayButton", []() {});
testConfigButton->set_interactable(false);
AddHoverHint(testConfigButton, "Unavailable on 1.25.1");

auto summonReplicaText = CreateUIButton(container->get_transform(), "Toggle Main Menu Text Replica", [&]() {
if (floatingScreen->get_active() == true) {
floatingScreen->SetActive(false);
Expand Down Expand Up @@ -116,7 +120,7 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy
//AddConfigValueIncrementVector3(container->get_transform(), getModConfig().TextPosition, 1, 0.5);

// X axis
CreateIncrementSetting(container->get_transform(), "Text Position X", 1, 0.5, getModConfig().PositionX.GetValue(),
CreateIncrementSetting(container->get_transform(), "Text Position X", 1, 0.1, getModConfig().PositionX.GetValue(),
[=](float value) {
getModConfig().PositionX.SetValue(value);

Expand All @@ -125,7 +129,7 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy
);

//Y
CreateIncrementSetting(container->get_transform(), "Text Position Y", 1, 0.5, getModConfig().PositionY.GetValue(),
CreateIncrementSetting(container->get_transform(), "Text Position Y", 1, 0.1, getModConfig().PositionY.GetValue(),
[=](float value) {
getModConfig().PositionY.SetValue(value);

Expand All @@ -134,7 +138,7 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy
);

//Z
CreateIncrementSetting(container->get_transform(), "Text Position Z", 1, 0.5, getModConfig().PositionZ.GetValue(),
CreateIncrementSetting(container->get_transform(), "Text Position Z", 1, 0.1, getModConfig().PositionZ.GetValue(),
[=](float value) {
getModConfig().PositionZ.SetValue(value);

Expand All @@ -145,7 +149,7 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy
//AddConfigValueIncrementVector3(container->get_transform(), getModConfig().TextRotation, 1, 1);

//X
CreateIncrementSetting(container->get_transform(), "Text Rotation X", 1, 0.5, getModConfig().RotationX.GetValue(),
CreateIncrementSetting(container->get_transform(), "Text Rotation X", 1, 1, getModConfig().RotationX.GetValue(),
[=](float value) {
getModConfig().RotationX.SetValue(value);

Expand All @@ -154,7 +158,7 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy
);

//Y
CreateIncrementSetting(container->get_transform(), "Text Rotation Y", 1, 0.5, getModConfig().RotationY.GetValue(),
CreateIncrementSetting(container->get_transform(), "Text Rotation Y", 1, 1, getModConfig().RotationY.GetValue(),
[=](float value) {
getModConfig().RotationY.SetValue(value);

Expand All @@ -163,7 +167,7 @@ void TextViewController::DidActivate(bool firstActivation, bool addedToHierarchy
);

//Z
CreateIncrementSetting(container->get_transform(), "Text Rotation Z", 1, 0.5, getModConfig().RotationZ.GetValue(),
CreateIncrementSetting(container->get_transform(), "Text Rotation Z", 1, 1, getModConfig().RotationZ.GetValue(),
[=](float value) {
getModConfig().RotationZ.SetValue(value);

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/InGameText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MAKE_AUTO_HOOK_MATCH(InGameText, &GlobalNamespace::GameplayCoreInstaller::Instal

InGameText(self);

screen = CreateFloatingScreen(UnityEngine::Vector2(1.0f, 1.0f), UnityEngine::Vector3(getModConfig().PositionX.GetValue(), getModConfig().PositionY.GetValue(), getModConfig().PositionZ.GetValue()), UnityEngine::Vector3(getModConfig().RotationX.GetValue(), getModConfig().RotationY.GetValue(), getModConfig().RotationZ.GetValue()), 0.0f, false, false);
screen = CreateFloatingScreen(UnityEngine::Vector2(0.0f, 0.0f), UnityEngine::Vector3(getModConfig().PositionX.GetValue(), getModConfig().PositionY.GetValue(), getModConfig().PositionZ.GetValue()), UnityEngine::Vector3(getModConfig().RotationX.GetValue(), getModConfig().RotationY.GetValue(), getModConfig().RotationZ.GetValue()), 0.0f, false, false);

if (getModConfig().InGameTextEnabled.GetValue() == true) {

Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" void load() {
getModConfig().Init(modInfo);

QuestUI::Init();
QuestUI::Register::RegisterModSettingsViewController<InGameText::TextViewController*>(modInfo, "In-Game Text");
QuestUI::Register::RegisterAllModSettingsViewController<InGameText::TextViewController*>(modInfo, "In-Game Text");

getLogger().info("Installing hooks...");

Expand Down

0 comments on commit 7d7fc5e

Please sign in to comment.