From 061d9de4e865006494f69689ce9269a927b7ed9d Mon Sep 17 00:00:00 2001 From: Insektaure <41437620+Insektaure@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:49:15 +0200 Subject: [PATCH] feat: add EffectsView + Egg Power Recipes --- Makefile | 2 +- source/models/powers/catchingPower.hpp | 42 ++++++++++++++++ source/models/powers/eggPower.hpp | 54 ++++++++++++++++++++ source/views/main-view.hpp | 7 ++- source/views/recipe-view.hpp | 1 - source/views/sv/catchingPower1-view.hpp | 66 +++++++++++++++++++++++++ source/views/sv/effects-view.hpp | 37 ++++++++++++++ 7 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 source/models/powers/catchingPower.hpp create mode 100644 source/models/powers/eggPower.hpp create mode 100644 source/views/sv/catchingPower1-view.hpp create mode 100644 source/views/sv/effects-view.hpp diff --git a/Makefile b/Makefile index a287d79..ce2bbd5 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ include $(DEVKITPRO)/libnx/switch_rules # NACP building is skipped as well. #--------------------------------------------------------------------------------- APP_TITLE := pkDwich -APP_VERSION := 1.0.1 +APP_VERSION := 1.0.2 TARGET := $(notdir $(CURDIR)) BUILD := build diff --git a/source/models/powers/catchingPower.hpp b/source/models/powers/catchingPower.hpp new file mode 100644 index 0000000..2326111 --- /dev/null +++ b/source/models/powers/catchingPower.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include "../recipe.hpp" + +Recipe CatchingPowerBug1 = { + { + {"Banana", 3}, + {"Chorizo", 2}, + {"Sweet Herba Mystica", 1}, + }, + { + {"Egg Power", "Normal", 3}, + {"Title Power: Normal", "Normal", 3}, + {"Item Drop Power: Electric", "Normal", 3} + } +}; + +Recipe CatchingPowerBug2 = { + { + {"Banana", 3}, + {"Chorizo", 2}, + {"Sweet Herba Mystica", 1}, + }, + { + {"Egg Power", "Normal", 3}, + {"Title Power: Normal", "Normal", 3}, + {"Item Drop Power: Electric", "Normal", 3} + } +}; + +Recipe CatchingPowerBug3 = { + { + {"Banana", 3}, + {"Chorizo", 2}, + {"Sweet Herba Mystica", 1}, + }, + { + {"Egg Power", "Normal", 3}, + {"Title Power: Normal", "Normal", 3}, + {"Item Drop Power: Electric", "Normal", 3} + } +}; diff --git a/source/models/powers/eggPower.hpp b/source/models/powers/eggPower.hpp new file mode 100644 index 0000000..05e8e93 --- /dev/null +++ b/source/models/powers/eggPower.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include "../recipe.hpp" + +Recipe EggPower1 = { + { + {"Banana", 1}, + {"Peanut Butter", 1}, + }, + { + {"Egg Power", "Normal", 1}, + {"Item Drop Power: Electric", "Normal", 1}, + {"Raid Power: Bug", "Normal", 1} + } +}; + +Recipe EggPower2 = { + { + {"Banana", 1}, + {"Peanut Butter", 1}, + {"Butter", 1}, + }, + { + {"Egg Power", "Normal", 2}, + {"Raid Power: Electric", "Normal", 1}, + {"Exp. Point Power: Normal", "Normal", 1} + } +}; + +Recipe EggPower3 = { + { + {"Banana", 3}, + {"Chorizo", 2}, + {"Sweet Herba Mystica", 1}, + }, + { + {"Egg Power", "Normal", 3}, + {"Title Power: Normal", "Normal", 3}, + {"Item Drop Power: Electric", "Normal", 3} + } +}; + +Recipe CatchingPower1 = { + { + {"Banana", 3}, + {"Chorizo", 2}, + {"Sweet Herba Mystica", 1}, + }, + { + {"Egg Power", "Normal", 3}, + {"Title Power: Normal", "Normal", 3}, + {"Item Drop Power: Electric", "Normal", 3} + } +}; diff --git a/source/views/main-view.hpp b/source/views/main-view.hpp index 30c774e..cabc96d 100644 --- a/source/views/main-view.hpp +++ b/source/views/main-view.hpp @@ -2,6 +2,7 @@ #include "./sv/monotypeSalty-view.hpp" #include "./sv/monotypeAlt-view.hpp" +#include "./sv/effects-view.hpp" #include class pkDwich : public tsl::Gui { @@ -10,7 +11,7 @@ class pkDwich : public tsl::Gui { virtual tsl::elm::Element* createUI() override { - auto frame = new tsl::elm::OverlayFrame("pkDwich", "v1.0.1"); + auto frame = new tsl::elm::OverlayFrame("pkDwich", "v1.0.2"); auto list = new tsl::elm::List(); list->addItem(new tsl::elm::CategoryHeader("Recipes")); @@ -18,6 +19,10 @@ class pkDwich : public tsl::Gui { list->addItem(new MonotypeViewButton()); list->addItem(new MonotypeAltViewButton()); + list->addItem(new tsl::elm::CategoryHeader("Effects")); + + list->addItem(new EffectsViewButton()); + frame->setContent(list); return frame; diff --git a/source/views/recipe-view.hpp b/source/views/recipe-view.hpp index 080aff5..f70277a 100644 --- a/source/views/recipe-view.hpp +++ b/source/views/recipe-view.hpp @@ -1,7 +1,6 @@ #pragma once #include "../components/button.hpp" -#include "../models/monotypeSalty.hpp" #include #include diff --git a/source/views/sv/catchingPower1-view.hpp b/source/views/sv/catchingPower1-view.hpp new file mode 100644 index 0000000..377b945 --- /dev/null +++ b/source/views/sv/catchingPower1-view.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include "../../components/button.hpp" +#include "../../models/powers/catchingPower.hpp" +#include "../recipe-view.hpp" +#include + +class CatchingPower1View : public tsl::Gui { + public: + CatchingPower1View(const std::string &power) : power(power) { } + + virtual tsl::elm::Element *createUI() override { + auto frame = new tsl::elm::OverlayFrame(power, "Lv.1"); + auto list = new tsl::elm::List(); + + list->addItem(new tsl::elm::CategoryHeader("Type")); + + list->addItem(new RecipeViewButton("Bug", "Bug", CatchingPowerBug1)); + /*list->addItem(new RecipeViewButton("Dark", "Dark", CatchingPowerDark1)); + list->addItem(new RecipeViewButton("Dragon", "Dragon", CatchingPowerDragon1)); + list->addItem(new RecipeViewButton("Electric", "Electric", CatchingPowerElectric1)); + list->addItem(new RecipeViewButton("Fairy", "Fairy", CatchingPowerFairy1)); + list->addItem(new RecipeViewButton("Fighting", "Fighting", CatchingPowerFighting1)); + list->addItem(new RecipeViewButton("Fire", "Fire", CatchingPowerFire1)); + list->addItem(new RecipeViewButton("Flying", "Flying", CatchingPowerFlying1)); + list->addItem(new RecipeViewButton("Ghost", "Ghost", CatchingPowerGhost1)); + list->addItem(new RecipeViewButton("Grass", "Grass", CatchingPowerGrass1)); + list->addItem(new RecipeViewButton("Ground", "Ground", CatchingPowerGround1)); + list->addItem(new RecipeViewButton("Ice", "Ice", CatchingPowerIce1)); + list->addItem(new RecipeViewButton("Normal", "Normal", CatchingPowerCatchingPowerNormal1)); + list->addItem(new RecipeViewButton("Psychic", "Psychic", CatchingPowerPsychic1)); + list->addItem(new RecipeViewButton("Rock", "Rock", CatchingPowerRock1)); + list->addItem(new RecipeViewButton("Steel", "Steel", CatchingPowerSteel1)); + list->addItem(new RecipeViewButton("Water", "Water", CatchingPowerWater1));*/ + + frame->setContent(list); + + return frame; + } + + private: + std::string power; + + /*Recipe generateRecipeName(const std::string& powerName, const std::string& type, int level) { + const std::string name = powerName + type + std::to_string(level); + + // populate the vector with the recipe + // based on the powerName, type, and level + + + + return name; + }*/ +}; + +class CatchingPower1Button : public Button { + public: + CatchingPower1Button(const std::string &power, const std::string &level) + : Button(level), power(power) { + this->onClick([this]() { tsl::changeTo(this->power); }); + } + + private: + std::string power; + std::string level; +}; \ No newline at end of file diff --git a/source/views/sv/effects-view.hpp b/source/views/sv/effects-view.hpp new file mode 100644 index 0000000..648b3b9 --- /dev/null +++ b/source/views/sv/effects-view.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "../../components/button.hpp" +#include "../../models/powers/eggPower.hpp" +#include "./catchingPower1-view.hpp" +#include "../recipe-view.hpp" +#include + +class EffectsView : public tsl::Gui { + public: + EffectsView() { } + + virtual tsl::elm::Element *createUI() override { + auto frame = new tsl::elm::OverlayFrame("Effects", "by Power"); + auto list = new tsl::elm::List(); + + list->addItem(new tsl::elm::CategoryHeader("Egg Power")); + list->addItem(new RecipeViewButton("Lv.1", "Egg Power Lv.1", EggPower1)); + list->addItem(new RecipeViewButton("Lv.2", "Egg Power Lv.2", EggPower2)); + list->addItem(new RecipeViewButton("Lv.3", "Egg Power Lv.3", EggPower3)); + + /*list->addItem(new tsl::elm::CategoryHeader("Catching Power")); + list->addItem(new CatchingPower1Button("Catching Power", "Lv.1")); + list->addItem(new CatchingPower2Button("Catching Power", "Lv.2")); + list->addItem(new CatchingPower3Button("Catching Power", "Lv.3"));*/ + + frame->setContent(list); + + return frame; + } + +}; + +class EffectsViewButton : public Button { + public: + EffectsViewButton() : Button("Effects") { this->onClick(tsl::changeTo); } +}; \ No newline at end of file