UNPKG

dragonbones-runtime

Version:

the tools to build dragonbones file for diffrent framework

45 lines (44 loc) 2.02 kB
/** * Created by yanjiaqi on 15/8/31. */ /// <reference path="../lib/types.d.ts" /> var file = require("../lib/FileUtil"); var ParseConfigCommand = (function () { function ParseConfigCommand() { } ParseConfigCommand.prototype.execute = function () { this.htmlTxt = file.read(file.joinPath(egret.args.projectDir, "index.html")); this.requireTxt = file.read(file.joinPath(egret.root, "tools", "templates", "empty", "launcher", "native_require.js")); this.read("data-entry-class", "entryClassName", true, '"Main"'); this.read("data-frame-rate", "frameRate", false, "60"); this.read("data-scale-mode", "scaleMode", true, '"showAll"'); this.read("data-content-width", "contentWidth", false, "480"); this.read("data-content-height", "contentHeight", false, "800"); this.read("data-show-paint-rect", "showPaintRect", false, 'false'); this.read("data-show-fps", "showFPS", false, 'false'); this.read("data-show-fps-style", "fpsStyles", true, '""'); this.read("data-show-log", "showLog", false, 'false'); this.read("data-log-filter", "logFilter", true, '""'); this.read("texture-scale-factor", "textureScaleFactor", false, "1"); this.read("data-multi-fingered", "maxTouches", false, "2"); return 0; }; ParseConfigCommand.prototype.read = function (name, replaceName, isString, defaultValue) { var result; var index = this.htmlTxt.indexOf(name); if (index != -1) { var str = this.htmlTxt.slice(index + name.length + 2, this.htmlTxt.length); var index2 = str.indexOf('"'); result = str.slice(0, index2); if (isString) { result = '"' + result + '"'; } } else { result = defaultValue; } this.requireTxt = this.requireTxt.replace('"' + replaceName + '"', result); }; return ParseConfigCommand; }()); module.exports = ParseConfigCommand;