NanoUI assets are now sent to the client automatically.

* NanoUI now finds and sends it's assets to the client (css, images, javascript and templates).

Part of my effort to make creating NanoUIs as simple as possible. This removes the need to add new NanoUI assets (such as templates) to the client send_resources proc.

Conflicts:
	code/modules/client/client procs.dm
	code/modules/nano/nanomanager.dm
This commit is contained in:
Mark Aherne (Faerdan)
2014-01-12 15:30:25 +00:00
committed by ZomgPonies
parent b907f8f716
commit 06541aecc5
2 changed files with 38 additions and 33 deletions
+5 -31
View File
@@ -280,38 +280,12 @@
//send resources to the client. It's here in its own proc so we can move it around easiliy if need be
/client/proc/send_resources()
// preload_vox()
// preload_vox() //Causes long delays with initial start window and subsequent windows when first logged in.
// Send NanoUI resources to this client
nanomanager.send_resources(src)
getFiles(
'nano/js/libraries.min.js',
// 'nano/js/libraries/1-jquery.js',
// 'nano/js/libraries/2-jsrender.js',
// 'nano/js/libraries/3-jquery.timers.js',
'nano/js/nano_update.js',
'nano/js/nano_config.js',
'nano/js/nano_base_helpers.js',
'nano/css/shared.css',
'nano/css/icons.css',
'nano/templates/chem_dispenser.tmpl',
'nano/templates/apc.tmpl',
'nano/templates/cryo.tmpl',
'nano/templates/dna_modifier.tmpl',
'nano/templates/geoscanner.tmpl',
'nano/templates/air_alarm.tmpl',
'nano/templates/atmos_control.tmpl',
'nano/templates/firealarm.tmpl',
'nano/templates/vending.tmpl',
'nano/templates/pda.tmpl',
'nano/templates/smes.tmpl',
'nano/templates/uplink.tmpl',
'nano/images/uiBackground.png',
'nano/images/uiBackground-Syndicate.png',
'nano/images/uiIcons16.png',
'nano/images/uiIcons24.png',
'nano/images/uiLinkPendingIcon.gif',
'nano/images/uiMaskBackground.png',
'nano/images/uiNoticeBackground.jpg',
'nano/images/uiTitleFluff.png',
'nano/images/uiTitleFluff-Syndicate.png',
'html/search.js',
'html/panels.css',
'icons/pda_icons/pda_atmos.png',
+33 -2
View File
@@ -29,11 +29,11 @@
{
ui = get_open_ui(user, src_object, ui_key)
}
if (!isnull(ui))
if (!isnull(ui))
// The UI is already open so push the data to it
ui.push_data(data)
return ui
return null
/**
@@ -203,3 +203,34 @@
oldMob.open_uis.Cut()
return 1 // success
/**
* Sends all nano assets to the client
* This is called on user login
*
* @param client /client The user's client
*
* @return nothing
*/
#define NANO_CSS_PATH "nano/css/"
#define NANO_IMAGES_PATH "nano/images/"
#define NANO_JS_PATH "nano/js/"
#define NANO_TEMPLATES_PATH "nano/templates/"
/datum/nanomanager/proc/send_resources(client)
var/list/css = flist(NANO_CSS_PATH)
var/list/images = flist(NANO_IMAGES_PATH)
var/list/js = flist(NANO_JS_PATH)
var/list/templates = flist(NANO_TEMPLATES_PATH)
for(var/file in css)
client << browse_rsc(file(NANO_CSS_PATH + file))
for(var/file in images)
client << browse_rsc(file(NANO_IMAGES_PATH + file))
for(var/file in js)
client << browse_rsc(file(NANO_JS_PATH + file))
for(var/file in templates)
client << browse_rsc(file(NANO_TEMPLATES_PATH + file))
return 1 // success