feat: add asset access to widgets

This commit is contained in:
Kazhnuz 2020-12-05 09:23:46 +01:00
parent 93bbf56047
commit 49509001ab

View file

@ -27,6 +27,7 @@ local BaseWidget = Object:extend()
function BaseWidget:new(menuName) function BaseWidget:new(menuName)
self.menu = self:getMenuByName(menuName) self.menu = self:getMenuByName(menuName)
self.assets = self:getAssets()
self.destroyed = false self.destroyed = false
self.selectable = false self.selectable = false
@ -51,6 +52,11 @@ function BaseWidget:getGui()
return scene.menusystem return scene.menusystem
end end
function BaseWidget:getAssets()
local scene = core.scenemanager.currentScene
return scene.assets
end
function BaseWidget:register() function BaseWidget:register()
self.creationID = self.menu:getWidgetNumber() self.creationID = self.menu:getWidgetNumber()
self.menu:addWidget(self) self.menu:addWidget(self)