Update NanoUI to use the asset_cache system

Also move a bunch of folders around.
This commit is contained in:
Bjorn Neergaard
2015-11-28 00:56:30 -05:00
parent 404642b25b
commit 6005d54d40
40 changed files with 50 additions and 68 deletions
+36
View File
@@ -204,3 +204,39 @@ proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE)
for(var/path in typesof(/datum/html_interface))
var/datum/html_interface/hi = new path()
hi.registerResources()
/datum/asset/nanoui
var/list/common = list()
var/list/common_dirs = list(
"nano/styles/",
"nano/scripts/",
"nano/images/",
"nano/layouts/"
)
var/list/uncommon_dirs = list(
"nano/interfaces/"
)
/datum/asset/nanoui/register()
// Crawl the directories to find files.
for (var/path in common_dirs)
var/list/filenames = flist(path)
for(var/filename in filenames)
if(copytext(filename, length(filename)) != "/") // Ignore directories.
if(fexists(path + filename))
common[filename] = fcopy_rsc(path + filename)
register_asset(filename, common[filename])
for (var/path in uncommon_dirs)
var/list/filenames = flist(path)
for(var/filename in filenames)
if(copytext(filename, length(filename)) != "/") // Ignore directories.
if(fexists(path + filename))
register_asset(filename, fcopy_rsc(path + filename))
/datum/asset/nanoui/send(client, uncommon)
if(!islist(uncommon))
uncommon = list(uncommon)
send_asset_list(client, uncommon, FALSE)
send_asset_list(client, common, TRUE)
-4
View File
@@ -333,9 +333,5 @@ var/next_external_rsc = 0
'html/browser/playeroptions.css',
)
spawn (10)
//Send nanoui files to client
SSnano.send_resources(src)
//Precache the client with all other assets slowly, so as to not block other browse() calls
getFilesSlow(src, asset_cache, register_asset = FALSE)