mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-07 08:49:08 +00:00
WIP: DropDown Menu.
This commit is contained in:
@@ -41,3 +41,5 @@ To build Universal-Updater from source, you need devkitPro installed, along with
|
|||||||
## Icon Credits
|
## Icon Credits
|
||||||
|
|
||||||
<a target="_blank" href="https://icons8.com/icons/set/trash">Trash icon</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
|
<a target="_blank" href="https://icons8.com/icons/set/trash">Trash icon</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
|
||||||
|
|
||||||
|
<a target="_blank" href="https://icons8.com/icons/set/menu">Menu icon</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
|
||||||
@@ -5,6 +5,7 @@ sprites/bottom_screen_bot.png
|
|||||||
sprites/bottom_screen_top.png
|
sprites/bottom_screen_top.png
|
||||||
sprites/delete.png
|
sprites/delete.png
|
||||||
sprites/download_all.png
|
sprites/download_all.png
|
||||||
|
sprites/dropdown.png
|
||||||
sprites/top_screen_bot.png
|
sprites/top_screen_bot.png
|
||||||
sprites/top_screen_top.png
|
sprites/top_screen_top.png
|
||||||
sprites/search.png
|
sprites/search.png
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 107 B |
@@ -44,12 +44,16 @@ private:
|
|||||||
mutable int screenPos = 0;
|
mutable int screenPos = 0;
|
||||||
mutable int screenPosList = 0;
|
mutable int screenPosList = 0;
|
||||||
mutable int Selection = 0;
|
mutable int Selection = 0;
|
||||||
|
int dropSelection = 0;
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
|
bool dropDownMenu = false;
|
||||||
|
|
||||||
// Draws.
|
// Draws.
|
||||||
void DrawBrowse(void) const;
|
void DrawBrowse(void) const;
|
||||||
void DrawGlossary(void) const;
|
void DrawGlossary(void) const;
|
||||||
|
|
||||||
|
void DropDownLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
|
|
||||||
nlohmann::json infoJson;
|
nlohmann::json infoJson;
|
||||||
int maxScripts;
|
int maxScripts;
|
||||||
|
|
||||||
@@ -58,15 +62,26 @@ private:
|
|||||||
int fastMode = false;
|
int fastMode = false;
|
||||||
std::vector<DirEntry> dirContents;
|
std::vector<DirEntry> dirContents;
|
||||||
void refresh();
|
void refresh();
|
||||||
|
void downloadAll();
|
||||||
|
|
||||||
// Button | Icon struct.
|
// Button | Icon struct.
|
||||||
std::vector<Structs::ButtonPos> arrowPos = {
|
std::vector<Structs::ButtonPos> arrowPos = {
|
||||||
{295, 0, 25, 25}, // Arrow Up.
|
{295, 0, 25, 25}, // Arrow Up.
|
||||||
{295, 215, 25, 25}, // Arrow Down.
|
{295, 215, 25, 25}, // Arrow Down.
|
||||||
{0, 215, 25, 25}, // Back Arrow.
|
{0, 215, 25, 25}, // Back Arrow.
|
||||||
{5, 0, 25, 25}, // Download All.
|
{5, 0, 25, 25} // Dropdown Menu.
|
||||||
{45, 0, 25, 25}, // ViewMode Change.
|
};
|
||||||
{80, 0, 25, 25}, // Search.
|
|
||||||
|
// DropDownMenu.
|
||||||
|
std::vector<Structs::ButtonPos> dropPos = {
|
||||||
|
{5, 30, 25, 25}, // Download All.
|
||||||
|
{5, 70, 25, 25}, // Refresh.
|
||||||
|
{5, 110, 25, 25} // ViewMode.
|
||||||
|
};
|
||||||
|
std::vector<Structs::ButtonPos> dropPos2 = {
|
||||||
|
{0, 28, 140, 30}, // Download All.
|
||||||
|
{0, 68, 140, 30}, // Refresh.
|
||||||
|
{0, 108, 140, 30} // ViewMode.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ private:
|
|||||||
mutable int screenPos = 0;
|
mutable int screenPos = 0;
|
||||||
mutable int screenPosList = 0;
|
mutable int screenPosList = 0;
|
||||||
mutable int Selection = 0;
|
mutable int Selection = 0;
|
||||||
|
int dropSelection = 0;
|
||||||
|
bool dropDownMenu = false;
|
||||||
|
|
||||||
// Browse stuff.
|
// Browse stuff.
|
||||||
int keyRepeatDelay = 0;
|
int keyRepeatDelay = 0;
|
||||||
@@ -92,14 +94,23 @@ private:
|
|||||||
{295, 0, 25, 25}, // Arrow Up.
|
{295, 0, 25, 25}, // Arrow Up.
|
||||||
{295, 215, 25, 25}, // Arrow Down.
|
{295, 215, 25, 25}, // Arrow Down.
|
||||||
{0, 215, 25, 25}, // Back Arrow.
|
{0, 215, 25, 25}, // Back Arrow.
|
||||||
{5, 0, 25, 25}, // viewMode Change
|
{5, 0, 25, 25} // Dropdown Menu.
|
||||||
{45, 0, 25, 25}, // Delete.
|
|
||||||
};
|
};
|
||||||
std::vector<Structs::ButtonPos> subPos = {
|
std::vector<Structs::ButtonPos> subPos = {
|
||||||
{10, 70, 140, 40}, // Script list.
|
{10, 70, 140, 40}, // Script list.
|
||||||
{170, 70, 140, 40}, // Get Scripts.
|
{170, 70, 140, 40}, // Get Scripts.
|
||||||
{10, 145, 140, 40}, // Script Creator.
|
{10, 145, 140, 40}, // Script Creator.
|
||||||
{170, 145, 140, 40}, // Script path change.
|
{170, 145, 140, 40} // Script path change.
|
||||||
|
};
|
||||||
|
|
||||||
|
// DropDownMenu.
|
||||||
|
std::vector<Structs::ButtonPos> dropPos = {
|
||||||
|
{5, 30, 25, 25}, // Delete.
|
||||||
|
{5, 70, 25, 25} // ViewMode.
|
||||||
|
};
|
||||||
|
std::vector<Structs::ButtonPos> dropPos2 = {
|
||||||
|
{0, 28, 140, 30}, // Delete.
|
||||||
|
{0, 68, 140, 30} // ViewMode.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ private:
|
|||||||
mutable int Selection = 0;
|
mutable int Selection = 0;
|
||||||
int screenPos = 0;
|
int screenPos = 0;
|
||||||
mutable int screenPosList = 0;
|
mutable int screenPosList = 0;
|
||||||
|
bool dropDownMenu = false;
|
||||||
|
int dropSelection = 0;
|
||||||
|
|
||||||
// Browse stuff.
|
// Browse stuff.
|
||||||
int keyRepeatDelay = 0;
|
int keyRepeatDelay = 0;
|
||||||
@@ -99,25 +101,35 @@ private:
|
|||||||
{295, 0, 25, 25}, // Arrow Up.
|
{295, 0, 25, 25}, // Arrow Up.
|
||||||
{295, 215, 25, 25}, // Arrow Down.
|
{295, 215, 25, 25}, // Arrow Down.
|
||||||
{0, 215, 25, 25}, // Back Arrow.
|
{0, 215, 25, 25}, // Back Arrow.
|
||||||
{5, 0, 25, 25}, // ViewMode Change.
|
{5, 0, 25, 25}, // Dropdown Menu.
|
||||||
{45, 0, 25, 25}, // Delete.
|
|
||||||
{85, 0, 25, 25}, // Update.
|
|
||||||
};
|
};
|
||||||
std::vector<Structs::ButtonPos> URLBtn = {
|
std::vector<Structs::ButtonPos> URLBtn = {
|
||||||
{10, 70, 140, 40}, // FULL URL.
|
{10, 70, 140, 40}, // FULL URL.
|
||||||
{170, 70, 140, 40}, // Github.
|
{170, 70, 140, 40}, // Github.
|
||||||
{10, 145, 140, 40}, // TinyDB.
|
{10, 145, 140, 40}, // TinyDB.
|
||||||
{170, 145, 140, 40}, // QR Code?
|
{170, 145, 140, 40} // QR Code?
|
||||||
};
|
};
|
||||||
std::vector<Structs::ButtonPos> GitHubPos = {
|
std::vector<Structs::ButtonPos> GitHubPos = {
|
||||||
{30, 50, 260, 30}, // Owner & Repo.
|
{30, 50, 260, 30}, // Owner & Repo.
|
||||||
{30, 130, 260, 30}, // Filename.
|
{30, 130, 260, 30}, // Filename.
|
||||||
{135, 180, 50, 30}, // OK.
|
{135, 180, 50, 30} // OK.
|
||||||
};
|
};
|
||||||
std::vector<Structs::ButtonPos> subPos = {
|
std::vector<Structs::ButtonPos> subPos = {
|
||||||
{90, 40, 140, 35}, // StoreList.
|
{90, 40, 140, 35}, // StoreList.
|
||||||
{90, 100, 140, 35}, // storeSearch.
|
{90, 100, 140, 35}, // storeSearch.
|
||||||
{90, 160, 140, 35}, // storePathChange.
|
{90, 160, 140, 35} // storePathChange.
|
||||||
|
};
|
||||||
|
|
||||||
|
// DropDownMenu.
|
||||||
|
std::vector<Structs::ButtonPos> dropPos = {
|
||||||
|
{5, 30, 25, 25}, // Delete.
|
||||||
|
{5, 70, 25, 25}, // Update.
|
||||||
|
{5, 110, 25, 25} // ViewMode.
|
||||||
|
};
|
||||||
|
std::vector<Structs::ButtonPos> dropPos2 = {
|
||||||
|
{0, 28, 140, 30}, // Delete.
|
||||||
|
{0, 68, 140, 30}, // Update.
|
||||||
|
{0, 108, 140, 30} // ViewMode.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -152,5 +152,11 @@
|
|||||||
"DELETE_SCRIPT2": "Delete the selected Script.",
|
"DELETE_SCRIPT2": "Delete the selected Script.",
|
||||||
"DELETE_UNISTORE": "Delete the selected UniStore.",
|
"DELETE_UNISTORE": "Delete the selected UniStore.",
|
||||||
"REFRESH_SCRIPTBROWSE_PROMPT": "Would you like to refresh the ScriptBrowse?",
|
"REFRESH_SCRIPTBROWSE_PROMPT": "Would you like to refresh the ScriptBrowse?",
|
||||||
"REFRESH_SCRIPTBROWSE": "Refresh the ScriptBrowse."
|
"REFRESH_SCRIPTBROWSE": "Refresh the ScriptBrowse.",
|
||||||
|
|
||||||
|
"DOWNLOAD_ALL_DDM": "Download All",
|
||||||
|
"REFRESH_BROWSE_DDM": "Refresh",
|
||||||
|
"VIEW_DDM": "Change ViewMode",
|
||||||
|
"DELETE_DDM": "Delete",
|
||||||
|
"UPDATE_DDM": "Update"
|
||||||
}
|
}
|
||||||
|
|||||||
+103
-36
@@ -152,9 +152,7 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
GFX::DrawArrow(315, 240, 180.0);
|
GFX::DrawArrow(315, 240, 180.0);
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
|
|
||||||
GFX::DrawSpriteBlend(sprites_download_all_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[4].x, arrowPos[4].y);
|
|
||||||
GFX::DrawSpriteBlend(sprites_update_idx, arrowPos[5].x, arrowPos[5].y);
|
|
||||||
|
|
||||||
Gui::DrawStringCentered(0, 1, 0.6f, Config::TxtColor, std::to_string(Selection + 1) + " | " + std::to_string(maxScripts));
|
Gui::DrawStringCentered(0, 1, 0.6f, Config::TxtColor, std::to_string(Selection + 1) + " | " + std::to_string(maxScripts));
|
||||||
|
|
||||||
@@ -162,8 +160,10 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
|
||||||
if(screenPos + i == Selection) {
|
if(screenPos + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (infoJson[screenPos+i]["curRevision"] == -1) {
|
if (infoJson[screenPos+i]["curRevision"] == -1) {
|
||||||
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::notFound);
|
Gui::Draw_Rect(295, 45+(i*59), 20, 20, Config::notFound);
|
||||||
} else if(infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) {
|
} else if(infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) {
|
||||||
@@ -181,8 +181,10 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
|
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
|
||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
||||||
if(screenPosList + i == Selection) {
|
if(screenPosList + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Script not found.
|
// Script not found.
|
||||||
if (infoJson[screenPosList+i]["curRevision"] == -1) {
|
if (infoJson[screenPosList+i]["curRevision"] == -1) {
|
||||||
@@ -201,6 +203,27 @@ void ScriptBrowse::DrawBrowse(void) const {
|
|||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, infoJson[screenPosList+i]["title"], 317);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, infoJson[screenPosList+i]["title"], 317);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DropDown Menu.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
// Draw Operation Box.
|
||||||
|
Gui::Draw_Rect(0, 25, 140, 130, Config::Color1);
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (dropSelection == i) {
|
||||||
|
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, Config::SelectedColor);
|
||||||
|
} else {
|
||||||
|
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, Config::UnselectedColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Draw Dropdown Icons.
|
||||||
|
GFX::DrawSpriteBlend(sprites_download_all_idx, dropPos[0].x, dropPos[0].y);
|
||||||
|
GFX::DrawSpriteBlend(sprites_update_idx, dropPos[1].x, dropPos[1].y);
|
||||||
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[2].x, dropPos[2].y);
|
||||||
|
// Dropdown Text.
|
||||||
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("DOWNLOAD_ALL_DDM"), 100);
|
||||||
|
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("REFRESH_BROWSE_DDM"), 100);
|
||||||
|
Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -245,14 +268,85 @@ void ScriptBrowse::DrawGlossary(void) const {
|
|||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptBrowse::DropDownLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_DOWN) {
|
||||||
|
if (dropSelection < 2) dropSelection++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if (dropSelection > 0) dropSelection--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
switch(dropSelection) {
|
||||||
|
case 0:
|
||||||
|
downloadAll();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
refresh();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, dropPos2[0])) {
|
||||||
|
downloadAll();
|
||||||
|
dropDownMenu = false;
|
||||||
|
} else if (touching(touch, dropPos2[1])) {
|
||||||
|
refresh();
|
||||||
|
dropDownMenu = false;
|
||||||
|
} else if (touching(touch, dropPos2[2])) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptBrowse::downloadAll() {
|
||||||
|
if (infoJson.size() != 0) {
|
||||||
|
for (int i = 0; i < (int)infoJson.size(); i++) {
|
||||||
|
int current = i+1;
|
||||||
|
int total = infoJson.size();
|
||||||
|
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[i]["title"]);
|
||||||
|
std::string titleFix = infoJson[i]["title"];
|
||||||
|
for (int l = 0; l < (int)titleFix.size(); l++) {
|
||||||
|
if (titleFix[l] == '/') {
|
||||||
|
titleFix[l] = '-';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Msg::DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
|
||||||
|
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
|
||||||
|
infoJson[i]["curRevision"] = infoJson[i]["revision"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
if (dropDownMenu) {
|
||||||
|
DropDownLogic(hDown, hHeld, touch);
|
||||||
|
} else {
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
infoJson.clear();
|
infoJson.clear();
|
||||||
Gui::screenBack();
|
Gui::screenBack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
|
||||||
if (Selection < (int)infoJson.size()-1) {
|
if (Selection < (int)infoJson.size()-1) {
|
||||||
@@ -267,6 +361,10 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropDownMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
||||||
if (Selection > 0) {
|
if (Selection > 0) {
|
||||||
Selection--;
|
Selection--;
|
||||||
@@ -343,18 +441,6 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
fastMode = false;
|
fastMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_X) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
|
|
||||||
if (Config::viewMode == 0) {
|
|
||||||
Config::viewMode = 1;
|
|
||||||
} else {
|
|
||||||
Config::viewMode = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[5]))) {
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
if(Selection < screenPos) {
|
if(Selection < screenPos) {
|
||||||
screenPos = Selection;
|
screenPos = Selection;
|
||||||
@@ -368,30 +454,11 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_Y) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
|
||||||
if (infoJson.size() != 0) {
|
|
||||||
for (int i = 0; i < (int)infoJson.size(); i++) {
|
|
||||||
int current = i+1;
|
|
||||||
int total = infoJson.size();
|
|
||||||
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[i]["title"]);
|
|
||||||
std::string titleFix = infoJson[i]["title"];
|
|
||||||
for (int l = 0; l < (int)titleFix.size(); l++) {
|
|
||||||
if (titleFix[l] == '/') {
|
|
||||||
titleFix[l] = '-';
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Msg::DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
|
|
||||||
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
|
|
||||||
infoJson[i]["curRevision"] = infoJson[i]["revision"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Switch to Glossary and back.
|
// Switch to Glossary and back.
|
||||||
if (hDown & KEY_RIGHT || hDown & KEY_LEFT) {
|
if (hDown & KEY_RIGHT || hDown & KEY_LEFT) {
|
||||||
if (mode == 0) mode = 1;
|
if (mode == 0) mode = 1;
|
||||||
else mode = 0;
|
else mode = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+123
-16
@@ -243,8 +243,7 @@ void ScriptList::DrawList(void) const {
|
|||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
GFX::DrawArrow(315, 240, 180.0);
|
GFX::DrawArrow(315, 240, 180.0);
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
GFX::DrawSpriteBlend(sprites_delete_idx, arrowPos[4].x, arrowPos[4].y);
|
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo.size();i++) {
|
||||||
@@ -252,8 +251,10 @@ void ScriptList::DrawList(void) const {
|
|||||||
line1 = fileInfo[screenPos + i].title;
|
line1 = fileInfo[screenPos + i].title;
|
||||||
line2 = fileInfo[screenPos + i].author;
|
line2 = fileInfo[screenPos + i].author;
|
||||||
if(screenPos + i == Selection) {
|
if(screenPos + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
||||||
}
|
}
|
||||||
@@ -262,11 +263,32 @@ void ScriptList::DrawList(void) const {
|
|||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
||||||
line1 = fileInfo[screenPosList + i].title;
|
line1 = fileInfo[screenPosList + i].title;
|
||||||
if(screenPosList + i == Selection) {
|
if(screenPosList + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DropDown Menu.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
// Draw Operation Box.
|
||||||
|
Gui::Draw_Rect(0, 25, 140, 87, Config::Color1);
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
if (dropSelection == i) {
|
||||||
|
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, Config::SelectedColor);
|
||||||
|
} else {
|
||||||
|
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, Config::UnselectedColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Draw Dropdown Icons.
|
||||||
|
GFX::DrawSpriteBlend(sprites_delete_idx, dropPos[0].x, dropPos[0].y);
|
||||||
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[1].x, dropPos[1].y);
|
||||||
|
// Dropdown Text.
|
||||||
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("DELETE_DDM"), 100);
|
||||||
|
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::Draw(void) const {
|
void ScriptList::Draw(void) const {
|
||||||
@@ -299,15 +321,17 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
GFX::DrawArrow(315, 240, 180.0);
|
GFX::DrawArrow(315, 240, 180.0);
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)fileInfo2.size();i++) {
|
||||||
Gui::Draw_Rect(0, 40+(i*57), 320, 45, unselected);
|
Gui::Draw_Rect(0, 40+(i*57), 320, 45, unselected);
|
||||||
info = fileInfo2[screenPos + i];
|
info = fileInfo2[screenPos + i];
|
||||||
if(screenPos + i == Selection) {
|
if(screenPos + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
|
Gui::DrawStringCentered(0, 50+(i*57), 0.7f, TextColor, info, 320);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,11 +340,24 @@ void ScriptList::DrawSingleObject(void) const {
|
|||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, unselected);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, unselected);
|
||||||
info = fileInfo2[screenPosList + i];
|
info = fileInfo2[screenPosList + i];
|
||||||
if(screenPosList + i == Selection) {
|
if(screenPosList + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, TextColor, info, 320);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, TextColor, info, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DropDown Menu.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
// Draw Operation Box.
|
||||||
|
Gui::Draw_Rect(0, 25, 140, 44, barColor);
|
||||||
|
Gui::drawAnimatedSelector(dropPos2[0].x, dropPos2[0].y, dropPos2[0].w, dropPos2[0].h, .090, TRANSPARENT, Config::SelectedColor);
|
||||||
|
// Draw Dropdown Icons.
|
||||||
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[0].x, dropPos[0].y);
|
||||||
|
// Dropdown Text.
|
||||||
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::refreshList() {
|
void ScriptList::refreshList() {
|
||||||
@@ -463,12 +500,62 @@ void ScriptList::deleteScript(int selectedScript) {
|
|||||||
void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
|
//DropDown Logic.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
if (hDown & KEY_DOWN) {
|
||||||
|
if (dropSelection < 1) dropSelection++;
|
||||||
|
}
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if (dropSelection > 0) dropSelection--;
|
||||||
|
}
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
switch(dropSelection) {
|
||||||
|
case 0:
|
||||||
|
if (Msg::promptMsg(Lang::get("DELETE_SCRIPT"))) {
|
||||||
|
deleteScript(Selection);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, dropPos2[0])) {
|
||||||
|
if (Msg::promptMsg(Lang::get("DELETE_SCRIPT"))) {
|
||||||
|
deleteScript(Selection);
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
} else if (touching(touch, dropPos2[1])) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
fileInfo.clear();
|
fileInfo.clear();
|
||||||
Selection = 0;
|
Selection = 0;
|
||||||
mode = 0;
|
mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropSelection = 0;
|
||||||
|
dropDownMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (hDown & KEY_START) {
|
if (hDown & KEY_START) {
|
||||||
if (Config::autoboot == 2) {
|
if (Config::autoboot == 2) {
|
||||||
if (Msg::promptMsg(Lang::get("DISABLE_AUTOBOOT"))) {
|
if (Msg::promptMsg(Lang::get("DISABLE_AUTOBOOT"))) {
|
||||||
@@ -502,11 +589,6 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
keyRepeatDelay = 6;
|
keyRepeatDelay = 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
|
|
||||||
if (Msg::promptMsg(Lang::get("DELETE_SCRIPT"))) {
|
|
||||||
deleteScript(Selection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
|
||||||
if (Selection > 0) {
|
if (Selection > 0) {
|
||||||
@@ -607,11 +689,43 @@ void ScriptList::ListSelection(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
|
//DropDown Logic.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, dropPos2[0])) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropSelection = 0;
|
||||||
|
dropDownMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
Selection = 0;
|
Selection = 0;
|
||||||
fileInfo2.clear();
|
fileInfo2.clear();
|
||||||
@@ -711,6 +825,7 @@ void ScriptList::SelectFunction(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
@@ -722,14 +837,6 @@ void ScriptList::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
SelectFunction(hDown, hHeld, touch);
|
SelectFunction(hDown, hHeld, touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_X) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
|
||||||
if (Config::viewMode == 0) {
|
|
||||||
Config::viewMode = 1;
|
|
||||||
} else {
|
|
||||||
Config::viewMode = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_LEFT || hDown & KEY_RIGHT) {
|
if (hDown & KEY_LEFT || hDown & KEY_RIGHT) {
|
||||||
if (mode == 3) {
|
if (mode == 3) {
|
||||||
mode = lastMode;
|
mode = lastMode;
|
||||||
|
|||||||
+137
-23
@@ -279,9 +279,7 @@ void UniStore::DrawStoreList(void) const {
|
|||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
GFX::DrawArrow(315, 240, 180.0);
|
GFX::DrawArrow(315, 240, 180.0);
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
GFX::DrawSpriteBlend(sprites_delete_idx, arrowPos[4].x, arrowPos[4].y);
|
|
||||||
GFX::DrawSpriteBlend(sprites_update_idx, arrowPos[5].x, arrowPos[5].y);
|
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {
|
||||||
@@ -289,8 +287,10 @@ void UniStore::DrawStoreList(void) const {
|
|||||||
line1 = storeInfo[screenPos + i].title;
|
line1 = storeInfo[screenPos + i].title;
|
||||||
line2 = storeInfo[screenPos + i].author;
|
line2 = storeInfo[screenPos + i].author;
|
||||||
if(screenPos + i == Selection) {
|
if(screenPos + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
|
||||||
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, line2, 320);
|
||||||
}
|
}
|
||||||
@@ -299,11 +299,34 @@ void UniStore::DrawStoreList(void) const {
|
|||||||
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
|
||||||
line1 = storeInfo[screenPosList + i].title;
|
line1 = storeInfo[screenPosList + i].title;
|
||||||
if(screenPosList + i == Selection) {
|
if(screenPosList + i == Selection) {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DropDown Menu.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
// Draw Operation Box.
|
||||||
|
Gui::Draw_Rect(0, 25, 140, 130, Config::Color1);
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (dropSelection == i) {
|
||||||
|
Gui::drawAnimatedSelector(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, .090, TRANSPARENT, Config::SelectedColor);
|
||||||
|
} else {
|
||||||
|
Gui::Draw_Rect(dropPos2[i].x, dropPos2[i].y, dropPos2[i].w, dropPos2[i].h, Config::UnselectedColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Draw Dropdown Icons.
|
||||||
|
GFX::DrawSpriteBlend(sprites_delete_idx, dropPos[0].x, dropPos[0].y);
|
||||||
|
GFX::DrawSpriteBlend(sprites_update_idx, dropPos[1].x, dropPos[1].y);
|
||||||
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[2].x, dropPos[2].y);
|
||||||
|
// Dropdown Text.
|
||||||
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("DELETE_DDM"), 100);
|
||||||
|
Gui::DrawString(dropPos[1].x+30, dropPos[1].y+5, 0.4f, Config::TxtColor, Lang::get("UPDATE_DDM"), 100);
|
||||||
|
Gui::DrawString(dropPos[2].x+30, dropPos[2].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::DrawStore(void) const {
|
void UniStore::DrawStore(void) const {
|
||||||
@@ -359,7 +382,7 @@ void UniStore::DrawStore(void) const {
|
|||||||
GFX::DrawArrow(295, -1);
|
GFX::DrawArrow(295, -1);
|
||||||
GFX::DrawArrow(315, 240, 180.0);
|
GFX::DrawArrow(315, 240, 180.0);
|
||||||
GFX::DrawArrow(0, 218, 0, 1);
|
GFX::DrawArrow(0, 218, 0, 1);
|
||||||
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[3].x, arrowPos[3].y);
|
GFX::DrawSpriteBlend(sprites_dropdown_idx, arrowPos[3].x, arrowPos[3].y);
|
||||||
|
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)appStoreJson.at("storeContent").size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)appStoreJson.at("storeContent").size();i++) {
|
||||||
@@ -368,8 +391,10 @@ void UniStore::DrawStore(void) const {
|
|||||||
if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) {
|
if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) {
|
||||||
drawNormal(appStoreJson["storeInfo"]["buttonLarge"], 0, 40+(i*57));
|
drawNormal(appStoreJson["storeInfo"]["buttonLarge"], 0, 40+(i*57));
|
||||||
} else {
|
} else {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
|
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, selected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) {
|
if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) {
|
||||||
drawBlend(appStoreJson["storeInfo"]["buttonLarge"], 0, 40+(i*57));
|
drawBlend(appStoreJson["storeInfo"]["buttonLarge"], 0, 40+(i*57));
|
||||||
@@ -386,8 +411,10 @@ void UniStore::DrawStore(void) const {
|
|||||||
if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
|
if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
|
||||||
drawNormal(appStoreJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
|
drawNormal(appStoreJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
|
||||||
} else {
|
} else {
|
||||||
|
if (!dropDownMenu) {
|
||||||
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
|
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, selected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
|
if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
|
||||||
drawBlend(appStoreJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
|
drawBlend(appStoreJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
|
||||||
@@ -398,6 +425,16 @@ void UniStore::DrawStore(void) const {
|
|||||||
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, TextColor, info, 320);
|
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, TextColor, info, 320);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// DropDown Menu.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
// Draw Operation Box.
|
||||||
|
Gui::Draw_Rect(0, 25, 140, 44, barColor);
|
||||||
|
Gui::drawAnimatedSelector(dropPos2[0].x, dropPos2[0].y, dropPos2[0].w, dropPos2[0].h, .090, TRANSPARENT, Config::SelectedColor);
|
||||||
|
// Draw Dropdown Icons.
|
||||||
|
GFX::DrawSpriteBlend(sprites_view_idx, dropPos[0].x, dropPos[0].y);
|
||||||
|
// Dropdown Text.
|
||||||
|
Gui::DrawString(dropPos[0].x+30, dropPos[0].y+5, 0.4f, Config::TxtColor, Lang::get("VIEW_DDM"), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::Draw(void) const {
|
void UniStore::Draw(void) const {
|
||||||
@@ -597,6 +634,64 @@ bool UniStore::handleIfDisplayText() {
|
|||||||
void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
|
if (dropDownMenu) {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_DOWN) {
|
||||||
|
if (dropSelection < 2) dropSelection++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if (dropSelection > 0) dropSelection--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
switch(dropSelection) {
|
||||||
|
case 0:
|
||||||
|
if (Msg::promptMsg(Lang::get("DELETE_STORE"))) {
|
||||||
|
deleteStore(Selection);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
updateStore(Selection);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, dropPos2[0])) {
|
||||||
|
if (Msg::promptMsg(Lang::get("DELETE_STORE"))) {
|
||||||
|
deleteStore(Selection);
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
} else if (touching(touch, dropPos2[1])) {
|
||||||
|
updateStore(Selection);
|
||||||
|
dropDownMenu = false;
|
||||||
|
} else if (touching(touch, dropPos2[2])) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropSelection = 0;
|
||||||
|
dropDownMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
storeInfo.clear();
|
storeInfo.clear();
|
||||||
Selection = 0;
|
Selection = 0;
|
||||||
@@ -636,10 +731,6 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_Y) || (hDown & KEY_TOUCH && touching(touch, arrowPos[5]))) {
|
|
||||||
updateStore(Selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_A) {
|
if (hDown & KEY_A) {
|
||||||
if (dirContents[Selection].isDirectory) {
|
if (dirContents[Selection].isDirectory) {
|
||||||
} else if (storeInfo.size() != 0) {
|
} else if (storeInfo.size() != 0) {
|
||||||
@@ -686,12 +777,6 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
|
|
||||||
if (Msg::promptMsg(Lang::get("DELETE_STORE"))) {
|
|
||||||
deleteStore(Selection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_TOUCH) {
|
if (hDown & KEY_TOUCH) {
|
||||||
if (Config::viewMode == 0) {
|
if (Config::viewMode == 0) {
|
||||||
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {
|
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {
|
||||||
@@ -760,11 +845,48 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
if (keyRepeatDelay) keyRepeatDelay--;
|
if (keyRepeatDelay) keyRepeatDelay--;
|
||||||
|
|
||||||
|
//DropDown Logic.
|
||||||
|
if (dropDownMenu) {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
if (hDown & KEY_DOWN) {
|
||||||
|
if (dropSelection < 1) dropSelection++;
|
||||||
|
}
|
||||||
|
if (hDown & KEY_UP) {
|
||||||
|
if (dropSelection > 0) dropSelection--;
|
||||||
|
}
|
||||||
|
if (hDown & KEY_A) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hDown & KEY_TOUCH) {
|
||||||
|
if (touching(touch, dropPos2[0])) {
|
||||||
|
if (Config::viewMode == 0) {
|
||||||
|
Config::viewMode = 1;
|
||||||
|
} else {
|
||||||
|
Config::viewMode = 0;
|
||||||
|
}
|
||||||
|
dropDownMenu = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((hDown & KEY_SELECT) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
|
||||||
|
dropSelection = 0;
|
||||||
|
dropDownMenu = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
|
||||||
Selection = 0;
|
Selection = 0;
|
||||||
refreshList();
|
refreshList();
|
||||||
@@ -855,6 +977,7 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
screenPosList = Selection - ENTRIES_PER_LIST + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
@@ -872,15 +995,6 @@ void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
|||||||
GitHubLogic(hDown, hHeld, touch);
|
GitHubLogic(hDown, hHeld, touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch ViewMode.
|
|
||||||
if (((mode != 0 || mode != 3) && (hDown & KEY_X)) || ((mode != 0 || mode != 3) && (hDown & KEY_TOUCH && touching(touch, arrowPos[3])))) {
|
|
||||||
if (Config::viewMode == 0) {
|
|
||||||
Config::viewMode = 1;
|
|
||||||
} else {
|
|
||||||
Config::viewMode = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hDown & KEY_LEFT || hDown & KEY_RIGHT) {
|
if (hDown & KEY_LEFT || hDown & KEY_RIGHT) {
|
||||||
if (mode == 6) {
|
if (mode == 6) {
|
||||||
mode = lastMode;
|
mode = lastMode;
|
||||||
|
|||||||
Reference in New Issue
Block a user