chore: delete the old radiance menus
This commit is contained in:
parent
f8a831d280
commit
1db72079bf
4 changed files with 0 additions and 299 deletions
|
@ -1,78 +0,0 @@
|
||||||
local List = require "game.modules.menus.list"
|
|
||||||
|
|
||||||
local fancy = {}
|
|
||||||
fancy.FancyMenu = List.ListMenu:extend()
|
|
||||||
fancy.BaseWidget = List.CenteredWidget:extend()
|
|
||||||
fancy.SubMenuWidget = fancy.BaseWidget:extend()
|
|
||||||
|
|
||||||
local MENU_ITEM_HEIGHT = 16
|
|
||||||
|
|
||||||
local gui = require "game.modules.gui"
|
|
||||||
|
|
||||||
function fancy.FancyMenu:new(scene, name, x, y, w, itemNumber, haveBiseau)
|
|
||||||
fancy.FancyMenu.super.new(self, scene, name, x, y, w, itemNumber, false)
|
|
||||||
self.haveBiseau = haveBiseau
|
|
||||||
end
|
|
||||||
|
|
||||||
function fancy.FancyMenu:getCursorPosition()
|
|
||||||
if (self.haveBiseau) then
|
|
||||||
local addition = MENU_ITEM_HEIGHT
|
|
||||||
local x = self.x + 4 + ((self.cursorTransition) * addition)/2
|
|
||||||
local y = self.y + ((self.cursorTransition) * addition)
|
|
||||||
return x, y
|
|
||||||
else
|
|
||||||
return fancy.FancyMenu.super.getCursorPosition(self)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function fancy.FancyMenu:getNextPosition(x, y, h)
|
|
||||||
if (self.haveBiseau) then
|
|
||||||
return (x + (h/2)), y+h
|
|
||||||
else
|
|
||||||
return fancy.FancyMenu.super.getNextPosition(self, x, y, h)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function fancy.FancyMenu:clone(name)
|
|
||||||
return fancy.FancyMenu(self.scene, name, self.x, self.y, self.w, self.itemNumber, self.haveBiseau)
|
|
||||||
end
|
|
||||||
|
|
||||||
function fancy.FancyMenu:addSubMenuWidget(newmenu, name)
|
|
||||||
fancy.SubMenuWidget(self.scene, self.name, newmenu, name)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- FancyWidgets
|
|
||||||
-- Add Fancy Widgets
|
|
||||||
function fancy.BaseWidget:new(scene, menu_name, label, label2)
|
|
||||||
self.label2 = label2
|
|
||||||
fancy.BaseWidget.super.new(self, scene, menu_name, label)
|
|
||||||
self.box = gui.newChoiceBack(self.menu.w + 24)
|
|
||||||
end
|
|
||||||
|
|
||||||
function fancy.BaseWidget:drawCanvas()
|
|
||||||
love.graphics.draw(self.box, 0, 0)
|
|
||||||
local h = math.floor(self.height / 2) - (self.font:getHeight() / 2) - 2
|
|
||||||
self.font:setColor(self.color[1], self.color[2], self.color[3], 1)
|
|
||||||
self.font:draw(self.label, 16, h, -1, "left")
|
|
||||||
self.font:draw(self.label2, self.width -8, h, -1, "right")
|
|
||||||
self.font:setColor(1, 1, 1, 1)
|
|
||||||
utils.graphics.resetColor()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Widget de sous-menu
|
|
||||||
function fancy.SubMenuWidget:new(scene, menu_name, newmenu, label)
|
|
||||||
local label2 = ""
|
|
||||||
if (label ~= "Back") then
|
|
||||||
label2 = ">"
|
|
||||||
end
|
|
||||||
fancy.SubMenuWidget.super.new(self, scene, menu_name, label, label2)
|
|
||||||
self.newmenu = newmenu
|
|
||||||
end
|
|
||||||
|
|
||||||
function fancy.SubMenuWidget:action()
|
|
||||||
self.scene.assets:playSFX("mBeep")
|
|
||||||
self.scene.menusystem:switchMenu(self.newmenu)
|
|
||||||
self.scene.menusystem.menus[self.newmenu]:activationAction()
|
|
||||||
end
|
|
||||||
|
|
||||||
return fancy
|
|
|
@ -1,172 +0,0 @@
|
||||||
local ParentMenu = require "game.modules.menus.parents.menu"
|
|
||||||
local Widget = require "birb.modules.menusystem.widgets"
|
|
||||||
|
|
||||||
local list = {}
|
|
||||||
list.ListMenu = ParentMenu:extend()
|
|
||||||
list.CenteredWidget = Widget.Text:extend()
|
|
||||||
list.DualTextWidget = list.CenteredWidget:extend()
|
|
||||||
list.SubMenuWidget = list.DualTextWidget:extend()
|
|
||||||
|
|
||||||
local MENU_ITEM_HEIGHT = 16
|
|
||||||
|
|
||||||
local gui = require "game.modules.gui"
|
|
||||||
|
|
||||||
-- ListMenu
|
|
||||||
function list.ListMenu:new(scene, name, x, y, w, itemNumber, isBoxed, smallborder)
|
|
||||||
self.scene = scene
|
|
||||||
self.name = name
|
|
||||||
local h = itemNumber * MENU_ITEM_HEIGHT
|
|
||||||
list.ListMenu.super.new(self, scene, name, x, y, w, h, itemNumber)
|
|
||||||
self.cursorTexture = love.graphics.newImage("assets/gui/cursor-menulist.png")
|
|
||||||
self.cursorTransition = 0
|
|
||||||
self.submenus = {}
|
|
||||||
self.itemNumber = itemNumber
|
|
||||||
self.smallborder = (smallborder == true)
|
|
||||||
|
|
||||||
self.isBoxed = isBoxed
|
|
||||||
if (self.isBoxed) then
|
|
||||||
local border = h+16
|
|
||||||
if (self.smallborder) then
|
|
||||||
border = h+8
|
|
||||||
end
|
|
||||||
self.box = gui.newTextBox("assets/gui/dialogbox.png", w, border)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:addSubMenu(name, nicerName)
|
|
||||||
local submenu = self:clone(name)
|
|
||||||
self:addSubMenuWidget(name, nicerName)
|
|
||||||
table.insert(self.submenus, name)
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:addSubMenuWidget(newmenu, name)
|
|
||||||
list.SubMenuWidget(self.scene, self.name, newmenu, name)
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:finalize(parent)
|
|
||||||
if (parent ~= "" and parent ~= nil) then
|
|
||||||
self:addSubMenuWidget(parent, "Back")
|
|
||||||
self:setCancelWidget()
|
|
||||||
end
|
|
||||||
|
|
||||||
for i,name in ipairs(self.submenus) do
|
|
||||||
if (self.menusystem.menus[name] ~= nil) then
|
|
||||||
self.menusystem.menus[name]:finalize(self.name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:clone(name)
|
|
||||||
return list.ListMenu(self.scene, name, self.x, self.y, self.w, self.itemNumber, self.isBoxed)
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:update(dt)
|
|
||||||
list.ListMenu.super.update(self, dt)
|
|
||||||
self:updateCursorPosition(dt)
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:updateCursorPosition(dt)
|
|
||||||
local relativecursor = self.widget.selected - self.view.firstSlot
|
|
||||||
|
|
||||||
local transition = self.cursorTransition - relativecursor
|
|
||||||
if math.abs(transition) < 0.1 then
|
|
||||||
self.cursorTransition = relativecursor
|
|
||||||
else
|
|
||||||
local speed = dt*45
|
|
||||||
local movement = ((relativecursor) - (self.cursorTransition))
|
|
||||||
self.cursorTransition = (self.cursorTransition) + movement * speed
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:drawCursor()
|
|
||||||
local x, y = self:getCursorPosition()
|
|
||||||
love.graphics.draw(self.cursorTexture, x, y)
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:getCursorPosition()
|
|
||||||
local addition = MENU_ITEM_HEIGHT
|
|
||||||
local x = self.x + 6
|
|
||||||
local y = self.y + ((self.cursorTransition) * addition) + 1
|
|
||||||
return x, y
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:draw()
|
|
||||||
if (self.isBoxed) then
|
|
||||||
local dy = 8
|
|
||||||
if (self.smallborder) then
|
|
||||||
dy = 4
|
|
||||||
end
|
|
||||||
love.graphics.draw(self.box, self.x, self.y - dy)
|
|
||||||
end
|
|
||||||
self:updateView()
|
|
||||||
local widgety = self.y
|
|
||||||
local widgetx = self.x
|
|
||||||
for i,v in ipairs(self.widget.list) do
|
|
||||||
if (i >= self.view.firstSlot) and (i < self.view.firstSlot + self.view.slotNumber) then
|
|
||||||
v:draw(widgetx, widgety, self.w, self.widget.h)
|
|
||||||
if self.widget.selected == i and self:haveFocus() == true then
|
|
||||||
v:drawSelected(widgetx, widgety, self.w, self.widget.h)
|
|
||||||
else
|
|
||||||
v:draw(widgetx, widgety, self.w, self.widget.h)
|
|
||||||
end
|
|
||||||
widgetx, widgety = self:getNextPosition(widgetx, widgety, self.widget.h)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.ListMenu:getNextPosition(x, y, h)
|
|
||||||
return x, y+h
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Widgets
|
|
||||||
-- Tout les widgets pour la liste de base
|
|
||||||
|
|
||||||
-- Widget centré
|
|
||||||
function list.CenteredWidget:new(scene, menu_name, label)
|
|
||||||
local font = scene.assets.fonts["small"]
|
|
||||||
font:setFilter("shadow")
|
|
||||||
self.scene = scene
|
|
||||||
local widgetMenu = scene.menusystem.menus[menu_name]
|
|
||||||
list.CenteredWidget.super.new(self, widgetMenu, font, label)
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.CenteredWidget:drawCanvas()
|
|
||||||
local h = math.floor(self.height / 2) - (self.font:getHeight() / 2) - 2
|
|
||||||
self.font:setColor(self.color[1], self.color[2], self.color[3], 1)
|
|
||||||
self.font:draw(self.label, self.width / 2, h, -1, "center")
|
|
||||||
self.font:setColor(1, 1, 1, 1)
|
|
||||||
utils.graphics.resetColor()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Widget avec deux bouts de textes
|
|
||||||
function list.DualTextWidget:new(scene, menu_name, label, label2)
|
|
||||||
self.label2 = label2
|
|
||||||
list.DualTextWidget.super.new(self, scene, menu_name, label)
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.DualTextWidget:drawCanvas()
|
|
||||||
local h = math.floor(self.height / 2) - (self.font:getHeight() / 2)
|
|
||||||
self.font:setColor(self.color[1], self.color[2], self.color[3], 1)
|
|
||||||
self.font:draw(self.label, 16, h, -1, "left")
|
|
||||||
self.font:draw(self.label2, self.width - 8, h, -1, "right")
|
|
||||||
self.font:setColor(1, 1, 1, 1)
|
|
||||||
utils.graphics.resetColor()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Widget de sous-menu
|
|
||||||
function list.SubMenuWidget:new(scene, menu_name, newmenu, label)
|
|
||||||
local label2 = ""
|
|
||||||
if (label ~= "Back") then
|
|
||||||
label2 = ">"
|
|
||||||
end
|
|
||||||
list.SubMenuWidget.super.new(self, scene, menu_name, label, label2)
|
|
||||||
self.newmenu = newmenu
|
|
||||||
end
|
|
||||||
|
|
||||||
function list.SubMenuWidget:action()
|
|
||||||
self.scene.assets:playSFX("mBeep")
|
|
||||||
self.scene.menusystem:switchMenu(self.newmenu)
|
|
||||||
self.scene.menusystem.menus[self.newmenu]:activationAction()
|
|
||||||
end
|
|
||||||
|
|
||||||
return list
|
|
|
@ -1,36 +0,0 @@
|
||||||
local ListBox = require "birb.modules.menusystem.listbox"
|
|
||||||
local TweenManager = require "birb.classes.time"
|
|
||||||
|
|
||||||
local RadianceMenu = ListBox:extend()
|
|
||||||
|
|
||||||
function RadianceMenu:new(scene, name, x, y, w, h, itemNumber)
|
|
||||||
self.scene = scene
|
|
||||||
self.tweens = TweenManager(self)
|
|
||||||
RadianceMenu.super.new(self, self.scene.menusystem, name, x, y, w, h, itemNumber)
|
|
||||||
end
|
|
||||||
|
|
||||||
function RadianceMenu:update(dt)
|
|
||||||
self.tweens:update(dt)
|
|
||||||
RadianceMenu.super.update(self, dt)
|
|
||||||
end
|
|
||||||
|
|
||||||
function RadianceMenu:moveFrom(x, y)
|
|
||||||
local newX, newY = self.x, self.y
|
|
||||||
self.x, self.y = x, y
|
|
||||||
|
|
||||||
self.tweens:addTween(0, 0.3, {x = newX, y = newY}, "inOutQuad")
|
|
||||||
end
|
|
||||||
|
|
||||||
function RadianceMenu:moveTo(newX, newY)
|
|
||||||
self.tweens:addTween(0, 0.3, {x = newX, y = newY}, "inOutQuad")
|
|
||||||
end
|
|
||||||
|
|
||||||
function RadianceMenu:getCenter()
|
|
||||||
return self.x + self.width, self.y + self.height
|
|
||||||
end
|
|
||||||
|
|
||||||
function RadianceMenu:activationAction()
|
|
||||||
-- Do nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
return RadianceMenu
|
|
|
@ -1,13 +0,0 @@
|
||||||
local Widget = require "birb.modules.menusystem.widgets"
|
|
||||||
local RadianceWidget = Widget.Text:extend()
|
|
||||||
|
|
||||||
function RadianceWidget:new(scene, name, label, color)
|
|
||||||
self.scene = scene
|
|
||||||
local label = label or ""
|
|
||||||
local font = scene.assets.fonts["small"]
|
|
||||||
font:setFilter("shadow")
|
|
||||||
local widgetMenu = scene.menusystem.menus[name]
|
|
||||||
RadianceWidget.super.new(self, widgetMenu, font, label, color)
|
|
||||||
end
|
|
||||||
|
|
||||||
return RadianceWidget
|
|
Loading…
Reference in a new issue