WIP Credits Screen Rewrite.

This commit is contained in:
StackZ
2020-01-01 03:45:14 +01:00
parent bc07670b6e
commit 6c3b5fc31a
3 changed files with 58 additions and 79 deletions
+3 -9
View File
@@ -42,20 +42,18 @@ public:
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
Settings(); Settings();
private: private:
// Credits stuff.
int DisplayMode = 1;
int delay = 120;
bool discordText = false;
int colorMode = 0; int colorMode = 0;
int mode = 0; int mode = 0;
int Selection = 0; int Selection = 0;
int creditsPage = 1;
// Draws.
void DrawSubMenu(void) const; void DrawSubMenu(void) const;
void DrawLanguageSelection(void) const; void DrawLanguageSelection(void) const;
void DrawColorChanging(void) const; void DrawColorChanging(void) const;
void DrawCreditsScreen(void) const; void DrawCreditsScreen(void) const;
void DrawMiscSettings(void) const; void DrawMiscSettings(void) const;
// Logic's.
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
void LanguageSelection(u32 hDown, touchPosition touch); void LanguageSelection(u32 hDown, touchPosition touch);
void colorChanging(u32 hDown, touchPosition touch); void colorChanging(u32 hDown, touchPosition touch);
@@ -87,10 +85,6 @@ private:
{220, 85, 95, 41, -1}, {220, 85, 95, 41, -1},
}; };
std::vector<Structs::ButtonPos> barPos = {
{0, 215, 320, 25, -1},
};
std::vector<Structs::ButtonPos> arrowPos = { std::vector<Structs::ButtonPos> arrowPos = {
{0, 0, 25, 25, -1}, // Previous Arrow. {0, 0, 25, 25, -1}, // Previous Arrow.
{295, 0, 25, 25, -1}, // Next Arrow. {295, 0, 25, 25, -1}, // Next Arrow.
+14 -29
View File
@@ -37,6 +37,7 @@
// The to editing script. // The to editing script.
nlohmann::json editScript; nlohmann::json editScript;
std::string entryName = ""; // So we can set to *that* entry.
void ScriptCreator::openJson(std::string fileName) { void ScriptCreator::openJson(std::string fileName) {
std::string scriptFile = Config::ScriptPath + fileName; std::string scriptFile = Config::ScriptPath + fileName;
@@ -103,9 +104,9 @@ void ScriptCreator::DrawSubMenu(void) const {
void ScriptCreator::DrawScriptScreen(void) const { void ScriptCreator::DrawScriptScreen(void) const {
Gui::DrawTop(); Gui::DrawTop();
if (Config::UseBars == true) { if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 400); Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, "Selected Entry: " + entryName, 400);
} else { } else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATOR"), 400); Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, "Selected Entry: " + entryName, 400);
} }
Gui::DrawBottom(); Gui::DrawBottom();
@@ -155,8 +156,6 @@ void ScriptCreator::createNewJson(std::string fileName) {
// Test. // Test.
void ScriptCreator::createDownloadRelease() { void ScriptCreator::createDownloadRelease() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// Repo. // Repo.
std::string repo = Input::getString(50, "Enter the name of the Owner."); std::string repo = Input::getString(50, "Enter the name of the Owner.");
repo += "/"; repo += "/";
@@ -170,15 +169,13 @@ void ScriptCreator::createDownloadRelease() {
// Message. // Message.
std::string message = Input::getString(50, "Enter the Message."); std::string message = Input::getString(50, "Enter the Message.");
editScript[entryname] = { {{"type", "downloadRelease"}, {"repo", repo}, {"file", file}, {"output", output}, {"includePrerelease", prerelease}, {"message", message}} }; editScript[entryName] = { {{"type", "downloadRelease"}, {"repo", repo}, {"file", file}, {"output", output}, {"includePrerelease", prerelease}, {"message", message}} };
Logging::writeToLog("Execute 'ScriptCreator::createDownloadRelease();'."); Logging::writeToLog("Execute 'ScriptCreator::createDownloadRelease();'.");
} }
// To-Do. // To-Do.
void ScriptCreator::createDownloadFile() { void ScriptCreator::createDownloadFile() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// URL of the file. // URL of the file.
std::string file = Input::getString(50, "Enter the URL of the file."); std::string file = Input::getString(50, "Enter the URL of the file.");
// Output. // Output.
@@ -186,27 +183,23 @@ void ScriptCreator::createDownloadFile() {
// Message. // Message.
std::string message = Input::getString(50, "Enter the Message."); std::string message = Input::getString(50, "Enter the Message.");
editScript[entryname] = { {{"type", "downloadFile"}, {"file", file}, {"output", output}, {"message", message}} }; editScript[entryName] = { {{"type", "downloadFile"}, {"file", file}, {"output", output}, {"message", message}} };
Logging::writeToLog("Execute 'ScriptCreator::createDownloadFile();'."); Logging::writeToLog("Execute 'ScriptCreator::createDownloadFile();'.");
} }
void ScriptCreator::createDeleteFile() { void ScriptCreator::createDeleteFile() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// URL of the file. // URL of the file.
std::string file = Input::getString(50, "Enter the path to the file."); std::string file = Input::getString(50, "Enter the path to the file.");
// Message. // Message.
std::string message = Input::getString(50, "Enter the Message."); std::string message = Input::getString(50, "Enter the Message.");
editScript[entryname] = { {{"type", "deleteFile"}, {"file", file}, {"message", message}} }; editScript[entryName] = { {{"type", "deleteFile"}, {"file", file}, {"message", message}} };
Logging::writeToLog("Execute 'ScriptCreator::createDeleteFile();'."); Logging::writeToLog("Execute 'ScriptCreator::createDeleteFile();'.");
} }
void ScriptCreator::createExtractFile() { void ScriptCreator::createExtractFile() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// File path. // File path.
std::string file = Input::getString(50, "Enter the path to the file."); std::string file = Input::getString(50, "Enter the path to the file.");
// Input of the archive. // Input of the archive.
@@ -216,63 +209,53 @@ void ScriptCreator::createExtractFile() {
// Message. // Message.
std::string message = Input::getString(50, "Enter the Message."); std::string message = Input::getString(50, "Enter the Message.");
editScript[entryname] = { {{"type", "extractFile"}, {"file", file}, {"input", input}, {"output", output}, {"message", message}} }; editScript[entryName] = { {{"type", "extractFile"}, {"file", file}, {"input", input}, {"output", output}, {"message", message}} };
Logging::writeToLog("Execute 'ScriptCreator::createExtractFile();'."); Logging::writeToLog("Execute 'ScriptCreator::createExtractFile();'.");
} }
void ScriptCreator::createInstallCia() { void ScriptCreator::createInstallCia() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// File path. // File path.
std::string file = Input::getString(50, "Enter the path to the CIA File."); std::string file = Input::getString(50, "Enter the path to the CIA File.");
// Message. // Message.
std::string message = Input::getString(50, "Enter the Message."); std::string message = Input::getString(50, "Enter the Message.");
editScript[entryname] = { {{"type", "installCia"}, {"file", file}, {"message", message}} }; editScript[entryName] = { {{"type", "installCia"}, {"file", file}, {"message", message}} };
Logging::writeToLog("Execute 'ScriptCreator::createInstallCia();'."); Logging::writeToLog("Execute 'ScriptCreator::createInstallCia();'.");
} }
void ScriptCreator::createMkDir() { void ScriptCreator::createMkDir() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// Directory path. // Directory path.
std::string directory = Input::getString(50, "Enter the directory path."); std::string directory = Input::getString(50, "Enter the directory path.");
editScript[entryname] = { {{"type", "mkdir"}, {"directory", directory}} }; editScript[entryName] = { {{"type", "mkdir"}, {"directory", directory}} };
Logging::writeToLog("Execute 'ScriptCreator::createMkDir();'."); Logging::writeToLog("Execute 'ScriptCreator::createMkDir();'.");
} }
void ScriptCreator::createRmDir() { void ScriptCreator::createRmDir() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// Directory path. // Directory path.
std::string directory = Input::getString(50, "Enter the directory path."); std::string directory = Input::getString(50, "Enter the directory path.");
editScript[entryname] = { {{"type", "rmdir"}, {"directory", directory}} }; editScript[entryName] = { {{"type", "rmdir"}, {"directory", directory}} };
Logging::writeToLog("Execute 'ScriptCreator::createRmDir();'."); Logging::writeToLog("Execute 'ScriptCreator::createRmDir();'.");
} }
void ScriptCreator::createMkFile() { void ScriptCreator::createMkFile() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// File path. // File path.
std::string file = Input::getString(50, "Enter the path to the new File."); std::string file = Input::getString(50, "Enter the path to the new File.");
editScript[entryname] = { {{"type", "mkfile"}, {"file", file}} }; editScript[entryName] = { {{"type", "mkfile"}, {"file", file}} };
Logging::writeToLog("Execute 'ScriptCreator::createMkFile();'."); Logging::writeToLog("Execute 'ScriptCreator::createMkFile();'.");
} }
void ScriptCreator::createTimeMsg() { void ScriptCreator::createTimeMsg() {
// Entry name.
std::string entryname = Input::getString(50, "Enter the name of the Entry.");
// Message. // Message.
std::string message = Input::getString(50, "Enter the Message."); std::string message = Input::getString(50, "Enter the Message.");
// Seconds. // Seconds.
int seconds = Input::getUint(999, "Enter the Seconds for the Message to display."); int seconds = Input::getUint(999, "Enter the Seconds for the Message to display.");
editScript[entryname] = { {{"type", "timeMsg"}, {"message", message}, {"seconds", seconds}} }; editScript[entryName] = { {{"type", "timeMsg"}, {"message", message}, {"seconds", seconds}} };
Logging::writeToLog("Execute 'ScriptCreator::createTimeMsg();'."); Logging::writeToLog("Execute 'ScriptCreator::createTimeMsg();'.");
} }
@@ -317,6 +300,7 @@ void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
jsonFileName += ".json"; jsonFileName += ".json";
createNewJson(jsonFileName); createNewJson(jsonFileName);
openJson(jsonFileName); openJson(jsonFileName);
entryName = Input::getString(50, "Enter the EntryName.");
Selection = 0; Selection = 0;
mode = 1; mode = 1;
} }
@@ -327,6 +311,7 @@ void ScriptCreator::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
jsonFileName = tempScript; jsonFileName = tempScript;
if(access(jsonFileName.c_str(), F_OK) != -1 ) { if(access(jsonFileName.c_str(), F_OK) != -1 ) {
openJson(jsonFileName); openJson(jsonFileName);
entryName = Input::getString(50, "Enter the EntryName.");
Selection = 0; Selection = 0;
mode = 1; mode = 1;
} }
+41 -41
View File
@@ -190,11 +190,10 @@ void Settings::DrawColorChanging(void) const {
} }
void Settings::DrawCreditsScreen(void) const { void Settings::DrawCreditsScreen(void) const {
if (DisplayMode == 1) { std::string title = "Universal-Updater - ";
Gui::DrawTop(); title += Lang::get("CREDITS");
std::string title = "Universal-Updater - "; Gui::DrawTop();
title += Lang::get("CREDITS"); if (creditsPage != 4) {
if (Config::UseBars == true) { if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400); Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, title, 400);
} else { } else {
@@ -206,22 +205,37 @@ void Settings::DrawCreditsScreen(void) const {
std::string currentVersion = Lang::get("CURRENT_VERSION"); std::string currentVersion = Lang::get("CURRENT_VERSION");
currentVersion += V_STRING; currentVersion += V_STRING;
Gui::DrawString(395-Gui::GetStringWidth(0.70f, currentVersion), 219, 0.70f, Config::TxtColor, currentVersion, 400); Gui::DrawString(395-Gui::GetStringWidth(0.70f, currentVersion), 219, 0.70f, Config::TxtColor, currentVersion, 400);
Gui::DrawBottom(); } else {
Gui::DrawArrow(0, 0, 0, 1);
Gui::DrawStringCentered(0, -2, 0.7f, Config::TxtColor, Lang::get("MANY_THANKS"), 320);
Gui::DrawStringCentered(0, 40, 0.7f, Config::TxtColor, Lang::get("TRANSLATORS"), 320);
Gui::DrawStringCentered(0, 70, 0.5f, Config::TxtColor, Lang::get("HELP_TRANSLATE"), 320);
Gui::DrawStringCentered(0, 100, 0.7f, Config::TxtColor, "Pk11", 320);
Gui::DrawStringCentered(0, 130, 0.5f, Config::TxtColor, Lang::get("HELP_OUT"), 320);
Gui::DrawStringCentered(0, 160, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATORS"), 320);
Gui::DrawStringCentered(0, 190, 0.5f, Config::TxtColor, Lang::get("CREATING_SCRIPTS"), 320);
Gui::DrawString((320-Gui::GetStringWidth(0.55, discordText ? Lang::get("SHOW_QR") : Lang::get("LINK")))/2, 220, 0.55, Config::TxtColor, discordText ? Lang::get("SHOW_QR") : Lang::get("LINK"), 320);
} else if (DisplayMode == 2) {
Gui::DrawTop();
Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, 190)); Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, 190));
Gui::sprite(sprites_discord_idx, 115, 35); Gui::sprite(sprites_discord_idx, 115, 35);
Gui::DrawBottom(); }
Gui::DrawBottom();
if (creditsPage != 4) {
Gui::DrawArrow(0, 218, 0, 1);
Gui::DrawArrow(318, 240, 180.0, 1);
}
if (creditsPage == 1) {
Gui::DrawStringCentered(0, -2, 0.7f, Config::TxtColor, Lang::get("TRANSLATORS"), 320);
Gui::DrawString(5, 30, 0.6f, Config::TxtColor, "- _mapple²\n- antoine62\n- Chips\n- David Pires\n- Flame\n- lemonnade0\n- Pk11\n- Roby Spia\n- StackZ\n- YoSoy");
Gui::DrawString(180, 30, 0.6f, Config::TxtColor, "Русский\nFrançais\nPortuguês\nPortuguês\nBruh\nLietuvių\n日本語\nItaliano\nDeutsch, English\nEspañol");
} else if (creditsPage == 2) {
Gui::DrawStringCentered(0, -2, 0.7f, Config::TxtColor, "Universal-Team", 320);
Gui::DrawStringCentered(-65, 35, 0.7f, Config::TxtColor, "DeadPhoenix");
Gui::DrawStringCentered(-40, 65, 0.7f, Config::TxtColor, "Flame");
Gui::DrawStringCentered(-38, 95, 0.7f, Config::TxtColor, "Pk11");
Gui::DrawStringCentered(-60, 125, 0.7f, Config::TxtColor, "RocketRobz");
Gui::DrawStringCentered(-42, 155, 0.7f, Config::TxtColor, "StackZ");
Gui::DrawStringCentered(-65, 185, 0.7f, Config::TxtColor, "TotallyNotGuy");
} else if (creditsPage == 3) {
Gui::DrawStringCentered(0, -2, 0.7f, Config::TxtColor, Lang::get("SCRIPTCREATORS"), 320);
Gui::DrawString(5, 27, 0.55f, Config::TxtColor, "- DualBladedKirito\n\n- Glazed_Belmont\n\n- Pk11\n\n- StackZ\n\n- The Conceptionist\n\n- YoSoy");
Gui::DrawString(180, 27, 0.55f, Config::TxtColor, "1\n\n1\n\n1\n\n5\n\n10\n\n1/2");
} else if (creditsPage == 4) {
Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, 190)); Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(0, 0, 0, 190));
Gui::DrawStringCentered(0, -2, 0.55f, Config::TxtColor, Lang::get("LINK"), 320);
Gui::DrawArrow(0, 218, 0, 1); Gui::DrawArrow(0, 218, 0, 1);
} }
} }
@@ -466,30 +480,16 @@ void Settings::colorChanging(u32 hDown, touchPosition touch) {
} }
void Settings::CreditsLogic(u32 hDown, touchPosition touch) { void Settings::CreditsLogic(u32 hDown, touchPosition touch) {
gspWaitForVBlank(); if ((hDown & KEY_LEFT || hDown & KEY_L) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
if(delay > 0) { if (creditsPage == 1) mode = 0;
delay--; else if (creditsPage > 1) creditsPage--;
} else {
delay = 120; } else if ((hDown & KEY_R || hDown & KEY_RIGHT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
discordText = !discordText; if (creditsPage < 4) creditsPage++;
} }
if (DisplayMode == 1) {
if (hDown & KEY_TOUCH) { if (hDown & KEY_B) {
if (touching(touch, barPos[0])) { mode = 0;
DisplayMode = 2;
} else if (touching(touch, arrowPos[3])) {
mode = 0;
}
}
if (hDown & KEY_B) {
mode = 0;
}
} else if (DisplayMode == 2) {
if (hDown & KEY_B) {
DisplayMode = 1;
} else if (hDown & KEY_TOUCH && touching(touch, arrowPos[2])) {
DisplayMode = 1;
}
} }
} }