@kurot/cli 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +128 -0
- package/README.md +296 -0
- package/dist/commands/build.d.ts +3 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +59 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/clean.d.ts +3 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +15 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +24 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +25 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/core/config.d.ts +94 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +70 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/dev-server.d.ts +21 -0
- package/dist/core/dev-server.d.ts.map +1 -0
- package/dist/core/dev-server.js +113 -0
- package/dist/core/dev-server.js.map +1 -0
- package/dist/core/errors.d.ts +16 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +23 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/exml/ast.d.ts +243 -0
- package/dist/core/exml/ast.d.ts.map +1 -0
- package/dist/core/exml/ast.js +8 -0
- package/dist/core/exml/ast.js.map +1 -0
- package/dist/core/exml/codegen.d.ts +23 -0
- package/dist/core/exml/codegen.d.ts.map +1 -0
- package/dist/core/exml/codegen.js +422 -0
- package/dist/core/exml/codegen.js.map +1 -0
- package/dist/core/exml/exml-parser.d.ts +27 -0
- package/dist/core/exml/exml-parser.d.ts.map +1 -0
- package/dist/core/exml/exml-parser.js +466 -0
- package/dist/core/exml/exml-parser.js.map +1 -0
- package/dist/core/exml/index.d.ts +52 -0
- package/dist/core/exml/index.d.ts.map +1 -0
- package/dist/core/exml/index.js +51 -0
- package/dist/core/exml/index.js.map +1 -0
- package/dist/core/exml/registry.d.ts +92 -0
- package/dist/core/exml/registry.d.ts.map +1 -0
- package/dist/core/exml/registry.js +177 -0
- package/dist/core/exml/registry.js.map +1 -0
- package/dist/core/exml/xml-parser.d.ts +61 -0
- package/dist/core/exml/xml-parser.d.ts.map +1 -0
- package/dist/core/exml/xml-parser.js +201 -0
- package/dist/core/exml/xml-parser.js.map +1 -0
- package/dist/core/namespace-external-plugin.d.ts +45 -0
- package/dist/core/namespace-external-plugin.d.ts.map +1 -0
- package/dist/core/namespace-external-plugin.js +66 -0
- package/dist/core/namespace-external-plugin.js.map +1 -0
- package/dist/core/pipeline.d.ts +75 -0
- package/dist/core/pipeline.d.ts.map +1 -0
- package/dist/core/pipeline.js +30 -0
- package/dist/core/pipeline.js.map +1 -0
- package/dist/core/plugins/clean-output.d.ts +3 -0
- package/dist/core/plugins/clean-output.d.ts.map +1 -0
- package/dist/core/plugins/clean-output.js +11 -0
- package/dist/core/plugins/clean-output.js.map +1 -0
- package/dist/core/plugins/compile-custom-namespaces.d.ts +19 -0
- package/dist/core/plugins/compile-custom-namespaces.d.ts.map +1 -0
- package/dist/core/plugins/compile-custom-namespaces.js +104 -0
- package/dist/core/plugins/compile-custom-namespaces.js.map +1 -0
- package/dist/core/plugins/compile-engine.d.ts +19 -0
- package/dist/core/plugins/compile-engine.d.ts.map +1 -0
- package/dist/core/plugins/compile-engine.js +75 -0
- package/dist/core/plugins/compile-engine.js.map +1 -0
- package/dist/core/plugins/compile-exml.d.ts +14 -0
- package/dist/core/plugins/compile-exml.d.ts.map +1 -0
- package/dist/core/plugins/compile-exml.js +223 -0
- package/dist/core/plugins/compile-exml.js.map +1 -0
- package/dist/core/plugins/compile-source.d.ts +14 -0
- package/dist/core/plugins/compile-source.d.ts.map +1 -0
- package/dist/core/plugins/compile-source.js +132 -0
- package/dist/core/plugins/compile-source.js.map +1 -0
- package/dist/core/plugins/copy-assets.d.ts +12 -0
- package/dist/core/plugins/copy-assets.d.ts.map +1 -0
- package/dist/core/plugins/copy-assets.js +33 -0
- package/dist/core/plugins/copy-assets.js.map +1 -0
- package/dist/core/plugins/generate-html.d.ts +16 -0
- package/dist/core/plugins/generate-html.d.ts.map +1 -0
- package/dist/core/plugins/generate-html.js +137 -0
- package/dist/core/plugins/generate-html.js.map +1 -0
- package/dist/core/plugins/index.d.ts +21 -0
- package/dist/core/plugins/index.d.ts.map +1 -0
- package/dist/core/plugins/index.js +39 -0
- package/dist/core/plugins/index.js.map +1 -0
- package/dist/core/plugins/manifest.d.ts +14 -0
- package/dist/core/plugins/manifest.d.ts.map +1 -0
- package/dist/core/plugins/manifest.js +28 -0
- package/dist/core/plugins/manifest.js.map +1 -0
- package/dist/core/project.d.ts +95 -0
- package/dist/core/project.d.ts.map +1 -0
- package/dist/core/project.js +79 -0
- package/dist/core/project.js.map +1 -0
- package/dist/core/template.d.ts +13 -0
- package/dist/core/template.d.ts.map +1 -0
- package/dist/core/template.js +79 -0
- package/dist/core/template.js.map +1 -0
- package/dist/define.d.ts +2 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +2 -0
- package/dist/define.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/fs.d.ts +5 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +30 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +18 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +45 -0
- package/templates/empty/kurot.config.ts +13 -0
- package/templates/empty/package.json +17 -0
- package/templates/empty/pnpm-workspace.yaml +3 -0
- package/templates/empty/src/Main.ts +32 -0
- package/templates/empty/template/web/index.html +38 -0
- package/templates/empty/tsconfig.json +10 -0
- package/templates/game/kurot.config.ts +16 -0
- package/templates/game/package.json +19 -0
- package/templates/game/pnpm-workspace.yaml +3 -0
- package/templates/game/resource/assets/eui.json +24 -0
- package/templates/game/resource/assets/eui.png +0 -0
- package/templates/game/resource/default.res.json +15 -0
- package/templates/game/resource/default.thm.json +19 -0
- package/templates/game/resource/skins/ButtonSkin.exml +16 -0
- package/templates/game/resource/skins/CheckBoxSkin.exml +18 -0
- package/templates/game/resource/skins/ComboBoxSkin.exml +31 -0
- package/templates/game/resource/skins/GroupSkin.exml +4 -0
- package/templates/game/resource/skins/HScrollBarSkin.exml +6 -0
- package/templates/game/resource/skins/HSliderSkin.exml +7 -0
- package/templates/game/resource/skins/ImageSkin.exml +4 -0
- package/templates/game/resource/skins/ItemRendererSkin.exml +15 -0
- package/templates/game/resource/skins/LabelSkin.exml +7 -0
- package/templates/game/resource/skins/ListSkin.exml +11 -0
- package/templates/game/resource/skins/PanelSkin.exml +15 -0
- package/templates/game/resource/skins/ProgressBarSkin.exml +11 -0
- package/templates/game/resource/skins/RadioButtonSkin.exml +18 -0
- package/templates/game/resource/skins/ScrollerSkin.exml +8 -0
- package/templates/game/resource/skins/TabBarSkin.exml +6 -0
- package/templates/game/resource/skins/TextInputSkin.exml +22 -0
- package/templates/game/resource/skins/ToggleButtonSkin.exml +21 -0
- package/templates/game/resource/skins/ToggleSwitchSkin.exml +15 -0
- package/templates/game/resource/skins/VScrollBarSkin.exml +6 -0
- package/templates/game/resource/skins/VSliderSkin.exml +7 -0
- package/templates/game/resource/skins/ViewStackSkin.exml +4 -0
- package/templates/game/src/LoadingUI.ts +27 -0
- package/templates/game/src/Main.ts +165 -0
- package/templates/game/template/web/index.html +109 -0
- package/templates/game/template/web/logo.png +0 -0
- package/templates/game/tsconfig.json +10 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
|
|
6
|
+
<title>Kurot Game</title>
|
|
7
|
+
<style>
|
|
8
|
+
html, body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
background: #000000;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
canvas {
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
27
|
+
{{KUROT_IMPORT_MAP}}
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<canvas id="gameCanvas"
|
|
31
|
+
data-content-width="{{KUROT_STAGE_WIDTH}}"
|
|
32
|
+
data-content-height="{{KUROT_STAGE_HEIGHT}}"
|
|
33
|
+
data-scale-mode="{{KUROT_SCALE_MODE}}"
|
|
34
|
+
data-orientation="{{KUROT_ORIENTATION}}"
|
|
35
|
+
data-frame-rate="{{KUROT_FRAME_RATE}}"></canvas>
|
|
36
|
+
<script type="module" src="{{KUROT_ENTRY_SCRIPT}}"></script>
|
|
37
|
+
</body>
|
|
38
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
target: 'html5',
|
|
3
|
+
entry: 'src/Main.ts',
|
|
4
|
+
output: { dir: 'bin-debug' },
|
|
5
|
+
html: { template: 'template/web/index.html' },
|
|
6
|
+
stage: {
|
|
7
|
+
width: 640,
|
|
8
|
+
height: 1136,
|
|
9
|
+
scaleMode: 'showAll',
|
|
10
|
+
orientation: 'auto',
|
|
11
|
+
frameRate: 60,
|
|
12
|
+
},
|
|
13
|
+
exml: {
|
|
14
|
+
themeFile: 'resource/default.thm.json',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kurot-game",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "kurot build",
|
|
7
|
+
"release": "kurot build --release",
|
|
8
|
+
"dev": "kurot dev",
|
|
9
|
+
"clean": "kurot clean"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@kurot/core": "latest",
|
|
13
|
+
"@kurot/game": "latest",
|
|
14
|
+
"@kurot/ui": "latest"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@kurot/cli": "latest"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{"file":"eui.png","frames":{
|
|
2
|
+
"button_down_png":{"x":200,"y":76,"w":16,"h":16,"offX":0,"offY":0,"sourceW":16,"sourceH":16},
|
|
3
|
+
"button_up_png":{"x":236,"y":58,"w":16,"h":16,"offX":0,"offY":0,"sourceW":16,"sourceH":16},
|
|
4
|
+
"checkbox_select_disabled_png":{"x":127,"y":49,"w":23,"h":23,"offX":0,"offY":0,"sourceW":23,"sourceH":23},
|
|
5
|
+
"checkbox_select_down_png":{"x":102,"y":49,"w":23,"h":23,"offX":0,"offY":0,"sourceW":23,"sourceH":23},
|
|
6
|
+
"checkbox_select_up_png":{"x":77,"y":49,"w":23,"h":23,"offX":0,"offY":0,"sourceW":23,"sourceH":23},
|
|
7
|
+
"checkbox_unselect_png":{"x":52,"y":49,"w":23,"h":23,"offX":0,"offY":0,"sourceW":23,"sourceH":23},
|
|
8
|
+
"selected_png":{"x":218,"y":58,"w":16,"h":16,"offX":0,"offY":0,"sourceW":16,"sourceH":16},
|
|
9
|
+
"border_png":{"x":0,"y":0,"w":177,"h":47,"offX":0,"offY":0,"sourceW":177,"sourceH":47},
|
|
10
|
+
"header_png":{"x":200,"y":58,"w":16,"h":16,"offX":0,"offY":0,"sourceW":16,"sourceH":16},
|
|
11
|
+
"thumb_pb_png":{"x":246,"y":16,"w":6,"h":6,"offX":0,"offY":0,"sourceW":6,"sourceH":6},
|
|
12
|
+
"track_pb_png":{"x":246,"y":8,"w":6,"h":6,"offX":0,"offY":0,"sourceW":6,"sourceH":6},
|
|
13
|
+
"radiobutton_select_disabled_png":{"x":152,"y":73,"w":22,"h":22,"offX":0,"offY":0,"sourceW":22,"sourceH":22},
|
|
14
|
+
"radiobutton_select_down_png":{"x":176,"y":58,"w":22,"h":22,"offX":0,"offY":0,"sourceW":22,"sourceH":22},
|
|
15
|
+
"radiobutton_select_up_png":{"x":152,"y":49,"w":22,"h":22,"offX":0,"offY":0,"sourceW":22,"sourceH":22},
|
|
16
|
+
"radiobutton_unselect_png":{"x":176,"y":82,"w":22,"h":22,"offX":0,"offY":0,"sourceW":22,"sourceH":22},
|
|
17
|
+
"roundthumb_png":{"x":246,"y":0,"w":6,"h":6,"offX":0,"offY":0,"sourceW":6,"sourceH":6},
|
|
18
|
+
"track_sb_png":{"x":246,"y":40,"w":6,"h":6,"offX":0,"offY":0,"sourceW":6,"sourceH":6},
|
|
19
|
+
"thumb_png":{"x":0,"y":49,"w":25,"h":25,"offX":0,"offY":0,"sourceW":25,"sourceH":25},
|
|
20
|
+
"track_png":{"x":246,"y":24,"w":6,"h":6,"offX":0,"offY":0,"sourceW":6,"sourceH":6},
|
|
21
|
+
"tracklight_png":{"x":246,"y":32,"w":6,"h":6,"offX":0,"offY":0,"sourceW":6,"sourceH":6},
|
|
22
|
+
"handle_png":{"x":27,"y":49,"w":23,"h":23,"offX":0,"offY":0,"sourceW":23,"sourceH":23},
|
|
23
|
+
"off_png":{"x":179,"y":0,"w":65,"h":27,"offX":0,"offY":0,"sourceW":65,"sourceH":27},
|
|
24
|
+
"on_png":{"x":179,"y":29,"w":65,"h":27,"offX":0,"offY":0,"sourceW":65,"sourceH":27}}}
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skins": {
|
|
3
|
+
"Button": "skins.ButtonSkin",
|
|
4
|
+
"CheckBox": "skins.CheckBoxSkin",
|
|
5
|
+
"RadioButton": "skins.RadioButtonSkin",
|
|
6
|
+
"ToggleSwitch": "skins.ToggleSwitchSkin",
|
|
7
|
+
"Panel": "skins.PanelSkin",
|
|
8
|
+
"ProgressBar": "skins.ProgressBarSkin",
|
|
9
|
+
"HSlider": "skins.HSliderSkin",
|
|
10
|
+
"VSlider": "skins.VSliderSkin",
|
|
11
|
+
"HScrollBar": "skins.HScrollBarSkin",
|
|
12
|
+
"VScrollBar": "skins.VScrollBarSkin",
|
|
13
|
+
"TextInput": "skins.TextInputSkin",
|
|
14
|
+
"ComboBox": "skins.ComboBoxSkin",
|
|
15
|
+
"Scroller": "skins.ScrollerSkin",
|
|
16
|
+
"ItemRenderer": "skins.ItemRendererSkin"
|
|
17
|
+
},
|
|
18
|
+
"exmls": []
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ButtonSkin"
|
|
3
|
+
states="up,down,disabled"
|
|
4
|
+
minWidth="100" minHeight="50"
|
|
5
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
6
|
+
<eui:Image width="100%" height="100%"
|
|
7
|
+
scale9Grid="1,3,8,8"
|
|
8
|
+
alpha.disabled="0.5"
|
|
9
|
+
source="button_up_png"
|
|
10
|
+
source.down="button_down_png"/>
|
|
11
|
+
<eui:Label id="labelDisplay" left="8" right="8" top="8" bottom="8"
|
|
12
|
+
textAlign="center" verticalAlign="middle"
|
|
13
|
+
textColor="0xffffff"
|
|
14
|
+
size="20"/>
|
|
15
|
+
<eui:Image id="iconDisplay" horizontalCenter="0" verticalCenter="0"/>
|
|
16
|
+
</eui:Skin>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.CheckBoxSkin"
|
|
3
|
+
states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected"
|
|
4
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
5
|
+
<eui:Group width="100%" height="100%">
|
|
6
|
+
<eui:layout>
|
|
7
|
+
<eui:HorizontalLayout verticalAlign="middle"/>
|
|
8
|
+
</eui:layout>
|
|
9
|
+
<eui:Image fillMode="scale"
|
|
10
|
+
alpha="1" alpha.disabled="0.5" alpha.down="0.7"
|
|
11
|
+
source="checkbox_unselect_png"
|
|
12
|
+
source.upAndSelected="checkbox_select_up_png"
|
|
13
|
+
source.downAndSelected="checkbox_select_down_png"
|
|
14
|
+
source.disabledAndSelected="checkbox_select_disabled_png"/>
|
|
15
|
+
<eui:Label id="labelDisplay" size="20" textColor="0x707070"
|
|
16
|
+
textAlign="center" verticalAlign="middle" fontFamily="Tahoma"/>
|
|
17
|
+
</eui:Group>
|
|
18
|
+
</eui:Skin>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ComboBoxSkin" minWidth="100" minHeight="36"
|
|
3
|
+
states="normal,open,disabled"
|
|
4
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
5
|
+
<!-- Trigger background -->
|
|
6
|
+
<eui:Rect width="100%" height="36"
|
|
7
|
+
fillColor="0x1a1a2e"
|
|
8
|
+
fillColor.open="0x16213e"
|
|
9
|
+
fillColor.disabled="0x16213e"
|
|
10
|
+
strokeColor="0x0f3460"
|
|
11
|
+
strokeColor.open="0x6c5ce7"
|
|
12
|
+
strokeColor.disabled="0x4a5459"
|
|
13
|
+
strokeWeight="1"/>
|
|
14
|
+
<!-- Selected item label -->
|
|
15
|
+
<eui:Label id="labelDisplay" left="10" right="36" top="0" height="36"
|
|
16
|
+
verticalAlign="middle"
|
|
17
|
+
textColor="0xdfe6e9"
|
|
18
|
+
textColor.disabled="0x636e72"
|
|
19
|
+
size="14"/>
|
|
20
|
+
<!-- Dropdown arrow indicator -->
|
|
21
|
+
<eui:Label right="4" top="0" width="24" height="36"
|
|
22
|
+
textAlign="center" verticalAlign="middle"
|
|
23
|
+
textColor="0x636e72"
|
|
24
|
+
textColor.open="0x6c5ce7"
|
|
25
|
+
text="▼"
|
|
26
|
+
size="10"/>
|
|
27
|
+
<!-- Dropdown panel -->
|
|
28
|
+
<eui:Scroller id="dropDown" left="0" right="0" top="36" height="180" visible="false">
|
|
29
|
+
<eui:List id="list" width="100%" height="180"/>
|
|
30
|
+
</eui:Scroller>
|
|
31
|
+
</eui:Skin>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.HScrollBarSkin" minWidth="20" minHeight="8"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Image id="thumb" source="roundthumb_png" scale9Grid="3,3,2,2"
|
|
5
|
+
width="30" height="8" verticalCenter="0"/>
|
|
6
|
+
</eui:Skin>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.HSliderSkin" minWidth="20" minHeight="8"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Image id="track" source="track_sb_png" scale9Grid="1,1,4,4"
|
|
5
|
+
width="100%" height="6" verticalCenter="0"/>
|
|
6
|
+
<eui:Image id="thumb" source="thumb_png" verticalCenter="0"/>
|
|
7
|
+
</eui:Skin>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ItemRendererSkin"
|
|
3
|
+
states="up,down,disabled"
|
|
4
|
+
minWidth="100" minHeight="50"
|
|
5
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
6
|
+
<eui:Image width="100%" height="100%"
|
|
7
|
+
source="button_up_png"
|
|
8
|
+
source.down="button_down_png"
|
|
9
|
+
scale9Grid="1,3,8,8"
|
|
10
|
+
alpha.disabled="0.5"/>
|
|
11
|
+
<eui:Label id="labelDisplay"
|
|
12
|
+
left="8" right="8" top="8" bottom="8"
|
|
13
|
+
size="20" fontFamily="Tahoma" textColor="0xffffff"
|
|
14
|
+
textAlign="center" verticalAlign="middle"/>
|
|
15
|
+
</eui:Skin>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ListSkin" minWidth="20" minHeight="20"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Rect width="100%" height="100%"
|
|
5
|
+
fillColor="0x1a1a2e"
|
|
6
|
+
strokeColor="0x0f3460"
|
|
7
|
+
strokeWeight="1"/>
|
|
8
|
+
<eui:Scroller id="scroller" width="100%" height="100%">
|
|
9
|
+
<eui:DataGroup id="dataGroup" width="100%" height="100%"/>
|
|
10
|
+
</eui:Scroller>
|
|
11
|
+
</eui:Skin>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.PanelSkin" minWidth="450" minHeight="230"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Image left="0" right="0" top="0" bottom="0"
|
|
5
|
+
source="border_png" scale9Grid="2,2,12,12"/>
|
|
6
|
+
<eui:Group id="moveArea" left="0" right="0" top="0" height="45">
|
|
7
|
+
<eui:Image left="0" right="0" top="0" bottom="0"
|
|
8
|
+
source="header_png" scale9Grid="2,2,12,12"/>
|
|
9
|
+
<eui:Label id="titleDisplay"
|
|
10
|
+
left="15" right="5" verticalCenter="0"
|
|
11
|
+
size="20" fontFamily="Tahoma" textColor="0xffffff"
|
|
12
|
+
wordWrap="false"/>
|
|
13
|
+
</eui:Group>
|
|
14
|
+
<eui:Button id="closeButton" label="close" bottom="5" horizontalCenter="0"/>
|
|
15
|
+
</eui:Skin>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ProgressBarSkin" minWidth="30" minHeight="18"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Image source="track_pb_png" scale9Grid="1,1,4,4"
|
|
5
|
+
width="100%" height="100%" verticalCenter="0"/>
|
|
6
|
+
<eui:Image id="thumb" source="thumb_pb_png" scale9Grid="1,1,4,4"
|
|
7
|
+
width="100%" height="100%"/>
|
|
8
|
+
<eui:Label id="labelDisplay" textAlign="center" verticalAlign="middle"
|
|
9
|
+
size="15" fontFamily="Tahoma" textColor="0x707070"
|
|
10
|
+
horizontalCenter="0" verticalCenter="0"/>
|
|
11
|
+
</eui:Skin>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.RadioButtonSkin"
|
|
3
|
+
states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected"
|
|
4
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
5
|
+
<eui:Group width="100%" height="100%">
|
|
6
|
+
<eui:layout>
|
|
7
|
+
<eui:HorizontalLayout verticalAlign="middle"/>
|
|
8
|
+
</eui:layout>
|
|
9
|
+
<eui:Image fillMode="scale"
|
|
10
|
+
alpha="1" alpha.disabled="0.5" alpha.down="0.7"
|
|
11
|
+
source="radiobutton_unselect_png"
|
|
12
|
+
source.upAndSelected="radiobutton_select_up_png"
|
|
13
|
+
source.downAndSelected="radiobutton_select_down_png"
|
|
14
|
+
source.disabledAndSelected="radiobutton_select_disabled_png"/>
|
|
15
|
+
<eui:Label id="labelDisplay" size="20" textColor="0x707070"
|
|
16
|
+
textAlign="center" verticalAlign="middle" fontFamily="Tahoma"/>
|
|
17
|
+
</eui:Group>
|
|
18
|
+
</eui:Skin>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ScrollerSkin" minWidth="20" minHeight="20"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:HScrollBar id="horizontalScrollBar" left="0" right="12" bottom="0" height="12"
|
|
5
|
+
autoVisibility="false" visible="false"/>
|
|
6
|
+
<eui:VScrollBar id="verticalScrollBar" top="0" right="0" bottom="12" width="12"
|
|
7
|
+
autoVisibility="false" visible="false"/>
|
|
8
|
+
</eui:Skin>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.TabBarSkin" minWidth="100" minHeight="40"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Rect width="100%" height="100%" fillColor="0x16213e"/>
|
|
5
|
+
<eui:DataGroup id="dataGroup" width="100%" height="100%"/>
|
|
6
|
+
</eui:Skin>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.TextInputSkin" minWidth="300" minHeight="40"
|
|
3
|
+
states="normal,disabled,normalWithPrompt,disabledWithPrompt"
|
|
4
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
5
|
+
<eui:Rect width="100%" height="100%"
|
|
6
|
+
fillColor="0xffffff"
|
|
7
|
+
alpha.disabled="0.5"/>
|
|
8
|
+
<eui:EditableText id="textDisplay"
|
|
9
|
+
left="10" right="10" verticalCenter="0" height="24"
|
|
10
|
+
verticalAlign="middle"
|
|
11
|
+
textColor="0x000000"
|
|
12
|
+
textColor.disabled="0xff0000"
|
|
13
|
+
size="20"/>
|
|
14
|
+
<eui:Label id="promptDisplay"
|
|
15
|
+
left="10" right="10" verticalCenter="0" height="24"
|
|
16
|
+
touchEnabled="false"
|
|
17
|
+
includeIn="normalWithPrompt,disabledWithPrompt"
|
|
18
|
+
multiline="false" wordWrap="false"
|
|
19
|
+
verticalAlign="middle"
|
|
20
|
+
textColor="0xa9a9a9"
|
|
21
|
+
size="20"/>
|
|
22
|
+
</eui:Skin>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ToggleButtonSkin"
|
|
3
|
+
states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected"
|
|
4
|
+
minWidth="100" minHeight="50"
|
|
5
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
6
|
+
<eui:Rect id="bg" width="100%" height="100%"
|
|
7
|
+
fillColor="0x636e72"
|
|
8
|
+
fillColor.down="0x4a5459"
|
|
9
|
+
fillColor.disabled="0x2d3436"
|
|
10
|
+
fillColor.upAndSelected="0x6c5ce7"
|
|
11
|
+
fillColor.downAndSelected="0x5a4bd1"
|
|
12
|
+
fillColor.disabledAndSelected="0x2d3436"
|
|
13
|
+
strokeColor="0x4a5459"
|
|
14
|
+
strokeWeight="1"/>
|
|
15
|
+
<eui:Label id="labelDisplay" left="8" right="8" top="8" bottom="8"
|
|
16
|
+
textAlign="center" verticalAlign="middle"
|
|
17
|
+
textColor="0xdfe6e9"
|
|
18
|
+
textColor.disabled="0x636e72"
|
|
19
|
+
textColor.upAndSelected="0xffffff"
|
|
20
|
+
size="16"/>
|
|
21
|
+
</eui:Skin>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.ToggleSwitchSkin"
|
|
3
|
+
states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected"
|
|
4
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
5
|
+
<eui:Image source="on_png"
|
|
6
|
+
source.up="off_png"
|
|
7
|
+
source.down="off_png"
|
|
8
|
+
source.disabled="off_png"/>
|
|
9
|
+
<eui:Image source="handle_png"
|
|
10
|
+
horizontalCenter="-18"
|
|
11
|
+
horizontalCenter.upAndSelected="18"
|
|
12
|
+
horizontalCenter.downAndSelected="18"
|
|
13
|
+
horizontalCenter.disabledAndSelected="18"
|
|
14
|
+
verticalCenter="0"/>
|
|
15
|
+
</eui:Skin>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.VScrollBarSkin" minWidth="8" minHeight="20"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Image id="thumb" source="roundthumb_png" scale9Grid="3,3,2,2"
|
|
5
|
+
width="8" height="30" horizontalCenter="0"/>
|
|
6
|
+
</eui:Skin>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<eui:Skin class="skins.VSliderSkin" minWidth="25" minHeight="30"
|
|
3
|
+
xmlns:eui="http://ns.egret.com/eui">
|
|
4
|
+
<eui:Image id="track" source="track_png" scale9Grid="1,1,4,4"
|
|
5
|
+
width="7" height="100%" horizontalCenter="0"/>
|
|
6
|
+
<eui:Image id="thumb" source="thumb_png" horizontalCenter="0"/>
|
|
7
|
+
</eui:Skin>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 资源加载进度界面
|
|
3
|
+
*
|
|
4
|
+
* 在资源加载期间显示 "Loading...current/total" 文本。
|
|
5
|
+
* 对应 Egret 的 LoadingUI。
|
|
6
|
+
*/
|
|
7
|
+
import { Sprite, TextField } from '@kurot/core';
|
|
8
|
+
|
|
9
|
+
class LoadingUI extends Sprite {
|
|
10
|
+
private textField: TextField;
|
|
11
|
+
|
|
12
|
+
public constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.textField = new TextField();
|
|
15
|
+
this.addChild(this.textField);
|
|
16
|
+
this.textField.y = 300;
|
|
17
|
+
this.textField.width = 480;
|
|
18
|
+
this.textField.height = 100;
|
|
19
|
+
this.textField.textAlign = 'center';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public onProgress(current: number, total: number): void {
|
|
23
|
+
this.textField.text = `Loading...${current}/${total}`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { LoadingUI };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kurot 标准游戏模板
|
|
3
|
+
*
|
|
4
|
+
* 使用 @kurot/core 进行 Canvas 绘制 + @kurot/game 补间动画。
|
|
5
|
+
* 通过 Shape、TextField 等基础显示对象构建游戏场景。
|
|
6
|
+
*
|
|
7
|
+
* 生命周期:constructor → ADDED_TO_STAGE → $onAddToStage → runGame → loadResource → createGameScene → startAnimation
|
|
8
|
+
*/
|
|
9
|
+
import { createPlayer, TextField, Shape, Event, Stage, Texture, resource } from '@kurot/core';
|
|
10
|
+
import { Button, DefaultAssetAdapter, Theme, UILayer, setAssetAdapter } from '@kurot/ui';
|
|
11
|
+
import { Tween } from '@kurot/game';
|
|
12
|
+
import { LoadingUI } from './LoadingUI';
|
|
13
|
+
|
|
14
|
+
class Main extends UILayer {
|
|
15
|
+
createChildren(): void {
|
|
16
|
+
super.createChildren();
|
|
17
|
+
|
|
18
|
+
const stage = this.stage;
|
|
19
|
+
if (!stage) return;
|
|
20
|
+
|
|
21
|
+
this.runGame(stage).catch(e => {
|
|
22
|
+
console.log(e);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private async runGame(stage: Stage): Promise<void> {
|
|
27
|
+
await this.loadResource(stage);
|
|
28
|
+
this.installResourceAssetAdapter();
|
|
29
|
+
await this.loadTheme();
|
|
30
|
+
this.createGameScene(stage);
|
|
31
|
+
this.startAnimation();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 让 EXML 中的 source="button_up_png" 优先解析为预加载图集的子纹理,
|
|
36
|
+
* 普通 URL 图片仍交给默认适配器加载。
|
|
37
|
+
*/
|
|
38
|
+
private installResourceAssetAdapter(): void {
|
|
39
|
+
const fallback = new DefaultAssetAdapter();
|
|
40
|
+
setAssetAdapter({
|
|
41
|
+
getAsset: (source, callback) => {
|
|
42
|
+
const texture = resource.get<Texture>(source);
|
|
43
|
+
if (texture) {
|
|
44
|
+
callback(texture, source);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
fallback.getAsset(source, callback);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private async loadResource(stage: Stage): Promise<void> {
|
|
53
|
+
const loadingView = new LoadingUI();
|
|
54
|
+
stage.addChild(loadingView);
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
await resource.loadConfig('resource/default.res.json', 'resource/');
|
|
58
|
+
if (resource.hasGroup('preload')) {
|
|
59
|
+
await resource.loadGroup('preload', 0, (loaded, total) => {
|
|
60
|
+
loadingView.onProgress(loaded, total);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
} catch {
|
|
64
|
+
// 资源配置文件不存在时静默跳过(纯代码项目无需资源配置)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
stage.removeChild(loadingView);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private async loadTheme(): Promise<void> {
|
|
71
|
+
// 加载主题(UI 组件默认皮肤映射)
|
|
72
|
+
const theme = new Theme('resource/default.thm.json');
|
|
73
|
+
await new Promise<void>(resolve => theme.addEventListener(Event.COMPLETE, () => resolve()));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private textfield!: TextField;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 创建游戏场景
|
|
80
|
+
*
|
|
81
|
+
* 使用 Shape(矢量绘制)和 TextField(文本)等基础显示对象搭建画面。
|
|
82
|
+
*/
|
|
83
|
+
private createGameScene(stage: Stage): void {
|
|
84
|
+
const stageW = stage.stageWidth;
|
|
85
|
+
const stageH = stage.stageHeight;
|
|
86
|
+
|
|
87
|
+
// 背景色块
|
|
88
|
+
const sky = new Shape();
|
|
89
|
+
sky.graphics.beginFill(0x2d3436, 1);
|
|
90
|
+
sky.graphics.drawRect(0, 0, stageW, stageH);
|
|
91
|
+
sky.graphics.endFill();
|
|
92
|
+
this.addChild(sky);
|
|
93
|
+
|
|
94
|
+
// 半透明顶栏
|
|
95
|
+
const topMask = new Shape();
|
|
96
|
+
topMask.graphics.beginFill(0x000000, 0.5);
|
|
97
|
+
topMask.graphics.drawRect(0, 0, stageW, 172);
|
|
98
|
+
topMask.graphics.endFill();
|
|
99
|
+
topMask.y = 33;
|
|
100
|
+
this.addChild(topMask);
|
|
101
|
+
|
|
102
|
+
// 标题文本
|
|
103
|
+
const colorLabel = new TextField();
|
|
104
|
+
colorLabel.textColor = 0xffffff;
|
|
105
|
+
colorLabel.width = stageW;
|
|
106
|
+
colorLabel.textAlign = 'center';
|
|
107
|
+
colorLabel.text = 'Hello Kurot';
|
|
108
|
+
colorLabel.size = 36;
|
|
109
|
+
colorLabel.x = 0;
|
|
110
|
+
colorLabel.y = 80;
|
|
111
|
+
this.addChild(colorLabel);
|
|
112
|
+
|
|
113
|
+
// 描述文本(用于动画)
|
|
114
|
+
const textfield = new TextField();
|
|
115
|
+
this.addChild(textfield);
|
|
116
|
+
textfield.alpha = 0;
|
|
117
|
+
textfield.width = stageW;
|
|
118
|
+
textfield.textAlign = 'center';
|
|
119
|
+
textfield.size = 24;
|
|
120
|
+
textfield.textColor = 0xffffff;
|
|
121
|
+
textfield.x = 0;
|
|
122
|
+
textfield.y = 135;
|
|
123
|
+
this.textfield = textfield;
|
|
124
|
+
|
|
125
|
+
// UI 按钮示例(需要默认主题)
|
|
126
|
+
const button = new Button();
|
|
127
|
+
button.label = 'Click Me';
|
|
128
|
+
button.x = (stageW - 200) / 2;
|
|
129
|
+
button.y = 200;
|
|
130
|
+
button.width = 200;
|
|
131
|
+
this.addChild(button);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 播放文本淡入淡出动画
|
|
136
|
+
*/
|
|
137
|
+
private startAnimation(): void {
|
|
138
|
+
const texts = ['Open-source, Free, Multi-platform', 'Push Game Forward', 'HTML5 Game Engine'];
|
|
139
|
+
let count = -1;
|
|
140
|
+
const change = () => {
|
|
141
|
+
count++;
|
|
142
|
+
if (count >= texts.length) {
|
|
143
|
+
count = 0;
|
|
144
|
+
}
|
|
145
|
+
this.textfield.text = texts[count];
|
|
146
|
+
const tw = Tween.get(this.textfield);
|
|
147
|
+
tw.to({ alpha: 1 }, 200);
|
|
148
|
+
tw.wait(2000);
|
|
149
|
+
tw.to({ alpha: 0 }, 200);
|
|
150
|
+
tw.call(change, this);
|
|
151
|
+
};
|
|
152
|
+
change();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ── 启动 ──────────────────────────────────────────────────────────────────
|
|
157
|
+
const app = createPlayer({
|
|
158
|
+
canvas: document.getElementById('gameCanvas') as HTMLCanvasElement,
|
|
159
|
+
contentWidth: 640,
|
|
160
|
+
contentHeight: 1136,
|
|
161
|
+
scaleMode: 'showAll',
|
|
162
|
+
frameRate: 60,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
app.start(new Main());
|