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"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="JavaScriptSettings"> <component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" /> <option name="languageLevel" value="FLOW" />
</component> </component>
</project> </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"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <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="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
...@@ -10,9 +26,9 @@ ...@@ -10,9 +26,9 @@
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES"> <option name="RECENT_TEMPLATES">
<list> <list>
<option value="JavaScript File" />
<option value="MarkDown" /> <option value="MarkDown" />
<option value="TypeScript File" /> <option value="TypeScript File" />
<option value="JavaScript File" />
</list> </list>
</option> </option>
</component> </component>
...@@ -25,28 +41,31 @@ ...@@ -25,28 +41,31 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
<option name="UPDATE_TYPE" value="MERGE" /> <option name="UPDATE_TYPE" value="MERGE" />
</component> </component>
<component name="IgnoredFileRootStore"> <component name="JsFlowSettings">
<option name="generatedRoots"> <service-enabled>true</service-enabled>
<set> <exe-path />
<option value="$PROJECT_DIR$/.idea" /> <other-services-enabled>true</other-services-enabled>
</set> <auto-save>true</auto-save>
</option>
</component> </component>
<component name="ProjectId" id="1ZYzLmPKm3UfhIZLkr8RtiZwhUf" /> <component name="ProjectId" id="1ZYzLmPKm3UfhIZLkr8RtiZwhUf" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/zeroing/game-warpper/mvvm" /> <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_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" /> <property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="yarn" /> <property name="nodejs_package_manager_path" value="yarn" />
<property name="run.code.analysis.last.selected.profile" value="pProject Default" /> <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" /> <property name="ts.external.directory.path" value="$PROJECT_DIR$/node_modules/typescript/lib" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
...@@ -108,8 +127,8 @@ ...@@ -108,8 +127,8 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="npm.preprocess" />
<item itemvalue="npm.dev" /> <item itemvalue="npm.dev" />
<item itemvalue="npm.preprocess" />
<item itemvalue="npm.declare" /> <item itemvalue="npm.declare" />
<item itemvalue="npm.debug" /> <item itemvalue="npm.debug" />
<item itemvalue="npm.build:prod" /> <item itemvalue="npm.build:prod" />
...@@ -157,15 +176,22 @@ ...@@ -157,15 +176,22 @@
<workItem from="1587606438033" duration="14026000" /> <workItem from="1587606438033" duration="14026000" />
<workItem from="1587696728690" duration="5561000" /> <workItem from="1587696728690" duration="5561000" />
<workItem from="1587713741312" duration="310000" /> <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> </task>
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" /> <option name="version" value="2" />
<option name="exactExcludedFiles"> <option name="exactExcludedFiles">
<list> <list>
<option value="$PROJECT_DIR$/examples/scripts/Wave.js" />
<option value="$PROJECT_DIR$/examples/scripts/TouchZoom.js" /> <option value="$PROJECT_DIR$/examples/scripts/TouchZoom.js" />
<option value="$PROJECT_DIR$/examples/scripts/Wave.js" />
</list> </list>
</option> </option>
</component> </component>
...@@ -190,37 +216,37 @@ ...@@ -190,37 +216,37 @@
<screen x="1680" y="-229" width="1920" height="1177" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </state>
<state width="969" height="466" key="DebuggerActiveHint/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1585535223173" /> <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"> <state width="493" height="821" key="GridCell.Tab.0.bottom" timestamp="1589897780335">
<screen x="1680" y="-252" width="1920" height="1200" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </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="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/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="493" height="821" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780335" />
<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="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="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"> <state width="493" height="821" key="GridCell.Tab.0.center" timestamp="1589897780335">
<screen x="1680" y="-252" width="1920" height="1200" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </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="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/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="493" height="821" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780335" />
<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="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="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"> <state width="493" height="821" key="GridCell.Tab.0.left" timestamp="1589897780334">
<screen x="1680" y="-252" width="1920" height="1200" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </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="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/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="493" height="821" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780334" />
<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="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="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"> <state width="493" height="821" key="GridCell.Tab.0.right" timestamp="1589897780335">
<screen x="1680" y="-252" width="1920" height="1200" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </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="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/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="493" height="821" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1589897780335" />
<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="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 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"> <state x="445" y="278" key="IDE.errors.dialog" timestamp="1585719736587">
<screen x="35" y="23" width="1645" height="1027" /> <screen x="35" y="23" width="1645" height="1027" />
...@@ -230,10 +256,14 @@ ...@@ -230,10 +256,14 @@
<screen x="1680" y="-229" width="1920" height="1177" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </state>
<state x="2356" y="82" key="MultipleFileMergeDialog/35.23.1645.1027/1680.-229.1920.1177@1680.-229.1920.1177" timestamp="1586919094159" /> <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" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </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"> <state x="2441" y="283" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1587713822207">
<screen x="1680" y="-229" width="1920" height="1177" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </state>
...@@ -248,11 +278,12 @@ ...@@ -248,11 +278,12 @@
<screen x="1680" y="-229" width="1920" height="1177" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </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="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"> <state x="2305" y="36" width="670" height="676" key="search.everywhere.popup" timestamp="1589893517546">
<screen x="1680" y="-252" width="1920" height="1200" /> <screen x="1680" y="-229" width="1920" height="1177" />
</state> </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="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/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> </component>
</project> </project>
\ No newline at end of file
...@@ -2,10 +2,10 @@ var __extends;var __assign;var __rest;var __decorate;var __param;var __metadata; ...@@ -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)}); }};__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}; 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) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib')) : typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('props-compute')) :
typeof define === 'function' && define.amd ? define(['exports', 'tslib'], factory) : typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'props-compute'], factory) :
(global = global || self, factory(global.engine = {}, global.tslib)); (global = global || self, factory(global.engine = {}, global.tslib, global.propsCompute));
}(this, function (exports, tslib_1) { 'use strict'; }(this, (function (exports, tslib_1, propsCompute) { 'use strict';
var HashObject = (function () { var HashObject = (function () {
function HashObject() { function HashObject() {
...@@ -63,6 +63,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -63,6 +63,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
s.type = type; s.type = type;
delete s.data; delete s.data;
}; };
Event.MAYBE_ALIGN = "maybeAlign";
Event.RESIZE = "onResize"; Event.RESIZE = "onResize";
Event.ON_SCROLL_TO_HEAD = "onScrollToHead"; Event.ON_SCROLL_TO_HEAD = "onScrollToHead";
Event.ON_SCROLL_STOP = "onScrollStop"; Event.ON_SCROLL_STOP = "onScrollStop";
...@@ -1634,135 +1635,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -1634,135 +1635,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return MouseEvent; return MouseEvent;
}(Event)); }(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 ESCAPE_REG_EXP = /\$\{[\u4e00-\u9fa5_a-zA-Z0-9\|]+\}/g;
var linkedFlag = '$_linked_$'; var linkedFlag = '$_linked_$';
var nodeScheme = 'node://'; var nodeScheme = 'node://';
...@@ -2016,6 +1888,198 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -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) { function transPoint(str, sep) {
if (sep === void 0) { sep = ','; } if (sep === void 0) { sep = ','; }
...@@ -3093,6 +3157,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3093,6 +3157,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
function Container() { function Container() {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
_this._mouseChildren = true; _this._mouseChildren = true;
_this.__width = 0;
_this.__height = 0;
_this._autoWidth = false;
_this._autoHeight = false;
_this._instanceType = "Container"; _this._instanceType = "Container";
_this.children = []; _this.children = [];
_this._transform = _this.transform; _this._transform = _this.transform;
...@@ -3113,14 +3181,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3113,14 +3181,10 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Container.prototype.afterConstructor = function () { Container.prototype.afterConstructor = function () {
}; };
Container.prototype.onChildrenChange = function (index) { Container.prototype.onChildrenChange = function (index) {
this.dispatchEvent(Event.MAYBE_ALIGN);
}; };
Container.prototype.attachVisibility = function () { Container.prototype.attachVisibility = function () {
return; 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) { Container.prototype.addChild = function (child) {
this.addChildAt(child, this.children.length); this.addChildAt(child, this.children.length);
...@@ -3516,6 +3580,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3516,6 +3580,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this._width = value; this._width = value;
this._localBoundsSelf.width = value; this._localBoundsSelf.width = value;
this.dispatchEvent(Event.RESIZE); 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, enumerable: true,
...@@ -3530,11 +3602,71 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -3530,11 +3602,71 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
this._height = value; this._height = value;
this._localBoundsSelf.height = value; this._localBoundsSelf.height = value;
this.dispatchEvent(Event.RESIZE); 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, enumerable: true,
configurable: 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
});
Container.prototype.clone = function (withEvents, withScripts) { Container.prototype.clone = function (withEvents, withScripts) {
if (withEvents === void 0) { withEvents = false; } if (withEvents === void 0) { withEvents = false; }
if (withScripts === void 0) { withScripts = false; } if (withScripts === void 0) { withScripts = false; }
...@@ -4675,7 +4807,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -4675,7 +4807,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
} }
function determineCrossOrigin(url, loc) { function determineCrossOrigin(url, loc) {
if (loc === void 0) { loc = window.location; }
if (url.indexOf('data:') === 0) { if (url.indexOf('data:') === 0) {
return ''; return '';
} }
...@@ -5405,7 +5536,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -5405,7 +5536,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return color; return color;
} }
function inputFeildIosEnable() { function inputFeildIosEnable() {
var u = navigator.userAgent, app = navigator.appVersion; var u = navigator.userAgent;
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if (isIOS) { if (isIOS) {
setTimeout(function () { setTimeout(function () {
...@@ -5745,9 +5876,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -5745,9 +5876,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return Math.abs(this.scale.x) * this._texture.orig.width; return Math.abs(this.scale.x) * this._texture.orig.width;
}, },
set: function (value) { set: function (value) {
value = Math.abs(value);
var s = sign(this.scale.x) || 1; var s = sign(this.scale.x) || 1;
this.scale.x = s * value / this._texture.orig.width; this.scale.x = s * value / this._texture.orig.width;
this._width = value; this._width = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
if (isNaN(this.percentWidth) || this.percentWidth === null) {
this.__width = value;
}
else {
this.__width = 0;
}
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true
...@@ -5757,9 +5896,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -5757,9 +5896,17 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return Math.abs(this.scale.y) * this._texture.orig.height; return Math.abs(this.scale.y) * this._texture.orig.height;
}, },
set: function (value) { set: function (value) {
value = Math.abs(value);
var s = sign(this.scale.y) || 1; var s = sign(this.scale.y) || 1;
this.scale.y = s * value / this._texture.orig.height; this.scale.y = s * value / this._texture.orig.height;
this._height = value; this._height = value;
this.dispatchEvent(Event.MAYBE_ALIGN);
if (isNaN(this.percentHeight) || this.percentHeight === null) {
this.__height = value;
}
else {
this.__height = 0;
}
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true
...@@ -8331,6 +8478,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -8331,6 +8478,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Stage.flushAll = function () { Stage.flushAll = function () {
if (!GlobalPro.startTime) if (!GlobalPro.startTime)
GlobalPro.startTime = Date.now(); GlobalPro.startTime = Date.now();
alignMgr.flush();
if (!Stage._pause) { if (!Stage._pause) {
var len = Stage.allUpdateObjList.length; var len = Stage.allUpdateObjList.length;
for (var i = 0; i < len; i++) { for (var i = 0; i < len; i++) {
...@@ -11354,24 +11502,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -11354,24 +11502,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var failedList = []; var failedList = [];
return Promise.all(config.map(function (assetConfig) { return Promise.all(config.map(function (assetConfig) {
assetsConfig.push(assetConfig); assetsConfig.push(assetConfig);
var url = assetConfig.url, ext = assetConfig.ext, uuid = assetConfig.uuid; if (assetConfig.url.indexOf(linkScheme) === 0) {
var loadFunc = loaderMapping[ext]; var linkUUID = assetConfig.url.replace(linkScheme, '');
if (loadFunc) { assetConfig = getAssetByUUID(linkUUID);
if (url.indexOf(linkScheme) === 0) { }
loaded++; if (assetConfig) {
onProgress && onProgress(loaded, total); var url_1 = assetConfig.url, ext = assetConfig.ext, uuid = assetConfig.uuid;
return Promise.resolve(); var loadFunc = loaderMapping[ext];
if (loadFunc) {
var method = globalLoader['load' + loadFunc];
return method.call(globalLoader, url_1, uuid).then(function (data) {
parse(assetConfig, data);
loaded++;
onProgress && onProgress(loaded, total);
}, function (error) {
failedList.push(url_1);
});
}
else {
return p();
} }
var method = globalLoader['load' + loadFunc];
return method.call(globalLoader, url, uuid).then(function (data) {
parse(assetConfig, data);
loaded++;
onProgress && onProgress(loaded, total);
}, function (error) {
failedList.push(url);
});
} }
else { else {
return p();
}
function p() {
loaded++; loaded++;
onProgress && onProgress(loaded, total); onProgress && onProgress(loaded, total);
return Promise.resolve(); return Promise.resolve();
...@@ -17150,10 +17305,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17150,10 +17305,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
if (playEffect === void 0) { playEffect = true; } if (playEffect === void 0) { playEffect = true; }
return new Promise(function (resolve) { return new Promise(function (resolve) {
var action = 'popAll'; var action = 'popAll';
var lastView = _this.getChildAt(0);
var len = _this.childNum; var len = _this.childNum;
while (_this.children.length > 1) { if (len == 0) {
_this.removeChildAt(1); resolve();
return;
}
var lastView = _this.getChildAt(len);
while (_this.children.length > 2) {
_this.removeChildAt(0);
} }
if (_this._mutex) { if (_this._mutex) {
_this._stack.splice(0); _this._stack.splice(0);
...@@ -17162,7 +17321,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17162,7 +17321,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
view.visible = false; view.visible = false;
_this.addChild(view); _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); _this.dispatchEvent(Event.START, data);
playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, _this._mutex, lastView, view, _this, function () { playViewEffect(playEffect ? options ? options.effect : null : null, options ? options.effectParams : {}, _this._mutex, lastView, view, _this, function () {
_this.dispatchEvent(Event.COMPLETE, data); _this.dispatchEvent(Event.COMPLETE, data);
...@@ -17173,155 +17332,155 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17173,155 +17332,155 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return StackContainer; return StackContainer;
}(Node$1)); }(Node$1));
var colorName = { var colorName = {
"aliceblue": [240, 248, 255], "aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215], "antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255], "aqua": [0, 255, 255],
"aquamarine": [127, 255, 212], "aquamarine": [127, 255, 212],
"azure": [240, 255, 255], "azure": [240, 255, 255],
"beige": [245, 245, 220], "beige": [245, 245, 220],
"bisque": [255, 228, 196], "bisque": [255, 228, 196],
"black": [0, 0, 0], "black": [0, 0, 0],
"blanchedalmond": [255, 235, 205], "blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255], "blue": [0, 0, 255],
"blueviolet": [138, 43, 226], "blueviolet": [138, 43, 226],
"brown": [165, 42, 42], "brown": [165, 42, 42],
"burlywood": [222, 184, 135], "burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160], "cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0], "chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30], "chocolate": [210, 105, 30],
"coral": [255, 127, 80], "coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237], "cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220], "cornsilk": [255, 248, 220],
"crimson": [220, 20, 60], "crimson": [220, 20, 60],
"cyan": [0, 255, 255], "cyan": [0, 255, 255],
"darkblue": [0, 0, 139], "darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139], "darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11], "darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169], "darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0], "darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169], "darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107], "darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139], "darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47], "darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0], "darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204], "darkorchid": [153, 50, 204],
"darkred": [139, 0, 0], "darkred": [139, 0, 0],
"darksalmon": [233, 150, 122], "darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143], "darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139], "darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79], "darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79], "darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209], "darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211], "darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147], "deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255], "deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105], "dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105], "dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255], "dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34], "firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240], "floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34], "forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255], "fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220], "gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255], "ghostwhite": [248, 248, 255],
"gold": [255, 215, 0], "gold": [255, 215, 0],
"goldenrod": [218, 165, 32], "goldenrod": [218, 165, 32],
"gray": [128, 128, 128], "gray": [128, 128, 128],
"green": [0, 128, 0], "green": [0, 128, 0],
"greenyellow": [173, 255, 47], "greenyellow": [173, 255, 47],
"grey": [128, 128, 128], "grey": [128, 128, 128],
"honeydew": [240, 255, 240], "honeydew": [240, 255, 240],
"hotpink": [255, 105, 180], "hotpink": [255, 105, 180],
"indianred": [205, 92, 92], "indianred": [205, 92, 92],
"indigo": [75, 0, 130], "indigo": [75, 0, 130],
"ivory": [255, 255, 240], "ivory": [255, 255, 240],
"khaki": [240, 230, 140], "khaki": [240, 230, 140],
"lavender": [230, 230, 250], "lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245], "lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0], "lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205], "lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230], "lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128], "lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255], "lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210], "lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211], "lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144], "lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211], "lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193], "lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122], "lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170], "lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250], "lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153], "lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153], "lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222], "lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224], "lightyellow": [255, 255, 224],
"lime": [0, 255, 0], "lime": [0, 255, 0],
"limegreen": [50, 205, 50], "limegreen": [50, 205, 50],
"linen": [250, 240, 230], "linen": [250, 240, 230],
"magenta": [255, 0, 255], "magenta": [255, 0, 255],
"maroon": [128, 0, 0], "maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170], "mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205], "mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211], "mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219], "mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113], "mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238], "mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154], "mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204], "mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133], "mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112], "midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250], "mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225], "mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181], "moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173], "navajowhite": [255, 222, 173],
"navy": [0, 0, 128], "navy": [0, 0, 128],
"oldlace": [253, 245, 230], "oldlace": [253, 245, 230],
"olive": [128, 128, 0], "olive": [128, 128, 0],
"olivedrab": [107, 142, 35], "olivedrab": [107, 142, 35],
"orange": [255, 165, 0], "orange": [255, 165, 0],
"orangered": [255, 69, 0], "orangered": [255, 69, 0],
"orchid": [218, 112, 214], "orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170], "palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152], "palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238], "paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147], "palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213], "papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185], "peachpuff": [255, 218, 185],
"peru": [205, 133, 63], "peru": [205, 133, 63],
"pink": [255, 192, 203], "pink": [255, 192, 203],
"plum": [221, 160, 221], "plum": [221, 160, 221],
"powderblue": [176, 224, 230], "powderblue": [176, 224, 230],
"purple": [128, 0, 128], "purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153], "rebeccapurple": [102, 51, 153],
"red": [255, 0, 0], "red": [255, 0, 0],
"rosybrown": [188, 143, 143], "rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225], "royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19], "saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114], "salmon": [250, 128, 114],
"sandybrown": [244, 164, 96], "sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87], "seagreen": [46, 139, 87],
"seashell": [255, 245, 238], "seashell": [255, 245, 238],
"sienna": [160, 82, 45], "sienna": [160, 82, 45],
"silver": [192, 192, 192], "silver": [192, 192, 192],
"skyblue": [135, 206, 235], "skyblue": [135, 206, 235],
"slateblue": [106, 90, 205], "slateblue": [106, 90, 205],
"slategray": [112, 128, 144], "slategray": [112, 128, 144],
"slategrey": [112, 128, 144], "slategrey": [112, 128, 144],
"snow": [255, 250, 250], "snow": [255, 250, 250],
"springgreen": [0, 255, 127], "springgreen": [0, 255, 127],
"steelblue": [70, 130, 180], "steelblue": [70, 130, 180],
"tan": [210, 180, 140], "tan": [210, 180, 140],
"teal": [0, 128, 128], "teal": [0, 128, 128],
"thistle": [216, 191, 216], "thistle": [216, 191, 216],
"tomato": [255, 99, 71], "tomato": [255, 99, 71],
"turquoise": [64, 224, 208], "turquoise": [64, 224, 208],
"violet": [238, 130, 238], "violet": [238, 130, 238],
"wheat": [245, 222, 179], "wheat": [245, 222, 179],
"white": [255, 255, 255], "white": [255, 255, 255],
"whitesmoke": [245, 245, 245], "whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0], "yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50] "yellowgreen": [154, 205, 50]
}; };
var isArrayish = function isArrayish(obj) { var isArrayish = function isArrayish(obj) {
...@@ -17604,155 +17763,155 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -17604,155 +17763,155 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
var colorString_1 = colorString.to; var colorString_1 = colorString.to;
var colorString_2 = colorString.get; var colorString_2 = colorString.get;
var colorName$1 = { var colorName$1 = {
"aliceblue": [240, 248, 255], "aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215], "antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255], "aqua": [0, 255, 255],
"aquamarine": [127, 255, 212], "aquamarine": [127, 255, 212],
"azure": [240, 255, 255], "azure": [240, 255, 255],
"beige": [245, 245, 220], "beige": [245, 245, 220],
"bisque": [255, 228, 196], "bisque": [255, 228, 196],
"black": [0, 0, 0], "black": [0, 0, 0],
"blanchedalmond": [255, 235, 205], "blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255], "blue": [0, 0, 255],
"blueviolet": [138, 43, 226], "blueviolet": [138, 43, 226],
"brown": [165, 42, 42], "brown": [165, 42, 42],
"burlywood": [222, 184, 135], "burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160], "cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0], "chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30], "chocolate": [210, 105, 30],
"coral": [255, 127, 80], "coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237], "cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220], "cornsilk": [255, 248, 220],
"crimson": [220, 20, 60], "crimson": [220, 20, 60],
"cyan": [0, 255, 255], "cyan": [0, 255, 255],
"darkblue": [0, 0, 139], "darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139], "darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11], "darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169], "darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0], "darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169], "darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107], "darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139], "darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47], "darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0], "darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204], "darkorchid": [153, 50, 204],
"darkred": [139, 0, 0], "darkred": [139, 0, 0],
"darksalmon": [233, 150, 122], "darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143], "darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139], "darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79], "darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79], "darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209], "darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211], "darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147], "deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255], "deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105], "dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105], "dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255], "dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34], "firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240], "floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34], "forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255], "fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220], "gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255], "ghostwhite": [248, 248, 255],
"gold": [255, 215, 0], "gold": [255, 215, 0],
"goldenrod": [218, 165, 32], "goldenrod": [218, 165, 32],
"gray": [128, 128, 128], "gray": [128, 128, 128],
"green": [0, 128, 0], "green": [0, 128, 0],
"greenyellow": [173, 255, 47], "greenyellow": [173, 255, 47],
"grey": [128, 128, 128], "grey": [128, 128, 128],
"honeydew": [240, 255, 240], "honeydew": [240, 255, 240],
"hotpink": [255, 105, 180], "hotpink": [255, 105, 180],
"indianred": [205, 92, 92], "indianred": [205, 92, 92],
"indigo": [75, 0, 130], "indigo": [75, 0, 130],
"ivory": [255, 255, 240], "ivory": [255, 255, 240],
"khaki": [240, 230, 140], "khaki": [240, 230, 140],
"lavender": [230, 230, 250], "lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245], "lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0], "lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205], "lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230], "lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128], "lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255], "lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210], "lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211], "lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144], "lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211], "lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193], "lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122], "lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170], "lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250], "lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153], "lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153], "lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222], "lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224], "lightyellow": [255, 255, 224],
"lime": [0, 255, 0], "lime": [0, 255, 0],
"limegreen": [50, 205, 50], "limegreen": [50, 205, 50],
"linen": [250, 240, 230], "linen": [250, 240, 230],
"magenta": [255, 0, 255], "magenta": [255, 0, 255],
"maroon": [128, 0, 0], "maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170], "mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205], "mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211], "mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219], "mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113], "mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238], "mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154], "mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204], "mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133], "mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112], "midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250], "mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225], "mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181], "moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173], "navajowhite": [255, 222, 173],
"navy": [0, 0, 128], "navy": [0, 0, 128],
"oldlace": [253, 245, 230], "oldlace": [253, 245, 230],
"olive": [128, 128, 0], "olive": [128, 128, 0],
"olivedrab": [107, 142, 35], "olivedrab": [107, 142, 35],
"orange": [255, 165, 0], "orange": [255, 165, 0],
"orangered": [255, 69, 0], "orangered": [255, 69, 0],
"orchid": [218, 112, 214], "orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170], "palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152], "palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238], "paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147], "palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213], "papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185], "peachpuff": [255, 218, 185],
"peru": [205, 133, 63], "peru": [205, 133, 63],
"pink": [255, 192, 203], "pink": [255, 192, 203],
"plum": [221, 160, 221], "plum": [221, 160, 221],
"powderblue": [176, 224, 230], "powderblue": [176, 224, 230],
"purple": [128, 0, 128], "purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153], "rebeccapurple": [102, 51, 153],
"red": [255, 0, 0], "red": [255, 0, 0],
"rosybrown": [188, 143, 143], "rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225], "royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19], "saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114], "salmon": [250, 128, 114],
"sandybrown": [244, 164, 96], "sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87], "seagreen": [46, 139, 87],
"seashell": [255, 245, 238], "seashell": [255, 245, 238],
"sienna": [160, 82, 45], "sienna": [160, 82, 45],
"silver": [192, 192, 192], "silver": [192, 192, 192],
"skyblue": [135, 206, 235], "skyblue": [135, 206, 235],
"slateblue": [106, 90, 205], "slateblue": [106, 90, 205],
"slategray": [112, 128, 144], "slategray": [112, 128, 144],
"slategrey": [112, 128, 144], "slategrey": [112, 128, 144],
"snow": [255, 250, 250], "snow": [255, 250, 250],
"springgreen": [0, 255, 127], "springgreen": [0, 255, 127],
"steelblue": [70, 130, 180], "steelblue": [70, 130, 180],
"tan": [210, 180, 140], "tan": [210, 180, 140],
"teal": [0, 128, 128], "teal": [0, 128, 128],
"thistle": [216, 191, 216], "thistle": [216, 191, 216],
"tomato": [255, 99, 71], "tomato": [255, 99, 71],
"turquoise": [64, 224, 208], "turquoise": [64, 224, 208],
"violet": [238, 130, 238], "violet": [238, 130, 238],
"wheat": [245, 222, 179], "wheat": [245, 222, 179],
"white": [255, 255, 255], "white": [255, 255, 255],
"whitesmoke": [245, 245, 245], "whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0], "yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50] "yellowgreen": [154, 205, 50]
}; };
var conversions = createCommonjsModule(function (module) { var conversions = createCommonjsModule(function (module) {
...@@ -20885,9 +21044,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -20885,9 +21044,9 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
return sendData(); return sendData();
}; };
} }
function accessLog(pagebizid, params) { function accessLog(pageBizId, params) {
var p = { var p = {
pagebizid: pagebizid, pageBizId: pageBizId,
}; };
injectProp(p, params); injectProp(p, params);
return httpRequest('buriedPoint', 'get', p); return httpRequest('buriedPoint', 'get', p);
...@@ -20999,30 +21158,22 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -20999,30 +21158,22 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}); });
GameStage.prototype.launch = function (config, onPreloadAssetsProgress, onPreloadAssetsComplete, onStart) { GameStage.prototype.launch = function (config, onPreloadAssetsProgress, onPreloadAssetsComplete, onStart) {
return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__awaiter(this, void 0, void 0, function () {
function p() { var _a, env, dataMapping, processes, builtinProcesses, customs;
loaded++; return tslib_1.__generator(this, function (_b) {
onPreloadAssetsProgress && onPreloadAssetsProgress(loaded, total); switch (_b.label) {
if (loaded >= total) {
onPreloadAssetsComplete && onPreloadAssetsComplete();
}
}
var assets, customs, loaded, assetsToLoad, total;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: case 0:
this._config = config; this._config = config;
assets = config.assets, customs = config.customs; _a = this._config, env = _a.options.env, dataMapping = _a.dataMapping, processes = _a.processes, builtinProcesses = _a.builtinProcesses, customs = _a.customs;
loaded = 0; Stage.addUpdateObj(Tween);
assetsToLoad = assets; injectEnv(env);
if (!Array.isArray(assets)) { registerCustomModules(customs);
assetsToLoad = assets['common']; if (dataMapping) {
this.dataCenter.registerDataMapping(dataMapping);
} }
total = assetsToLoad.length; setProcessMetaLibs(processes, builtinProcesses);
return [4, loadAssets(assetsToLoad, p).catch(function (e) { return [4, this.loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete)];
console.log(e);
})];
case 1: case 1:
_a.sent(); _b.sent();
this.start(); this.start();
dealPxEnv(); dealPxEnv();
dealPageRemainTime(); dealPageRemainTime();
...@@ -21035,14 +21186,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21035,14 +21186,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}; };
GameStage.prototype.start = function () { GameStage.prototype.start = function () {
var _this = this; 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; var entrySceneView = this._config.options.entrySceneView;
Stage.addUpdateObj(Tween);
injectEnv(env);
registerCustomModules(customs);
if (dataMapping) {
this.dataCenter.registerDataMapping(dataMapping);
}
setProcessMetaLibs(processes, builtinProcesses);
setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var sceneEntry; var sceneEntry;
return tslib_1.__generator(this, function (_a) { return tslib_1.__generator(this, function (_a) {
...@@ -21119,6 +21263,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21119,6 +21263,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
groups[viewConfig.uuid] = depAssets; 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 [4, loadAssetsGroups(groups, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) { return tslib_1.__generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
...@@ -21206,6 +21351,58 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21206,6 +21351,58 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}; };
GameStage.prototype.onPopupContainerComplete = function (e) { 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; return GameStage;
}(Node$1)); }(Node$1));
...@@ -21293,6 +21490,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21293,6 +21490,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
} }
} }
var alignManager = alignMgr;
function launch(url, loadingDelegate, onStart) { function launch(url, loadingDelegate, onStart) {
if (queryParams.__proxy_mode__) { if (queryParams.__proxy_mode__) {
return Promise.resolve('cancel launch'); return Promise.resolve('cancel launch');
...@@ -21358,101 +21556,14 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -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; 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(); var emojiRegexp = emojiRegex();
Object.defineProperty(exports, 'computeProps', {
enumerable: true,
get: function () {
return propsCompute.compute;
}
});
exports.BaseTexture = BaseTexture; exports.BaseTexture = BaseTexture;
exports.BaseTextureCache = BaseTextureCache; exports.BaseTextureCache = BaseTextureCache;
exports.BitmapText = BitmapText; exports.BitmapText = BitmapText;
...@@ -21517,6 +21628,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21517,6 +21628,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.abs = abs; exports.abs = abs;
exports.accessLog = accessLog; exports.accessLog = accessLog;
exports.addCustomModule = addCustomModule; exports.addCustomModule = addCustomModule;
exports.alignManager = alignManager;
exports.appendScript = appendScript; exports.appendScript = appendScript;
exports.applyEvents = applyEvents; exports.applyEvents = applyEvents;
exports.applyScript = applyScript; exports.applyScript = applyScript;
...@@ -21527,7 +21639,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21527,7 +21639,6 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.clearTextureCache = clearTextureCache; exports.clearTextureCache = clearTextureCache;
exports.cmdOldPrefix = cmdOldPrefix; exports.cmdOldPrefix = cmdOldPrefix;
exports.cmdPrefix = cmdPrefix; exports.cmdPrefix = cmdPrefix;
exports.computeProps = compute;
exports.copyProp = copyProp; exports.copyProp = copyProp;
exports.cos = cos; exports.cos = cos;
exports.countTrailingZeros = countTrailingZeros; exports.countTrailingZeros = countTrailingZeros;
...@@ -21633,6 +21744,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21633,6 +21744,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
exports.strLen = strLen; exports.strLen = strLen;
exports.strShort = strShort; exports.strShort = strShort;
exports.string2hex = string2hex; exports.string2hex = string2hex;
exports.toBoolean = toBoolean;
exports.toDisplayDataURL = toDisplayDataURL; exports.toDisplayDataURL = toDisplayDataURL;
exports.transPoint = transPoint; exports.transPoint = transPoint;
exports.traverseViewNode = traverseViewNode; exports.traverseViewNode = traverseViewNode;
...@@ -21642,5 +21754,5 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -21642,5 +21754,5 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
})); })));
//# sourceMappingURL=engine.js.map //# 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 { ...@@ -26,10 +26,10 @@ export default {
}, },
], ],
plugins: [ plugins: [
progress(), // progress(),
resolve({}), resolve({}),
typescript({ typescript({
//useTsconfigDeclarationDir: true, // useTsconfigDeclarationDir: true,
}), }),
commonjs(), commonjs(),
process.env.BUILD === 'production' && uglify({}) process.env.BUILD === 'production' && uglify({})
......
import {DisplayObject} from './DisplayObject'; import { DisplayObject } from './DisplayObject';
import {Rectangle} from "../math/Rectangle"; import { Rectangle } from "../math/Rectangle";
import {Point} from '../math/index'; import { Point } from '../math/index';
import CanvasRenderer from '../renderers/CanvasRenderer'; import CanvasRenderer from '../renderers/CanvasRenderer';
import {Event} from "../events/Event" import { Event } from "../events/Event"
import {WebglRenderer} from '../renderers/WebglRenderer'; import { WebglRenderer } from '../renderers/WebglRenderer';
import {applyAutoAdjust} from "../../zeroing/decorators/auto-adjust"; import { applyAutoAdjust } from "../../zeroing/decorators/auto-adjust";
import {applyScript} from "../../zeroing/decorators/scripts"; import { applyScript } from "../../zeroing/decorators/scripts";
import {applyEvents} from "../../zeroing/decorators/events"; import { applyEvents } from "../../zeroing/decorators/events";
import {afterConstructor} from "../../zeroing/decorators/after-constructor"; import { afterConstructor } from "../../zeroing/decorators/after-constructor";
import {injectProperties, instantiateScript} from "../../zeroing/utils/index"; import { injectProperties, instantiateScript, toBoolean } from "../../zeroing/utils/index";
import {isUI} from "../../zeroing/game-warpper/nodes/IUIComponent"; import { isUI } from "../../zeroing/game-warpper/nodes/IUIComponent";
import Transform from "../math/Transform"; import Transform from "../math/Transform";
/** /**
...@@ -23,811 +23,885 @@ import Transform from "../math/Transform"; ...@@ -23,811 +23,885 @@ import Transform from "../math/Transform";
@applyScript @applyScript
@applyEvents @applyEvents
export default class Container extends DisplayObject { export default class Container extends DisplayObject {
percentWidth: number; percentWidth: number;
percentHeight: number; percentHeight: number;
left: number; left: number;
top: number; top: number;
right: number; right: number;
bottom: number; bottom: number;
horizonCenter: number; horizonCenter: number;
verticalCenter: number; verticalCenter: number;
private _transform: Transform; private _transform: Transform;
private _lastLocalID; private _lastLocalID;
/** /**
* 为false鼠标事件不再向下传递 * 为false鼠标事件不再向下传递
*/ */
_mouseChildren: boolean = true; _mouseChildren: boolean = true;
/** /**
* 孩子们 * 孩子们
* @member {DisplayObject[]} * @member {DisplayObject[]}
* @readonly * @readonly
*/ */
children: any[]; children: any[];
/** /**
* 特殊用处 * 特殊用处
* 缓存的Container的updateTransform * 缓存的Container的updateTransform
*/ */
containerUpdateTransform; containerUpdateTransform;
constructor() { constructor() {
super(); super();
this._instanceType = "Container"; this._instanceType = "Container";
this.children = []; this.children = [];
this._transform = this.transform; this._transform = this.transform;
this.afterConstructor(); this.afterConstructor();
} }
get mouseChildren() { get mouseChildren() {
return this._mouseChildren; return this._mouseChildren;
} }
set mouseChildren(v) { set mouseChildren(v) {
this._mouseChildren = v; this._mouseChildren = v;
} }
afterConstructor() { afterConstructor() {
} }
/** /**
* children改变时 * children改变时
* @private * @private
*/ */
onChildrenChange(index) { onChildrenChange(index) {
/* empty */ /* empty */
//子类需要时重写 //子类需要时重写
} this.dispatchEvent(Event.MAYBE_ALIGN);
}
attachVisibility() {
return; attachVisibility() {
this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN); return;
for (let i = 0, li = this.children.length; i < li; i++) { this.dispatchEvent(this.worldVisible ? Event.VISIBLE : Event.HIDDEN);
const child = <Container>this.children[i]; for(let i = 0, li = this.children.length; i < li; i++) {
child.attachVisibility(); const child = <Container>this.children[i];
} child.attachVisibility();
} }
}
/**
* 添加child /**
* @param {DisplayObject} child * 添加child
* @return {DisplayObject} * @param {DisplayObject} child
*/ * @return {DisplayObject}
addChild(child: DisplayObject): DisplayObject { */
//默认添加在最顶层 addChild(child: DisplayObject): DisplayObject {
this.addChildAt(child, this.children.length); //默认添加在最顶层
return child; this.addChildAt(child, this.children.length);
} return child;
}
/**
* 在相应index处添加child /**
* @param {DisplayObject} child - The child to add * 在相应index处添加child
* @param {number} index - The index to place the child in * @param {DisplayObject} child - The child to add
* @return {DisplayObject} The child that was added. * @param {number} index - The index to place the child in
*/ * @return {DisplayObject} The child that was added.
addChildAt(child: DisplayObject, index: number): DisplayObject { */
if (!child) return; addChildAt(child: DisplayObject, index: number): DisplayObject {
if(!child) return;
let s = this;
let sameParent = (s == child.parent); let s = this;
let len: number; let sameParent = (s == child.parent);
if (child.parent) { let len: number;
if (!sameParent) { if(child.parent) {
child.parent.removeChild(child); if(!sameParent) {
} else { child.parent.removeChild(child);
len = s.children.length; } else {
for (let i = 0; i < len; i++) { len = s.children.length;
if (s.children[i] == child) { for(let i = 0; i < len; i++) {
s.children.splice(i, 1); if(s.children[i] == child) {
break; s.children.splice(i, 1);
} break;
} }
} }
} }
child.parent = s; }
child.parent = s;
//保证child的transform会被更新
child.transform._parentID = -1; //保证child的transform会被更新
child.transform._parentID = -1;
//确保包围盒重新计算
this._boundsID++; //确保包围盒重新计算
this._boundsID++;
len = s.children.length;
if (index >= len) { len = s.children.length;
s.children[s.children.length] = child; if(index >= len) {
index = len; s.children[s.children.length] = child;
} else if (index == 0 || index < 0) { index = len;
s.children.unshift(child); } else if(index == 0 || index < 0) {
index = 0; s.children.unshift(child);
} else { index = 0;
s.children.splice(index, 0, child); } else {
} s.children.splice(index, 0, child);
if (s.stage && !sameParent) { }
// child["_cp"] = true; if(s.stage && !sameParent) {
child._onDispatchBubbledEvent(Event.ADDED_TO_STAGE); // child["_cp"] = true;
} child._onDispatchBubbledEvent(Event.ADDED_TO_STAGE);
}
this.onChildrenChange(index);
this.onChildrenChange(index);
return child;
} return child;
}
/**
* 只用于交换索引 /**
* @param {DisplayObject} child - First display object to swap * 只用于交换索引
* @param {DisplayObject} child2 - Second display object to swap * @param {DisplayObject} child - First display object to swap
*/ * @param {DisplayObject} child2 - Second display object to swap
swapChildren(child1: DisplayObject, child2: DisplayObject) { */
if (child1 === child2) { swapChildren(child1: DisplayObject, child2: DisplayObject) {
return; if(child1 === child2) {
} return;
let s = this; }
let id1 = -1; let s = this;
let id2 = -1; let id1 = -1;
let childCount = s.children.length; let id2 = -1;
if (typeof (child1) == "number") { let childCount = s.children.length;
id1 = child1; if(typeof (child1) == "number") {
} else { id1 = child1;
id1 = s.getChildIndex(child1); } else {
} id1 = s.getChildIndex(child1);
if (typeof (child2) == "number") { }
id2 = child2; if(typeof (child2) == "number") {
} else { id2 = child2;
id2 = s.getChildIndex(child2); } else {
} id2 = s.getChildIndex(child2);
if (id1 == id2 || id1 < 0 || id1 >= childCount || id2 < 0 || id2 >= childCount) { }
return false; if(id1 == id2 || id1 < 0 || id1 >= childCount || id2 < 0 || id2 >= childCount) {
} else { return false;
let temp: any = s.children[id1]; } else {
s.children[id1] = s.children[id2]; let temp: any = s.children[id1];
s.children[id2] = temp; s.children[id1] = s.children[id2];
s.children[id2] = temp;
this.onChildrenChange(id1 < id2 ? id1 : id2);
return true; this.onChildrenChange(id1 < id2 ? id1 : id2);
} return true;
}
}
}
/**
* 获取child的层级索引index /**
* @param {DisplayObject} child - The DisplayObject instance to identify * 获取child的层级索引index
* @return {number} The index position of the child display object to identify * @param {DisplayObject} child - The DisplayObject instance to identify
*/ * @return {number} The index position of the child display object to identify
getChildIndex(child: DisplayObject): number { */
const index = this.children.indexOf(child); getChildIndex(child: DisplayObject): number {
const index = this.children.indexOf(child);
if (index === -1) {
return null if(index === -1) {
} return null
return index; }
} return index;
}
/**
* 是否含有child /**
* @param child * 是否含有child
*/ * @param child
contains(child: DisplayObject): boolean { */
return !!this.getChildIndex(child); contains(child: DisplayObject): boolean {
} return !!this.getChildIndex(child);
}
/**
* 设置child的层级 /**
* @param {DisplayObject} child * 设置child的层级
* @param {number} index * @param {DisplayObject} child
*/ * @param {number} index
setChildIndex(child: DisplayObject, index: number) { */
this.addChildAt(child, index); setChildIndex(child: DisplayObject, index: number) {
} this.addChildAt(child, index);
}
/**
* Returns the child at the specified index /**
* @param {number} index - The index to get the child at * Returns the child at the specified index
* @return {DisplayObject} The child at the given index, if any. * @param {number} index - The index to get the child at
*/ * @return {DisplayObject} The child at the given index, if any.
getChildAt(index: number): DisplayObject { */
if (index < 0 || index >= this.children.length) { getChildAt(index: number): DisplayObject {
return null if(index < 0 || index >= this.children.length) {
} return null
return this.children[index]; }
} return this.children[index];
}
/**
* 根据路径获取子节点 /**
* @param path * 根据路径获取子节点
* @param method * @param path
*/ * @param method
getChildByPath(path: any, method: string): DisplayObject { */
if (!path) { getChildByPath(path: any, method: string): DisplayObject {
return null; if(!path) {
} return null;
let p = this; }
while (path.length > 0) { let p = this;
let segment = path.shift(); while(path.length > 0) {
p = p[method](segment); let segment = path.shift();
if (!p) { p = p[method](segment);
break; if(!p) {
} break;
} }
}
return p;
} return p;
}
/**
* 根据名称路径获取子节点 /**
* @param path * 根据名称路径获取子节点
*/ * @param path
getChildByNamePath(path: string): DisplayObject { */
const pathArr = path.split('/'); getChildByNamePath(path: string): DisplayObject {
return this.getChildByPath(pathArr, 'getChildByName'); const pathArr = path.split('/');
} return this.getChildByPath(pathArr, 'getChildByName');
}
/**
* 根据索引路径获取子节点 /**
* @param path * 根据索引路径获取子节点
*/ * @param path
getChildByIndexPath(path: string): DisplayObject { */
const pathArr = path.split('/').map(seg => parseInt(seg)); getChildByIndexPath(path: string): DisplayObject {
return this.getChildByPath(pathArr, 'getChildAt'); const pathArr = path.split('/').map(seg => parseInt(seg));
} return this.getChildByPath(pathArr, 'getChildAt');
}
/**
* 根据uuid搜索子节点 /**
* @param uuid * 根据uuid搜索子节点
*/ * @param uuid
findChildByUUID(uuid: string) { */
if (this['uuid'] === uuid) { findChildByUUID(uuid: string) {
return this; if(this['uuid'] === uuid) {
} return this;
}
if (this.children && this.children.length > 0) {
for (let child of this.children) { if(this.children && this.children.length > 0) {
if (child.findChildByUUID) { for(let child of this.children) {
let target = child.findChildByUUID(uuid); if(child.findChildByUUID) {
if (target) { let target = child.findChildByUUID(uuid);
return target; if(target) {
} return target;
} }
} }
} }
} }
}
/**
* 通过名字获取子级 /**
* @param name * 通过名字获取子级
* @param isOnlyOne * @param name
* @param isRecursive * @param isOnlyOne
*/ * @param isRecursive
public getChildByName(name: string | RegExp, isOnlyOne: boolean = true, isRecursive: boolean = false): any { */
if (!name) return null; public getChildByName(name: string | RegExp, isOnlyOne: boolean = true, isRecursive: boolean = false): any {
let s = this; if(!name) return null;
let rex: any; let s = this;
if (typeof (name) == "string") { let rex: any;
rex = new RegExp("^" + name + "$"); if(typeof (name) == "string") {
} else { rex = new RegExp("^" + name + "$");
rex = name; } else {
} rex = name;
let elements: Array<DisplayObject> = []; }
Container._getElementsByName(rex, s, isOnlyOne, isRecursive, elements); let elements: Array<DisplayObject> = [];
let len = elements.length; Container._getElementsByName(rex, s, isOnlyOne, isRecursive, elements);
if (len == 0) { let len = elements.length;
return null; if(len == 0) {
} else if (len == 1) { return null;
return elements[0]; } else if(len == 1) {
} else { return elements[0];
return elements; } else {
} return elements;
} }
}
/**
* 移除child /**
* @param {DisplayObject} child * 移除child
* @return {DisplayObject} * @param {DisplayObject} child
*/ * @return {DisplayObject}
removeChild(child: DisplayObject): DisplayObject { */
removeChild(child: DisplayObject): DisplayObject {
const index = this.children.indexOf(child);
const index = this.children.indexOf(child);
if (index === -1) return null;
if(index === -1) return null;
this.removeChildAt(index);
this.removeChildAt(index);
return child;
} return child;
}
/**
* 在index处移除child /**
* @param {number} index - The index to get the child from * 在index处移除child
* @return {DisplayObject} The child that was removed. * @param {number} index - The index to get the child from
*/ * @return {DisplayObject} The child that was removed.
removeChildAt(index: number): DisplayObject { */
let s = this; removeChildAt(index: number): DisplayObject {
let child: any; let s = this;
let len = s.children.length - 1; let child: any;
if (len < 0) return; let len = s.children.length - 1;
if (index == len) { if(len < 0) return;
child = s.children.pop(); if(index == len) {
} else if (index == 0) { child = s.children.pop();
child = s.children.shift(); } else if(index == 0) {
} else { child = s.children.shift();
child = s.children.splice(index, 1)[0]; } else {
} child = s.children.splice(index, 1)[0];
child._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE); }
child._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE);
//保证子级会被更新
child.parent = null; //保证子级会被更新
child.transform._parentID = -1; child.parent = null;
child.transform._parentID = -1;
//保证包围盒重新计算
this._boundsID++; //保证包围盒重新计算
this._boundsID++;
this.onChildrenChange(index);
this.onChildrenChange(index);
return child;
} return child;
}
/**
* 通过索引批量移除child /**
* @param {number} [beginIndex=0] * 通过索引批量移除child
* @param {number} [endIndex=this.children.length] * @param {number} [beginIndex=0]
* @returns {DisplayObject[]} List of removed children * @param {number} [endIndex=this.children.length]
*/ * @returns {DisplayObject[]} List of removed children
removeChildren(beginIndex: number = 0, endIndex: number = this.children.length): DisplayObject[] { */
const begin = beginIndex; removeChildren(beginIndex: number = 0, endIndex: number = this.children.length): DisplayObject[] {
const end = typeof endIndex === 'number' ? endIndex : this.children.length; const begin = beginIndex;
const range = end - begin; const end = typeof endIndex === 'number' ? endIndex : this.children.length;
let removed; const range = end - begin;
let removed;
if (range > 0 && range <= end) {
removed = this.children.splice(begin, range); if(range > 0 && range <= end) {
removed = this.children.splice(begin, range);
for (let i = 0; i < removed.length; ++i) {
removed[i].parent = null; for(let i = 0; i < removed.length; ++i) {
if (removed[i].transform) { removed[i].parent = null;
removed[i].transform._parentID = -1; if(removed[i].transform) {
} removed[i].transform._parentID = -1;
} }
}
this._boundsID++;
this._boundsID++;
this.onChildrenChange(beginIndex);
this.onChildrenChange(beginIndex);
for (let i = 0; i < removed.length; ++i) {
removed[i]._onDispatchBubbledEvent(Event.REMOVED_FROM_STAGE); 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) { return removed;
return []; } else if(range === 0 && this.children.length === 0) {
} return [];
}
throw new RangeError('removeChildren: numeric values are outside the acceptable range.');
} throw new RangeError('removeChildren: numeric values are outside the acceptable range.');
}
/**
* 更新矩阵 /**
*/ * 更新矩阵
updateTransform() { */
//自己先算 updateTransform() {
super.updateTransform(); //自己先算
//考虑是否要加, super.updateTransform();
this._boundsID++; //考虑是否要加,
//children遍历计算 this._boundsID++;
for (let i = 0, j = this.children.length; i < j; ++i) { //children遍历计算
const child = this.children[i]; for(let i = 0, j = this.children.length; i < j; ++i) {
if (child.visible) { const child = this.children[i];
child.updateTransform(); if(child.visible) {
} child.updateTransform();
} }
}
/*if(this._transform === this.transform && isUI(this) && this._lastLocalID !== this.transform.localID){
this._lastLocalID = this.transform.localID; /*if(this._transform === this.transform && isUI(this) && this._lastLocalID !== this.transform.localID){
//console.log(this.name, this.instanceId , 'dirty!'); this._lastLocalID = this.transform.localID;
this.stage.layoutInvalid = true; //console.log(this.name, this.instanceId , 'dirty!');
}*/ this.stage.layoutInvalid = true;
} }*/
}
/**
* 父类重写 /**
* 都是全局的 * 父类重写
*/ * 都是全局的
calculateBounds() { */
if (this._lastBoundsID == this._boundsID) return calculateBounds() {
this._lastBoundsID = this._boundsID if(this._lastBoundsID == this._boundsID) return
this._bounds.clear(); this._lastBoundsID = this._boundsID
//算自己的 this._bounds.clear();
this._calculateBounds(); //算自己的
for (let i = 0; i < this.children.length; i++) { this._calculateBounds();
const child = this.children[i]; for(let i = 0; i < this.children.length; i++) {
if (!child.visible || !child.renderable) { const child = this.children[i];
continue; if(!child.visible || !child.renderable) {
} continue;
child.calculateBounds(); }
if (child.$mask) { child.calculateBounds();
child.$mask.calculateBounds(); if(child.$mask) {
//取交集矩形 child.$mask.calculateBounds();
if (child._bounds.x < child.$mask._bounds.x) { //取交集矩形
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) { }
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) { }
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) { }
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); }
} else { Rectangle.createFromRects(this._bounds, child._bounds);
Rectangle.createFromRects(this._bounds, child._bounds); } else {
} Rectangle.createFromRects(this._bounds, child._bounds);
} }
}
}
}
/**
* 加"_"的方法基本是为了自己特殊处理 /**
*/ * 加"_"的方法基本是为了自己特殊处理
protected _calculateBounds() { */
//子类自己重写 protected _calculateBounds() {
//let wp = this.worldMatrix.transformPoint(this.x, this.y); //子类自己重写
//let wp = this.worldMatrix.transformPoint(this.x, this.y);
let widthSetted = !!this._width && this._width !== 0;
let heightSetted = !!this._height && this._height !== 0; let widthSetted = !!this._width && this._width !== 0;
/*if (widthSetted) { let heightSetted = !!this._height && this._height !== 0;
this._bounds.x = this.x; /*if (widthSetted) {
this._bounds.width = this._width; this._bounds.x = this.x;
} this._bounds.width = this._width;
if (heightSetted) { }
this._bounds.y = this.y; if (heightSetted) {
this._bounds.height = this._height; this._bounds.y = this.y;
}*/ this._bounds.height = this._height;
}*/
if(widthSetted || heightSetted){
const rect = this._localBoundsSelf; if(widthSetted || heightSetted) {
var matrix = this.transform.worldMatrix; const rect = this._localBoundsSelf;
matrix.transformPoint(rect.x, rect.y, DisplayObject._p1); var matrix = this.transform.worldMatrix;
matrix.transformPoint(rect.x + rect.width, rect.y, DisplayObject._p2); matrix.transformPoint(rect.x, rect.y, DisplayObject._p1);
matrix.transformPoint(rect.x + rect.width, rect.y + rect.height, DisplayObject._p3); matrix.transformPoint(rect.x + rect.width, rect.y, DisplayObject._p2);
matrix.transformPoint(rect.x, rect.y + rect.height, DisplayObject._p4); matrix.transformPoint(rect.x + rect.width, rect.y + rect.height, DisplayObject._p3);
Rectangle.createFromPoints(this._bounds, DisplayObject._p1, DisplayObject._p2, DisplayObject._p3, DisplayObject._p4); matrix.transformPoint(rect.x, rect.y + rect.height, DisplayObject._p4);
} Rectangle.createFromPoints(this._bounds, DisplayObject._p1, DisplayObject._p2, DisplayObject._p3, DisplayObject._p4);
} }
}
/**
* 检测点是否在任何child上 /**
* 重写父类方法 * 检测点是否在任何child上
*/ * 重写父类方法
hitTestPoint(globalPoint: Point, isMouseEvent: boolean = false) { */
//如果不可见 hitTestPoint(globalPoint: Point, isMouseEvent: boolean = false) {
if (!this.visible) return null //如果不可见
//如果禁止子级的鼠标事件 if(!this.visible) return null
if (isMouseEvent && !this.mouseChildren){ //如果禁止子级的鼠标事件
return this.hitTestSelf(globalPoint); if(isMouseEvent && !this.mouseChildren) {
} return this.hitTestSelf(globalPoint);
var children = this.children; }
var length = children.length; var children = this.children;
let child, hitDisplayObject; var length = children.length;
//后序遍历,后添加的在上层 let child, hitDisplayObject;
for (var i = length - 1; i >= 0; i--) { //后序遍历,后添加的在上层
child = children[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); //检测
//存在直接返回 hitDisplayObject = child.hitTestPoint(globalPoint, isMouseEvent);
if (hitDisplayObject) return hitDisplayObject; //存在直接返回
} if(hitDisplayObject) return hitDisplayObject;
}
return this.displayObjectHitTestPoint(globalPoint, isMouseEvent);
} return this.displayObjectHitTestPoint(globalPoint, isMouseEvent);
}
hitTestSelf(globalPoint) {
if (this.mouseEnabled) { hitTestSelf(globalPoint) {
return this.hitTestSelfBounds(globalPoint); if(this.mouseEnabled) {
} return this.hitTestSelfBounds(globalPoint);
return null; }
} return null;
}
hitTestSelfBounds(globalPoint) {
if (this._width && this._height) { hitTestSelfBounds(globalPoint) {
//let {x: tx, y: ty} = this.getBounds(); if(this._width && this._height) {
let {tx, ty} = this.worldMatrix; //let {x: tx, y: ty} = this.getBounds();
const {x, y} = globalPoint; let {tx, ty} = this.worldMatrix;
if (x > tx && const {x, y} = globalPoint;
x < tx + this.width && if(x > tx &&
y > ty && x < tx + this.width &&
y < ty + this.height y > ty &&
) return this; y < ty + this.height
} ) return this;
return null }
} return null
}
/**
* webgl渲染 /**
* @param {WebglRenderer} renderer - The renderer * webgl渲染
*/ * @param {WebglRenderer} renderer - The renderer
renderWebGL(renderer: WebglRenderer) { */
//不可见,全局透明度为0,或者 不渲染,直接return renderWebGL(renderer: WebglRenderer) {
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { //不可见,全局透明度为0,或者 不渲染,直接return
return; if(!this.visible || this.worldAlpha <= 0 || !this.renderable) {
} return;
//是否有遮罩。到时如果有滤镜, }
if (this.mask) { //是否有遮罩。到时如果有滤镜,
this.renderAdvancedWebGL(renderer); if(this.mask) {
} else { this.renderAdvancedWebGL(renderer);
//自身先渲染 } else {
this._renderWebGL(renderer); //自身先渲染
//遍历children this._renderWebGL(renderer);
for (let i = 0, j = this.children.length; i < j; ++i) { //遍历children
this.children[i].renderWebGL(renderer); for(let i = 0, j = this.children.length; i < j; ++i) {
} this.children[i].renderWebGL(renderer);
} }
} }
}
/**
* 高级渲染方法 /**
* * 高级渲染方法
* @private *
* @param {WebGLRenderer} renderer - The renderer * @private
*/ * @param {WebGLRenderer} renderer - The renderer
private renderAdvancedWebGL(renderer: WebglRenderer) { */
//之前的批处理刷掉先 private renderAdvancedWebGL(renderer: WebglRenderer) {
renderer.batchManager.flush(); //之前的批处理刷掉先
renderer.batchManager.flush();
//有滤镜再说
//有滤镜再说
const mask = this.mask;
const mask = this.mask;
if (mask) {
//先画遮罩 if(mask) {
renderer.maskManager.pushMask(this, this.mask); //先画遮罩
} renderer.maskManager.pushMask(this, this.mask);
}
//渲染自身
this._renderWebGL(renderer); //渲染自身
this._renderWebGL(renderer);
//遍历children
for (let i = 0, j = this.children.length; i < j; i++) { //遍历children
this.children[i].renderWebGL(renderer); for(let i = 0, j = this.children.length; i < j; i++) {
} this.children[i].renderWebGL(renderer);
}
//刷掉批处理
renderer.batchManager.flush(); //刷掉批处理
renderer.batchManager.flush();
if (mask) {
//移除遮罩,支持多重遮罩 if(mask) {
renderer.maskManager.popMask(this, this.mask); //移除遮罩,支持多重遮罩
} renderer.maskManager.popMask(this, this.mask);
} }
}
/**
* 自身渲染方式 /**
* @private * 自身渲染方式
* @param {WebglRenderer} renderer - The renderer * @private
*/ * @param {WebglRenderer} renderer - The renderer
protected _renderWebGL(renderer: WebglRenderer) { */
//自身绘制方法 protected _renderWebGL(renderer: WebglRenderer) {
} //自身绘制方法
}
/**
* canvas渲染方式 /**
* @param {CanvasRenderer} renderer - The renderer * canvas渲染方式
*/ * @param {CanvasRenderer} renderer - The renderer
renderCanvas(renderer: CanvasRenderer) { */
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { renderCanvas(renderer: CanvasRenderer) {
return; if(!this.visible || this.worldAlpha <= 0 || !this.renderable) {
} return;
}
if (this.mask) {
renderer.maskManager.pushMask(this.mask); if(this.mask) {
} renderer.maskManager.pushMask(this.mask);
}
this._renderCanvas(renderer);
for (let i = 0, j = this.children.length; i < j; ++i) { this._renderCanvas(renderer);
this.children[i].renderCanvas(renderer); for(let i = 0, j = this.children.length; i < j; ++i) {
} this.children[i].renderCanvas(renderer);
}
if (this.mask) {
renderer.maskManager.popMask(renderer); if(this.mask) {
} renderer.maskManager.popMask(renderer);
} }
}
/**
* 自身渲染方法 /**
* * 自身渲染方法
* @private *
* @param {CanvasRenderer} renderer - The renderer * @private
*/ * @param {CanvasRenderer} renderer - The renderer
protected _renderCanvas(renderer: CanvasRenderer) { */
//自身绘制方法 protected _renderCanvas(renderer: CanvasRenderer) {
} //自身绘制方法
}
/**
* 更新方法 /**
*/ * 更新方法
update(deltaTime: number) { */
/*if (!this.visible) return;*/ update(deltaTime: number) {
//更新自己的 /*if (!this.visible) return;*/
super.update(deltaTime) //更新自己的
//更新儿子们的 super.update(deltaTime)
let len = this.children.length; //更新儿子们的
for (let i = len - 1; i >= 0; i--) { let len = this.children.length;
const child = this.children[i]; for(let i = len - 1; i >= 0; i--) {
/*if (child.visible)*/ const child = this.children[i];
child.update(deltaTime); /*if (child.visible)*/
} child.update(deltaTime);
} }
}
/**
* 调用此方法对自己及其child触发一次指定事件 /**
* @method _onDispatchBubbledEvent * 调用此方法对自己及其child触发一次指定事件
* @public * @method _onDispatchBubbledEvent
* @param {string} type * @public
* @since 1.0.0 * @param {string} type
*/ * @since 1.0.0
public _onDispatchBubbledEvent(type: string): void { */
let s = this; public _onDispatchBubbledEvent(type: string): void {
let len = s.children.length; let s = this;
if (type == Event.REMOVED_FROM_STAGE && !s.stage) return; let len = s.children.length;
super._onDispatchBubbledEvent(type); if(type == Event.REMOVED_FROM_STAGE && !s.stage) return;
for (let i = 0; i < len; i++) { super._onDispatchBubbledEvent(type);
s.children[i]._onDispatchBubbledEvent(type); for(let i = 0; i < len; i++) {
} s.children[i]._onDispatchBubbledEvent(type);
}
}
}
/**
* /**
*/ *
destroy() { */
let s = this; destroy() {
//让子级也destroy let s = this;
for (let i = s.children.length - 1; i >= 0; i--) { //让子级也destroy
s.children[i].destroy(); for(let i = s.children.length - 1; i >= 0; i--) {
} s.children[i].destroy();
super.destroy(); }
this.mouseChildren = false; super.destroy();
} this.mouseChildren = false;
}
/**
* 一般用于获取宽高并设置 /**
* 包括子级的,容器的尽量少用,子类可重写 * 一般用于获取宽高并设置
* @member {number} * 包括子级的,容器的尽量少用,子类可重写
*/ * @member {number}
get width(): number { */
return this._width || this.scale.x * this.getLocalBounds().width; get width(): number {
} return this._width || this.scale.x * this.getLocalBounds().width;
}
set width(value: number) {
// const width = this.getLocalBounds().width; set width(value: number) {
// const width = this.getLocalBounds().width;
// if (width !== 0) {
// this.scale.x = value / width; // if (width !== 0) {
// } else { // this.scale.x = value / width;
// this.scale.x = 1; // } else {
// } // this.scale.x = 1;
if (this._width !== value) { // }
//子类有用,有_width,才需设置scaleX if(this._width !== value) {
this._width = value; //子类有用,有_width,才需设置scaleX
this._localBoundsSelf.width = value; this._width = value;
//if (this.stage) this.stage.layoutInvalid = true; this._localBoundsSelf.width = value;
this.dispatchEvent(Event.RESIZE); //if (this.stage) this.stage.layoutInvalid = true;
} this.dispatchEvent(Event.RESIZE);
} this.dispatchEvent(Event.MAYBE_ALIGN);
}
/** // 如果它设置了 percentWidth 或同时设置了 left 和 right 则表示他的宽度是相对的,则对于父级来说它的宽度永远是 0
* 高度同width if(toBoolean(this.percentWidth)
* @member {number} || (toBoolean(this.left) && toBoolean(this.right))
*/ ) {
get height(): number { this.__width = 0;
return this._height || this.scale.y * this.getLocalBounds().height; } else {
} this.__width = value;
}
set height(value: number) { }
// const height = this.getLocalBounds().height;
/**
// if (height !== 0) { * 高度同width
// this.scale.y = value / height; * @member {number}
// } else { */
// this.scale.y = 1; get height(): number {
// } return this._height || this.scale.y * this.getLocalBounds().height;
if (this._height !== value) { }
this._height = value;
this._localBoundsSelf.height = value; set height(value: number) {
//if (this.stage) this.stage.layoutInvalid = true; // const height = this.getLocalBounds().height;
this.dispatchEvent(Event.RESIZE);
} // if (height !== 0) {
} // this.scale.y = value / height;
// } else {
clone(withEvents = false, withScripts = false) { // this.scale.y = 1;
let target = this.constructor.apply(Object.create(this.constructor.prototype)); // }
if(this._height !== value) {
const originConfig = this['__originConfig']; this._height = value;
const {name, properties, events, scripts} = originConfig; this._localBoundsSelf.height = value;
target.name = name; //if (this.stage) this.stage.layoutInvalid = true;
target['__originConfig'] = originConfig; this.dispatchEvent(Event.RESIZE);
injectProperties(target, properties); this.dispatchEvent(Event.MAYBE_ALIGN);
}
if (withScripts) { // 如果它设置了 percentHeight 或同时设置了 top 和 bottom 则表示他的高度是相对的,则对于父级来说它的高度永远是 0
if (scripts && scripts.length > 0) { if(toBoolean(this.percentHeight)
for (let scriptConfig of scripts) { || (toBoolean(this.top) && toBoolean(this.bottom))
instantiateScript(target, scriptConfig); ) {
} this.__height = 0;
} } else {
} this.__height = value;
if (withEvents) { }
if (events) { }
target.eventsProxy.start(events);
} protected __width = 0; // 忽略 相对宽度 的 宽度,在父级计算自动宽度的时候用到
} protected __height = 0; // 忽略 相对高度 的 高度,在父级计算自动高度的时候用到
for (let child of this.children) { protected _autoWidth = false; // 自动宽度?
let childCopy = child.clone(withEvents, withScripts); protected _autoHeight = false; // 自动高度?
target.addChild(childCopy);
} public get autoWidth() {
return this._autoWidth;
return target; }
}
public get autoHeight() {
get $store() { return this._autoHeight;
let p = this; }
do {
if (p['$isViewRoot']) { public set autoWidth(autoWidth) {
break; this._autoWidth = autoWidth;
} this.right = NaN; /// TODO 不知道需不需要
p = p.parent; this.percentWidth = NaN; /// TODO 不知道需不需要
} this.adjustProxy.makeDirty();
while (p.parent); }
if (p) { public set autoHeight(autoHeight) {
return p['$_store']; this._autoHeight = autoHeight;
} this.bottom = NaN; /// TODO 不知道需不需要
} this.percentHeight = NaN; /// TODO 不知道需不需要
this.adjustProxy.makeDirty();
//全局遍历 }
/**
* @method _getElementsByName // public judgeAutoSize() {
* @param {RegExp} rex // this.autoWidth = !(toBoolean(this.right) || toBoolean(this.percentWidth) || toBoolean(this._width));
* @param {Container} root // this.autoHeight = !(toBoolean(this.bottom) || toBoolean(this.percentHeight) || toBoolean(this._height));
* @param {boolean} isOnlyOne // }
* @param {boolean} isRecursive
* @param {Array<DisplayObject>} resultList get x(): number {
* @private return this.position.x;
* @static }
*/
private static _getElementsByName(rex: RegExp, root: Container, isOnlyOne: boolean, isRecursive: boolean, resultList: Array<DisplayObject>): void { set x(value: number) {
let len = root.children.length; if(value == this.transform.position.x) return;
if (len > 0) { this.transform.position.x = value;
let name: string;
let child: any; this.dispatchEvent(Event.MAYBE_ALIGN);
for (let i = 0; i < len; i++) { }
child = root.children[i];
name = child.name; get y(): number {
if (name && name != "") { return this.position.y;
if (rex.test(name)) { }
resultList[resultList.length] = child;
if (isOnlyOne) { set y(value: number) {
return; if(value == this.transform.position.y) return;
} this.transform.position.y = value;
}
} this.dispatchEvent(Event.MAYBE_ALIGN);
if (isRecursive) { }
if (child["children"] != null) {
Container._getElementsByName(rex, child, isOnlyOne, isRecursive, resultList); clone(withEvents = false, withScripts = false) {
} let target = this.constructor.apply(Object.create(this.constructor.prototype));
}
} const originConfig = this['__originConfig'];
} const {name, properties, events, scripts} = originConfig;
} target.name = name;
target['__originConfig'] = originConfig;
injectProperties(target, properties);
if(withScripts) {
if(scripts && scripts.length > 0) {
for(let scriptConfig of scripts) {
instantiateScript(target, scriptConfig);
}
}
}
if(withEvents) {
if(events) {
target.eventsProxy.start(events);
}
}
for(let child of this.children) {
let childCopy = child.clone(withEvents, withScripts);
target.addChild(childCopy);
}
return target;
}
get $store() {
let p = this;
do {
if(p['$isViewRoot']) {
break;
}
p = p.parent;
}
while(p.parent);
if(p) {
return p['$_store'];
}
}
//全局遍历
/**
* @method _getElementsByName
* @param {RegExp} rex
* @param {Container} root
* @param {boolean} isOnlyOne
* @param {boolean} isRecursive
* @param {Array<DisplayObject>} resultList
* @private
* @static
*/
private static _getElementsByName(rex: RegExp, root: Container, isOnlyOne: boolean, isRecursive: boolean, resultList: Array<DisplayObject>): void {
let len = root.children.length;
if(len > 0) {
let name: string;
let child: any;
for(let i = 0; i < len; i++) {
child = root.children[i];
name = child.name;
if(name && name != "") {
if(rex.test(name)) {
resultList[resultList.length] = child;
if(isOnlyOne) {
return;
}
}
}
if(isRecursive) {
if(child["children"] != null) {
Container._getElementsByName(rex, child, isOnlyOne, isRecursive, resultList);
}
}
}
}
}
} }
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;
...@@ -395,10 +395,19 @@ export default class Sprite extends Container { ...@@ -395,10 +395,19 @@ export default class Sprite extends Container {
} }
set width(value) { set width(value) {
value = Math.abs(value);
const s = sign(this.scale.x) || 1; const s = sign(this.scale.x) || 1;
this.scale.x = s * value / this._texture.orig.width; this.scale.x = s * value / this._texture.orig.width;
this._width = value; 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 { ...@@ -410,9 +419,17 @@ export default class Sprite extends Container {
} }
set height(value) { set height(value) {
value = Math.abs(value);
const s = sign(this.scale.y) || 1; const s = sign(this.scale.y) || 1;
this.scale.y = s * value / this._texture.orig.height; this.scale.y = s * value / this._texture.orig.height;
this._height = value; 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"; ...@@ -12,6 +12,7 @@ import {WebglRenderer} from "../renderers/WebglRenderer";
import {GDispatcher} from "../events/GDispatcher"; import {GDispatcher} from "../events/GDispatcher";
import CanvasRenderer from "../renderers/CanvasRenderer"; import CanvasRenderer from "../renderers/CanvasRenderer";
import {GlobalPro, isWebGLSupported} from "../utils/index"; import {GlobalPro, isWebGLSupported} from "../utils/index";
import { alignMgr } from "../../zeroing/decorators/AlignManager";
//如果以后还出现帧率问题,使用ticker; //如果以后还出现帧率问题,使用ticker;
//兼容requestAnimationFrame //兼容requestAnimationFrame
...@@ -972,12 +973,13 @@ export class Stage extends Container { ...@@ -972,12 +973,13 @@ export class Stage extends Container {
if (!GlobalPro.startTime) GlobalPro.startTime = Date.now(); if (!GlobalPro.startTime) GlobalPro.startTime = Date.now();
//console.log('flushAll', Date.now()); //console.log('flushAll', Date.now());
alignMgr.flush();
if (!Stage._pause) { if (!Stage._pause) {
let len = Stage.allUpdateObjList.length; let len = Stage.allUpdateObjList.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
Stage.allUpdateObjList[i] && Stage.allUpdateObjList[i].flush(); Stage.allUpdateObjList[i] && Stage.allUpdateObjList[i].flush();
} }
} }
requestAnimationFrame(Stage.flushAll); requestAnimationFrame(Stage.flushAll);
} }
...@@ -1035,4 +1037,4 @@ export class Stage extends Container { ...@@ -1035,4 +1037,4 @@ export class Stage extends Container {
s._ml = null; s._ml = null;
super.destroy(); super.destroy();
} }
} }
\ No newline at end of file
...@@ -9,9 +9,10 @@ import {HashObject} from "../HashObject"; ...@@ -9,9 +9,10 @@ import {HashObject} from "../HashObject";
*/ */
export class Event extends 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 * @Event
* @property RESIZE * @property RESIZE
......
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,151 +4,320 @@ ...@@ -4,151 +4,320 @@
* 自适应功能 * 自适应功能
*/ */
import {Event} from "../../2d/events/index"; import { Event } from "../../2d/events/index";
import { alignMgr } from "./AlignManager";
/** /**
* 应用自适应 * 应用自适应
* @param ctor * @param ctor
*/ */
export function applyAutoAdjust(ctor: Function) { export function applyAutoAdjust(ctor: Function) {
ctor.prototype.applyAutoAdjust = function () { ctor.prototype.applyAutoAdjust = function() {
let adjustProxy = this.adjustProxy = new AdjustProxy(this); let adjustProxy = this.adjustProxy = new AdjustProxy(this);
this.addEventListener(Event.ADDED_TO_STAGE, adjustProxy.onAddedToStage, adjustProxy); this.addEventListener(Event.ADDED_TO_STAGE, adjustProxy.onAddedToStage, adjustProxy);
this.addEventListener(Event.REMOVED_FROM_STAGE, adjustProxy.onRemovedFromStage, adjustProxy); this.addEventListener(Event.REMOVED_FROM_STAGE, adjustProxy.onRemovedFromStage, adjustProxy);
}; };
let temp = new AdjustProxy(null); let temp = new AdjustProxy(null);
for (let key in temp.data) for(let key in temp.data) {
Object.defineProperty(ctor.prototype, key, { if(key == 'alignMode'
get: function () { // || key == 'percentWidth' || key == 'percentHeight'
return this.adjustProxy.data[key]; ) continue;
},
set: function (v) { Object.defineProperty(ctor.prototype, key, {
const adjustProxy: AdjustProxy = this.adjustProxy; get: function() {
if (adjustProxy.data[key] !== v) { return this.adjustProxy.data[key];
adjustProxy.data[key] = v; },
adjustProxy.makeDirty(); set: function(v) {
} const adjustProxy: AdjustProxy = this.adjustProxy;
}, if(adjustProxy.data[key] !== v && !(isNaN(adjustProxy.data[key]) && isNaN(v))) {
enumerable: true, adjustProxy.data[key] = v;
configurable: true adjustProxy.makeDirty();
}); }
},
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',
} }
/** /**
* 自适应数据 * 自适应数据
*/ */
class AdjustProxy { class AdjustProxy {
data = { data = {
percentWidth: NaN, percentWidth: NaN,
percentHeight: NaN, percentHeight: NaN,
left: NaN, left: NaN,
top: NaN, top: NaN,
right: NaN, right: NaN,
bottom: NaN, bottom: NaN,
horizonCenter: NaN, horizonCenter: NaN,
verticalCenter: NaN, verticalCenter: NaN,
};
private _host;
private _sizeDirty;
constructor(host) {
this._host = host;
this.makeDirty();
}
makeDirty() {
this._sizeDirty = true;
}
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);
}
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);
}
setFrom(adjustProxy: AdjustProxy) {
for (let k in adjustProxy.data) {
this.data[k] = adjustProxy.data[k];
}
}
private onResize(e) {
this._sizeDirty = true;
}
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();
}
}
}
} alignEnabled: true,
alignMode: ALIGN_MODE.ALWAYS,
};
private _host;
private _sizeDirty;
constructor(host) {
this._host = host;
this.makeDirty();
}
makeDirty() {
this._sizeDirty = true;
this._host && alignMgr.addAlign(this._host);
this._host && this._host.parent && this._host.parent.adjustProxy.makeDirty();
}
onAddedToStage(e) {
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.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) {
this.data[k] = adjustProxy.data[k];
}
}
/**
* 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
}
// 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,354 +2,354 @@ ...@@ -2,354 +2,354 @@
* Created by rockyl on 2019-11-05. * Created by rockyl on 2019-11-05.
*/ */
import {Stage} from "../../2d/display/index"; import { Stage } from "../../2d/display/index";
import {StackContainer} from "./StackContainer"; import { StackContainer } from "./StackContainer";
import {checkAssetGroupLoaded, loadAssetsGroup, loadAssets, loadAssetsGroups} from "./assets-manager"; import { checkAssetGroupLoaded, loadAssetsGroup, loadAssets, loadAssetsGroups } from "./assets-manager";
import {instantiate} from "./view-interpreter"; import { instantiate } from "./view-interpreter";
import {dataCenter, DataCenter} from "./data-center"; import { dataCenter, DataCenter } from "./data-center";
import {setProcessMetaLibs} from "../behavior-runtime/index"; import { setProcessMetaLibs } from "../behavior-runtime/index";
import {Tween} from "../../2d/tween/index"; import { Tween } from "../../2d/tween/index";
import {Rect} from "./nodes/index"; import { Rect } from "./nodes/index";
import {injectEnv} from "./enviroment"; import { injectEnv } from "./enviroment";
import {Toast} from "./Toast"; import { Toast } from "./Toast";
import {arrayFind} from "../utils/index"; import { arrayFind } from "../utils/index";
import {Node} from "./nodes/Node"; import { Node } from "./nodes/Node";
import {bind, createStore} from "./mvvm/index"; import { bind, createStore } from "./mvvm/index";
import {registerCustomModules} from "./custom-module"; import { registerCustomModules } from "./custom-module";
import {dealPageRemainTime, dealPxEnv} from "../px-logics"; import { dealPageRemainTime, dealPxEnv } from "../px-logics";
import Container from "../../2d/display/Container"; import Container from "../../2d/display/Container";
import {Event} from "../../2d/events/Event"; import { Event } from "../../2d/events/Event";
/** /**
* 游戏舞台 * 游戏舞台
*/ */
export class GameStage extends Node { export class GameStage extends Node {
private _sceneContainer: StackContainer; //场景容器 private _sceneContainer: StackContainer; //场景容器
private _popupContainer: StackContainer; //弹层容器 private _popupContainer: StackContainer; //弹层容器
private _loadingView: Container; private _loadingView: Container;
private _toast: Toast; private _toast: Toast;
private _blackLayer: Rect; private _blackLayer: Rect;
private _stage; private _stage;
private _dataCenter: DataCenter; private _dataCenter: DataCenter;
private _config: any; private _config: any;
private _viewCache: any = {}; private _viewCache: any = {};
constructor(stage: Stage) { constructor(stage: Stage) {
super(); super();
this.name = 'game-stage'; this.name = 'game-stage';
stage.width = stage.viewRect.width; stage.width = stage.viewRect.width;
stage.height = stage.viewRect.height; stage.height = stage.viewRect.height;
this._stage = stage; this._stage = stage;
this._dataCenter = dataCenter; this._dataCenter = dataCenter;
this.percentWidth = 100; this.percentWidth = 100;
this.percentHeight = 100; this.percentHeight = 100;
this.mouseEnabled = false; this.mouseEnabled = false;
let loadingView = this._loadingView = new Container(); let loadingView = this._loadingView = new Container();
this.addChild(this._sceneContainer = new StackContainer()); this.addChild(this._sceneContainer = new StackContainer());
this.addChild(this._popupContainer = new StackContainer(false, 1)); this.addChild(this._popupContainer = new StackContainer(false, 1));
this.addChild(this._toast = new Toast(this)); this.addChild(this._toast = new Toast(this));
this.addChild(loadingView); this.addChild(loadingView);
let blackLayer = this._blackLayer = new Rect(); let blackLayer = this._blackLayer = new Rect();
blackLayer.name = 'blackLayer'; blackLayer.name = 'blackLayer';
blackLayer.width = stage.width; blackLayer.width = stage.width;
blackLayer.height = stage.height; blackLayer.height = stage.height;
blackLayer.fillColor = 0; blackLayer.fillColor = 0;
blackLayer.alpha = 0.7; blackLayer.alpha = 0.7;
loadingView.percentWidth = 100; loadingView.percentWidth = 100;
loadingView.percentHeight = 100; loadingView.percentHeight = 100;
loadingView.visible = false; loadingView.visible = false;
this._sceneContainer.name = 'scene-container'; this._sceneContainer.name = 'scene-container';
this._popupContainer.name = 'popup-container'; this._popupContainer.name = 'popup-container';
this._popupContainer.addEventListener(Event.START, this.onPopupContainerStart, this); this._popupContainer.addEventListener(Event.START, this.onPopupContainerStart, this);
this._popupContainer.addEventListener(Event.COMPLETE, this.onPopupContainerComplete, this); this._popupContainer.addEventListener(Event.COMPLETE, this.onPopupContainerComplete, this);
} }
/** /**
* 场景容器 * 场景容器
*/ */
get sceneContainer(): StackContainer { get sceneContainer(): StackContainer {
return this._sceneContainer; return this._sceneContainer;
} }
/** /**
* 弹层容器 * 弹层容器
*/ */
get popupContainer(): StackContainer { get popupContainer(): StackContainer {
return this._popupContainer; return this._popupContainer;
} }
/** /**
* Toast提示 * Toast提示
*/ */
get toast(): Toast { get toast(): Toast {
return this._toast; return this._toast;
} }
/** /**
* 数据中心 * 数据中心
*/ */
get dataCenter(): DataCenter { get dataCenter(): DataCenter {
return this._dataCenter; return this._dataCenter;
} }
/** /**
* 启动游戏 * 启动游戏
* @param config * @param config
* @param onPreloadAssetsProgress 预加载素材进度 * @param onPreloadAssetsProgress 预加载素材进度
* @param onPreloadAssetsComplete 预加载素材完成 * @param onPreloadAssetsComplete 预加载素材完成
* @param onStart * @param onStart
*/ */
async launch(config, onPreloadAssetsProgress?, onPreloadAssetsComplete?, onStart?) { async launch(config, onPreloadAssetsProgress?, onPreloadAssetsComplete?, onStart?) {
this._config = config; this._config = config;
const {options: {env}, dataMapping, processes, builtinProcesses, customs} = this._config; const {options: {env}, dataMapping, processes, builtinProcesses, customs} = this._config;
Stage.addUpdateObj(Tween); Stage.addUpdateObj(Tween);
injectEnv(env); injectEnv(env);
//registerScripts(scripts); //registerScripts(scripts);
//registerCustomModuleFromConfig(customs); //registerCustomModuleFromConfig(customs);
registerCustomModules(customs); registerCustomModules(customs);
if (dataMapping) { if(dataMapping) {
this.dataCenter.registerDataMapping(dataMapping); this.dataCenter.registerDataMapping(dataMapping);
} }
setProcessMetaLibs(processes, builtinProcesses); setProcessMetaLibs(processes, builtinProcesses);
await this.loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete); await this.loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete);
this.start(); this.start();
dealPxEnv(); dealPxEnv();
dealPageRemainTime(); dealPageRemainTime();
onStart && onStart(); onStart && onStart();
setTimeout(this.lazyLoadAllAssets, setTimeout(this.lazyLoadAllAssets,
this._config.options.lazyLoadWait || 1000); this._config.options.lazyLoadWait || 1000);
} }
/** /**
* 开始游戏 * 开始游戏
*/ */
start() { start() {
const {options: {entrySceneView, }, } = this._config; const {options: {entrySceneView,},} = this._config;
setTimeout(async () => { setTimeout(async () => {
let sceneEntry = await this.instantiateView(entrySceneView); let sceneEntry = await this.instantiateView(entrySceneView);
if (sceneEntry) { if(sceneEntry) {
this._sceneContainer.push(sceneEntry); this._sceneContainer.push(sceneEntry);
} }
}) })
} }
/** /**
* 显示加载视图 * 显示加载视图
*/ */
async showInnerLoadingView() { async showInnerLoadingView() {
let loadingViewName = this._config.options.loadingView; let loadingViewName = this._config.options.loadingView;
let loadingView = this._loadingView.getChildAt(0); 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); loadingView = await this.instantiateView(loadingViewName, true, false);
this._loadingView.addChild(loadingView); this._loadingView.addChild(loadingView);
} }
this._loadingView.visible = true; this._loadingView.visible = true;
} }
/** /**
* 隐藏加载视图 * 隐藏加载视图
*/ */
hideInnerLoadingView() { hideInnerLoadingView() {
if (this._loadingView.visible) { if(this._loadingView.visible) {
this._loadingView.visible = false; this._loadingView.visible = false;
} }
} }
/** /**
* 实例化视图 * 实例化视图
* @param name * @param name
* @param cache 如果开启缓存,就会以单例形式存在 * @param cache 如果开启缓存,就会以单例形式存在
* @param showLoadingView * @param showLoadingView
*/ */
async instantiateView(name, cache = true, showLoadingView = true) { async instantiateView(name, cache = true, showLoadingView = true) {
let view; let view;
if (cache) { if(cache) {
view = this._viewCache[name]; view = this._viewCache[name];
} }
if (!view) { if(!view) {
let viewConfig = this.getViewConfigByName(name); let viewConfig = this.getViewConfigByName(name);
if (viewConfig) { if(viewConfig) {
const {assets, customs} = this._config; const {assets, customs} = this._config;
if (!Array.isArray(assets)) { if(!Array.isArray(assets)) {
let groups = {}; let groups = {};
let {depCustoms} = viewConfig; let {depCustoms} = viewConfig;
if (depCustoms && depCustoms.length > 0) { if(depCustoms && depCustoms.length > 0) {
for (let custom of customs) { for(let custom of customs) {
if (depCustoms.indexOf(custom.id) >= 0 && custom.assets) { if(depCustoms.indexOf(custom.id) >= 0 && custom.assets) {
if (!checkAssetGroupLoaded(custom.id)) { if(!checkAssetGroupLoaded(custom.id)) {
groups[custom.id] = custom.assets; groups[custom.id] = custom.assets;
} }
} }
} }
} }
if (!checkAssetGroupLoaded(viewConfig.uuid)) { if(!checkAssetGroupLoaded(viewConfig.uuid)) {
let depAssets = assets[viewConfig.uuid]; let depAssets = assets[viewConfig.uuid];
if (depAssets && depAssets.length > 0) { if(depAssets && depAssets.length > 0) {
groups[viewConfig.uuid] = depAssets; groups[viewConfig.uuid] = depAssets;
} }
} }
if(Object.keys(groups).length > 0){ if(Object.keys(groups).length > 0) {
await loadAssetsGroups(groups, async () => { await loadAssetsGroups(groups, async () => {
if (showLoadingView) { if(showLoadingView) {
await this.showInnerLoadingView(); await this.showInnerLoadingView();
} }
}, async () => { }, async () => {
if (showLoadingView) { if(showLoadingView) {
this.hideInnerLoadingView(); this.hideInnerLoadingView();
} }
}); });
} }
} }
view = instantiate(viewConfig); view = instantiate(viewConfig);
let store = {}; let store = {};
if (viewConfig.store) { if(viewConfig.store) {
const {exp, computed} = viewConfig.store; const {exp, computed} = viewConfig.store;
store = createStore(exp, computed); store = createStore(exp, computed);
} }
view['$isViewRoot'] = true; view['$isViewRoot'] = true;
view['$_store'] = store; view['$_store'] = store;
console.time('bind'); console.time('bind');
bind(store, view); bind(store, view);
console.timeEnd('bind'); console.timeEnd('bind');
if (cache) { if(cache) {
this._viewCache[name] = view; this._viewCache[name] = view;
} }
} else { } else {
console.error('view config not exists:', name); console.error('view config not exists:', name);
} }
} }
return view; return view;
} }
/** /**
* 根据name获取视图配置 * 根据name获取视图配置
* @param name * @param name
*/ */
getViewConfigByName(name) { getViewConfigByName(name) {
return arrayFind(this._config.views, view => view.name === name); return arrayFind(this._config.views, view => view.name === name);
} }
onPopupContainerStart(e) { onPopupContainerStart(e) {
const {action, view, lastView, options, hasView} = e.data; const {action, view, lastView, options, hasView} = e.data;
const target = <StackContainer>e.target; const target = <StackContainer>e.target;
switch (action) { switch(action) {
case 'push': case 'push':
case 'replace': case 'replace':
case 'popAll': case 'popAll':
if (options && options.center) { if(options && options.center) {
view.x = (target.width - view.width) / 2; view.x = (target.width - view.width) / 2;
view.y = (target.height - view.height) / 2; view.y = (target.height - view.height) / 2;
} }
break; break;
} }
let blackLayer = this._blackLayer; let blackLayer = this._blackLayer;
let pParent = blackLayer.parent; let pParent = blackLayer.parent;
if (hasView) { if(hasView) {
target.addChildAt(blackLayer, target.childNum - 1 - (view ? 0 : 1)); target.addChildAt(blackLayer, target.childNum - 1 - (view ? 0 : 1));
let modalAlpha = 0.7; let modalAlpha = 0.7;
if(options && options.hasOwnProperty('modalAlpha')){ if(options && options.hasOwnProperty('modalAlpha')) {
modalAlpha = options.modalAlpha; modalAlpha = options.modalAlpha;
} }
if (!pParent || blackLayer['tween_count'] > 0) { if(!pParent || blackLayer['tween_count'] > 0) {
blackLayer.alpha = 0; blackLayer.alpha = 0;
Tween.get(blackLayer, null, null, true) Tween.get(blackLayer, null, null, true)
.to({alpha: modalAlpha}, 300); .to({alpha: modalAlpha}, 300);
} }
} else if (pParent) { } else if(pParent) {
Tween.get(blackLayer, null, null, true) Tween.get(blackLayer, null, null, true)
.to({alpha: 0}, 300) .to({alpha: 0}, 300)
.call(() => { .call(() => {
pParent.removeChild(blackLayer); pParent.removeChild(blackLayer);
}); });
} }
} }
onPopupContainerComplete(e) { onPopupContainerComplete(e) {
} }
lazyLoadAllAssets = async () => { lazyLoadAllAssets = async () => {
let {assets, customs} = this._config; let {assets, customs} = this._config;
if (!Array.isArray(assets)) { if(!Array.isArray(assets)) {
for (let uuid in assets) { for(let uuid in assets) {
let group = assets[uuid]; let group = assets[uuid];
if (group && group.length > 0) { if(group && group.length > 0) {
await loadAssetsGroup(group, uuid); await loadAssetsGroup(group, uuid);
} }
} }
} }
for (let custom of customs) { for(let custom of customs) {
let group = custom.assets; let group = custom.assets;
if (group && group.length > 0) { if(group && group.length > 0) {
await loadAssetsGroup(group, custom.id); await loadAssetsGroup(group, custom.id);
} }
} }
}; };
async loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete){ async loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete) {
const {assets, } = this._config; const {assets,} = this._config;
let loaded = 0; let loaded = 0;
let assetsToLoad = assets; let assetsToLoad = assets;
let total; let total;
if (!Array.isArray(assets)) { //如果是分组后的配置就加载共用分组,否则加载全部 if(!Array.isArray(assets)) { //如果是分组后的配置就加载共用分组,否则加载全部
assetsToLoad = assets['common']; assetsToLoad = assets['common'];
if(assetsToLoad.length > 0){ if(assetsToLoad.length > 0) {
await this.showInnerLoadingView(); await this.showInnerLoadingView();
await loadAssetsGroups({ await loadAssetsGroups({
preload: assetsToLoad, preload: assetsToLoad,
}, async () => { }, async () => {
}, async () => { }, async () => {
this.hideInnerLoadingView(); this.hideInnerLoadingView();
}); });
} }
}else{ } else {
total = assetsToLoad.length; total = assetsToLoad.length;
await loadAssets(assetsToLoad, p).catch(e => { await loadAssets(assetsToLoad, p).catch(e => {
console.log(e); console.log(e);
}); });
} }
function p() { function p() {
loaded++; loaded++;
onPreloadAssetsProgress && onPreloadAssetsProgress(loaded, total); onPreloadAssetsProgress && onPreloadAssetsProgress(loaded, total);
if (loaded >= total) { if(loaded >= total) {
onPreloadAssetsComplete && onPreloadAssetsComplete(); onPreloadAssetsComplete && onPreloadAssetsComplete();
} }
} }
} }
} }
...@@ -2,87 +2,92 @@ ...@@ -2,87 +2,92 @@
* Created by rockyl on 2019-11-08. * Created by rockyl on 2019-11-08.
*/ */
import {Stage} from "../2d/display/index"; import { Stage } from "../2d/display/index";
import {GameStage, registerCustomModuleFromConfig} from "./game-warpper/index"; import { GameStage, registerCustomModuleFromConfig } from "./game-warpper/index";
import {setGlobalContext, setProcessMetaLibs} from "./behavior-runtime/index"; import { setGlobalContext, setProcessMetaLibs } from "./behavior-runtime/index";
import {globalLoader} from "../2d/loader/Loader"; import { globalLoader } from "../2d/loader/Loader";
import {Event} from "../2d/events/Event"; import { Event } from "../2d/events/Event";
import builtinLoadingView from "./game-warpper/LoadingView"; import builtinLoadingView from "./game-warpper/LoadingView";
import {queryParams} from "./web"; import { queryParams } from "./web";
import {initAutoLayout} from "./game-warpper/auto-layout"; import { initAutoLayout } from "./game-warpper/auto-layout";
import {registerScripts} from "./decorators/scripts"; import { registerScripts } from "./decorators/scripts";
import {RENDERER_TYPE, StageScaleMode} from "../2d/const"; import { RENDERER_TYPE, StageScaleMode } from "../2d/const";
import { alignMgr } from "./decorators/AlignManager";
export let gameStage: GameStage; export let gameStage: GameStage;
export let alignManager = alignMgr;
export function launch(url, loadingDelegate?, onStart?) { export function launch(url, loadingDelegate?, onStart?) {
if (queryParams.__proxy_mode__) { if(queryParams.__proxy_mode__) {
return Promise.resolve('cancel launch'); return Promise.resolve('cancel launch');
} }
return globalLoader.loadJson(url) return globalLoader.loadJson(url)
.then(config => { .then(config => {
return launchWithConfig(config, loadingDelegate, onStart); return launchWithConfig(config, loadingDelegate, onStart);
}); });
} }
export function launchWithLocalStorage(id, loadingDelegate?, onStart?) { export function launchWithLocalStorage(id, loadingDelegate?, onStart?) {
const storeKey = 'preview-project-' + id; const storeKey = 'preview-project-' + id;
let storeData = localStorage.getItem(storeKey); let storeData = localStorage.getItem(storeKey);
let {data, processes, scripts, customs,} = JSON.parse(storeData); let {data, processes, scripts, customs,} = JSON.parse(storeData);
setProcessMetaLibs(processes); setProcessMetaLibs(processes);
registerScripts(scripts); registerScripts(scripts);
registerCustomModuleFromConfig(customs); registerCustomModuleFromConfig(customs);
return launchWithConfig(data, loadingDelegate, onStart); return launchWithConfig(data, loadingDelegate, onStart);
} }
export function launchWithWindowVariable(name, loadingDelegate?, onStart?) { export function launchWithWindowVariable(name, loadingDelegate?, onStart?) {
let {data, processes, scripts, customs,} = window[name]; let {data, processes, scripts, customs,} = window[name];
setProcessMetaLibs(processes); setProcessMetaLibs(processes);
registerScripts(scripts); registerScripts(scripts);
registerCustomModuleFromConfig(customs); registerCustomModuleFromConfig(customs);
return launchWithConfig(data, loadingDelegate, onStart); return launchWithConfig(data, loadingDelegate, onStart);
} }
export async function launchWithConfig(config, loadingDelegate?, onStart?) { export async function launchWithConfig(config, loadingDelegate?, onStart?) {
await new Promise(resolve => { await new Promise(resolve => {
setTimeout(resolve, 300); setTimeout(resolve, 300);
}); });
return await new Promise(resolve => { return await new Promise(resolve => {
const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType, bgColor, autoResize,} = config.options;
let stage = window['stage'] = new Stage( const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType, bgColor, autoResize,} = config.options;
containerId || "game-container", let stage = window['stage'] = new Stage(
designWidth || 750, containerId || "game-container",
designHeight || 1334, designWidth || 750,
frameRate || 60, designHeight || 1334,
scaleMode || StageScaleMode.FIXED_WIDTH, frameRate || 60,
rendererType || RENDERER_TYPE.WEBGL, scaleMode || StageScaleMode.FIXED_WIDTH,
true, rendererType || RENDERER_TYPE.WEBGL,
bgColor, true,
autoResize, bgColor,
); autoResize,
initAutoLayout(stage); );
Stage.flushAll(); initAutoLayout(stage);
Stage.flushAll();
stage.addEventListener(Event.ON_INIT_STAGE, () => {
gameStage = new GameStage(stage); // Stage.addUpdateObj(alignMgr);
setGlobalContext({
gameStage stage.addEventListener(Event.ON_INIT_STAGE, () => {
}); gameStage = new GameStage(stage);
stage.addChild(gameStage); setGlobalContext({
gameStage
let delegate = loadingDelegate || builtinLoadingView; });
stage.addChild(gameStage);
gameStage.launch(config, function (done, total) {
delegate.onProgress && delegate.onProgress(done, total) let delegate = loadingDelegate || builtinLoadingView;
}, function () {
delegate.onComplete && delegate.onComplete(); gameStage.launch(config, function(done, total) {
}, onStart); delegate.onProgress && delegate.onProgress(done, total)
}); }, function() {
delegate.onComplete && delegate.onComplete();
resolve(gameStage); }, onStart);
}) });
resolve(gameStage);
})
} }
...@@ -14,16 +14,16 @@ export const linkScheme = 'link://'; ...@@ -14,16 +14,16 @@ export const linkScheme = 'link://';
* @param predicate * @param predicate
*/ */
export function arrayFind(arr, predicate) { export function arrayFind(arr, predicate) {
if (!arr) { if(!arr) {
return; 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]; const item = arr[i];
if (predicate(item, i, arr)) { if(predicate(item, i, arr)) {
return item; return item;
} }
} }
} }
/** /**
...@@ -31,23 +31,23 @@ export function arrayFind(arr, predicate) { ...@@ -31,23 +31,23 @@ export function arrayFind(arr, predicate) {
* @param obj * @param obj
*/ */
export function objClone(obj) { export function objClone(obj) {
return obj ? JSON.parse(JSON.stringify(obj)) : obj; return obj ? JSON.parse(JSON.stringify(obj)) : obj;
} }
const percentKeys = ['width', 'height']; const percentKeys = ['width', 'height'];
export function propertyParse(key, node, properties) { export function propertyParse(key, node, properties) {
let value = properties[key]; let value = properties[key];
let targetKey = key; let targetKey = key;
if (percentKeys.indexOf(key) >= 0) { if(percentKeys.indexOf(key) >= 0) {
if (typeof value === 'string') { if(typeof value === 'string') {
if (value[value.length - 1] === '%') { if(value[value.length - 1] === '%') {
targetKey = 'percent' + key[0].toUpperCase() + key.substr(1); targetKey = 'percent' + key[0].toUpperCase() + key.substr(1);
} }
value = parseInt(value); value = parseInt(value);
} }
} }
node[targetKey] = value; node[targetKey] = value;
} }
/** /**
...@@ -57,15 +57,15 @@ export function propertyParse(key, node, properties) { ...@@ -57,15 +57,15 @@ export function propertyParse(key, node, properties) {
* @param throwException * @param throwException
*/ */
export function getDataByPath(scope, path, throwException?) { export function getDataByPath(scope, path, throwException?) {
let func = new Function('scope', `return scope` + (path ? ('.' + path) : '')); let func = new Function('scope', `return scope` + (path ? ('.' + path) : ''));
try { try {
return func(scope); return func(scope);
} catch (e) { } catch(e) {
//console.warn(e); //console.warn(e);
if (throwException) { if(throwException) {
throw e; throw e;
} }
} }
} }
/** /**
...@@ -74,14 +74,14 @@ export function getDataByPath(scope, path, throwException?) { ...@@ -74,14 +74,14 @@ export function getDataByPath(scope, path, throwException?) {
* @param throwException * @param throwException
*/ */
export function safeEval(code, throwException = false) { export function safeEval(code, throwException = false) {
let func = new Function(code); let func = new Function(code);
try { try {
return func(); return func();
} catch (e) { } catch(e) {
if (throwException) { if(throwException) {
throw e; throw e;
} }
} }
} }
/** /**
...@@ -95,28 +95,28 @@ export function safeEval(code, throwException = false) { ...@@ -95,28 +95,28 @@ export function safeEval(code, throwException = false) {
* @return 是否有字段注入 * @return 是否有字段注入
*/ */
export function injectProp(target: any, data?: any, callback?: Function, ignoreMethod: boolean = true, ignoreNull: boolean = true): boolean { export function injectProp(target: any, data?: any, callback?: Function, ignoreMethod: boolean = true, ignoreNull: boolean = true): boolean {
if (!target || !data) { if(!target || !data) {
return false; return false;
} }
let result = false; let result = false;
for (let key in data) { for(let key in data) {
let value: any = data[key]; let value: any = data[key];
if ((!ignoreMethod || typeof value != 'function') && (!ignoreNull || value != null)) { if((!ignoreMethod || typeof value != 'function') && (!ignoreNull || value != null)) {
if (callback) { if(callback) {
callback(target, key, value); callback(target, key, value);
} else { } else {
try { try {
target[key] = value; target[key] = value;
} catch (e) { } catch(e) {
} }
} }
result = true; result = true;
} }
} }
return result; return result;
} }
/** /**
...@@ -126,22 +126,22 @@ export function injectProp(target: any, data?: any, callback?: Function, ignoreM ...@@ -126,22 +126,22 @@ export function injectProp(target: any, data?: any, callback?: Function, ignoreM
* @param config * @param config
*/ */
export function copyProp(target, data, config?) { export function copyProp(target, data, config?) {
if (data) { if(data) {
for (let key in config) { for(let key in config) {
let valueConfig = config[key]; let valueConfig = config[key];
if (Array.isArray(valueConfig)) { if(Array.isArray(valueConfig)) {
target[key] = {}; target[key] = {};
for (let field of valueConfig) { for(let field of valueConfig) {
target[key][field] = data[key][field]; target[key][field] = data[key][field];
} }
} else if (typeof valueConfig === 'string') { } else if(typeof valueConfig === 'string') {
target[valueConfig] = data[valueConfig]; target[valueConfig] = data[valueConfig];
} else if (typeof valueConfig === 'object') { } else if(typeof valueConfig === 'object') {
target[key] = {}; target[key] = {};
copyProp(target[key], data[key], valueConfig) copyProp(target[key], data[key], valueConfig)
} }
} }
} }
} }
/** /**
...@@ -149,18 +149,18 @@ export function copyProp(target, data, config?) { ...@@ -149,18 +149,18 @@ export function copyProp(target, data, config?) {
* @param obj * @param obj
*/ */
export function obj2query(obj: any): string { export function obj2query(obj: any): string {
if (!obj) { if(!obj) {
return ''; return '';
} }
let arr: string[] = []; let arr: string[] = [];
for (let key in obj) { for(let key in obj) {
arr.push(key + (key ? '=' : '') + obj[key]); arr.push(key + (key ? '=' : '') + obj[key]);
} }
return arr.join('&'); return arr.join('&');
} }
function requireForCJS(id) { function requireForCJS(id) {
return window[id]; return window[id];
} }
/** /**
...@@ -169,19 +169,19 @@ function requireForCJS(id) { ...@@ -169,19 +169,19 @@ function requireForCJS(id) {
* @param node * @param node
*/ */
export function importCJSCode(code, node?) { export function importCJSCode(code, node?) {
if (node) { if(node) {
let create = new Function('module', 'require', code); let create = new Function('module', 'require', code);
let module = { let module = {
exports: {}, exports: {},
}; };
create(module, requireForCJS); create(module, requireForCJS);
return module.exports; return module.exports;
} else { } else {
let create = new Function('exports', code); let create = new Function('exports', code);
let exports: any = {}; let exports: any = {};
create(exports); create(exports);
return exports.default; return exports.default;
} }
} }
/** /**
...@@ -189,10 +189,10 @@ export function importCJSCode(code, node?) { ...@@ -189,10 +189,10 @@ export function importCJSCode(code, node?) {
* @param code * @param code
*/ */
export function importUMDCode(code) { export function importUMDCode(code) {
let create = new Function('exports', code); let create = new Function('exports', code);
let exports: any = {}; let exports: any = {};
create.call(exports); create.call(exports);
return exports; return exports;
} }
/** /**
...@@ -201,24 +201,24 @@ export function importUMDCode(code) { ...@@ -201,24 +201,24 @@ export function importUMDCode(code) {
* @param char * @param char
*/ */
export function trimChar(str: string, char: string) { export function trimChar(str: string, char: string) {
if (!str || !char) { if(!str || !char) {
return; return;
} }
while (true) { while(true) {
let len = str.length, from = 0, end = len; let len = str.length, from = 0, end = len;
if (str[0] === char) { if(str[0] === char) {
from = 1; from = 1;
} }
if (str[len - 1] === char) { if(str[len - 1] === char) {
end = len - 1; end = len - 1;
} }
str = str.substring(from, end); str = str.substring(from, end);
if (str.length == len) { if(str.length == len) {
break; break;
} }
} }
return str; return str;
} }
/** /**
...@@ -226,11 +226,11 @@ export function trimChar(str: string, char: string) { ...@@ -226,11 +226,11 @@ export function trimChar(str: string, char: string) {
* @param segments * @param segments
*/ */
export function joinPath(...segments: string[]) { export function joinPath(...segments: string[]) {
let result = []; let result = [];
for (let segment of segments) { for(let segment of segments) {
result.push(trimChar(segment, '/')); result.push(trimChar(segment, '/'));
} }
return result.join('/'); return result.join('/');
} }
/** /**
...@@ -239,16 +239,16 @@ export function joinPath(...segments: string[]) { ...@@ -239,16 +239,16 @@ export function joinPath(...segments: string[]) {
* @param contexts * @param contexts
*/ */
export function findVariable(name: string, ...contexts) { export function findVariable(name: string, ...contexts) {
let result; let result;
for (let context of contexts) { for(let context of contexts) {
if (context) { if(context) {
result = context[name]; result = context[name];
if (result !== undefined) { if(result !== undefined) {
break; break;
} }
} }
} }
return result; return result;
} }
let el; let el;
...@@ -258,15 +258,15 @@ let el; ...@@ -258,15 +258,15 @@ let el;
* @param htmlText * @param htmlText
*/ */
export function htmlToPureText(htmlText) { export function htmlToPureText(htmlText) {
if (!el) { if(!el) {
el = document.createElement('div'); el = document.createElement('div');
} }
el.innerHTML = htmlText; el.innerHTML = htmlText;
document.body.appendChild(el); document.body.appendChild(el);
let pureText = el.innerText; let pureText = el.innerText;
document.body.removeChild(el); document.body.removeChild(el);
return pureText; return pureText;
} }
const zhReg = /[\u4e00-\u9fa5]/; const zhReg = /[\u4e00-\u9fa5]/;
...@@ -276,11 +276,11 @@ const zhReg = /[\u4e00-\u9fa5]/; ...@@ -276,11 +276,11 @@ const zhReg = /[\u4e00-\u9fa5]/;
* @param str * @param str
*/ */
export function strLen(str) { export function strLen(str) {
let len = 0; let len = 0;
for (let char of str) { for(let char of str) {
len += char.match(zhReg) ? 2 : 1; len += char.match(zhReg) ? 2 : 1;
} }
return len; return len;
} }
/** /**
...@@ -290,23 +290,23 @@ export function strLen(str) { ...@@ -290,23 +290,23 @@ export function strLen(str) {
* @param replace * @param replace
*/ */
export function strShort(str, limit, replace = '…') { export function strShort(str, limit, replace = '…') {
let result = ''; let result = '';
if (strLen(str) > limit) { if(strLen(str) > limit) {
let len = 0; 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]; const char = str[i];
len += char.match(zhReg) ? 2 : 1; len += char.match(zhReg) ? 2 : 1;
if (len > limit) { if(len > limit) {
result += replace; result += replace;
break; break;
} else { } else {
result += char; result += char;
} }
} }
} else { } else {
result = str; result = str;
} }
return result; return result;
} }
/** /**
...@@ -315,8 +315,8 @@ export function strShort(str, limit, replace = '…') { ...@@ -315,8 +315,8 @@ export function strShort(str, limit, replace = '…') {
* @param ScriptConfig * @param ScriptConfig
*/ */
export function instantiateScript(node, ScriptConfig) { export function instantiateScript(node, ScriptConfig) {
const {script: scriptName, props, disabled} = ScriptConfig; const {script: scriptName, props, disabled} = ScriptConfig;
const script = node.scripts.add(scriptName, props, disabled); const script = node.scripts.add(scriptName, props, disabled);
} }
export const cmdPrefix = 'z-'; export const cmdPrefix = 'z-';
...@@ -328,13 +328,13 @@ export const cmdOldPrefix = '//z-'; ...@@ -328,13 +328,13 @@ export const cmdOldPrefix = '//z-';
* @param source * @param source
*/ */
export function injectProperties(target, source) { export function injectProperties(target, source) {
for (let key in source) { for(let key in source) {
if (key.indexOf('//') !== 0 && !source.hasOwnProperty(cmdPrefix + key)) { if(key.indexOf('//') !== 0 && !source.hasOwnProperty(cmdPrefix + key)) {
propertyParse(key, target, source); propertyParse(key, target, source);
} }
} }
return target; return target;
} }
/** /**
...@@ -344,14 +344,25 @@ export function injectProperties(target, source) { ...@@ -344,14 +344,25 @@ export function injectProperties(target, source) {
* @param includeSelf * @param includeSelf
*/ */
export function traverseViewNode(node: Container, callback: Function, includeSelf = false) { export function traverseViewNode(node: Container, callback: Function, includeSelf = false) {
if (includeSelf) { if(includeSelf) {
callback(node); callback(node);
} }
for (let child of node.children) { for(let child of node.children) {
callback(child, node); callback(child, node);
if (child.children && child.children.length > 0) { if(child.children && child.children.length > 0) {
traverseViewNode(child, callback); 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: ...@@ -438,10 +438,10 @@ rollup-plugin-node-resolve@^5.2.0:
resolve "^1.11.1" resolve "^1.11.1"
rollup-pluginutils "^2.8.1" rollup-pluginutils "^2.8.1"
rollup-plugin-progress@^1.1.1: rollup-plugin-progress@^1.1.2:
version "1.1.1" version "1.1.2"
resolved "https://registry.npm.taobao.org/rollup-plugin-progress/download/rollup-plugin-progress-1.1.1.tgz#fcce2f915d545014ac89ea0927ee97cb48052f60" resolved "https://registry.npm.taobao.org/rollup-plugin-progress/download/rollup-plugin-progress-1.1.2.tgz#5c1dfe7c50f654906bc34d167d5512ee1a4b72d5"
integrity sha1-/M4vkV1UUBSsieoJJ+6Xy0gFL2A= integrity sha1-XB3+fFD2VJBrw00WfVUS7hpLctU=
dependencies: dependencies:
chalk "^2.4.2" 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