Ajout des derniers développement #1

Merged
kazhnuz merged 68 commits from chronicles-cbs into master 2020-08-02 11:14:18 +02:00
5 changed files with 71 additions and 2 deletions
Showing only changes of commit cb5f9eec5a - Show all commits

View file

@ -13,7 +13,7 @@ CONST.MENU = {}
CONST.MENU.X = 16 CONST.MENU.X = 16
CONST.MENU.Y = 48 CONST.MENU.Y = 48
CONST.MENU.W = 424/2 CONST.MENU.W = 424/2
CONST.MENU.ITEM_NUMBER = 10 CONST.MENU.ITEM_NUMBER = 8
CONST.MENU.ITEM_HEIGHT = 18 CONST.MENU.ITEM_HEIGHT = 18
-- Basic menu structure -- Basic menu structure
@ -28,6 +28,13 @@ function menu.DebugMenu:drawCursor()
end end
function menu.DebugMenu:draw()
love.graphics.setColor(0, 0, 0, 0.5)
love.graphics.rectangle("fill", self.x, self.y, self.w, self.h)
utils.graphics.resetColor()
menu.DebugMenu.super.draw(self)
end
-- Widget -- Widget
function menu.DebugWidget:new(scene, menu_name, label) function menu.DebugWidget:new(scene, menu_name, label)
local font = scene.assets.fonts["small"] local font = scene.assets.fonts["small"]

View file

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

View file

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

View file

@ -0,0 +1,40 @@
local Scene = require "core.modules.scenes"
local menu = require "scenes.debug.viewers.battleBack.menu"
local BackgroundViewer = Scene:extend()
local Background = require "game.modules.drawing.parallaxBackground"
local backgroundList = require "datas.gamedata.maps.shoot.zones"
function BackgroundViewer:new()
BackgroundViewer.super.new(self)
self.assets:batchImport("scenes.debug.commons.assets")
menu.commons.DebugMenu(self, "MainMenu")
self:setBackground("city")
for backId, backgroundData in pairs(backgroundList) do
menu.ShowBackgroundWidget(self, "MainMenu", backgroundData.name, backId)
end
menu.commons.SceneWidget(self, "MainMenu", scenes.debug.menu, "Back")
self.menusystem:activate()
self.menusystem:switchMenu("MainMenu")
end
function BackgroundViewer:update(dt)
if (love.keyboard.isDown("z") and (not self.menusystem.isActive)) then
self.menusystem:activate()
end
end
function BackgroundViewer:setBackground(newBackground)
self.background = Background(self, 5, 1, newBackground)
end
function BackgroundViewer:draw()
self.background:draw()
end
return BackgroundViewer

View file

@ -0,0 +1,18 @@
local commons = require "scenes.debug.commons.menu"
local menu = {}
menu.commons = commons
menu.ShowBackgroundWidget = menu.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
return menu