sonic-radiance/sonic-radiance.love/scenes/debug/viewers/choregraphy/init.lua

103 lines
3 KiB
Lua

local Scene = require "birb.modules.scenes"
local menu = require "scenes.debug.viewers.choregraphy.menu"
local ChoregraphyViewer = Scene:extend()
local World = require "scenes.battlesystem.world"
local Fighter = require "scenes.debug.viewers.choregraphy.mocks.fighter"
function ChoregraphyViewer:new()
ChoregraphyViewer.super.new(self)
self.assets:batchImport("assets.commons")
self.assets:batchImport("assets.battle")
self.world = World(self)
self:buildMenu()
self:buildMocks()
end
-- MENU FUNCTIONS
function ChoregraphyViewer:buildMenu()
menu.commons.DebugMenu(self, "MainMenu")
self:buildCharacterMenu()
self.menusystem.menus["MainMenu"]:finalize()
self.menusystem:activate()
self.menusystem:switchMenu("MainMenu")
menu.commons.SceneWidget(self, "MainMenu", scenes.debug.menu, "Back")
end
function ChoregraphyViewer:buildCharacterMenu()
for i,category in ipairs(core.datas:getCategories("ennemies")) do
self:buildEnnemyListMenu(category)
end
self:addSubMenu("characters", "MainMenu", "Rivals")
for k, character in pairs(game.characters.list) do
self:addSubMenu(k, "characters", character.fullname)
menu.HeroChoregraphyWidget(self, k, core.datas:get("skills", "attack"))
self:buildSkillMenu(k)
end
end
function ChoregraphyViewer:buildEnnemyListMenu(category)
self:addSubMenu(category, "MainMenu", category)
for i,ennemy in ipairs(core.datas.getFromCategory("ennemies", category)) do
self:buildEnnemySkillMenu(category, ennemy)
end
end
function ChoregraphyViewer:buildEnnemySkillMenu(category, ennemy)
self:addSubMenu(ennemy, category, ennemy)
local data = core.datas:get("ennemies", ennemy)
for j,skillName in ipairs(data.skills) do
if (core.datas:exists("badskills", skillName)) then
menu.EnnemyChoregraphyWidget(self, category, ennemy, core.datas:get("badskills", skillName))
end
end
end
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
if (core.datas:exists("skills", skillName)) then
menu.HeroChoregraphyWidget(self, charName, core.datas:get("skills", skillName))
end
end
end
end
function ChoregraphyViewer:addSubMenu(submenu, parent, name)
local parent = parent or "MainMenu"
self.menusystem.menus[parent]:addSubMenu(submenu, name)
end
-- MOCKS FUNCTIONS
function ChoregraphyViewer:buildMocks()
self.fighter = Fighter(self)
end
function ChoregraphyViewer:playHeroChoregraphy(character, data)
self.fighter:playHeroChoregraphy(character, data)
end
function ChoregraphyViewer:playEnnemyChoregraphy(category, ennemy, data)
self.fighter:playEnnemyChoregraphy(category, ennemy, data)
end
-- OTHER
function ChoregraphyViewer:update(dt)
self.fighter:update(dt)
self.world:update(dt)
end
function ChoregraphyViewer:draw()
end
return ChoregraphyViewer