suite.asyncSetup = function (done) { pers.init(pbeMock); config.init(true, { gsjs: { config: 'config_prod', }, }); gsjsBridge.init(true, function cb() { // hi variants tracker group required for pc login: pers.create(Group, {tsid: 'RIFUKAGPIJC358O', class_tsid: 'hi_variants_tracker'}); var geo = Geo.create({tsid: 'GXYZ', layers: {middleground: { platform_lines: {plat_1: { start: {x: -100, y: 0}, end: {x: 100, y: 0}, platform_item_perm: -1, platform_pc_perm: -1, }}}}}); loc = Location.create(geo); pc = Player.create({ tsid: 'PXYYZ', label: 'Chuck', class_tsid: 'human', skip_newux: true, location: loc, x: 0, y: -100, last_location: {}, }); trant = Item.create('trant_bean'); trant.setContainer(loc, 12, 34); trant.die = function () {}; // prevent dying apple = Item.create('apple'); apple.setContainer(pc, 0); done(); }); };
// 初始化tagName // 创建基础dom constructor(tagName) { this.attributes = {}; this.extend = extend; this.CONFIG = new Config; this.CONFIG.init(); this.tagName = tagName || 'div'; this.dom = document.createElement(this.tagName); this.$dom = $(this.dom); }
/** * Main entry point - this function is called when running: * ``` * node server.js * ``` * * @private */ function main() { // init low-level things first (synchronously) config.init(cluster.isMaster); if (config.get('debug').stackTraceLimit) { Error.stackTraceLimit = config.get('debug:stackTraceLimit'); } logging.init(); metrics.init(); // then actually fork workers, resp. defer to worker module there if (cluster.isMaster) runMaster(); else worker.run(); }
function initConfig() { // minimal configuration just to enable tests config.init(false, { net: { gameServers: { gs01: { host: '127.0.0.1', ports: [1443], }, }, maxMsgSize: 131072, rpc: { timeout: 10000, }, amflib: 'cc', }, pers: { backEnd: { config: { rethink: { dbname: 'eleven_test', dbtable: 'gamedata', dbhost: 'localhost', dbport: 28015, dbauth: 'test123', queryOpts: { durability: 'hard', noreply: false, }, }, }, }, }, gsjs: { config: 'config_prod', }, cache: { pathfinding: './test/pathfinding.json', }, }, { gsid: 'gs01-01', }); }
// initializes the process either as master (RPC client for the purpose of // this benchmark) or worker (RPC server, started as a child process) function init(isMaster, ready) { config.init(isMaster, CONFIG, isMaster ? {} : {gsid: 'gs01-01'}); // mock the persistence layer (dirty as f**k, but we're only messing up // the rpc module for this particular process here) rpc.__set__('pers', { get: function() { return DUMMY_OBJ; }, }); // initialize RPC channels rpc.init(function callback(err) { if (err) throw err; if (isMaster) { // master -> start benchmark ready(); } else { // worker -> signal parent process (benchmark suite) that we're ready process.send({type: 'ready'}); } }); }
/** * app.js * * Entry point for NodeUsage. * */ var Config = require( 'config' ); var Controller = require( 'controller' ); // init Config.init(); Controller.init(); // get usage if( !Config.getCredentials() ) Controller.error( "Please set credentials in the Pebble app." ); else Controller.displayUsage();