From eec62143058163bd99133aa6748e9f6918316e61 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Wed, 14 Aug 2019 17:07:42 +0200 Subject: [PATCH] improvement(cbs): translate battle system menu --- .../datas/languages/en/battle.lua | 12 +++ .../datas/languages/en/skills.lua | 11 +++ .../datas/languages/fr/battle.lua | 12 +++ .../datas/languages/fr/skills.lua | 11 +++ .../scenes/battlesystem/menu.lua | 73 ++++++++++++++----- 5 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 sonic-radiance.love/datas/languages/en/battle.lua create mode 100644 sonic-radiance.love/datas/languages/en/skills.lua create mode 100644 sonic-radiance.love/datas/languages/fr/battle.lua create mode 100644 sonic-radiance.love/datas/languages/fr/skills.lua diff --git a/sonic-radiance.love/datas/languages/en/battle.lua b/sonic-radiance.love/datas/languages/en/battle.lua new file mode 100644 index 0000000..a077855 --- /dev/null +++ b/sonic-radiance.love/datas/languages/en/battle.lua @@ -0,0 +1,12 @@ +return { + ['attack'] = "Attack", + ['skills'] = "Skills", + ['objects'] = "Objects", + ['defend'] = "Defends", + ['flee'] = "Flee", + ['back'] = "Back", + ['heal'] = "Healing", + ['rings'] = "Rings", + ['wisps'] = "Wisps", + ['other'] = "Other", +} diff --git a/sonic-radiance.love/datas/languages/en/skills.lua b/sonic-radiance.love/datas/languages/en/skills.lua new file mode 100644 index 0000000..588bdda --- /dev/null +++ b/sonic-radiance.love/datas/languages/en/skills.lua @@ -0,0 +1,11 @@ +return { + ['spinattack'] = "Spin Attack", + ['spinjump'] = "Spin Jump", + ['spindash'] = "Spin Dash", + ['hommingattack'] = "Homming Attack", + ['sonicflare'] = "Sonic Flare", + ['bluetornado'] = "Blue Tornado", + ['soniccracker'] = "Sonic Cracker", + ['boost'] = "Boost", + ['lightspeedattack'] = "L. Speed Atk", +} diff --git a/sonic-radiance.love/datas/languages/fr/battle.lua b/sonic-radiance.love/datas/languages/fr/battle.lua new file mode 100644 index 0000000..9ba0722 --- /dev/null +++ b/sonic-radiance.love/datas/languages/fr/battle.lua @@ -0,0 +1,12 @@ +return { + ['attack'] = "Attaquer", + ['skills'] = "Techniques", + ['objects'] = "Objets", + ['defend'] = "Défendre", + ['flee'] = "Fuite", + ['back'] = "Retour", + ['heal'] = "Médecines", + ['rings'] = "Anneaux", + ['wisps'] = "Wisps", + ['other'] = "Autres", +} diff --git a/sonic-radiance.love/datas/languages/fr/skills.lua b/sonic-radiance.love/datas/languages/fr/skills.lua new file mode 100644 index 0000000..067d1a8 --- /dev/null +++ b/sonic-radiance.love/datas/languages/fr/skills.lua @@ -0,0 +1,11 @@ +return { + ['spinattack'] = "Atk Tourbillon", + ['spinjump'] = "Saut Tourbillon", + ['spindash'] = "Charge Tourbillon", + ['hommingattack'] = "Atk Téléguidée", + ['sonicflare'] = "Sonic Flare", + ['bluetornado'] = "Tornade Bleu", + ['soniccracker'] = "Sonic Cracker", + ['boost'] = "Boost", + ['lightspeedattack'] = "L. Speed Atk", +} diff --git a/sonic-radiance.love/scenes/battlesystem/menu.lua b/sonic-radiance.love/scenes/battlesystem/menu.lua index 1f889e0..a80eb8d 100644 --- a/sonic-radiance.love/scenes/battlesystem/menu.lua +++ b/sonic-radiance.love/scenes/battlesystem/menu.lua @@ -7,6 +7,7 @@ local CharacterMenu = ListBox:extend() local CharMenuWidget = Widget.Text:extend() local SubMenuWidget = CharMenuWidget:extend() local BackMenuWidget = CharMenuWidget:extend() +local SkillWidget = Widget.Text:extend() local MENUPOS_X1, MENUPOS_X2, MENUPOS_Y = 32, 32, 110 local MENU_WIDTH, MENU_ITEM_HEIGHT = 112, 17 @@ -31,12 +32,12 @@ end function MenuConstructor:buildBaseMenu(character) CharacterMenu(self.controller, "BaseMenu", MENUPOS_X1 - 16, MENUPOS_Y) - CharMenuWidget(self.controller, "BaseMenu", "Attaquer", "", character) - SubMenuWidget(self.controller, "BaseMenu", "Techniques", "SkillMenu", character) - SubMenuWidget(self.controller, "BaseMenu", "Objets", "ObjectMenu", character) - CharMenuWidget(self.controller, "BaseMenu", "Défendre", "", character) - CharMenuWidget(self.controller, "BaseMenu", "Fuite", "", character) - BackMenuWidget(self.controller, "BaseMenu", "Retour", character) + CharMenuWidget(self.controller, "BaseMenu", "attack", "", character) + SubMenuWidget(self.controller, "BaseMenu", "skills", "SkillMenu", character) + SubMenuWidget(self.controller, "BaseMenu", "objects", "ObjectMenu", character) + CharMenuWidget(self.controller, "BaseMenu", "defend", "", character) + CharMenuWidget(self.controller, "BaseMenu", "flee", "", character) + BackMenuWidget(self.controller, "BaseMenu", "back", character) self.controller.menusystem.menus["BaseMenu"]:setCancelWidget() end @@ -49,9 +50,9 @@ function MenuConstructor:buildSkillMenu(character) CharacterMenu(self.controller, "SkillMenu", MENUPOS_X1 - 16, MENUPOS_Y) local list = game.characters:getSkillList(character.charid) for k,v in pairs(list) do - CharMenuWidget(self.controller, "SkillMenu", k, "", character) + SkillWidget(self.controller, "SkillMenu", k, "", character) end - SubMenuWidget(self.controller, "SkillMenu", "Retour", "BaseMenu", character) + SubMenuWidget(self.controller, "SkillMenu", "back", "BaseMenu", character) self.controller.menusystem.menus["SkillMenu"]:setCancelWidget() end @@ -65,16 +66,16 @@ function MenuConstructor:buildObjectMenu(character) CharacterMenu(self.controller, "OtherMenu", MENUPOS_X1 - 16, MENUPOS_Y) - SubMenuWidget(self.controller, "ObjectMenu", "Médecine", "MedMenu", character) - SubMenuWidget(self.controller, "ObjectMenu", "Rings", "RingMenu", character) - SubMenuWidget(self.controller, "ObjectMenu", "Wisps", "WispMenu", character) - SubMenuWidget(self.controller, "ObjectMenu", "Autres", "OtherMenu", character) + SubMenuWidget(self.controller, "ObjectMenu", "heal", "MedMenu", character) + SubMenuWidget(self.controller, "ObjectMenu", "rings", "RingMenu", character) + SubMenuWidget(self.controller, "ObjectMenu", "wisps", "WispMenu", character) + SubMenuWidget(self.controller, "ObjectMenu", "other", "OtherMenu", character) - SubMenuWidget(self.controller, "ObjectMenu", "Retour", "BaseMenu", character) - SubMenuWidget(self.controller, "MedMenu", "Retour", "ObjectMenu", character) - SubMenuWidget(self.controller, "RingMenu", "Retour", "ObjectMenu", character) - SubMenuWidget(self.controller, "WispMenu", "Retour", "ObjectMenu", character) - SubMenuWidget(self.controller, "OtherMenu", "Retour", "ObjectMenu", character) + SubMenuWidget(self.controller, "ObjectMenu", "back", "BaseMenu", character) + SubMenuWidget(self.controller, "MedMenu", "back", "ObjectMenu", character) + SubMenuWidget(self.controller, "RingMenu", "back", "ObjectMenu", character) + SubMenuWidget(self.controller, "WispMenu", "back", "ObjectMenu", character) + SubMenuWidget(self.controller, "OtherMenu", "back", "ObjectMenu", character) self.controller.menusystem.menus["ObjectMenu"]:setCancelWidget() @@ -128,9 +129,11 @@ function CharMenuWidget:new(scene, menu_name, label1, label2, character) self.character = character self.menuname = menu_name self.scene = scene + self.actionType = label1 + local menu = scene.menusystem.menus[menu_name] or error("menu " ..menu_name .. " doesn't exist") local font = scene.assets.fonts["small"] - CharMenuWidget.super.new(self, menu, font, label1) + CharMenuWidget.super.new(self, menu, font, core.lang:translate("battle", label1)) self.label2 = label2 or "" end @@ -167,7 +170,7 @@ end -- Back Widget function BackMenuWidget:new(scene, menu_name, label, character) - BackMenuWidget.super.new(self, scene, menu_name, "Retour", "", character) + BackMenuWidget.super.new(self, scene, menu_name, "back", "", character) end function BackMenuWidget:action() @@ -176,5 +179,37 @@ function BackMenuWidget:action() self.scene.menusystem:reset() end +-- Skill Widget + +function SkillWidget:new(scene, menu_name, label1, label2, character) + self.character = character + self.menuname = menu_name + self.scene = scene + self.actionType = label1 + + local menu = scene.menusystem.menus[menu_name] or error("menu " ..menu_name .. " doesn't exist") + local font = scene.assets.fonts["small"] + CharMenuWidget.super.new(self, menu, font, core.lang:translate("skills", label1)) + self.label2 = label2 or "" +end + +function SkillWidget:drawCanvas() + local h + local asset = love.graphics.newImage("assets/gui/attacklist.png") + love.graphics.draw(asset, 0, (self.height - 13) / 2) + h = math.floor(self.height / 2) - (self.font:getHeight() / 2) + love.graphics.setColor(0, 0, 0, .8) + self.font:print(self.label, 17, h, "left") + self.font:print(self.label2, self.width - 8, h, "right") + utils.graphics.resetColor() + self.font:print(self.label, 16, h, "left") + self.font:print(self.label2, self.width - 9, h, "right") +end + +function SkillWidget:action() + self.character:getSignal(self.menuname, self.label) + self.scene:flushKeys() + self.scene.menusystem:reset() +end return MenuConstructor