Commit 9b8ae891 authored by haiyoucuv's avatar haiyoucuv

1

parent a3eb0863
File added
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
<option name="languageLevel" value="FLOW" />
</component>
</project>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<changelist name="Uncommitted_changes_before_Checkout_at_2020_5_15,_2_12_下午_[Default_Changelist]" date="1589523138013" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_2020_5_15,_2_12_下午_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 2020/5/15, 2:12 下午 [Default Changelist]" />
</changelist>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<changelist name="Uncommitted_changes_before_Update_at_2020_5_14,_2_47_下午_[Default_Changelist]" date="1589438835098" recycled="false" toDelete="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2020_5_14,_2_47_下午_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 2020/5/14, 2:47 下午 [Default Changelist]" />
</changelist>
\ No newline at end of file
<changelist name="Uncommitted_changes_before_Update_at_2020_5_14,_2_47_下午_[Default_Changelist]1" date="1589438857749" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2020_5_14,_2_47_下午_[Default_Changelist]1/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 2020/5/14, 2:47 下午 [Default Changelist]" />
</changelist>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="af35c04f-08f6-48ed-85db-2f94c60e87fd" name="Default Changelist" comment="" />
<list default="true" id="af35c04f-08f6-48ed-85db-2f94c60e87fd" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/debug/engine.js" beforeDir="false" afterPath="$PROJECT_DIR$/debug/engine.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/debug/engine.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/debug/engine.js.map" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/rollup.config.js" beforeDir="false" afterPath="$PROJECT_DIR$/rollup.config.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/display/Container.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/display/Container.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/display/Sprite.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/display/Sprite.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/display/Stage.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/display/Stage.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/2d/events/Event.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/2d/events/Event.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/decorators/auto-adjust.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/decorators/auto-adjust.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/game-warpper/GameStage.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/game-warpper/GameStage.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/launcher.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/launcher.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/zeroing/utils/utils.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/zeroing/utils/utils.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/yarn.lock" beforeDir="false" afterPath="$PROJECT_DIR$/yarn.lock" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
......@@ -10,9 +26,9 @@
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="JavaScript File" />
<option value="MarkDown" />
<option value="TypeScript File" />
<option value="JavaScript File" />
</list>
</option>
</component>
......@@ -25,28 +41,31 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="UPDATE_TYPE" value="MERGE" />
</component>
<component name="IgnoredFileRootStore">
<option name="generatedRoots">
<set>
<option value="$PROJECT_DIR$/.idea" />
</set>
</option>
<component name="JsFlowSettings">
<service-enabled>true</service-enabled>
<exe-path />
<other-services-enabled>true</other-services-enabled>
<auto-save>true</auto-save>
</component>
<component name="ProjectId" id="1ZYzLmPKm3UfhIZLkr8RtiZwhUf" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/zeroing/game-warpper/mvvm" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="yarn" />
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
<property name="settings.editor.selected.configurable" value="settings.typescriptcompiler" />
<property name="settings.editor.selected.configurable" value="yiiguxing.plugin.translate" />
<property name="ts.external.directory.path" value="$PROJECT_DIR$/node_modules/typescript/lib" />
</component>
<component name="RecentsManager">
......@@ -108,8 +127,8 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="npm.preprocess" />
<item itemvalue="npm.dev" />
<item itemvalue="npm.preprocess" />
<item itemvalue="npm.declare" />
<item itemvalue="npm.debug" />
<item itemvalue="npm.build:prod" />
......@@ -157,15 +176,22 @@
<workItem from="1587606438033" duration="14026000" />
<workItem from="1587696728690" duration="5561000" />
<workItem from="1587713741312" duration="310000" />
<workItem from="1589536818547" duration="8764000" />
<workItem from="1589709011120" duration="341000" />
<workItem from="1589766926355" duration="379000" />
<workItem from="1589767318703" duration="29000" />
<workItem from="1589767471060" duration="25732000" />
<workItem from="1589853014410" duration="21858000" />
<workItem from="1589888428282" duration="5840000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
<option name="version" value="2" />
<option name="exactExcludedFiles">
<list>
<option value="$PROJECT_DIR$/examples/scripts/Wave.js" />
<option value="$PROJECT_DIR$/examples/scripts/TouchZoom.js" />
<option value="$PROJECT_DIR$/examples/scripts/Wave.js" />
</list>
</option>
</component>
......@@ -190,37 +216,37 @@
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state width="969" height="466" key="DebuggerActiveHint/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1585535223173" />
<state width="584" height="1056" key="GridCell.Tab.0.bottom" timestamp="1587713730150">
<screen x="1680" y="-252" width="1920" height="1200" />
<state width="493" height="821" key="GridCell.Tab.0.bottom" timestamp="1589897780335">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state width="276" height="1101" key="GridCell.Tab.0.bottom/0.0.1680.1050/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587712516387" />
<state width="584" height="1056" key="GridCell.Tab.0.bottom/0.23.1680.1027/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587713730150" />
<state width="584" height="1056" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1587710590931" />
<state width="336" height="906" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1585720951511" />
<state width="493" height="821" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780335" />
<state width="687" height="907" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1589767347615" />
<state width="427" height="906" key="GridCell.Tab.0.bottom/35.23.1645.1027@35.23.1645.1027" timestamp="1586963282147" />
<state width="584" height="1056" key="GridCell.Tab.0.center" timestamp="1587713730146">
<screen x="1680" y="-252" width="1920" height="1200" />
<state width="493" height="821" key="GridCell.Tab.0.center" timestamp="1589897780335">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state width="276" height="1101" key="GridCell.Tab.0.center/0.0.1680.1050/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587712516380" />
<state width="584" height="1056" key="GridCell.Tab.0.center/0.23.1680.1027/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587713730146" />
<state width="584" height="1056" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1587710590929" />
<state width="336" height="906" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1585720951508" />
<state width="493" height="821" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780335" />
<state width="687" height="907" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1589767347614" />
<state width="427" height="906" key="GridCell.Tab.0.center/35.23.1645.1027@35.23.1645.1027" timestamp="1586963282146" />
<state width="584" height="1056" key="GridCell.Tab.0.left" timestamp="1587713730145">
<screen x="1680" y="-252" width="1920" height="1200" />
<state width="493" height="821" key="GridCell.Tab.0.left" timestamp="1589897780334">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state width="276" height="1101" key="GridCell.Tab.0.left/0.0.1680.1050/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587712516377" />
<state width="584" height="1056" key="GridCell.Tab.0.left/0.23.1680.1027/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587713730145" />
<state width="584" height="1056" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1587710590928" />
<state width="336" height="906" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1585720951505" />
<state width="493" height="821" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780334" />
<state width="687" height="907" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1589767347614" />
<state width="427" height="906" key="GridCell.Tab.0.left/35.23.1645.1027@35.23.1645.1027" timestamp="1586963282146" />
<state width="584" height="1056" key="GridCell.Tab.0.right" timestamp="1587713730146">
<screen x="1680" y="-252" width="1920" height="1200" />
<state width="493" height="821" key="GridCell.Tab.0.right" timestamp="1589897780335">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state width="276" height="1101" key="GridCell.Tab.0.right/0.0.1680.1050/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587712516385" />
<state width="584" height="1056" key="GridCell.Tab.0.right/0.23.1680.1027/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587713730146" />
<state width="584" height="1056" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1587710590930" />
<state width="336" height="906" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1585720951509" />
<state width="493" height="821" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780335" />
<state width="687" height="907" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1589767347615" />
<state width="427" height="906" key="GridCell.Tab.0.right/35.23.1645.1027@35.23.1645.1027" timestamp="1586963282147" />
<state x="445" y="278" key="IDE.errors.dialog" timestamp="1585719736587">
<screen x="35" y="23" width="1645" height="1027" />
......@@ -230,10 +256,14 @@
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state x="2356" y="82" key="MultipleFileMergeDialog/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1586919094159" />
<state x="2149" y="-2" key="SettingsEditor" timestamp="1585555176349">
<state x="631" y="245" key="RollbackChangesDialog" timestamp="1589766990893">
<screen x="35" y="23" width="1645" height="1027" />
</state>
<state x="631" y="245" key="RollbackChangesDialog/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1589766990893" />
<state x="2149" y="-2" key="SettingsEditor" timestamp="1589888551577">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state x="2149" y="-2" key="SettingsEditor/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1585555176349" />
<state x="2149" y="-2" key="SettingsEditor/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589888551577" />
<state x="2441" y="283" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1587713822207">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
......@@ -248,11 +278,12 @@
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state x="2327" y="157" key="git4idea.merge.GitPullDialog/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1587714144888" />
<state x="2305" y="18" width="670" height="690" key="search.everywhere.popup" timestamp="1587713287518">
<screen x="1680" y="-252" width="1920" height="1200" />
<state x="2305" y="36" width="670" height="676" key="search.everywhere.popup" timestamp="1589893517546">
<screen x="1680" y="-229" width="1920" height="1177" />
</state>
<state x="2305" y="18" width="670" height="690" key="search.everywhere.popup/0.0.1680.1050/1680.-252.1920.1200@1680.-252.1920.1200" timestamp="1587713287518" />
<state x="2305" y="36" width="670" height="676" key="search.everywhere.popup/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1587712362381" />
<state x="2305" y="36" width="670" height="676" key="search.everywhere.popup/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589893517546" />
<state x="570" y="254" width="670" height="590" key="search.everywhere.popup/35.23.1645.1027/1680.-229.1920.1177@35.23.1645.1027" timestamp="1587004990635" />
<state x="570" y="254" width="670" height="590" key="search.everywhere.popup/35.23.1645.1027@35.23.1645.1027" timestamp="1589767535433" />
</component>
</project>
\ No newline at end of file
......@@ -2,10 +2,10 @@ var __extends;var __assign;var __rest;var __decorate;var __param;var __metadata;
}};__exportStar=function(m,exports){for(var p in m){if(!exports.hasOwnProperty(p)){exports[p]=m[p]}}};__values=function(o){var m=typeof Symbol==="function"&&o[Symbol.iterator],i=0;if(m){return m.call(o)}return{next:function(){if(o&&i>=o.length){o=void 0}return{value:o&&o[i++],done:!o}}}};__read=function(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m){return o}var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-->0)&&!(r=i.next()).done){ar.push(r.value)}}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"])){m.call(i)}}finally{if(e){throw e.error}}}return ar};__spread=function(){for(var ar=[],i=0;i<arguments.length;i++){ar=ar.concat(__read(arguments[i]))}return ar};__spreadArrays=function(){for(var s=0,i=0,il=arguments.length;i<il;i++){s+=arguments[i].length}for(var r=Array(s),k=0,i=0;i<il;i++){for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++){r[k]=a[j]}}return r};__await=function(v){return this instanceof __await?(this.v=v,this):new __await(v)};__asyncGenerator=function(thisArg,_arguments,generator){if(!Symbol.asyncIterator){throw new TypeError("Symbol.asyncIterator is not defined.")}var g=generator.apply(thisArg,_arguments||[]),i,q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){if(g[n]){i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})}}}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){if(f(v),q.shift(),q.length){resume(q[0][0],q[0][1])}}};__asyncDelegator=function(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await(o[n](v)),done:n==="return"}:f?f(v):v}:f}};__asyncValues=function(o){if(!Symbol.asyncIterator){throw new TypeError("Symbol.asyncIterator is not defined.")}var m=o[Symbol.asyncIterator],i;return m?m.call(o):(o=typeof __values==="function"?__values(o):o[Symbol.iterator](),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){v=o[n](v),settle(resolve,reject,v.done,v.value)})}}function settle(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)}};__makeTemplateObject=function(cooked,raw){if(Object.defineProperty){Object.defineProperty(cooked,"raw",{value:raw})}else{cooked.raw=raw}return cooked};__importStar=function(mod){if(mod&&mod.__esModule){return mod}var result={};if(mod!=null){for(var k in mod){if(Object.hasOwnProperty.call(mod,k)){result[k]=mod[k]}}}result["default"]=mod;return result};__importDefault=function(mod){return(mod&&mod.__esModule)?mod:{"default":mod}};exporter("__extends",__extends);exporter("__assign",__assign);exporter("__rest",__rest);exporter("__decorate",__decorate);exporter("__param",__param);exporter("__metadata",__metadata);exporter("__awaiter",__awaiter);exporter("__generator",__generator);exporter("__exportStar",__exportStar);exporter("__values",__values);exporter("__read",__read);exporter("__spread",__spread);exporter("__spreadArrays",__spreadArrays);exporter("__await",__await);exporter("__asyncGenerator",__asyncGenerator);exporter("__asyncDelegator",__asyncDelegator);exporter("__asyncValues",__asyncValues);exporter("__makeTemplateObject",__makeTemplateObject);exporter("__importStar",__importStar);exporter("__importDefault",__importDefault)});
var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: __decorate,__param: __param,__metadata: __metadata,__awaiter: __awaiter,__generator: __generator,__exportStar: __exportStar,__values: __values,__read: __read,__spread: __spread,__spreadArrays: __spreadArrays,__await: __await,__asyncGenerator: __asyncGenerator,__asyncDelegator: __asyncDelegator,__asyncValues: __asyncValues,__makeTemplateObject: __makeTemplateObject,__importStar: __importStar,__importDefault: __importDefault};
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib')) :
typeof define === 'function' && define.amd ? define(['exports', 'tslib'], factory) :
(global = global || self, factory(global.engine = {}, global.tslib));
}(this, function (exports, tslib_1) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('props-compute')) :
typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'props-compute'], factory) :
(global = global || self, factory(global.engine = {}, global.tslib, global.propsCompute));
}(this, (function (exports, tslib_1, propsCompute) { 'use strict';
var HashObject = (function () {
function HashObject() {
......@@ -63,6 +63,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s.type = type;
delete s.data;
};
Event.MAYBE_ALIGN = "maybeAlign";
Event.RESIZE = "onResize";
Event.ON_SCROLL_TO_HEAD = "onScrollToHead";
Event.ON_SCROLL_STOP = "onScrollStop";
......@@ -1634,135 +1635,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return MouseEvent;
}(Event));
function applyAutoAdjust(ctor) {
ctor.prototype.applyAutoAdjust = function () {
var adjustProxy = this.adjustProxy = new AdjustProxy(this);
this.addEventListener(Event.ADDED_TO_STAGE, adjustProxy.onAddedToStage, adjustProxy);
this.addEventListener(Event.REMOVED_FROM_STAGE, adjustProxy.onRemovedFromStage, adjustProxy);
};
var temp = new AdjustProxy(null);
var _loop_1 = function (key) {
Object.defineProperty(ctor.prototype, key, {
get: function () {
return this.adjustProxy.data[key];
},
set: function (v) {
var adjustProxy = this.adjustProxy;
if (adjustProxy.data[key] !== v) {
adjustProxy.data[key] = v;
adjustProxy.makeDirty();
}
},
enumerable: true,
configurable: true
});
};
for (var key in temp.data) {
_loop_1(key);
}
}
var AdjustProxy = (function () {
function AdjustProxy(host) {
this.data = {
percentWidth: NaN,
percentHeight: NaN,
left: NaN,
top: NaN,
right: NaN,
bottom: NaN,
horizonCenter: NaN,
verticalCenter: NaN,
};
this._host = host;
this.makeDirty();
}
AdjustProxy.prototype.makeDirty = function () {
this._sizeDirty = true;
};
AdjustProxy.prototype.onAddedToStage = function (e) {
this._host.parent.addEventListener(Event.RESIZE, this.onResize, this);
this._host.addEventListener(Event.RESIZE, this.onResize, this);
this._host.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, this);
};
AdjustProxy.prototype.onRemovedFromStage = function (e) {
this._host.removeEventListener(Event.RESIZE, this.onResize, this);
this._host.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
};
AdjustProxy.prototype.setFrom = function (adjustProxy) {
for (var k in adjustProxy.data) {
this.data[k] = adjustProxy.data[k];
}
};
AdjustProxy.prototype.onResize = function (e) {
this._sizeDirty = true;
};
AdjustProxy.prototype.onEnterFrame = function (e) {
if (this._sizeDirty) {
this._sizeDirty = false;
this.adjustLayout();
}
};
AdjustProxy.prototype.adjustLayout = function () {
var that = this._host;
var _a = that.parent, pWidth = _a.width, pHeight = _a.height;
var width = that.width, height = that.height;
var _b = this.data, percentWidth = _b.percentWidth, percentHeight = _b.percentHeight, left = _b.left, top = _b.top, right = _b.right, bottom = _b.bottom, horizonCenter = _b.horizonCenter, verticalCenter = _b.verticalCenter;
var applyPercentWidth = function () {
if (t(percentWidth)) {
that.width = pWidth * percentWidth / 100;
}
};
var applyPercentHeight = function () {
if (t(percentHeight)) {
that.height = pHeight * percentHeight / 100;
}
};
var pw = true, ph = true;
if (t(horizonCenter)) {
applyPercentWidth();
that.x = (pWidth - that.width) / 2 + horizonCenter;
}
else {
if (t(left)) {
that.x = left;
if (t(right)) {
that.width = pWidth - left - right;
pw = false;
}
}
else if (t(right)) {
that.x = pWidth - width - right;
}
if (pw) {
applyPercentWidth();
}
}
if (t(verticalCenter)) {
applyPercentHeight();
that.y = (pHeight - that.height) / 2 + verticalCenter;
}
else {
if (t(top)) {
that.y = top;
if (t(bottom)) {
that.height = pHeight - top - bottom;
ph = false;
}
}
else if (t(bottom)) {
that.y = pHeight - height - bottom;
}
if (ph) {
applyPercentHeight();
}
}
};
return AdjustProxy;
}());
function t(v) {
return !isNaN(v) && v !== null && v !== undefined;
}
var ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
var linkedFlag = '$_linked_$';
var nodeScheme = 'node://';
......@@ -2016,6 +1888,198 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
}
function toBoolean(v) {
return !isNaN(v) && v !== null && v !== undefined;
}
var AlignManager = (function () {
function AlignManager() {
this.alignList = [];
}
AlignManager.prototype.flush = function () {
var _this = this;
this.alignList.forEach(function (v) {
_this.autoSize(v);
_this.align(v);
});
this.alignList.forEach(function (v) {
if (v.alignMode === ALIGN_MODE.ONCE) {
v.alignEnabled = false;
}
});
this.alignList.length = 0;
};
AlignManager.prototype.align = function (that) {
var _this = this;
if (!that.alignEnabled)
return;
var percentWidth = that.percentWidth, percentHeight = that.percentHeight, left = that.left, top = that.top, right = that.right, bottom = that.bottom, horizonCenter = that.horizonCenter, verticalCenter = that.verticalCenter;
var _a = that._width, tW_Z = _a === void 0 ? 0 : _a, _b = that._height, tH_Z = _b === void 0 ? 0 : _b;
var _c = (that.parent || {}), _d = _c._width, pW_Z = _d === void 0 ? 0 : _d, _e = _c._height, pH_Z = _e === void 0 ? 0 : _e;
if (toBoolean(left) && toBoolean(right)) {
that.x = left;
that.width = pW_Z - left - right;
}
else {
toBoolean(percentWidth) && (tW_Z = that.width = pW_Z * percentWidth / 100);
if (toBoolean(horizonCenter)) {
that.x = pW_Z / 2 - tW_Z / 2 + horizonCenter;
}
else if (toBoolean(left)) {
that.x = left;
}
else if (toBoolean(right)) {
that.x = pW_Z - right - tW_Z;
}
}
if (toBoolean(top) && toBoolean(bottom)) {
that.y = top;
that.height = pH_Z - top - bottom;
}
else {
toBoolean(percentHeight) && (tH_Z = that.height = pH_Z * percentHeight / 100);
if (toBoolean(verticalCenter)) {
that.y = pH_Z / 2 - tH_Z / 2 + verticalCenter;
}
else if (toBoolean(top)) {
that.y = top;
}
else if (toBoolean(bottom)) {
that.y = pH_Z - bottom - tH_Z;
}
}
that.children.forEach(function (v) { return _this.align(v); });
};
AlignManager.prototype.autoSize = function (that) {
var len = that.children.length;
if (len > 0) {
if (that.autoWidth && !toBoolean(that.right) && !toBoolean(that.percentWidth)) {
var max = 0;
for (var i = 0; i < len; i++) {
if (toBoolean(that.children[i].right))
continue;
var _x = that.children[i].x || 0;
var _w = that.children[i].__width || 0;
if (_x + _w > max) {
max = _x + _w;
}
}
that.width = max;
}
if (that.autoHeight && !toBoolean(that.bottom) && !toBoolean(that.percentHeight)) {
var max = 0;
for (var i = 0; i < len; i++) {
if (toBoolean(that.children[i].bottom))
continue;
var _y = that.children[i].y || 0;
var _h = that.children[i].__height || 0;
if (_y + _h > max) {
max = _y + _h;
}
}
that.height = max;
}
}
};
AlignManager.prototype.addAlign = function (obj) {
if (this.alignList.indexOf(obj) < 0) {
this.alignList.push(obj);
}
};
return AlignManager;
}());
var alignMgr = new AlignManager();
function applyAutoAdjust(ctor) {
ctor.prototype.applyAutoAdjust = function () {
var adjustProxy = this.adjustProxy = new AdjustProxy(this);
this.addEventListener(Event.ADDED_TO_STAGE, adjustProxy.onAddedToStage, adjustProxy);
this.addEventListener(Event.REMOVED_FROM_STAGE, adjustProxy.onRemovedFromStage, adjustProxy);
};
var temp = new AdjustProxy(null);
var _loop_1 = function (key) {
if (key == 'alignMode')
return "continue";
Object.defineProperty(ctor.prototype, key, {
get: function () {
return this.adjustProxy.data[key];
},
set: function (v) {
var adjustProxy = this.adjustProxy;
if (adjustProxy.data[key] !== v && !(isNaN(adjustProxy.data[key]) && isNaN(v))) {
adjustProxy.data[key] = v;
adjustProxy.makeDirty();
}
},
enumerable: true,
configurable: true
});
};
for (var key in temp.data) {
_loop_1(key);
}
Object.defineProperty(ctor.prototype, 'alignMode', {
get: function () {
return this.adjustProxy.data['alignMode'];
},
set: function (v) {
var adjustProxy = this.adjustProxy;
if (adjustProxy.data['alignMode'] !== v) {
adjustProxy.data['alignMode'] = v;
adjustProxy.makeDirty();
if (v == ALIGN_MODE.ALWAYS)
this.alignEnabled = true;
}
},
enumerable: true,
configurable: true
});
}
var ALIGN_MODE;
(function (ALIGN_MODE) {
ALIGN_MODE["ONCE"] = "once";
ALIGN_MODE["ALWAYS"] = "always";
})(ALIGN_MODE || (ALIGN_MODE = {}));
var AdjustProxy = (function () {
function AdjustProxy(host) {
this.data = {
percentWidth: NaN,
percentHeight: NaN,
left: NaN,
top: NaN,
right: NaN,
bottom: NaN,
horizonCenter: NaN,
verticalCenter: NaN,
alignEnabled: true,
alignMode: ALIGN_MODE.ALWAYS,
};
this._host = host;
this.makeDirty();
}
AdjustProxy.prototype.makeDirty = function () {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty();
};
AdjustProxy.prototype.onAddedToStage = function (e) {
this._host.addEventListener(Event.MAYBE_ALIGN, this.readyAlign, this);
};
AdjustProxy.prototype.onRemovedFromStage = function (e) {
this._host.removeEventListener(Event.MAYBE_ALIGN, this.readyAlign);
};
AdjustProxy.prototype.setFrom = function (adjustProxy) {
for (var k in adjustProxy.data) {
this.data[k] = adjustProxy.data[k];
}
};
AdjustProxy.prototype.readyAlign = function (e) {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty();
};
return AdjustProxy;
}());
function transPoint(str, sep) {
if (sep === void 0) { sep = ','; }
......@@ -3093,6 +3157,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function Container() {
var _this = _super.call(this) || this;
_this._mouseChildren = true;
_this.__width = 0;
_this.__height = 0;
_this._autoWidth = false;
_this._autoHeight = false;
_this._instanceType = "Container";
_this.children = [];
_this._transform = _this.transform;
......@@ -3113,14 +3181,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Container.prototype.afterConstructor = function () {
};
Container.prototype.onChildrenChange = function (index) {
this.dispatchEvent(Event.MAYBE_ALIGN);
};
Container.prototype.attachVisibility = function () {
return;
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
for (var i = 0, li = this.children.length; i < li; i++) {
var child = this.children[i];
child.attachVisibility();
}
};
Container.prototype.addChild = function (child) {
this.addChildAt(child, this.children.length);
......@@ -3516,6 +3580,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this._width = value;
this._localBoundsSelf.width = value;
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
}
if (toBoolean(this.percentWidth)
|| (toBoolean(this.left) && toBoolean(this.right))) {
this.__width = 0;
}
else {
this.__width = value;
}
},
enumerable: true,
......@@ -3530,7 +3602,67 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this._height = value;
this._localBoundsSelf.height = value;
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
}
if (toBoolean(this.percentHeight)
|| (toBoolean(this.top) && toBoolean(this.bottom))) {
this.__height = 0;
}
else {
this.__height = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Container.prototype, "autoWidth", {
get: function () {
return this._autoWidth;
},
set: function (autoWidth) {
this._autoWidth = autoWidth;
this.right = NaN;
this.percentWidth = NaN;
this.adjustProxy.makeDirty();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Container.prototype, "autoHeight", {
get: function () {
return this._autoHeight;
},
set: function (autoHeight) {
this._autoHeight = autoHeight;
this.bottom = NaN;
this.percentHeight = NaN;
this.adjustProxy.makeDirty();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Container.prototype, "x", {
get: function () {
return this.position.x;
},
set: function (value) {
if (value == this.transform.position.x)
return;
this.transform.position.x = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Container.prototype, "y", {
get: function () {
return this.position.y;
},
set: function (value) {
if (value == this.transform.position.y)
return;
this.transform.position.y = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
},
enumerable: true,
configurable: true
......@@ -4675,7 +4807,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
function determineCrossOrigin(url, loc) {
if (loc === void 0) { loc = window.location; }
if (url.indexOf('data:') === 0) {
return '';
}
......@@ -5405,7 +5536,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return color;
}
function inputFeildIosEnable() {
var u = navigator.userAgent, app = navigator.appVersion;
var u = navigator.userAgent;
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if (isIOS) {
setTimeout(function () {
......@@ -5745,9 +5876,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return Math.abs(this.scale.x) * this._texture.orig.width;
},
set: function (value) {
value = Math.abs(value);
var s = sign(this.scale.x) || 1;
this.scale.x = s * value / this._texture.orig.width;
this._width = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
if (isNaN(this.percentWidth) || this.percentWidth === null) {
this.__width = value;
}
else {
this.__width = 0;
}
},
enumerable: true,
configurable: true
......@@ -5757,9 +5896,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return Math.abs(this.scale.y) * this._texture.orig.height;
},
set: function (value) {
value = Math.abs(value);
var s = sign(this.scale.y) || 1;
this.scale.y = s * value / this._texture.orig.height;
this._height = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
if (isNaN(this.percentHeight) || this.percentHeight === null) {
this.__height = value;
}
else {
this.__height = 0;
}
},
enumerable: true,
configurable: true
......@@ -8331,6 +8478,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Stage.flushAll = function () {
if (!GlobalPro.startTime)
GlobalPro.startTime = Date.now();
alignMgr.flush();
if (!Stage._pause) {
var len = Stage.allUpdateObjList.length;
for (var i = 0; i < len; i++) {
......@@ -11354,24 +11502,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var failedList = [];
return Promise.all(config.map(function (assetConfig) {
assetsConfig.push(assetConfig);
var url = assetConfig.url, ext = assetConfig.ext, uuid = assetConfig.uuid;
if (assetConfig.url.indexOf(linkScheme) === 0) {
var linkUUID = assetConfig.url.replace(linkScheme, '');
assetConfig = getAssetByUUID(linkUUID);
}
if (assetConfig) {
var url_1 = assetConfig.url, ext = assetConfig.ext, uuid = assetConfig.uuid;
var loadFunc = loaderMapping[ext];
if (loadFunc) {
if (url.indexOf(linkScheme) === 0) {
loaded++;
onProgress && onProgress(loaded, total);
return Promise.resolve();
}
var method = globalLoader['load' + loadFunc];
return method.call(globalLoader, url, uuid).then(function (data) {
return method.call(globalLoader, url_1, uuid).then(function (data) {
parse(assetConfig, data);
loaded++;
onProgress && onProgress(loaded, total);
}, function (error) {
failedList.push(url);
failedList.push(url_1);
});
}
else {
return p();
}
}
else {
return p();
}
function p() {
loaded++;
onProgress && onProgress(loaded, total);
return Promise.resolve();
......@@ -17150,10 +17305,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (playEffect === void 0) { playEffect = true; }
return new Promise(function (resolve) {
var action = 'popAll';
var lastView = _this.getChildAt(0);
var len = _this.childNum;
while (_this.children.length > 1) {
_this.removeChildAt(1);
if (len == 0) {
resolve();
return;
}
var lastView = _this.getChildAt(len);
while (_this.children.length > 2) {
_this.removeChildAt(0);
}
if (_this._mutex) {
_this._stack.splice(0);
......@@ -17162,7 +17321,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
view.visible = false;
_this.addChild(view);
}
var data = { action: action, view: view, lastView: lastView, options: options, hasView: len > 1 };
var data = { action: action, view: view, lastView: lastView, options: options, hasView: false };
_this.dispatchEvent(Event.START, data);
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, _this._mutex, lastView, view, _this, function () {
_this.dispatchEvent(Event.COMPLETE, data);
......@@ -20885,9 +21044,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return sendData();
};
}
function accessLog(pagebizid, params) {
function accessLog(pageBizId, params) {
var p = {
pagebizid: pagebizid,
pageBizId: pageBizId,
};
injectProp(p, params);
return httpRequest('buriedPoint', 'get', p);
......@@ -20999,30 +21158,22 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
});
GameStage.prototype.launch = function (config, onPreloadAssetsProgress, onPreloadAssetsComplete, onStart) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
function p() {
loaded++;
onPreloadAssetsProgress && onPreloadAssetsProgress(loaded, total);
if (loaded >= total) {
onPreloadAssetsComplete && onPreloadAssetsComplete();
}
}
var assets, customs, loaded, assetsToLoad, total;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
var _a, env, dataMapping, processes, builtinProcesses, customs;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
this._config = config;
assets = config.assets, customs = config.customs;
loaded = 0;
assetsToLoad = assets;
if (!Array.isArray(assets)) {
assetsToLoad = assets['common'];
_a = this._config, env = _a.options.env, dataMapping = _a.dataMapping, processes = _a.processes, builtinProcesses = _a.builtinProcesses, customs = _a.customs;
Stage.addUpdateObj(Tween);
injectEnv(env);
registerCustomModules(customs);
if (dataMapping) {
this.dataCenter.registerDataMapping(dataMapping);
}
total = assetsToLoad.length;
return [4, loadAssets(assetsToLoad, p).catch(function (e) {
console.log(e);
})];
setProcessMetaLibs(processes, builtinProcesses);
return [4, this.loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete)];
case 1:
_a.sent();
_b.sent();
this.start();
dealPxEnv();
dealPageRemainTime();
......@@ -21035,14 +21186,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
GameStage.prototype.start = function () {
var _this = this;
var _a = this._config, _b = _a.options, entrySceneView = _b.entrySceneView, env = _b.env, dataMapping = _a.dataMapping, processes = _a.processes, builtinProcesses = _a.builtinProcesses, scripts = _a.scripts, customs = _a.customs;
Stage.addUpdateObj(Tween);
injectEnv(env);
registerCustomModules(customs);
if (dataMapping) {
this.dataCenter.registerDataMapping(dataMapping);
}
setProcessMetaLibs(processes, builtinProcesses);
var entrySceneView = this._config.options.entrySceneView;
setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var sceneEntry;
return tslib_1.__generator(this, function (_a) {
......@@ -21119,6 +21263,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
groups[viewConfig.uuid] = depAssets;
}
}
if (!(Object.keys(groups).length > 0)) return [3, 2];
return [4, loadAssetsGroups(groups, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
......@@ -21206,6 +21351,58 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
};
GameStage.prototype.onPopupContainerComplete = function (e) {
};
GameStage.prototype.loadPreloadAssets = function (onPreloadAssetsProgress, onPreloadAssetsComplete) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
function p() {
loaded++;
onPreloadAssetsProgress && onPreloadAssetsProgress(loaded, total);
if (loaded >= total) {
onPreloadAssetsComplete && onPreloadAssetsComplete();
}
}
var assets, loaded, assetsToLoad, total;
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
assets = this._config.assets;
loaded = 0;
assetsToLoad = assets;
if (!!Array.isArray(assets)) return [3, 4];
assetsToLoad = assets['common'];
if (!(assetsToLoad.length > 0)) return [3, 3];
return [4, this.showInnerLoadingView()];
case 1:
_a.sent();
return [4, loadAssetsGroups({
preload: assetsToLoad,
}, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
return [2];
});
}); }, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
this.hideInnerLoadingView();
return [2];
});
}); })];
case 2:
_a.sent();
_a.label = 3;
case 3: return [3, 6];
case 4:
total = assetsToLoad.length;
return [4, loadAssets(assetsToLoad, p).catch(function (e) {
console.log(e);
})];
case 5:
_a.sent();
_a.label = 6;
case 6: return [2];
}
});
});
};
return GameStage;
}(Node$1));
......@@ -21293,6 +21490,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}
}
var alignManager = alignMgr;
function launch(url, loadingDelegate, onStart) {
if (queryParams.__proxy_mode__) {
return Promise.resolve('cancel launch');
......@@ -21358,101 +21556,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
};
/**
* Created by rockyl on 2020-01-27.
*/
var genericRegexp = /(\w+)(<(\w+)>)?/;
function compute(props, options) {
var result = props || {};
var _loop_1 = function (key) {
var sourceValue = getValue(result, options, key);
var value = sourceValue;
if (options) {
var option = options[key];
if (option && option.type) {
var _a = parseType(option.type), type = _a.type, generic_1 = _a.generic;
switch (type) {
case 'vector2':
value = parseVector2(sourceValue);
break;
case 'array':
var seps = sourceValue.split(',');
seps = seps.map(function (sep) {
var item;
if (generic_1) {
switch (generic_1) {
case 'number':
item = parseFloat(sep);
break;
case 'boolean':
item = sep === 'true';
break;
default:
item = sep;
break;
}
}
else {
item = sep;
}
return item;
});
value = seps;
break;
}
}
}
result[key] = value;
};
for (var key in options) {
_loop_1(key);
}
return result;
}
function parseType(typeStr) {
var type = typeStr, generic;
var regResult = typeStr.match(genericRegexp);
if (regResult) {
type = regResult[1];
generic = regResult[3];
}
return {
type: type, generic: generic,
};
}
function parseVector2(sourceValue) {
var value = sourceValue;
if (!sourceValue) {
value = { x: undefined, y: undefined };
}
if (typeof sourceValue === 'string') {
var arr = sourceValue.split(',');
value = {
x: arr[0] === '' ? undefined : parseFloat(arr[0]),
y: arr[1] === '' ? undefined : parseFloat(arr[1]),
};
}
else if (Array.isArray(sourceValue)) {
value = {
x: sourceValue[0] === '' ? undefined : parseFloat(sourceValue[0]),
y: sourceValue[1] === '' ? undefined : parseFloat(sourceValue[1]),
};
}
return value;
}
function getValue(props, options, key) {
var value;
if (props.hasOwnProperty(key)) {
value = props[key];
}
else if (options && options[key].hasOwnProperty('default')) {
value = options[key].default;
}
return value;
}
var emojiRegexp = emojiRegex();
Object.defineProperty(exports, 'computeProps', {
enumerable: true,
get: function () {
return propsCompute.compute;
}
});
exports.BaseTexture = BaseTexture;
exports.BaseTextureCache = BaseTextureCache;
exports.BitmapText = BitmapText;
......@@ -21517,6 +21628,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.abs = abs;
exports.accessLog = accessLog;
exports.addCustomModule = addCustomModule;
exports.alignManager = alignManager;
exports.appendScript = appendScript;
exports.applyEvents = applyEvents;
exports.applyScript = applyScript;
......@@ -21527,7 +21639,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.clearTextureCache = clearTextureCache;
exports.cmdOldPrefix = cmdOldPrefix;
exports.cmdPrefix = cmdPrefix;
exports.computeProps = compute;
exports.copyProp = copyProp;
exports.cos = cos;
exports.countTrailingZeros = countTrailingZeros;
......@@ -21633,6 +21744,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.strLen = strLen;
exports.strShort = strShort;
exports.string2hex = string2hex;
exports.toBoolean = toBoolean;
exports.toDisplayDataURL = toDisplayDataURL;
exports.transPoint = transPoint;
exports.traverseViewNode = traverseViewNode;
......@@ -21642,5 +21754,5 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Object.defineProperty(exports, '__esModule', { value: true });
}));
})));
//# sourceMappingURL=engine.js.map
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -26,10 +26,10 @@ export default {
},
],
plugins: [
progress(),
// progress(),
resolve({}),
typescript({
//useTsconfigDeclarationDir: true,
// useTsconfigDeclarationDir: true,
}),
commonjs(),
process.env.BUILD === 'production' && uglify({})
......
import {DisplayObject} from './DisplayObject';
import {Rectangle} from "../math/Rectangle";
import {Point} from '../math/index';
import { DisplayObject } from './DisplayObject';
import { Rectangle } from "../math/Rectangle";
import { Point } from '../math/index';
import CanvasRenderer from '../renderers/CanvasRenderer';
import {Event} from "../events/Event"
import {WebglRenderer} from '../renderers/WebglRenderer';
import {applyAutoAdjust} from "../../zeroing/decorators/auto-adjust";
import {applyScript} from "../../zeroing/decorators/scripts";
import {applyEvents} from "../../zeroing/decorators/events";
import {afterConstructor} from "../../zeroing/decorators/after-constructor";
import {injectProperties, instantiateScript} from "../../zeroing/utils/index";
import {isUI} from "../../zeroing/game-warpper/nodes/IUIComponent";
import { Event } from "../events/Event"
import { WebglRenderer } from '../renderers/WebglRenderer';
import { applyAutoAdjust } from "../../zeroing/decorators/auto-adjust";
import { applyScript } from "../../zeroing/decorators/scripts";
import { applyEvents } from "../../zeroing/decorators/events";
import { afterConstructor } from "../../zeroing/decorators/after-constructor";
import { injectProperties, instantiateScript, toBoolean } from "../../zeroing/utils/index";
import { isUI } from "../../zeroing/game-warpper/nodes/IUIComponent";
import Transform from "../math/Transform";
/**
......@@ -81,12 +81,13 @@ export default class Container extends DisplayObject {
onChildrenChange(index) {
/* empty */
//子类需要时重写
this.dispatchEvent(Event.MAYBE_ALIGN);
}
attachVisibility() {
return;
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
for (let i = 0, li = this.children.length; i < li; i++) {
for(let i = 0, li = this.children.length; i < li; i++) {
const child = <Container>this.children[i];
child.attachVisibility();
}
......@@ -110,18 +111,18 @@ export default class Container extends DisplayObject {
* @return {DisplayObject} The child that was added.
*/
addChildAt(child: DisplayObject, index: number): DisplayObject {
if (!child) return;
if(!child) return;
let s = this;
let sameParent = (s == child.parent);
let len: number;
if (child.parent) {
if (!sameParent) {
if(child.parent) {
if(!sameParent) {
child.parent.removeChild(child);
} else {
len = s.children.length;
for (let i = 0; i < len; i++) {
if (s.children[i] == child) {
for(let i = 0; i < len; i++) {
if(s.children[i] == child) {
s.children.splice(i, 1);
break;
}
......@@ -137,16 +138,16 @@ export default class Container extends DisplayObject {
this._boundsID++;
len = s.children.length;
if (index >= len) {
if(index >= len) {
s.children[s.children.length] = child;
index = len;
} else if (index == 0 || index < 0) {
} else if(index == 0 || index < 0) {
s.children.unshift(child);
index = 0;
} else {
s.children.splice(index, 0, child);
}
if (s.stage && !sameParent) {
if(s.stage && !sameParent) {
// child["_cp"] = true;
child._onDispatchBubbledEvent(Event.ADDED_TO_STAGE);
}
......@@ -162,24 +163,24 @@ export default class Container extends DisplayObject {
* @param {DisplayObject} child2 - Second display object to swap
*/
swapChildren(child1: DisplayObject, child2: DisplayObject) {
if (child1 === child2) {
if(child1 === child2) {
return;
}
let s = this;
let id1 = -1;
let id2 = -1;
let childCount = s.children.length;
if (typeof (child1) == "number") {
if(typeof (child1) == "number") {
id1 = child1;
} else {
id1 = s.getChildIndex(child1);
}
if (typeof (child2) == "number") {
if(typeof (child2) == "number") {
id2 = child2;
} else {
id2 = s.getChildIndex(child2);
}
if (id1 == id2 || id1 < 0 || id1 >= childCount || id2 < 0 || id2 >= childCount) {
if(id1 == id2 || id1 < 0 || id1 >= childCount || id2 < 0 || id2 >= childCount) {
return false;
} else {
let temp: any = s.children[id1];
......@@ -200,7 +201,7 @@ export default class Container extends DisplayObject {
getChildIndex(child: DisplayObject): number {
const index = this.children.indexOf(child);
if (index === -1) {
if(index === -1) {
return null
}
return index;
......@@ -229,7 +230,7 @@ export default class Container extends DisplayObject {
* @return {DisplayObject} The child at the given index, if any.
*/
getChildAt(index: number): DisplayObject {
if (index < 0 || index >= this.children.length) {
if(index < 0 || index >= this.children.length) {
return null
}
return this.children[index];
......@@ -241,14 +242,14 @@ export default class Container extends DisplayObject {
* @param method
*/
getChildByPath(path: any, method: string): DisplayObject {
if (!path) {
if(!path) {
return null;
}
let p = this;
while (path.length > 0) {
while(path.length > 0) {
let segment = path.shift();
p = p[method](segment);
if (!p) {
if(!p) {
break;
}
}
......@@ -279,15 +280,15 @@ export default class Container extends DisplayObject {
* @param uuid
*/
findChildByUUID(uuid: string) {
if (this['uuid'] === uuid) {
if(this['uuid'] === uuid) {
return this;
}
if (this.children && this.children.length > 0) {
for (let child of this.children) {
if (child.findChildByUUID) {
if(this.children && this.children.length > 0) {
for(let child of this.children) {
if(child.findChildByUUID) {
let target = child.findChildByUUID(uuid);
if (target) {
if(target) {
return target;
}
}
......@@ -302,10 +303,10 @@ export default class Container extends DisplayObject {
* @param isRecursive
*/
public getChildByName(name: string | RegExp, isOnlyOne: boolean = true, isRecursive: boolean = false): any {
if (!name) return null;
if(!name) return null;
let s = this;
let rex: any;
if (typeof (name) == "string") {
if(typeof (name) == "string") {
rex = new RegExp("^" + name + "$");
} else {
rex = name;
......@@ -313,9 +314,9 @@ export default class Container extends DisplayObject {
let elements: Array<DisplayObject> = [];
Container._getElementsByName(rex, s, isOnlyOne, isRecursive, elements);
let len = elements.length;
if (len == 0) {
if(len == 0) {
return null;
} else if (len == 1) {
} else if(len == 1) {
return elements[0];
} else {
return elements;
......@@ -331,7 +332,7 @@ export default class Container extends DisplayObject {
const index = this.children.indexOf(child);
if (index === -1) return null;
if(index === -1) return null;
this.removeChildAt(index);
......@@ -347,10 +348,10 @@ export default class Container extends DisplayObject {
let s = this;
let child: any;
let len = s.children.length - 1;
if (len < 0) return;
if (index == len) {
if(len < 0) return;
if(index == len) {
child = s.children.pop();
} else if (index == 0) {
} else if(index == 0) {
child = s.children.shift();
} else {
child = s.children.splice(index, 1)[0];
......@@ -381,12 +382,12 @@ export default class Container extends DisplayObject {
const range = end - begin;
let removed;
if (range > 0 && range <= end) {
if(range > 0 && range <= end) {
removed = this.children.splice(begin, range);
for (let i = 0; i < removed.length; ++i) {
for(let i = 0; i < removed.length; ++i) {
removed[i].parent = null;
if (removed[i].transform) {
if(removed[i].transform) {
removed[i].transform._parentID = -1;
}
}
......@@ -395,12 +396,12 @@ export default class Container extends DisplayObject {
this.onChildrenChange(beginIndex);
for (let i = 0; i < removed.length; ++i) {
for(let i = 0; i < removed.length; ++i) {
removed[i]._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE);
}
return removed;
} else if (range === 0 && this.children.length === 0) {
} else if(range === 0 && this.children.length === 0) {
return [];
}
......@@ -416,9 +417,9 @@ export default class Container extends DisplayObject {
//考虑是否要加,
this._boundsID++;
//children遍历计算
for (let i = 0, j = this.children.length; i < j; ++i) {
for(let i = 0, j = this.children.length; i < j; ++i) {
const child = this.children[i];
if (child.visible) {
if(child.visible) {
child.updateTransform();
}
}
......@@ -435,30 +436,30 @@ export default class Container extends DisplayObject {
* 都是全局的
*/
calculateBounds() {
if (this._lastBoundsID == this._boundsID) return
if(this._lastBoundsID == this._boundsID) return
this._lastBoundsID = this._boundsID
this._bounds.clear();
//算自己的
this._calculateBounds();
for (let i = 0; i < this.children.length; i++) {
for(let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (!child.visible || !child.renderable) {
if(!child.visible || !child.renderable) {
continue;
}
child.calculateBounds();
if (child.$mask) {
if(child.$mask) {
child.$mask.calculateBounds();
//取交集矩形
if (child._bounds.x < child.$mask._bounds.x) {
if(child._bounds.x < child.$mask._bounds.x) {
child._bounds.x = child.$mask._bounds.x;
}
if (child._bounds.y < child.$mask._bounds.y) {
if(child._bounds.y < child.$mask._bounds.y) {
child._bounds.y = child.$mask._bounds.y;
}
if (child._bounds.width > child.$mask._bounds.width) {
if(child._bounds.width > child.$mask._bounds.width) {
child._bounds.width = child.$mask._bounds.width;
}
if (child._bounds.height > child.$mask._bounds.height) {
if(child._bounds.height > child.$mask._bounds.height) {
child._bounds.height = child.$mask._bounds.height;
}
Rectangle.createFromRects(this._bounds, child._bounds);
......@@ -488,7 +489,7 @@ export default class Container extends DisplayObject {
this._bounds.height = this._height;
}*/
if(widthSetted || heightSetted){
if(widthSetted || heightSetted) {
const rect = this._localBoundsSelf;
var matrix = this.transform.worldMatrix;
matrix.transformPoint(rect.x, rect.y, DisplayObject._p1);
......@@ -505,43 +506,43 @@ export default class Container extends DisplayObject {
*/
hitTestPoint(globalPoint: Point, isMouseEvent: boolean = false) {
//如果不可见
if (!this.visible) return null
if(!this.visible) return null
//如果禁止子级的鼠标事件
if (isMouseEvent && !this.mouseChildren){
if(isMouseEvent && !this.mouseChildren) {
return this.hitTestSelf(globalPoint);
}
var children = this.children;
var length = children.length;
let child, hitDisplayObject;
//后序遍历,后添加的在上层
for (var i = length - 1; i >= 0; i--) {
for(var i = length - 1; i >= 0; i--) {
child = children[i];
//当作遮罩的不作为检测,跳过
if (child.isUsedToMask) continue;
if(child.isUsedToMask) continue;
//有遮罩,但是不在遮罩内,跳过
if (child.mask && !child.mask.hitTestPoint(globalPoint, isMouseEvent)) continue;
if(child.mask && !child.mask.hitTestPoint(globalPoint, isMouseEvent)) continue;
//检测
hitDisplayObject = child.hitTestPoint(globalPoint, isMouseEvent);
//存在直接返回
if (hitDisplayObject) return hitDisplayObject;
if(hitDisplayObject) return hitDisplayObject;
}
return this.displayObjectHitTestPoint(globalPoint, isMouseEvent);
}
hitTestSelf(globalPoint) {
if (this.mouseEnabled) {
if(this.mouseEnabled) {
return this.hitTestSelfBounds(globalPoint);
}
return null;
}
hitTestSelfBounds(globalPoint) {
if (this._width && this._height) {
if(this._width && this._height) {
//let {x: tx, y: ty} = this.getBounds();
let {tx, ty} = this.worldMatrix;
const {x, y} = globalPoint;
if (x > tx &&
if(x > tx &&
x < tx + this.width &&
y > ty &&
y < ty + this.height
......@@ -556,17 +557,17 @@ export default class Container extends DisplayObject {
*/
renderWebGL(renderer: WebglRenderer) {
//不可见,全局透明度为0,或者 不渲染,直接return
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
if(!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return;
}
//是否有遮罩。到时如果有滤镜,
if (this.mask) {
if(this.mask) {
this.renderAdvancedWebGL(renderer);
} else {
//自身先渲染
this._renderWebGL(renderer);
//遍历children
for (let i = 0, j = this.children.length; i < j; ++i) {
for(let i = 0, j = this.children.length; i < j; ++i) {
this.children[i].renderWebGL(renderer);
}
}
......@@ -586,7 +587,7 @@ export default class Container extends DisplayObject {
const mask = this.mask;
if (mask) {
if(mask) {
//先画遮罩
renderer.maskManager.pushMask(this, this.mask);
}
......@@ -595,14 +596,14 @@ export default class Container extends DisplayObject {
this._renderWebGL(renderer);
//遍历children
for (let i = 0, j = this.children.length; i < j; i++) {
for(let i = 0, j = this.children.length; i < j; i++) {
this.children[i].renderWebGL(renderer);
}
//刷掉批处理
renderer.batchManager.flush();
if (mask) {
if(mask) {
//移除遮罩,支持多重遮罩
renderer.maskManager.popMask(this, this.mask);
}
......@@ -622,20 +623,20 @@ export default class Container extends DisplayObject {
* @param {CanvasRenderer} renderer - The renderer
*/
renderCanvas(renderer: CanvasRenderer) {
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
if(!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return;
}
if (this.mask) {
if(this.mask) {
renderer.maskManager.pushMask(this.mask);
}
this._renderCanvas(renderer);
for (let i = 0, j = this.children.length; i < j; ++i) {
for(let i = 0, j = this.children.length; i < j; ++i) {
this.children[i].renderCanvas(renderer);
}
if (this.mask) {
if(this.mask) {
renderer.maskManager.popMask(renderer);
}
}
......@@ -659,7 +660,7 @@ export default class Container extends DisplayObject {
super.update(deltaTime)
//更新儿子们的
let len = this.children.length;
for (let i = len - 1; i >= 0; i--) {
for(let i = len - 1; i >= 0; i--) {
const child = this.children[i];
/*if (child.visible)*/
child.update(deltaTime);
......@@ -677,9 +678,9 @@ export default class Container extends DisplayObject {
public _onDispatchBubbledEvent(type: string): void {
let s = this;
let len = s.children.length;
if (type == Event.REMOVED_FROM_STAGE && !s.stage) return;
if(type == Event.REMOVED_FROM_STAGE && !s.stage) return;
super._onDispatchBubbledEvent(type);
for (let i = 0; i < len; i++) {
for(let i = 0; i < len; i++) {
s.children[i]._onDispatchBubbledEvent(type);
}
......@@ -691,7 +692,7 @@ export default class Container extends DisplayObject {
destroy() {
let s = this;
//让子级也destroy
for (let i = s.children.length - 1; i >= 0; i--) {
for(let i = s.children.length - 1; i >= 0; i--) {
s.children[i].destroy();
}
super.destroy();
......@@ -715,12 +716,21 @@ export default class Container extends DisplayObject {
// } else {
// this.scale.x = 1;
// }
if (this._width !== value) {
if(this._width !== value) {
//子类有用,有_width,才需设置scaleX
this._width = value;
this._localBoundsSelf.width = value;
//if (this.stage) this.stage.layoutInvalid = true;
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
}
// 如果它设置了 percentWidth 或同时设置了 left 和 right 则表示他的宽度是相对的,则对于父级来说它的宽度永远是 0
if(toBoolean(this.percentWidth)
|| (toBoolean(this.left) && toBoolean(this.right))
) {
this.__width = 0;
} else {
this.__width = value;
}
}
......@@ -740,12 +750,76 @@ export default class Container extends DisplayObject {
// } else {
// this.scale.y = 1;
// }
if (this._height !== value) {
if(this._height !== value) {
this._height = value;
this._localBoundsSelf.height = value;
//if (this.stage) this.stage.layoutInvalid = true;
this.dispatchEvent(Event.RESIZE);
this.dispatchEvent(Event.MAYBE_ALIGN);
}
// 如果它设置了 percentHeight 或同时设置了 top 和 bottom 则表示他的高度是相对的,则对于父级来说它的高度永远是 0
if(toBoolean(this.percentHeight)
|| (toBoolean(this.top) && toBoolean(this.bottom))
) {
this.__height = 0;
} else {
this.__height = value;
}
}
protected __width = 0; // 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到
protected __height = 0; // 忽略 相对高度 的 高度,在父级计算自动高度的时候用到
protected _autoWidth = false; // 自动宽度?
protected _autoHeight = false; // 自动高度?
public get autoWidth() {
return this._autoWidth;
}
public get autoHeight() {
return this._autoHeight;
}
public set autoWidth(autoWidth) {
this._autoWidth = autoWidth;
this.right = NaN; /// TODO 不知道需不需要
this.percentWidth = NaN; /// TODO 不知道需不需要
this.adjustProxy.makeDirty();
}
public set autoHeight(autoHeight) {
this._autoHeight = autoHeight;
this.bottom = NaN; /// TODO 不知道需不需要
this.percentHeight = NaN; /// TODO 不知道需不需要
this.adjustProxy.makeDirty();
}
// public judgeAutoSize() {
// this.autoWidth = !(toBoolean(this.right) || toBoolean(this.percentWidth) || toBoolean(this._width));
// this.autoHeight = !(toBoolean(this.bottom) || toBoolean(this.percentHeight) || toBoolean(this._height));
// }
get x(): number {
return this.position.x;
}
set x(value: number) {
if(value == this.transform.position.x) return;
this.transform.position.x = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
}
get y(): number {
return this.position.y;
}
set y(value: number) {
if(value == this.transform.position.y) return;
this.transform.position.y = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
}
clone(withEvents = false, withScripts = false) {
......@@ -757,20 +831,20 @@ export default class Container extends DisplayObject {
target['__originConfig'] = originConfig;
injectProperties(target, properties);
if (withScripts) {
if (scripts && scripts.length > 0) {
for (let scriptConfig of scripts) {
if(withScripts) {
if(scripts && scripts.length > 0) {
for(let scriptConfig of scripts) {
instantiateScript(target, scriptConfig);
}
}
}
if (withEvents) {
if (events) {
if(withEvents) {
if(events) {
target.eventsProxy.start(events);
}
}
for (let child of this.children) {
for(let child of this.children) {
let childCopy = child.clone(withEvents, withScripts);
target.addChild(childCopy);
}
......@@ -781,14 +855,14 @@ export default class Container extends DisplayObject {
get $store() {
let p = this;
do {
if (p['$isViewRoot']) {
if(p['$isViewRoot']) {
break;
}
p = p.parent;
}
while (p.parent);
while(p.parent);
if (p) {
if(p) {
return p['$_store'];
}
}
......@@ -806,22 +880,22 @@ export default class Container extends DisplayObject {
*/
private static _getElementsByName(rex: RegExp, root: Container, isOnlyOne: boolean, isRecursive: boolean, resultList: Array<DisplayObject>): void {
let len = root.children.length;
if (len > 0) {
if(len > 0) {
let name: string;
let child: any;
for (let i = 0; i < len; i++) {
for(let i = 0; i < len; i++) {
child = root.children[i];
name = child.name;
if (name && name != "") {
if (rex.test(name)) {
if(name && name != "") {
if(rex.test(name)) {
resultList[resultList.length] = child;
if (isOnlyOne) {
if(isOnlyOne) {
return;
}
}
}
if (isRecursive) {
if (child["children"] != null) {
if(isRecursive) {
if(child["children"] != null) {
Container._getElementsByName(rex, child, isOnlyOne, isRecursive, resultList);
}
}
......
......@@ -395,10 +395,19 @@ export default class Sprite extends Container {
}
set width(value) {
value = Math.abs(value);
const s = sign(this.scale.x) || 1;
this.scale.x = s * value / this._texture.orig.width;
this._width = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
if(isNaN(this.percentWidth) || this.percentWidth === null) {
this.__width = value;
} else {
this.__width = 0;
}
}
/**
......@@ -410,9 +419,17 @@ export default class Sprite extends Container {
}
set height(value) {
value = Math.abs(value);
const s = sign(this.scale.y) || 1;
this.scale.y = s * value / this._texture.orig.height;
this._height = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
if(isNaN(this.percentHeight) || this.percentHeight === null) {
this.__height = value;
} else {
this.__height= 0;
}
}
/**
......
......@@ -12,6 +12,7 @@ import {WebglRenderer} from "../renderers/WebglRenderer";
import {GDispatcher} from "../events/GDispatcher";
import CanvasRenderer from "../renderers/CanvasRenderer";
import {GlobalPro, isWebGLSupported} from "../utils/index";
import { alignMgr } from "../../zeroing/decorators/AlignManager";
//如果以后还出现帧率问题,使用ticker;
//兼容requestAnimationFrame
......@@ -972,12 +973,13 @@ export class Stage extends Container {
if (!GlobalPro.startTime) GlobalPro.startTime = Date.now();
//console.log('flushAll', Date.now());
alignMgr.flush();
if (!Stage._pause) {
let len = Stage.allUpdateObjList.length;
for (let i = 0; i < len; i++) {
Stage.allUpdateObjList[i] && Stage.allUpdateObjList[i].flush();
}
}
requestAnimationFrame(Stage.flushAll);
}
......
......@@ -9,8 +9,9 @@ import {HashObject} from "../HashObject";
*/
export class Event extends HashObject {
// public static IMAGE_LOADED: string = "onImageLoaded"
public static MAYBE_ALIGN: string = "maybeAlign";
// public static IMAGE_LOADED: string = "onImageLoaded"
/**
* 舞台尺寸发生变化时触发
* @Event
......
import { ALIGN_MODE } from "./auto-adjust";
import { toBoolean } from "../utils/utils";
/**
* 自适应管理器
* @constructor
*/
class AlignManager {
// 这个列表里的对象会在渲染前被自动调整
private alignList = [];
constructor() {
}
/**
* flash (渲染前)
*/
public flush() {
this.alignList.forEach((v) => {
this.autoSize(v); // 去调整大小
this.align(v); // 去自动对齐
});
// 要在这里单独检查,因为对齐一次后可能遇到其父节点需要对齐导致其再对齐一次
this.alignList.forEach((v) => {
if(v.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
v.alignEnabled = false;
}
});
// 干掉列表
this.alignList.length = 0;
}
/**
* align
* @param that
*/
private align(that) {
// if(that)
if(!that.alignEnabled) return; // 如果的自动对齐关闭里则啥也不干
// if(that.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
// that.alignEnabled = false;
// }
const {percentWidth, percentHeight, left, top, right, bottom, horizonCenter, verticalCenter} = that;
let {_width: tW_Z = 0, _height: tH_Z = 0} = that;
const {_width: pW_Z = 0, _height: pH_Z = 0} = (that.parent || {});
/**
* 计算 width 和 x 值
*/
if(toBoolean(left) && toBoolean(right)) { // left right 都有则直接拉伸或缩小
that.x = left;
that.width = pW_Z - left - right;
} else {
// 先设置下自己的 width
toBoolean(percentWidth) && (tW_Z = that.width = pW_Z * percentWidth / 100);
// 先考虑 horizonCenter 属性
if(toBoolean(horizonCenter)) {
// x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
that.x = pW_Z / 2 - tW_Z / 2 + horizonCenter;
} else if(toBoolean(left)) { // 假如有左边距
that.x = left;
} else if(toBoolean(right)) { // 假如有右边距
that.x = pW_Z - right - tW_Z;
}
}
/**
* 计算 height 和 y 值
*/
if(toBoolean(top) && toBoolean(bottom)) { // top bottom 都有则直接拉伸或缩小
that.y = top;
that.height = pH_Z - top - bottom;
} else {
// 先设置下自己的 height
toBoolean(percentHeight) && (tH_Z = that.height = pH_Z * percentHeight / 100);
// 先考虑 horizonCenter 属性
if(toBoolean(verticalCenter)) {
// x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
that.y = pH_Z / 2 - tH_Z / 2 + verticalCenter;
} else if(toBoolean(top)) { // 假如有 top
that.y = top;
} else if(toBoolean(bottom)) { // 假如有 bottom
that.y = pH_Z - bottom - tH_Z;
}
}
// console.log(that.name, that.width, that.height);
that.children.forEach(v => this.align(v));
}
/**
* 自动大小
* @param that
*/
private autoSize(that) {
let len = that.children.length
if(len > 0) {
// 检测本身的是否是可以自动宽
if(that.autoWidth && !toBoolean(that.right) && !toBoolean(that.percentWidth)) {
// 找出子节点最小x
// let minX = 0;
// for(let i = 0; i < len; i++) {
// if(that.children[i].x < minX) {
// minX = that.children[i].x;
// }
// }
// if(minX < 0) {
// that.children.forEach(v => v.x -= minX);
// that.x += minX;
// that.width -= minX;
// }
// 找出最右值
let max = 0;
for(let i = 0; i < len; i++) {
if(toBoolean(that.children[i].right)) continue;
let _x = that.children[i].x || 0;
let _w = that.children[i].__width || 0;
if(_x + _w > max) {
max = _x + _w;
}
}
that.width = max;
}
// 检测本身的是否是可以自动高
if(that.autoHeight && !toBoolean(that.bottom) && !toBoolean(that.percentHeight)) {
// 找出子节点最小y
// let minY = 0;
// for(let i = 1; i < len; i++) {
// if(that.children[i].y < minY) {
// minY = that.children[i].y;
// }
// }
// if(minY < 0) {
// that.children.forEach(v => v.y -= minY);
// that.y += minY;
// that.height -= minY;
// }
// 找出最下值
let max = 0;
for(let i = 0; i < len; i++) {
if(toBoolean(that.children[i].bottom)) continue;
let _y = that.children[i].y || 0;
let _h = that.children[i].__height || 0;
if(_y + _h > max) {
max = _y + _h;
}
}
that.height = max;
}
}
}
/**
* 添加一个变脏的对象
* @param obj
*/
public addAlign(obj) {
if(this.alignList.indexOf(obj) < 0) {
this.alignList.push(obj);
}
}
}
export let alignMgr = new AlignManager();
......@@ -4,27 +4,32 @@
* 自适应功能
*/
import {Event} from "../../2d/events/index";
import { Event } from "../../2d/events/index";
import { alignMgr } from "./AlignManager";
/**
* 应用自适应
* @param ctor
*/
export function applyAutoAdjust(ctor: Function) {
ctor.prototype.applyAutoAdjust = function () {
ctor.prototype.applyAutoAdjust = function() {
let adjustProxy = this.adjustProxy = new AdjustProxy(this);
this.addEventListener(Event.ADDED_TO_STAGE, adjustProxy.onAddedToStage, adjustProxy);
this.addEventListener(Event.REMOVED_FROM_STAGE, adjustProxy.onRemovedFromStage, adjustProxy);
};
let temp = new AdjustProxy(null);
for (let key in temp.data)
for(let key in temp.data) {
if(key == 'alignMode'
// || key == 'percentWidth' || key == 'percentHeight'
) continue;
Object.defineProperty(ctor.prototype, key, {
get: function () {
get: function() {
return this.adjustProxy.data[key];
},
set: function (v) {
set: function(v) {
const adjustProxy: AdjustProxy = this.adjustProxy;
if (adjustProxy.data[key] !== v) {
if(adjustProxy.data[key] !== v && !(isNaN(adjustProxy.data[key]) && isNaN(v))) {
adjustProxy.data[key] = v;
adjustProxy.makeDirty();
}
......@@ -32,6 +37,64 @@ export function applyAutoAdjust(ctor: Function) {
enumerable: true,
configurable: true
});
}
// Object.defineProperty(ctor.prototype, 'percentWidth', {
// get: function() {
// return this.adjustProxy.data['percentWidth'];
// },
// set: function(v) {
// const adjustProxy: AdjustProxy = this.adjustProxy;
// if(adjustProxy.data['percentWidth'] !== v) {
// adjustProxy.data['percentWidth'] = v;
// adjustProxy.makeDirty();
//
// this._autoWidth = false;
// }
// },
// enumerable: true,
// configurable: true
// });
//
// Object.defineProperty(ctor.prototype, 'percentHeight', {
// get: function() {
// return this.adjustProxy.data['percentHeight'];
// },
// set: function(v) {
// const adjustProxy: AdjustProxy = this.adjustProxy;
// if(adjustProxy.data['percentHeight'] !== v) {
// adjustProxy.data['percentHeight'] = v;
// adjustProxy.makeDirty();
//
// this._autoHeight = isNaN(this._height) || this._height === null || this._height === undefined;
// }
// },
// enumerable: true,
// configurable: true
// });
Object.defineProperty(ctor.prototype, 'alignMode', {
get: function() {
return this.adjustProxy.data['alignMode'];
},
set: function(v) {
const adjustProxy: AdjustProxy = this.adjustProxy;
if(adjustProxy.data['alignMode'] !== v) {
adjustProxy.data['alignMode'] = v;
adjustProxy.makeDirty();
if(v == ALIGN_MODE.ALWAYS) this.alignEnabled = true; // 如果设置为 always 则自动开启
}
},
enumerable: true,
configurable: true
});
}
export enum ALIGN_MODE {
ONCE = 'once',
ALWAYS = 'always',
}
/**
......@@ -47,6 +110,9 @@ class AdjustProxy {
bottom: NaN,
horizonCenter: NaN,
verticalCenter: NaN,
alignEnabled: true,
alignMode: ALIGN_MODE.ALWAYS,
};
private _host;
......@@ -59,96 +125,199 @@ class AdjustProxy {
makeDirty() {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty();
}
onAddedToStage(e) {
this._host.parent.addEventListener(Event.RESIZE, this.onResize, this);
this._host.addEventListener(Event.RESIZE, this.onResize, this);
this._host.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, this);
this._host.addEventListener(Event.MAYBE_ALIGN, this.readyAlign, this);
// this._host.parent.addEventListener(Event.MAYBE_ALIGN, this.align, this);
// this._host.parent.addEventListener(Event.RESIZE, this.align, this);
// this._host.addEventListener(Event.RESIZE, this.align, this);
// this._host.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, this);
}
onRemovedFromStage(e) {
//this._host.parent.removeEventListener(Event.RESIZE, this.onResize);
this._host.removeEventListener(Event.RESIZE, this.onResize, this);
this._host.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
this._host.removeEventListener(Event.MAYBE_ALIGN, this.readyAlign);
// this._host.parent.removeEventListener(Event.MAYBE_ALIGN, this.align);
// this._host.parent.removeEventListener(Event.RESIZE, this.align);
// this._host.removeEventListener(Event.RESIZE, this.align, this);
// this._host.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
}
setFrom(adjustProxy: AdjustProxy) {
for (let k in adjustProxy.data) {
for(let k in adjustProxy.data) {
this.data[k] = adjustProxy.data[k];
}
}
private onResize(e) {
/**
* align 方式 T + 1
* @param e
*/
private readyAlign(e) {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty(); // 它爸爸也要设置一次。可能有autoSize
}
private onEnterFrame(e) {
if (this._sizeDirty) {
this._sizeDirty = false;
this.adjustLayout();
}
}
adjustLayout() {
const that = this._host;
const {width: pWidth, height: pHeight} = that.parent;
const {width, height} = that;
const {percentWidth, percentHeight, left, top, right, bottom, horizonCenter, verticalCenter} = this.data;
const applyPercentWidth = function () {
if (t(percentWidth)) {
that.width = pWidth * percentWidth / 100;
}
};
const applyPercentHeight = function () {
if (t(percentHeight)) {
that.height = pHeight * percentHeight / 100;
}
};
let pw = true, ph = true;
if (t(horizonCenter)) {
applyPercentWidth();
that.x = (pWidth - that.width) / 2 + horizonCenter;
} else {
if (t(left)) {
that.x = left;
if (t(right)) {
that.width = pWidth - left - right;
pw = false;
}
} else if (t(right)) {
that.x = pWidth - width - right;
}
if (pw) {
applyPercentWidth();
}
}
if (t(verticalCenter)) {
applyPercentHeight();
that.y = (pHeight - that.height) / 2 + verticalCenter;
} else {
if (t(top)) {
that.y = top;
if (t(bottom)) {
that.height = pHeight - top - bottom;
ph = false;
}
} else if (t(bottom)) {
that.y = pHeight - height - bottom;
}
if (ph) {
applyPercentHeight();
}
}
}
// autoSize() {
// let that = this._host.parent;
// if(that.name !== 'rect1' && that.name !== 'rect_main' && that.name !== 'rect2' && that.name !== 'rect3') return;
//
// if(that.name == "scene-container"
// || that.name == "game-stage"
// || that.name == "main")
// return;
//
// // 检测本身的是否是自动宽高
// let len = that.children.length
// if(len > 0) {
// // if(that._autoWidth) {
// // 找出子节点最小x
// // let minX = that.children[0].x;
// // for(let i = 1; i < len; i++) {
// // if(that.children[i].x < minX) {
// // minX = that.children[i].x;
// // }
// // }
// // that.children.forEach(v => v._x -= minX);
// // that._x += minX;
//
// // 找出右值
// let max = 0;
// for(let i = 0; i < len; i++) {
// if(t(that.children[i].right)) continue;
// let _x = that.children[i].x || 0;
// let _w = that.children[i].__width || 0;
// if(_x + _w > max) {
// max = _x + _w;
// }
// }
// that.width = max;
// // let dw = that.width - max;
// // that._width -= dw;
// // }
//
// // if(that._autoHeight) {
// // 找出子节点最小y
// // let minY = that.children[0].y;
// // for(let i = 1; i < len; i++) {
// // if(that.children[i].x < minY) {
// // minY = that.children[i].y;
// // }
// // }
// // that.children.forEach(v => v._y -= minY);
// // that._y += minY;
//
// // 找出右值
// max = 0;
// for(let i = 0; i < len; i++) {
// if(t(that.children[i].bottom)) continue;
// let _y = that.children[i].y || 0;
// let _h = that.children[i].__height || 0;
// if(_y + _h > max) {
// max = _y + _h;
// }
// }
// that.height = max;
// // let dh = that.height - max;
// // that._height -= dh;
// // }
// }
//
// }
}
// private onEnterFrame(e) {
// if(this._sizeDirty) {
// this._sizeDirty = false;
//
// // this.adjustLayout();
// }
// }
function t(v) {
return !isNaN(v) && v !== null && v !== undefined;
// /**
// * 手动调用可在当前帧 align
// */
// adjustLayout() {
// // return;
//
// const that = this._host;
//
// if(!that.alignEnabled) return;
//
// if(that.alignMode === ALIGN_MODE.ONCE) { // 如果是单次对齐则一次运算之后就关闭它
// that.alignEnabled = false;
// }
//
// const {percentWidth, percentHeight, left, top, right, bottom, horizonCenter, verticalCenter} = this.data;
//
// let {_width: tW_Z = 0, _height: tH_Z = 0} = that;
// const {_width: pW_Z = 0, _height: pH_Z = 0} = that.parent;
//
// let {_width: tW, _height: tH} = that;
// const {_width: pW, _height: pH} = that.parent;
// this.autoSize();
//
// /**
// * 计算 width 和 x 值
// */
// if(t(left) && t(right)) { // left right 都有则直接拉伸或缩小
//
// that.x = left;
//
// that.width = pW_Z - left - right;
//
// } else {
// // 先设置下自己的 width
// t(percentWidth) && (tW_Z = that.width = pW_Z * percentWidth / 100);
//
// // 先考虑 horizonCenter 属性
// if(t(horizonCenter)) {
// // x 值 = 父节点的中间值 - 自己宽度的一半 - 居中差值
// that.x = pW_Z / 2 - tW_Z / 2 + horizonCenter;
//
// } else if(t(left)) { // 假如有左边距
//
// that.x = left;
//
// } else if(t(right)) { // 假如有右边距
//
// that.x = pW_Z - right - tW_Z;
//
// }
// }
//
// /**
// * 计算 height 和 y 值
// */
// if(t(top) && t(bottom)) { // top bottom 都有则直接拉伸或缩小
//
// that.y = top;
//
// that.height = pH_Z - top - bottom;
//
// } else {
// // 先设置下自己的 height
// t(percentHeight) && (tH_Z = that.height = pH_Z * percentHeight / 100);
//
// // 先考虑 horizonCenter 属性
// if(t(verticalCenter)) {
// // x 值 = 父节点的中间值 - 自己高度的一半 - 居中差值
// that.y = pH_Z / 2 - tH_Z / 2 + verticalCenter;
//
// } else if(t(top)) { // 假如有 top
//
// that.y = top;
//
// } else if(t(bottom)) { // 假如有 bottom
//
// that.y = pH_Z - bottom - tH_Z;
//
// }
// }
//
// // console.log(that.name, that.width, that.height);
// that.children.forEach(v => v.adjustProxy.adjustLayout());
// }
}
......@@ -2,23 +2,23 @@
* Created by rockyl on 2019-11-05.
*/
import {Stage} from "../../2d/display/index";
import {StackContainer} from "./StackContainer";
import {checkAssetGroupLoaded, loadAssetsGroup, loadAssets, loadAssetsGroups} from "./assets-manager";
import {instantiate} from "./view-interpreter";
import {dataCenter, DataCenter} from "./data-center";
import {setProcessMetaLibs} from "../behavior-runtime/index";
import {Tween} from "../../2d/tween/index";
import {Rect} from "./nodes/index";
import {injectEnv} from "./enviroment";
import {Toast} from "./Toast";
import {arrayFind} from "../utils/index";
import {Node} from "./nodes/Node";
import {bind, createStore} from "./mvvm/index";
import {registerCustomModules} from "./custom-module";
import {dealPageRemainTime, dealPxEnv} from "../px-logics";
import { Stage } from "../../2d/display/index";
import { StackContainer } from "./StackContainer";
import { checkAssetGroupLoaded, loadAssetsGroup, loadAssets, loadAssetsGroups } from "./assets-manager";
import { instantiate } from "./view-interpreter";
import { dataCenter, DataCenter } from "./data-center";
import { setProcessMetaLibs } from "../behavior-runtime/index";
import { Tween } from "../../2d/tween/index";
import { Rect } from "./nodes/index";
import { injectEnv } from "./enviroment";
import { Toast } from "./Toast";
import { arrayFind } from "../utils/index";
import { Node } from "./nodes/Node";
import { bind, createStore } from "./mvvm/index";
import { registerCustomModules } from "./custom-module";
import { dealPageRemainTime, dealPxEnv } from "../px-logics";
import Container from "../../2d/display/Container";
import {Event} from "../../2d/events/Event";
import { Event } from "../../2d/events/Event";
/**
* 游戏舞台
......@@ -123,7 +123,7 @@ export class GameStage extends Node {
registerCustomModules(customs);
if (dataMapping) {
if(dataMapping) {
this.dataCenter.registerDataMapping(dataMapping);
}
setProcessMetaLibs(processes, builtinProcesses);
......@@ -145,12 +145,12 @@ export class GameStage extends Node {
* 开始游戏
*/
start() {
const {options: {entrySceneView, }, } = this._config;
const {options: {entrySceneView,},} = this._config;
setTimeout(async () => {
let sceneEntry = await this.instantiateView(entrySceneView);
if (sceneEntry) {
if(sceneEntry) {
this._sceneContainer.push(sceneEntry);
}
})
......@@ -162,7 +162,7 @@ export class GameStage extends Node {
async showInnerLoadingView() {
let loadingViewName = this._config.options.loadingView;
let loadingView = this._loadingView.getChildAt(0);
if (this._loadingView.children.length == 0 && loadingViewName) {
if(this._loadingView.children.length == 0 && loadingViewName) {
loadingView = await this.instantiateView(loadingViewName, true, false);
this._loadingView.addChild(loadingView);
}
......@@ -173,7 +173,7 @@ export class GameStage extends Node {
* 隐藏加载视图
*/
hideInnerLoadingView() {
if (this._loadingView.visible) {
if(this._loadingView.visible) {
this._loadingView.visible = false;
}
}
......@@ -186,40 +186,40 @@ export class GameStage extends Node {
*/
async instantiateView(name, cache = true, showLoadingView = true) {
let view;
if (cache) {
if(cache) {
view = this._viewCache[name];
}
if (!view) {
if(!view) {
let viewConfig = this.getViewConfigByName(name);
if (viewConfig) {
if(viewConfig) {
const {assets, customs} = this._config;
if (!Array.isArray(assets)) {
if(!Array.isArray(assets)) {
let groups = {};
let {depCustoms} = viewConfig;
if (depCustoms && depCustoms.length > 0) {
for (let custom of customs) {
if (depCustoms.indexOf(custom.id) >= 0 && custom.assets) {
if (!checkAssetGroupLoaded(custom.id)) {
if(depCustoms && depCustoms.length > 0) {
for(let custom of customs) {
if(depCustoms.indexOf(custom.id) >= 0 && custom.assets) {
if(!checkAssetGroupLoaded(custom.id)) {
groups[custom.id] = custom.assets;
}
}
}
}
if (!checkAssetGroupLoaded(viewConfig.uuid)) {
if(!checkAssetGroupLoaded(viewConfig.uuid)) {
let depAssets = assets[viewConfig.uuid];
if (depAssets && depAssets.length > 0) {
if(depAssets && depAssets.length > 0) {
groups[viewConfig.uuid] = depAssets;
}
}
if(Object.keys(groups).length > 0){
if(Object.keys(groups).length > 0) {
await loadAssetsGroups(groups, async () => {
if (showLoadingView) {
if(showLoadingView) {
await this.showInnerLoadingView();
}
}, async () => {
if (showLoadingView) {
if(showLoadingView) {
this.hideInnerLoadingView();
}
});
......@@ -228,7 +228,7 @@ export class GameStage extends Node {
view = instantiate(viewConfig);
let store = {};
if (viewConfig.store) {
if(viewConfig.store) {
const {exp, computed} = viewConfig.store;
store = createStore(exp, computed);
}
......@@ -240,7 +240,7 @@ export class GameStage extends Node {
bind(store, view);
console.timeEnd('bind');
if (cache) {
if(cache) {
this._viewCache[name] = view;
}
} else {
......@@ -262,11 +262,11 @@ export class GameStage extends Node {
const {action, view, lastView, options, hasView} = e.data;
const target = <StackContainer>e.target;
switch (action) {
switch(action) {
case 'push':
case 'replace':
case 'popAll':
if (options && options.center) {
if(options && options.center) {
view.x = (target.width - view.width) / 2;
view.y = (target.height - view.height) / 2;
}
......@@ -275,18 +275,18 @@ export class GameStage extends Node {
let blackLayer = this._blackLayer;
let pParent = blackLayer.parent;
if (hasView) {
if(hasView) {
target.addChildAt(blackLayer, target.childNum - 1 - (view ? 0 : 1));
let modalAlpha = 0.7;
if(options && options.hasOwnProperty('modalAlpha')){
if(options && options.hasOwnProperty('modalAlpha')) {
modalAlpha = options.modalAlpha;
}
if (!pParent || blackLayer['tween_count'] > 0) {
if(!pParent || blackLayer['tween_count'] > 0) {
blackLayer.alpha = 0;
Tween.get(blackLayer, null, null, true)
.to({alpha: modalAlpha}, 300);
}
} else if (pParent) {
} else if(pParent) {
Tween.get(blackLayer, null, null, true)
.to({alpha: 0}, 300)
.call(() => {
......@@ -301,32 +301,32 @@ export class GameStage extends Node {
lazyLoadAllAssets = async () => {
let {assets, customs} = this._config;
if (!Array.isArray(assets)) {
for (let uuid in assets) {
if(!Array.isArray(assets)) {
for(let uuid in assets) {
let group = assets[uuid];
if (group && group.length > 0) {
if(group && group.length > 0) {
await loadAssetsGroup(group, uuid);
}
}
}
for (let custom of customs) {
for(let custom of customs) {
let group = custom.assets;
if (group && group.length > 0) {
if(group && group.length > 0) {
await loadAssetsGroup(group, custom.id);
}
}
};
async loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete){
const {assets, } = this._config;
async loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete) {
const {assets,} = this._config;
let loaded = 0;
let assetsToLoad = assets;
let total;
if (!Array.isArray(assets)) { //如果是分组后的配置就加载共用分组,否则加载全部
if(!Array.isArray(assets)) { //如果是分组后的配置就加载共用分组,否则加载全部
assetsToLoad = assets['common'];
if(assetsToLoad.length > 0){
if(assetsToLoad.length > 0) {
await this.showInnerLoadingView();
await loadAssetsGroups({
preload: assetsToLoad,
......@@ -336,7 +336,7 @@ export class GameStage extends Node {
this.hideInnerLoadingView();
});
}
}else{
} else {
total = assetsToLoad.length;
await loadAssets(assetsToLoad, p).catch(e => {
console.log(e);
......@@ -347,7 +347,7 @@ export class GameStage extends Node {
loaded++;
onPreloadAssetsProgress && onPreloadAssetsProgress(loaded, total);
if (loaded >= total) {
if(loaded >= total) {
onPreloadAssetsComplete && onPreloadAssetsComplete();
}
}
......
......@@ -2,21 +2,23 @@
* Created by rockyl on 2019-11-08.
*/
import {Stage} from "../2d/display/index";
import {GameStage, registerCustomModuleFromConfig} from "./game-warpper/index";
import {setGlobalContext, setProcessMetaLibs} from "./behavior-runtime/index";
import {globalLoader} from "../2d/loader/Loader";
import {Event} from "../2d/events/Event";
import { Stage } from "../2d/display/index";
import { GameStage, registerCustomModuleFromConfig } from "./game-warpper/index";
import { setGlobalContext, setProcessMetaLibs } from "./behavior-runtime/index";
import { globalLoader } from "../2d/loader/Loader";
import { Event } from "../2d/events/Event";
import builtinLoadingView from "./game-warpper/LoadingView";
import {queryParams} from "./web";
import {initAutoLayout} from "./game-warpper/auto-layout";
import {registerScripts} from "./decorators/scripts";
import {RENDERER_TYPE, StageScaleMode} from "../2d/const";
import { queryParams } from "./web";
import { initAutoLayout } from "./game-warpper/auto-layout";
import { registerScripts } from "./decorators/scripts";
import { RENDERER_TYPE, StageScaleMode } from "../2d/const";
import { alignMgr } from "./decorators/AlignManager";
export let gameStage: GameStage;
export let alignManager = alignMgr;
export function launch(url, loadingDelegate?, onStart?) {
if (queryParams.__proxy_mode__) {
if(queryParams.__proxy_mode__) {
return Promise.resolve('cancel launch');
}
return globalLoader.loadJson(url)
......@@ -52,6 +54,7 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
setTimeout(resolve, 300);
});
return await new Promise(resolve => {
const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType, bgColor, autoResize,} = config.options;
let stage = window['stage'] = new Stage(
containerId || "game-container",
......@@ -67,6 +70,8 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
initAutoLayout(stage);
Stage.flushAll();
// Stage.addUpdateObj(alignMgr);
stage.addEventListener(Event.ON_INIT_STAGE, () => {
gameStage = new GameStage(stage);
setGlobalContext({
......@@ -76,9 +81,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
let delegate = loadingDelegate || builtinLoadingView;
gameStage.launch(config, function (done, total) {
gameStage.launch(config, function(done, total) {
delegate.onProgress && delegate.onProgress(done, total)
}, function () {
}, function() {
delegate.onComplete && delegate.onComplete();
}, onStart);
});
......
......@@ -14,13 +14,13 @@ export const linkScheme = 'link://';
* @param predicate
*/
export function arrayFind(arr, predicate) {
if (!arr) {
if(!arr) {
return;
}
for (let i = 0, li = arr.length; i < li; i++) {
for(let i = 0, li = arr.length; i < li; i++) {
const item = arr[i];
if (predicate(item, i, arr)) {
if(predicate(item, i, arr)) {
return item;
}
}
......@@ -39,9 +39,9 @@ const percentKeys = ['width', 'height'];
export function propertyParse(key, node, properties) {
let value = properties[key];
let targetKey = key;
if (percentKeys.indexOf(key) >= 0) {
if (typeof value === 'string') {
if (value[value.length - 1] === '%') {
if(percentKeys.indexOf(key) >= 0) {
if(typeof value === 'string') {
if(value[value.length - 1] === '%') {
targetKey = 'percent' + key[0].toUpperCase() + key.substr(1);
}
value = parseInt(value);
......@@ -60,9 +60,9 @@ export function getDataByPath(scope, path, throwException?) {
let func = new Function('scope', `return scope` + (path ? ('.' + path) : ''));
try {
return func(scope);
} catch (e) {
} catch(e) {
//console.warn(e);
if (throwException) {
if(throwException) {
throw e;
}
}
......@@ -77,8 +77,8 @@ export function safeEval(code, throwException = false) {
let func = new Function(code);
try {
return func();
} catch (e) {
if (throwException) {
} catch(e) {
if(throwException) {
throw e;
}
}
......@@ -95,20 +95,20 @@ export function safeEval(code, throwException = false) {
* @return 是否有字段注入
*/
export function injectProp(target: any, data?: any, callback?: Function, ignoreMethod: boolean = true, ignoreNull: boolean = true): boolean {
if (!target || !data) {
if(!target || !data) {
return false;
}
let result = false;
for (let key in data) {
for(let key in data) {
let value: any = data[key];
if ((!ignoreMethod || typeof value != 'function') && (!ignoreNull || value != null)) {
if (callback) {
if((!ignoreMethod || typeof value != 'function') && (!ignoreNull || value != null)) {
if(callback) {
callback(target, key, value);
} else {
try {
target[key] = value;
} catch (e) {
} catch(e) {
}
}
......@@ -126,17 +126,17 @@ export function injectProp(target: any, data?: any, callback?: Function, ignoreM
* @param config
*/
export function copyProp(target, data, config?) {
if (data) {
for (let key in config) {
if(data) {
for(let key in config) {
let valueConfig = config[key];
if (Array.isArray(valueConfig)) {
if(Array.isArray(valueConfig)) {
target[key] = {};
for (let field of valueConfig) {
for(let field of valueConfig) {
target[key][field] = data[key][field];
}
} else if (typeof valueConfig === 'string') {
} else if(typeof valueConfig === 'string') {
target[valueConfig] = data[valueConfig];
} else if (typeof valueConfig === 'object') {
} else if(typeof valueConfig === 'object') {
target[key] = {};
copyProp(target[key], data[key], valueConfig)
}
......@@ -149,11 +149,11 @@ export function copyProp(target, data, config?) {
* @param obj
*/
export function obj2query(obj: any): string {
if (!obj) {
if(!obj) {
return '';
}
let arr: string[] = [];
for (let key in obj) {
for(let key in obj) {
arr.push(key + (key ? '=' : '') + obj[key]);
}
return arr.join('&');
......@@ -169,7 +169,7 @@ function requireForCJS(id) {
* @param node
*/
export function importCJSCode(code, node?) {
if (node) {
if(node) {
let create = new Function('module', 'require', code);
let module = {
exports: {},
......@@ -201,19 +201,19 @@ export function importUMDCode(code) {
* @param char
*/
export function trimChar(str: string, char: string) {
if (!str || !char) {
if(!str || !char) {
return;
}
while (true) {
while(true) {
let len = str.length, from = 0, end = len;
if (str[0] === char) {
if(str[0] === char) {
from = 1;
}
if (str[len - 1] === char) {
if(str[len - 1] === char) {
end = len - 1;
}
str = str.substring(from, end);
if (str.length == len) {
if(str.length == len) {
break;
}
}
......@@ -227,7 +227,7 @@ export function trimChar(str: string, char: string) {
*/
export function joinPath(...segments: string[]) {
let result = [];
for (let segment of segments) {
for(let segment of segments) {
result.push(trimChar(segment, '/'));
}
return result.join('/');
......@@ -240,10 +240,10 @@ export function joinPath(...segments: string[]) {
*/
export function findVariable(name: string, ...contexts) {
let result;
for (let context of contexts) {
if (context) {
for(let context of contexts) {
if(context) {
result = context[name];
if (result !== undefined) {
if(result !== undefined) {
break;
}
}
......@@ -258,7 +258,7 @@ let el;
* @param htmlText
*/
export function htmlToPureText(htmlText) {
if (!el) {
if(!el) {
el = document.createElement('div');
}
el.innerHTML = htmlText;
......@@ -277,7 +277,7 @@ const zhReg = /[\u4e00-\u9fa5]/;
*/
export function strLen(str) {
let len = 0;
for (let char of str) {
for(let char of str) {
len += char.match(zhReg) ? 2 : 1;
}
return len;
......@@ -291,12 +291,12 @@ export function strLen(str) {
*/
export function strShort(str, limit, replace = '…') {
let result = '';
if (strLen(str) > limit) {
if(strLen(str) > limit) {
let len = 0;
for (let i = 0, li = str.length; i < li; i++) {
for(let i = 0, li = str.length; i < li; i++) {
const char = str[i];
len += char.match(zhReg) ? 2 : 1;
if (len > limit) {
if(len > limit) {
result += replace;
break;
} else {
......@@ -328,8 +328,8 @@ export const cmdOldPrefix = '//z-';
* @param source
*/
export function injectProperties(target, source) {
for (let key in source) {
if (key.indexOf('//') !== 0 && !source.hasOwnProperty(cmdPrefix + key)) {
for(let key in source) {
if(key.indexOf('//') !== 0 && !source.hasOwnProperty(cmdPrefix + key)) {
propertyParse(key, target, source);
}
}
......@@ -344,14 +344,25 @@ export function injectProperties(target, source) {
* @param includeSelf
*/
export function traverseViewNode(node: Container, callback: Function, includeSelf = false) {
if (includeSelf) {
if(includeSelf) {
callback(node);
}
for (let child of node.children) {
for(let child of node.children) {
callback(child, node);
if (child.children && child.children.length > 0) {
if(child.children && child.children.length > 0) {
traverseViewNode(child, callback);
}
}
}
/**
* 数字转化为boolean值
* NaN -> false 'aaa' -> false null -> false undefined -> false
* 666 -> true '007' -> true Infinity -> true
* @param v
* @returns {boolean}
*/
export function toBoolean(v): boolean {
return !isNaN(v) && v !== null && v !== undefined;
}
......@@ -438,10 +438,10 @@ rollup-plugin-node-resolve@^5.2.0:
resolve "^1.11.1"
rollup-pluginutils "^2.8.1"
rollup-plugin-progress@^1.1.1:
version "1.1.1"
resolved "https://registry.npm.taobao.org/rollup-plugin-progress/download/rollup-plugin-progress-1.1.1.tgz#fcce2f915d545014ac89ea0927ee97cb48052f60"
integrity sha1-/M4vkV1UUBSsieoJJ+6Xy0gFL2A=
rollup-plugin-progress@^1.1.2:
version "1.1.2"
resolved "https://registry.npm.taobao.org/rollup-plugin-progress/download/rollup-plugin-progress-1.1.2.tgz#5c1dfe7c50f654906bc34d167d5512ee1a4b72d5"
integrity sha1-XB3+fFD2VJBrw00WfVUS7hpLctU=
dependencies:
chalk "^2.4.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment