From 9a828197e51193ab02392103d059883d81e69469 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 10 Mar 2019 13:41:37 +0100 Subject: [PATCH] game: load at start character module --- sonic-radiance.love/game/characters.lua | 8 ++++---- sonic-radiance.love/game/init.lua | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sonic-radiance.love/game/characters.lua b/sonic-radiance.love/game/characters.lua index ab60ef6..e1e0051 100644 --- a/sonic-radiance.love/game/characters.lua +++ b/sonic-radiance.love/game/characters.lua @@ -26,16 +26,16 @@ local CharacterManager = Object:extend() function CharacterManager:new(controller) self.controller = controller - self.namelist = require "datas.characters" + self.namelist = require "datas.gamedata.characters" self.list = {} - self.team = require "datas.characters.baseteam" + self.team = require "datas.gamedata.characters.baseteam" self.active = 1 self:init() end function CharacterManager:init() for k, v in pairs(self.namelist) do - local dir = "datas/characters/" .. v .. ".lua" + local dir = "datas/gamedata/characters/" .. v .. ".lua" local fileinfo = love.filesystem.getInfo(dir) if fileinfo ~= nil then self:initCharacter(v) @@ -45,7 +45,7 @@ end function CharacterManager:getCharacterData(charname) -- va eprmettre de récupérer les données d'un personnage - return require("datas.characters." .. charname) + return require("datas.gamedata.characters." .. charname) end function CharacterManager:initCharacter(id) diff --git a/sonic-radiance.love/game/init.lua b/sonic-radiance.love/game/init.lua index dce217c..91476ef 100644 --- a/sonic-radiance.love/game/init.lua +++ b/sonic-radiance.love/game/init.lua @@ -23,24 +23,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] -local Game = Object:extend() - +local Game = Object:extend() +local Characters = require "game.characters" local binser = require "libs.binser" function Game:new() self.slot = -1 self.gametime = 0 + + self.characters = Characters(self) end function Game:setData(data) local data = data - self.gametime = data.gametime + self.gametime = data.gametime + self.characters:setData(data.characters) end function Game:getData() local data = {} data.gametime = self.gametime + data.characters = self.characters:getData() return data end