chore: add basis of the new choregraphy viewer

This commit is contained in:
Kazhnuz 2020-08-03 11:50:39 +02:00
parent 751951f734
commit 2509708067
4 changed files with 107 additions and 1 deletions

View file

@ -1,6 +1,7 @@
return {
menu = require "scenes.debug.menu",
viewers = {
battleBack = require "scenes.debug.viewers.battleBack"
battleBack = require "scenes.debug.viewers.battleBack",
choregraphy = require "scenes.debug.viewers.choregraphy"
}
}

View file

@ -32,6 +32,7 @@ function DebugMenu:buildBattleMenu()
self:addSubMenu("combat", "BaseMenu", "Battle System")
menu.commons.SceneWidget(self, "combat", scenes.cbs, "Launch Battle")
menu.commons.SceneWidget(self, "combat", scenes.debug.viewers.battleBack, "Background Viewer")
menu.commons.SceneWidget(self, "combat", scenes.debug.viewers.choregraphy, "Choregraphy Viewer")
menu.commons.SubMenuWidget(self, "combat", "BaseMenu", "Back")
end

View file

@ -0,0 +1,74 @@
local Scene = require "core.modules.scenes"
local menu = require "scenes.debug.viewers.choregraphy.menu"
local ChoregraphyViewer = Scene:extend()
local World = require "scenes.battlesystem.world"
function ChoregraphyViewer:new()
ChoregraphyViewer.super.new(self)
self.assets:batchImport("scenes.battlesystem.assets")
self.world = World(self)
self:buildMenu()
end
-- MENU FUNCTIONS
function ChoregraphyViewer:buildMenu()
menu.commons.DebugMenu(self, "MainMenu")
self:buildCharacterMenu()
self.menusystem:activate()
self.menusystem:switchMenu("MainMenu")
menu.commons.SceneWidget(self, "MainMenu", scenes.debug.menu, "Back")
end
function ChoregraphyViewer:buildCharacterMenu()
self:addSubMenu("characters", "MainMenu", "Characters")
for k, character in pairs(game.characters.list) do
self:addSubMenu(k, "characters", character.fullname)
menu.HeroChoregraphyWidget(self, k, game.skills:getSkillData("attack"))
self:buildSkillMenu(k)
menu.commons.SubMenuWidget(self, k, "characters", "Back")
end
menu.commons.SubMenuWidget(self, "characters", "MainMenu", "Back")
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 (game.skills:skillDataExists(skillName)) then
menu.HeroChoregraphyWidget(self, charName, game.skills:getSkillData(skillName))
end
end
end
end
function ChoregraphyViewer:addSubMenu(submenu, parent, name)
local parent = parent or "MainMenu"
menu.commons.DebugMenu(self, submenu)
menu.commons.SubMenuWidget(self, parent, submenu, name .. " >")
end
-- MOCKS FUNCTIONS
-- OTHER
function ChoregraphyViewer:update(dt)
end
function ChoregraphyViewer:setBackground(newBackground)
end
function ChoregraphyViewer:draw()
end
return ChoregraphyViewer

View file

@ -0,0 +1,30 @@
local commons = require "scenes.debug.commons.menu"
local menu = {}
menu.commons = commons
menu.ShowBackgroundWidget = menu.commons.DebugWidget:extend()
menu.HeroChoregraphyWidget = commons.DebugWidget:extend()
-- ShowBackground
function menu.ShowBackgroundWidget:new(scene, menuName, backgroundName, backgroundId)
menu.ShowBackgroundWidget.super.new(self, scene, menuName, backgroundName)
self.backgroundId = backgroundId
end
function menu.ShowBackgroundWidget:action()
self.scene:setBackground(self.backgroundId)
self.scene.menusystem:deactivate()
end
-- ShowBackground
function menu.HeroChoregraphyWidget:new(scene, charName, skillData)
menu.HeroChoregraphyWidget.super.new(self, scene, charName, skillData.name)
self.character = charName
self.skillData = skillData
end
function menu.HeroChoregraphyWidget:action()
self.scene.menusystem:deactivate()
end
return menu