2021-05-05 08:30:32 +02:00
|
|
|
local Scene = require "birb.modules.scenes"
|
2021-08-15 16:26:05 +02:00
|
|
|
local menu = require "scenes.menus.debugmenus.choregraphy.menu"
|
2020-08-03 11:50:39 +02:00
|
|
|
|
|
|
|
local ChoregraphyViewer = Scene:extend()
|
|
|
|
|
|
|
|
local World = require "scenes.battlesystem.world"
|
2021-08-15 16:26:05 +02:00
|
|
|
local Fighter = require "scenes.menus.debugmenus.choregraphy.mocks.fighter"
|
2020-08-03 11:50:39 +02:00
|
|
|
|
|
|
|
function ChoregraphyViewer:new()
|
|
|
|
ChoregraphyViewer.super.new(self)
|
2021-08-15 16:13:20 +02:00
|
|
|
self.assets:batchImport("assets.commons")
|
|
|
|
self.assets:batchImport("assets.battle")
|
2020-08-03 11:50:39 +02:00
|
|
|
self.world = World(self)
|
|
|
|
|
|
|
|
self:buildMenu()
|
2020-08-03 17:59:44 +02:00
|
|
|
self:buildMocks()
|
2020-08-03 11:50:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- MENU FUNCTIONS
|
|
|
|
function ChoregraphyViewer:buildMenu()
|
|
|
|
menu.commons.DebugMenu(self, "MainMenu")
|
|
|
|
|
|
|
|
self:buildCharacterMenu()
|
|
|
|
|
2020-08-19 20:44:38 +02:00
|
|
|
self.menusystem.menus["MainMenu"]:finalize()
|
2020-08-03 11:50:39 +02:00
|
|
|
self.menusystem:activate()
|
|
|
|
self.menusystem:switchMenu("MainMenu")
|
2021-08-15 16:26:05 +02:00
|
|
|
menu.commons.SceneWidget(self, "MainMenu", scenes.menus.main, "Back")
|
2020-08-03 11:50:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function ChoregraphyViewer:buildCharacterMenu()
|
2021-05-15 21:43:15 +02:00
|
|
|
for i,category in ipairs(core.datas:getCategories("ennemies")) do
|
2020-08-04 17:50:03 +02:00
|
|
|
self:buildEnnemyListMenu(category)
|
|
|
|
end
|
|
|
|
|
2020-08-04 12:27:33 +02:00
|
|
|
self:addSubMenu("characters", "MainMenu", "Rivals")
|
2020-08-03 11:50:39 +02:00
|
|
|
for k, character in pairs(game.characters.list) do
|
|
|
|
self:addSubMenu(k, "characters", character.fullname)
|
2021-05-16 08:48:05 +02:00
|
|
|
menu.HeroChoregraphyWidget(self, k, core.datas:get("skills", "attack"))
|
2020-08-03 11:50:39 +02:00
|
|
|
self:buildSkillMenu(k)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-04 17:50:03 +02:00
|
|
|
function ChoregraphyViewer:buildEnnemyListMenu(category)
|
|
|
|
self:addSubMenu(category, "MainMenu", category)
|
2021-05-15 21:43:15 +02:00
|
|
|
for i,ennemy in ipairs(core.datas.getFromCategory("ennemies", category)) do
|
2020-08-04 23:21:45 +02:00
|
|
|
self:buildEnnemySkillMenu(category, ennemy)
|
2020-08-04 17:50:03 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-04 23:21:45 +02:00
|
|
|
function ChoregraphyViewer:buildEnnemySkillMenu(category, ennemy)
|
|
|
|
self:addSubMenu(ennemy, category, ennemy)
|
2021-05-15 21:43:15 +02:00
|
|
|
local data = core.datas:get("ennemies", ennemy)
|
2020-08-04 23:21:45 +02:00
|
|
|
for j,skillName in ipairs(data.skills) do
|
2021-05-16 08:48:05 +02:00
|
|
|
if (core.datas:exists("badskills", skillName)) then
|
|
|
|
menu.EnnemyChoregraphyWidget(self, category, ennemy, core.datas:get("badskills", skillName))
|
2020-08-04 23:21:45 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-03 11:50:39 +02:00
|
|
|
function ChoregraphyViewer:buildSkillMenu(charName)
|
|
|
|
local skillList = require("datas.gamedata.characters." .. charName .. ".skills")
|
|
|
|
local skillTreated = {}
|
|
|
|
for i,skill in ipairs(skillList) do
|
|
|
|
local skillName = skill[1]
|
|
|
|
if (skillTreated[skillName] ~= true) then
|
|
|
|
skillTreated[skillName] = true
|
2021-05-16 08:48:05 +02:00
|
|
|
if (core.datas:exists("skills", skillName)) then
|
|
|
|
menu.HeroChoregraphyWidget(self, charName, core.datas:get("skills", skillName))
|
2020-08-03 11:50:39 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ChoregraphyViewer:addSubMenu(submenu, parent, name)
|
|
|
|
local parent = parent or "MainMenu"
|
2020-08-19 20:44:38 +02:00
|
|
|
self.menusystem.menus[parent]:addSubMenu(submenu, name)
|
2020-08-03 11:50:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- MOCKS FUNCTIONS
|
2020-08-03 17:59:44 +02:00
|
|
|
function ChoregraphyViewer:buildMocks()
|
|
|
|
self.fighter = Fighter(self)
|
2020-08-03 11:50:39 +02:00
|
|
|
end
|
|
|
|
|
2020-08-03 17:59:44 +02:00
|
|
|
function ChoregraphyViewer:playHeroChoregraphy(character, data)
|
|
|
|
self.fighter:playHeroChoregraphy(character, data)
|
|
|
|
end
|
2020-08-03 11:50:39 +02:00
|
|
|
|
2020-08-04 23:21:45 +02:00
|
|
|
function ChoregraphyViewer:playEnnemyChoregraphy(category, ennemy, data)
|
|
|
|
self.fighter:playEnnemyChoregraphy(category, ennemy, data)
|
|
|
|
end
|
|
|
|
|
2020-08-03 17:59:44 +02:00
|
|
|
-- OTHER
|
|
|
|
function ChoregraphyViewer:update(dt)
|
|
|
|
self.fighter:update(dt)
|
|
|
|
self.world:update(dt)
|
2020-08-03 11:50:39 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function ChoregraphyViewer:draw()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return ChoregraphyViewer
|