diff --git a/item_smartphone.lua b/item_smartphone.lua index b86b673..67ffedf 100644 --- a/item_smartphone.lua +++ b/item_smartphone.lua @@ -19,8 +19,14 @@ modComputing.getTextClockBar = function() ) end -modComputing.getFormSmartphone = function(player) - local playername = player:get_player_name() +modComputing.smartphone.getFormSpec = function(player) + local formspec = "" + ..modComputing.smartphone.getFormBackground() + ..modComputing.smartphone.getAppListConteiner(player) + return formspec +end + +modComputing.smartphone.getFormBackground = function() local formspec = "" .."formspec_version[6]" .."size["..(10*271/484)..",10.0,true]" @@ -32,6 +38,11 @@ modComputing.getFormSmartphone = function(player) .."image[0,0;"..(10*271/484)..",10.0;text_smartphone_271x484.png;true]" .."style_type[label;font=mono;font_size=10;textcolor=#FFFFFF]" .."label[0.75,1.975;"..core.formspec_escape(modComputing.getTextClockBar()).."]" + return formspec +end +modComputing.smartphone.getAppListConteiner = function(player) + local playername = player:get_player_name() + local formspec = "" .."style_type[container;font=normal;font_size=7;textcolor=#FFFFFF]" --.."button_exit[0.75,2.50;1.5,1.5;btnClose;"..core.formspec_escape(modComputing.translate("Banana\nStore")).."]" @@ -56,61 +67,66 @@ modComputing.getFormSmartphone = function(player) local sizeButtonY = modComputing.smartphone.sizeButtonY for k,v in pairs(appnames) do - appsCount = appsCount + 1 - local apps = modComputing.get_apps() - --modComputing.debug("apps = "..dump(apps) --[[, playername--]]) + local apps = modComputing.get_apps() local icon_name = apps[v].icon_name local icon_title = apps[v].icon_title local icon_descryption = apps[v].icon_descryption local icon_type = apps[v].icon_type local icon_image = apps[v].icon_image local on_iconclick = apps[v].on_iconclick + local is_visible = apps[v].is_visible or true - local page = math.floor((appsCount - 1) / (maxRow * maxCol)) --math.floor : arredonda sempre para menos - if page == modComputing.show_page[playername] then - local iconInPage = appsCount - math.floor(page * maxRow * maxCol) - local iconRow = math.floor((iconInPage - 1) / maxCol) - local iconCol = (iconInPage - 1) % maxCol - - --SAMPLE: image_button[,;,;;;