game: load at start character module

This commit is contained in:
Kazhnuz 2019-03-10 13:41:37 +01:00
parent 824fcb866b
commit 9a828197e5
2 changed files with 11 additions and 7 deletions

View file

@ -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)

View file

@ -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