modComputing.smartphone = { maxCol = 2, maxRow = 3, offSetX = 1.00, offSetY = 2.25, marginConteinerX = 0.50, marginConteinerY = 0.25, sizeButtonX = 1.50, sizeButtonY = 1.50, } modComputing.getTextClockBar = function() --return modComputing.getTextNowWeekDay3S()..", "..modComputing.getTextNowDate().." "..modComputing.getTextNowTime() return modComputing.translate( "@1, @2 @3", modComputing.getTextNowWeekDay3S(), modComputing.getTextNowDate(), modComputing.getTextNowTime() ) end 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]" .."no_prepend[]" .."bgcolor[#08080844;true]" --PadrĂ£o: #080808BB | true = 100% transparente .."style_type[image_button;font=normal;font_size=11;textcolor=#FFFFFF]" .."style_type[image_button_exit;font=normal;font_size=11;textcolor=#FFFFFF]" --.."background[-0.75,-2.00;"..(10*271/484)..",10.0;text_smartphone_271x484.png;true]" .."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")).."]" if type(modComputing.show_page)~="table" then modComputing.show_page = { } end if type(modComputing.show_page[playername])~="number" or modComputing.show_page[playername] < 0 then modComputing.show_page[playername] = 0 end local appsCount = 0 local appnames = modComputing.get_appnames() local maxCol = modComputing.smartphone.maxCol local maxRow = modComputing.smartphone.maxRow local offSetX = modComputing.smartphone.offSetX local offSetY = modComputing.smartphone.offSetY local marginConteinerX = modComputing.smartphone.marginConteinerX local marginConteinerY = modComputing.smartphone.marginConteinerY local sizeButtonX = modComputing.smartphone.sizeButtonX local sizeButtonY = modComputing.smartphone.sizeButtonY for k,v in pairs(appnames) do 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 --modComputing.debug("apps = "..dump(apps) --[[, playername--]]) --modComputing.debug("is_visible = "..dump(is_visible) --[[, playername--]]) if (type(is_visible)=="boolean" and is_visible == true) or (type(is_visible)=="function" and is_visible(player)) then appsCount = appsCount + 1 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[,;,;;;