mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-08 13:44:39 +02:00
* WIP Menu system vs raw module access
This commit is contained in:
parent
f7462bbbdd
commit
efcc8756ba
8 changed files with 153 additions and 32 deletions
|
@ -1,20 +1,53 @@
|
|||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
var PluginModule = require('./plugin_module.js').PluginModule;
|
||||
var PluginModule = require('./plugin_module.js').PluginModule;
|
||||
var theme = require('./theme.js');
|
||||
|
||||
var async = require('async');
|
||||
var assert = require('assert');
|
||||
|
||||
exports.MenuModule = MenuModule;
|
||||
|
||||
function MenuModule() {
|
||||
function MenuModule(menuConfig) {
|
||||
PluginModule.call(this);
|
||||
|
||||
this.viewControllers = [];
|
||||
var self = this;
|
||||
this.menuConfig = menuConfig;
|
||||
|
||||
this.viewControllers = [];
|
||||
|
||||
this.loadArt = function() {
|
||||
async.waterfall(
|
||||
[
|
||||
function displayArt(callback) {
|
||||
console.log(self.menuConfig)
|
||||
theme.displayThemeArt(self.menuConfig.art, self.client, function onArt(err, mciMap) {
|
||||
callback(err, mciMap);
|
||||
});
|
||||
},
|
||||
function artDisplayed(mciMap, callback) {
|
||||
if(!mciMap) {
|
||||
callback(null);
|
||||
} else {
|
||||
self.mciReady(mciMap);
|
||||
}
|
||||
}
|
||||
],
|
||||
function onComplete(err) {
|
||||
if(err) {
|
||||
// :TODO: Log me!!! ... and what else?
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
require('util').inherits(MenuModule, PluginModule);
|
||||
|
||||
MenuModule.prototype.enter = function(client) {
|
||||
|
||||
this.client = client;
|
||||
assert(typeof client !== 'undefined');
|
||||
};
|
||||
|
||||
MenuModule.prototype.leave = function() {
|
||||
|
@ -25,5 +58,8 @@ MenuModule.prototype.leave = function() {
|
|||
|
||||
MenuModule.prototype.addViewController = function(vc) {
|
||||
this.viewControllers.push(vc);
|
||||
return vc; // allow var vc = this.addViewController(new ViewController(...));
|
||||
return vc;
|
||||
};
|
||||
|
||||
MenuModule.prototype.mciReady = function(mciMap) {
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue