avg-core-ts
Version:
Develop Adventure Game (or ADV, Visual Novel, Galgame, etc.) on your own!
1,541 lines (1,260 loc) • 2.01 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("PIXI"));
else if(typeof define === 'function' && define.amd)
define(["PIXI"], factory);
else if(typeof exports === 'object')
exports["AVG"] = factory(require("PIXI"));
else
root["AVG"] = factory(root["PIXI"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_18__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 747);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(3);
var core = __webpack_require__(34);
var hide = __webpack_require__(22);
var redefine = __webpack_require__(23);
var ctx = __webpack_require__(35);
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
var key, own, out, exp;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// extend global
if (target) redefine(target, key, out, type & $export.U);
// export
if (exports[key] != out) hide(exports, key, exp);
if (IS_PROTO && expProto[key] != out) expProto[key] = out;
}
};
global.core = core;
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(5);
module.exports = function (it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (false) {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/***/ }),
/* 3 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/* 5 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
/**
* WARNING: DO NOT manually require this module.
* This is a replacement for `invariant(...)` used by the error code system
* and will _only_ be required by the corresponding babel pass.
* It always throws.
*/
function reactProdInvariant(code) {
var argCount = arguments.length - 1;
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
for (var argIdx = 0; argIdx < argCount; argIdx++) {
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
}
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
var error = new Error(message);
error.name = 'Invariant Violation';
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
throw error;
}
module.exports = reactProdInvariant;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var emptyFunction = __webpack_require__(43);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (false) {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
module.exports = warning;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// --------------------------------------------------------------------
// Imports
// --------------------------------------------------------------------
var extend = __webpack_require__(181);
// --------------------------------------------------------------------
// Private Stuff
// --------------------------------------------------------------------
// Helpers
var escapeStringFor = {};
for (var c = 0; c < 128; c++) {
escapeStringFor[c] = String.fromCharCode(c);
}
escapeStringFor["'".charCodeAt(0)] = "\\'";
escapeStringFor['"'.charCodeAt(0)] = '\\"';
escapeStringFor['\\'.charCodeAt(0)] = '\\\\';
escapeStringFor['\b'.charCodeAt(0)] = '\\b';
escapeStringFor['\f'.charCodeAt(0)] = '\\f';
escapeStringFor['\n'.charCodeAt(0)] = '\\n';
escapeStringFor['\r'.charCodeAt(0)] = '\\r';
escapeStringFor['\t'.charCodeAt(0)] = '\\t';
escapeStringFor['\u000b'.charCodeAt(0)] = '\\v';
// --------------------------------------------------------------------
// Exports
// --------------------------------------------------------------------
exports.abstract = function(optMethodName) {
var methodName = optMethodName || '';
return function() {
throw new Error(
'this method ' + methodName + ' is abstract! ' +
'(it has no implementation in class ' + this.constructor.name + ')');
};
};
exports.assert = function(cond, message) {
if (!cond) {
throw new Error(message);
}
};
// Define a lazily-computed, non-enumerable property named `propName`
// on the object `obj`. `getterFn` will be called to compute the value the
// first time the property is accessed.
exports.defineLazyProperty = function(obj, propName, getterFn) {
var memo;
Object.defineProperty(obj, propName, {
get: function() {
if (!memo) {
memo = getterFn.call(this);
}
return memo;
}
});
};
exports.clone = function(obj) {
if (obj) {
return extend({}, obj);
}
return obj;
};
exports.extend = extend;
exports.repeatFn = function(fn, n) {
var arr = [];
while (n-- > 0) {
arr.push(fn());
}
return arr;
};
exports.repeatStr = function(str, n) {
return new Array(n + 1).join(str);
};
exports.repeat = function(x, n) {
return exports.repeatFn(function() { return x; }, n);
};
exports.getDuplicates = function(array) {
var duplicates = [];
for (var idx = 0; idx < array.length; idx++) {
var x = array[idx];
if (array.lastIndexOf(x) !== idx && duplicates.indexOf(x) < 0) {
duplicates.push(x);
}
}
return duplicates;
};
exports.copyWithoutDuplicates = function(array) {
var noDuplicates = [];
array.forEach(function(entry) {
if (noDuplicates.indexOf(entry) < 0) {
noDuplicates.push(entry);
}
});
return noDuplicates;
};
exports.isSyntactic = function(ruleName) {
var firstChar = ruleName[0];
return firstChar === firstChar.toUpperCase();
};
exports.isLexical = function(ruleName) {
return !exports.isSyntactic(ruleName);
};
exports.padLeft = function(str, len, optChar) {
var ch = optChar || ' ';
if (str.length < len) {
return exports.repeatStr(ch, len - str.length) + str;
}
return str;
};
// StringBuffer
exports.StringBuffer = function() {
this.strings = [];
};
exports.StringBuffer.prototype.append = function(str) {
this.strings.push(str);
};
exports.StringBuffer.prototype.contents = function() {
return this.strings.join('');
};
// Character escaping and unescaping
exports.escapeChar = function(c, optDelim) {
var charCode = c.charCodeAt(0);
if ((c === '"' || c === "'") && optDelim && c !== optDelim) {
return c;
} else if (charCode < 128) {
return escapeStringFor[charCode];
} else if (128 <= charCode && charCode < 256) {
return '\\x' + exports.padLeft(charCode.toString(16), 2, '0');
} else {
return '\\u' + exports.padLeft(charCode.toString(16), 4, '0');
}
};
exports.unescapeChar = function(s) {
if (s.charAt(0) === '\\') {
switch (s.charAt(1)) {
case 'b': return '\b';
case 'f': return '\f';
case 'n': return '\n';
case 'r': return '\r';
case 't': return '\t';
case 'v': return '\v';
case 'x': return String.fromCharCode(parseInt(s.substring(2, 4), 16));
case 'u': return String.fromCharCode(parseInt(s.substring(2, 6), 16));
default: return s.charAt(1);
}
} else {
return s;
}
};
// Helper for producing a description of an unknown object in a safe way.
// Especially useful for error messages where an unexpected type of object was encountered.
exports.unexpectedObjToString = function(obj) {
if (obj == null) {
return String(obj);
}
var baseToString = Object.prototype.toString.call(obj);
try {
var typeName;
if (obj.constructor && obj.constructor.name) {
typeName = obj.constructor.name;
} else if (baseToString.indexOf('[object ') === 0) {
typeName = baseToString.slice(8, -1); // Extract e.g. "Array" from "[object Array]".
} else {
typeName = typeof obj;
}
return typeName + ': ' + JSON.stringify(String(obj));
} catch (e) {
return baseToString;
}
};
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(86)('wks');
var uid = __webpack_require__(66);
var Symbol = __webpack_require__(3).Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(37);
var min = Math.min;
module.exports = function (it) {
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// --------------------------------------------------------------------
// Imports
// --------------------------------------------------------------------
var UnicodeCategories = __webpack_require__(646);
var common = __webpack_require__(8);
var errors = __webpack_require__(47);
var inherits = __webpack_require__(114);
// --------------------------------------------------------------------
// Private stuff
// --------------------------------------------------------------------
// General stuff
function PExpr() {
throw new Error("PExpr cannot be instantiated -- it's abstract");
}
// Set the `source` property to the interval containing the source for this expression.
PExpr.prototype.withSource = function(interval) {
if (interval) {
this.source = interval.trimmed();
}
return this;
};
// Any
var any = Object.create(PExpr.prototype);
// End
var end = Object.create(PExpr.prototype);
// Terminals
function Terminal(obj) {
this.obj = obj;
}
inherits(Terminal, PExpr);
// Ranges
function Range(from, to) {
this.from = from;
this.to = to;
}
inherits(Range, PExpr);
// Parameters
function Param(index) {
this.index = index;
}
inherits(Param, PExpr);
// Alternation
function Alt(terms) {
this.terms = terms;
}
inherits(Alt, PExpr);
// Extend is an implementation detail of rule extension
function Extend(superGrammar, name, body) {
this.superGrammar = superGrammar;
this.name = name;
this.body = body;
var origBody = superGrammar.rules[name].body;
this.terms = [body, origBody];
}
inherits(Extend, Alt);
// Sequences
function Seq(factors) {
this.factors = factors;
}
inherits(Seq, PExpr);
// Iterators and optionals
function Iter(expr) {
this.expr = expr;
}
inherits(Iter, PExpr);
function Star(expr) {
this.expr = expr;
}
inherits(Star, Iter);
function Plus(expr) {
this.expr = expr;
}
inherits(Plus, Iter);
function Opt(expr) {
this.expr = expr;
}
inherits(Opt, Iter);
Star.prototype.operator = '*';
Plus.prototype.operator = '+';
Opt.prototype.operator = '?';
Star.prototype.minNumMatches = 0;
Plus.prototype.minNumMatches = 1;
Opt.prototype.minNumMatches = 0;
Star.prototype.maxNumMatches = Number.POSITIVE_INFINITY;
Plus.prototype.maxNumMatches = Number.POSITIVE_INFINITY;
Opt.prototype.maxNumMatches = 1;
// Predicates
function Not(expr) {
this.expr = expr;
}
inherits(Not, PExpr);
function Lookahead(expr) {
this.expr = expr;
}
inherits(Lookahead, PExpr);
// "Lexification"
function Lex(expr) {
this.expr = expr;
}
inherits(Lex, PExpr);
// Array decomposition
function Arr(expr) {
this.expr = expr;
}
inherits(Arr, PExpr);
// String decomposition
function Str(expr) {
this.expr = expr;
}
inherits(Str, PExpr);
// Object decomposition
function Obj(properties, isLenient) {
var names = properties.map(function(property) { return property.name; });
var duplicates = common.getDuplicates(names);
if (duplicates.length > 0) {
throw errors.duplicatePropertyNames(duplicates);
} else {
this.properties = properties;
this.isLenient = isLenient;
}
}
inherits(Obj, PExpr);
// Rule application
function Apply(ruleName, optArgs) {
this.ruleName = ruleName;
this.args = optArgs || [];
}
inherits(Apply, PExpr);
Apply.prototype.isSyntactic = function() {
return common.isSyntactic(this.ruleName);
};
// This method just caches the result of `this.toString()` in a non-enumerable property.
Apply.prototype.toMemoKey = function() {
if (!this._memoKey) {
Object.defineProperty(this, '_memoKey', {value: this.toString()});
}
return this._memoKey;
};
// Unicode character
function UnicodeChar(category) {
this.category = category;
this.pattern = UnicodeCategories[category];
}
inherits(UnicodeChar, PExpr);
// --------------------------------------------------------------------
// Exports
// --------------------------------------------------------------------
exports.PExpr = PExpr;
exports.any = any;
exports.end = end;
exports.Terminal = Terminal;
exports.Range = Range;
exports.Param = Param;
exports.Alt = Alt;
exports.Extend = Extend;
exports.Seq = Seq;
exports.Iter = Iter;
exports.Star = Star;
exports.Plus = Plus;
exports.Opt = Opt;
exports.Not = Not;
exports.Lookahead = Lookahead;
exports.Lex = Lex;
exports.Arr = Arr;
exports.Str = Str;
exports.Obj = Obj;
exports.Apply = Apply;
exports.UnicodeChar = UnicodeChar;
// --------------------------------------------------------------------
// Extensions
// --------------------------------------------------------------------
__webpack_require__(630);
__webpack_require__(631);
__webpack_require__(632);
__webpack_require__(633);
__webpack_require__(634);
__webpack_require__(635);
__webpack_require__(637);
__webpack_require__(636);
__webpack_require__(640);
__webpack_require__(638);
__webpack_require__(639);
__webpack_require__(641);
__webpack_require__(643);
__webpack_require__(642);
__webpack_require__(644);
__webpack_require__(645);
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _koaCompose=__webpack_require__(297);var _koaCompose2=_interopRequireDefault(_koaCompose);var _fontfaceobserver=__webpack_require__(580);var _fontfaceobserver2=_interopRequireDefault(_fontfaceobserver);var _reactDom=__webpack_require__(657);var _Container=__webpack_require__(299);var _Container2=_interopRequireDefault(_Container);var _EventManager=__webpack_require__(186);var _sayHello=__webpack_require__(326);var _sayHello2=_interopRequireDefault(_sayHello);var _fitWindow=__webpack_require__(325);var _fitWindow2=_interopRequireDefault(_fitWindow);var _logger=__webpack_require__(81);var _logger2=_interopRequireDefault(_logger);var _preloader=__webpack_require__(314);var _ticker=__webpack_require__(315);var _ticker2=_interopRequireDefault(_ticker);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _asyncToGenerator(fn){return function(){var gen=fn.apply(this,arguments);return new Promise(function(resolve,reject){function step(key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{return Promise.resolve(value).then(function(value){step("next",value);},function(err){step("throw",err);});}}return step("next");});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var PIXI=__webpack_require__(18);var isMobile=__webpack_require__(593);var logger=_logger2.default.create('Core');var Core=function(){function Core(){_classCallCheck(this,Core);this._init=false;this._tickTime=0;this.renderer=null;this.stage=null;this.canvas=null;this.options={};this.middlewares={};this.plugins={};this.assetsPath=null;}_createClass(Core,[{key:'use',value:function use(name,middleware){var middlewares=void 0;if(!this.middlewares[name]){middlewares=[];this.middlewares[name]=middlewares;}else{middlewares=this.middlewares[name];}middlewares.push(middleware);}},{key:'unuse',value:function unuse(name,middleware){var middlewares=this.middlewares[name];if(middlewares){var pos=middlewares.indexOf(middleware);if(pos!==-1){middlewares.splice(pos,1);}else{logger.warn('Do not find the given middleware in '+name+'.');}}else{logger.warn('Do not find the given middleware in '+name+'.');}}},{key:'post',value:function post(name,context,next){var middlewares=this.middlewares[name];if(middlewares){return(0,_koaCompose2.default)(middlewares)(context||{},next);}return Promise.resolve();}},{key:'installPlugin',value:function installPlugin(constructor){new constructor(this);}},{key:'init',value:function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark(function _callee(width,height){var _this=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var _options,font,assetsPath;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!this._init){_context.next=2;break;}return _context.abrupt('return');case 2:_options=Object.assign({fitWindow:false,assetsPath:'/',tryWebp:false},options);if(!_options.fontFamily){_context.next=7;break;}font=new _fontfaceobserver2.default(_options.fontFamily);_context.next=7;return font.load();case 7:if(_options.renderer){this.renderer=_options.renderer;}else{if(isMobile.any){PIXI.settings.RESOLUTION=1;PIXI.settings.TARGET_FPMS=0.03;}else{PIXI.settings.RESOLUTION=window.devicePixelRatio||1;}this.renderer=new PIXI.WebGLRenderer(width,height,{view:_options.view,autoResize:true,roundPixels:true});}this.options=_options;if(_options.fitWindow){window.addEventListener('resize',function(){(0,_fitWindow2.default)(_this.renderer,window.innerWidth,window.innerHeight);});(0,_fitWindow2.default)(this.renderer,window.innerWidth,window.innerHeight);}assetsPath=_options.assetsPath;if(!assetsPath.endsWith('/')){assetsPath+='/';}this.assetsPath=assetsPath;(0,_preloader.init)(assetsPath,_options.tryWebp);this.stage=new _Container2.default();(0,_EventManager.attachToSprite)(this.stage);this.stage._ontap=function(e){return _this.post('tap',e);};this.stage._onclick=function(e){return _this.post('click',e);};this.ticker=new _ticker2.default();this.ticker.add(this.tick.bind(this));(0,_sayHello2.default)();this._init=true;case 22:case'end':return _context.stop();}}},_callee,this);}));function init(_x,_x2){return _ref.apply(this,arguments);}return init;}()},{key:'getRenderer',value:function getRenderer(){if(this._init){return this.renderer;}logger.error('Renderer hasn\'t been initialed.');return null;}},{key:'getStage',value:function getStage(){if(this._init){return this.stage;}logger.error('Stage hasn\'t been initialed.');return null;}},{key:'getAssetsPath',value:function getAssetsPath(){return this.assetsPath;}},{key:'getTexture',value:function getTexture(url){return(0,_preloader.getTexture)(url);}},{key:'getLogger',value:function getLogger(name){return _logger2.default.create(name);}},{key:'loadAssets',value:function loadAssets(list,onProgress){return(0,_preloader.load)(list,onProgress);}},{key:'render',value:function(){var _ref2=_asyncToGenerator(regeneratorRuntime.mark(function _callee2(component,target){var _this2=this;var append=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(this._init){_context2.next=2;break;}throw Error('not initialed');case 2:return _context2.abrupt('return',new Promise(function(resolve){(0,_reactDom.render)(component,target,resolve);}).then(function(){append&&target.appendChild(_this2.renderer.view);}));case 3:case'end':return _context2.stop();}}},_callee2,this);}));function render(_x4,_x5){return _ref2.apply(this,arguments);}return render;}()},{key:'getTicker',value:function getTicker(){return this.ticker;}},{key:'tick',value:function tick(deltaTime){this._tickTime+=deltaTime;if(this._init&&this._tickTime>0.98){this.renderer.render(this.stage);this._tickTime=0;window.stats&&window.stats.update();}}},{key:'start',value:function start(){this.ticker.start();}},{key:'stop',value:function stop(){this.ticker.stop();}}]);return Core;}();var core=new Core();exports.default=core;
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(4)(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(1);
var IE8_DOM_DEFINE = __webpack_require__(198);
var toPrimitive = __webpack_require__(42);
var dP = Object.defineProperty;
exports.f = __webpack_require__(13) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var _prodInvariant = __webpack_require__(6);
var DOMProperty = __webpack_require__(76);
var ReactDOMComponentFlags = __webpack_require__(255);
var invariant = __webpack_require__(2);
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var Flags = ReactDOMComponentFlags;
var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
/**
* Check if a given node should be cached.
*/
function shouldPrecacheNode(node, nodeID) {
return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' ';
}
/**
* Drill down (through composites and empty components) until we get a host or
* host text component.
*
* This is pretty polymorphic but unavoidable with the current structure we have
* for `_renderedChildren`.
*/
function getRenderedHostOrTextFromComponent(component) {
var rendered;
while (rendered = component._renderedComponent) {
component = rendered;
}
return component;
}
/**
* Populate `_hostNode` on the rendered host/text component with the given
* DOM node. The passed `inst` can be a composite.
*/
function precacheNode(inst, node) {
var hostInst = getRenderedHostOrTextFromComponent(inst);
hostInst._hostNode = node;
node[internalInstanceKey] = hostInst;
}
function uncacheNode(inst) {
var node = inst._hostNode;
if (node) {
delete node[internalInstanceKey];
inst._hostNode = null;
}
}
/**
* Populate `_hostNode` on each child of `inst`, assuming that the children
* match up with the DOM (element) children of `node`.
*
* We cache entire levels at once to avoid an n^2 problem where we access the
* children of a node sequentially and have to walk from the start to our target
* node every time.
*
* Since we update `_renderedChildren` and the actual DOM at (slightly)
* different times, we could race here and see a newer `_renderedChildren` than
* the DOM nodes we see. To avoid this, ReactMultiChild calls
* `prepareToManageChildren` before we change `_renderedChildren`, at which
* time the container's child nodes are always cached (until it unmounts).
*/
function precacheChildNodes(inst, node) {
if (inst._flags & Flags.hasCachedChildNodes) {
return;
}
var children = inst._renderedChildren;
var childNode = node.firstChild;
outer: for (var name in children) {
if (!children.hasOwnProperty(name)) {
continue;
}
var childInst = children[name];
var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
if (childID === 0) {
// We're currently unmounting this child in ReactMultiChild; skip it.
continue;
}
// We assume the child nodes are in the same order as the child instances.
for (; childNode !== null; childNode = childNode.nextSibling) {
if (shouldPrecacheNode(childNode, childID)) {
precacheNode(childInst, childNode);
continue outer;
}
}
// We reached the end of the DOM children without finding an ID match.
true ? false ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
}
inst._flags |= Flags.hasCachedChildNodes;
}
/**
* Given a DOM node, return the closest ReactDOMComponent or
* ReactDOMTextComponent instance ancestor.
*/
function getClosestInstanceFromNode(node) {
if (node[internalInstanceKey]) {
return node[internalInstanceKey];
}
// Walk up the tree until we find an ancestor whose instance we have cached.
var parents = [];
while (!node[internalInstanceKey]) {
parents.push(node);
if (node.parentNode) {
node = node.parentNode;
} else {
// Top of the tree. This node must not be part of a React tree (or is
// unmounted, potentially).
return null;
}
}
var closest;
var inst;
for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
closest = inst;
if (parents.length) {
precacheChildNodes(inst, node);
}
}
return closest;
}
/**
* Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
* instance, or null if the node was not rendered by this React.
*/
function getInstanceFromNode(node) {
var inst = getClosestInstanceFromNode(node);
if (inst != null && inst._hostNode === node) {
return inst;
} else {
return null;
}
}
/**
* Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
* DOM node.
*/
function getNodeFromInstance(inst) {
// Without this first invariant, passing a non-DOM-component triggers the next
// invariant for a missing parent, which is super confusing.
!(inst._hostNode !== undefined) ? false ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
if (inst._hostNode) {
return inst._hostNode;
}
// Walk up the tree until we find an ancestor whose DOM node we have cached.
var parents = [];
while (!inst._hostNode) {
parents.push(inst);
!inst._hostParent ? false ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
inst = inst._hostParent;
}
// Now parents contains each ancestor that does *not* have a cached native
// node, and `inst` is the deepest ancestor that does.
for (; parents.length; inst = parents.pop()) {
precacheChildNodes(inst, inst._hostNode);
}
return inst._hostNode;
}
var ReactDOMComponentTree = {
getClosestInstanceFromNode: getClosestInstanceFromNode,
getInstanceFromNode: getInstanceFromNode,
getNodeFromInstance: getNodeFromInstance,
precacheChildNodes: precacheChildNodes,
precacheNode: precacheNode,
uncacheNode: uncacheNode
};
module.exports = ReactDOMComponentTree;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(40);
module.exports = function (it) {
return Object(defined(it));
};
/***/ }),
/* 18 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_18__;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__(79);
/***/ }),
/* 20 */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(15);
var createDesc = __webpack_require__(62);
module.exports = __webpack_require__(13) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(3);
var hide = __webpack_require__(22);
var has = __webpack_require__(26);
var SRC = __webpack_require__(66)('src');
var $toString = __webpack_require__(347);
var TO_STRING = 'toString';
var TPL = ('' + $toString).split(TO_STRING);
__webpack_require__(34).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
var $export = __webpack_require__(0);
var fails = __webpack_require__(4);
var defined = __webpack_require__(40);
var quot = /"/g;
// B.2.3.2.1 CreateHTML(string, tag, attribute, value)
var createHTML = function (string, tag, attribute, value) {
var S = String(defined(string));
var p1 = '<' + tag;
if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"';
return p1 + '>' + S + '</' + tag + '>';
};
module.exports = function (NAME, exec) {
var O = {};
O[NAME] = exec(createHTML);
$export($export.P + $export.F * fails(function () {
var test = ''[NAME]('"');
return test !== test.toLowerCase() || test.split('"').length > 3;
}), 'String', O);
};
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports,"__esModule",{value:true});var ReactMultiChild=__webpack_require__(262);var ContainerMixin=Object.assign({},ReactMultiChild.Mixin,{moveChild:function moveChild(child){var childNode=child._mountImage;var layer=this.node;layer.addChild(childNode);},createChild:function createChild(child,afterNode,childNode){child._mountImage=childNode;var layer=this.node;layer.addChild(childNode);},removeChild:function removeChild(child){this.node.removeChild(child._mountImage);child._mountImage.destroy();child._mountImage=null;},mountAndInjectChildren:function mountAndInjectChildren(children,transaction,context){var mountedImages=this.mountChildren(children,transaction,context);var i=0;for(var key in this._renderedChildren){if(this._renderedChildren.hasOwnProperty(key)){var child=this._renderedChildren[key];child._mountImage=mountedImages[i];this.node.addChild(mountedImages[i]);i++;}}}});exports.default=ContainerMixin;
/***/ }),
/* 26 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(85);
var createDesc = __webpack_require__(62);
var toIObject = __webpack_require__(29);
var toPrimitive = __webpack_require__(42);
var has = __webpack_require__(26);
var IE8_DOM_DEFINE = __webpack_require__(198);
var gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(13) ? gOPD : function getOwnPropertyDescriptor(O, P) {
O = toIObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return gOPD(O, P);
} catch (e) { /* empty */ }
if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
};
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(26);
var toObject = __webpack_require__(17);
var IE_PROTO = __webpack_require__(144)('IE_PROTO');
var ObjectProto = Object.prototype;
module.exports = Object.getPrototypeOf || function (O) {
O = toObject(O);
if (has(O, IE_PROTO)) return O[IE_PROTO];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(84);
var defined = __webpack_require__(40);
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var _prodInvariant = __webpack_require__(6),
_assign = __webpack_require__(14);
var CallbackQueue = __webpack_require__(253);
var PooledClass = __webpack_require__(70);
var ReactFeatureFlags = __webpack_require__(258);
var ReactReconciler = __webpack_require__(78);
var Transaction = __webpack_require__(120);
var invariant = __webpack_require__(2);
var dirtyComponents = [];
var updateBatchNumber = 0;
var asapCallbackQueue = CallbackQueue.getPooled();
var asapEnqueued = false;
var batchingStrategy = null;
function ensureInjected() {
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? false ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
}
var NESTED_UPDATES = {
initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
// these new updates so that if A's componentDidUpdate calls setState on
// B, B will update before the callback A's updater provided when calling
// setState.
dirtyComponents.splice(0, this.dirtyComponentsLength);
flushBatchedUpdates();
} else {
dirtyComponents.length = 0;
}
}
};
var UPDATE_QUEUEING = {
initialize: function () {
this.callbackQueue.reset();
},
close: function () {
this.callbackQueue.notifyAll();
}
};
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
function ReactUpdatesFlushTransaction() {
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* useCreateElement */true);
}
_assign(ReactUpdatesFlushTransaction.prototype, Transaction, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
this.reconcileTransaction = null;
},
perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
return batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
* Array comparator for ReactComponents by mount ordering.
*
* @param {ReactComponent} c1 first component you're comparing
* @param {ReactComponent} c2 second component you're comparing
* @return {number} Return value usable by Array.prototype.sort().
*/
function mountOrderComparator(c1, c2) {
return c1._mountOrder - c2._mountOrder;
}
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
!(len === dirtyComponents.length) ? false ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountOrderComparator);
// Any updates enqueued while reconciling must be performed after this entire
// batch. Otherwise, if dirtyComponents is [A, B] where A has children B and
// C, B could update twice in a single batch if C's render enqueues an update
// to B (since B would have already updated, we should skip it, and the only
// way we can know to do so is by checking the batch counter).
updateBatchNumber++;
for (var i = 0; i < len; i++) {
// If a component is unmounted before pending changes apply, it will still
// be here, but we assume that it has cleared its _pendingCallbacks and
// that performUpdateIfNecessary is a noop.
var component = dirtyComponents[i];
// If performUpdateIfNecessary happens to enqueue any new updates, we
// shouldn't execute the callbacks until the next render happens, so
// stash the callbacks first
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
var markerName;
if (ReactFeatureFlags.logTopLevelRenders) {
var namedComponent = component;
// Duck type TopLevelWrapper. This is probably always true.
if (component._currentElement.type.isReactTopLevelWrapper) {
namedComponent = component._renderedComponent;
}
markerName = 'React update: ' + namedComponent.getName();
console.time(markerName);
}
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber);
if (markerName) {
console.timeEnd(markerName);
}
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates