mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-22 18:56:00 +02:00
+ Introduction of WIP asset system - menus, prompts, art, etc. @type:location/asset
This commit is contained in:
parent
113e16df0d
commit
3336caeec9
6 changed files with 95 additions and 26 deletions
31
core/asset.js
Normal file
31
core/asset.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
exports.parseAsset = parseAsset;
|
||||
|
||||
var ALL_ASSETS = [
|
||||
'art',
|
||||
'menu',
|
||||
'method',
|
||||
'prompt',
|
||||
];
|
||||
|
||||
// \@(art|menu|method)\:([\w\.]*)(?:\/?([\w\d\_]+))*
|
||||
var ASSET_RE = new RegExp('\\@(' + ALL_ASSETS.join('|') + ')\\:([\\w\\.]*)(?:\\?/([\\w\\d\\_]+))*');
|
||||
|
||||
function parseAsset(s) {
|
||||
var m = ASSET_RE.exec(s);
|
||||
|
||||
if(m) {
|
||||
var result = { type : m[1] };
|
||||
|
||||
if(m[3]) {
|
||||
result.location = m[2];
|
||||
result.asset = m[3];
|
||||
} else {
|
||||
result.asset = m[2];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue