@yangyongtao/gaea 1.0.3 → 1.1.0
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/README.md +158 -67
- package/package.json +28 -7
- package/public/Gaea.apple-touch-icon.png +0 -0
- package/public/Gaea.apple-touch-icon.png.import +35 -0
- package/public/Gaea.audio.worklet.js +211 -0
- package/public/Gaea.html +245 -0
- package/public/Gaea.icon.png +0 -0
- package/public/Gaea.icon.png.import +35 -0
- package/public/Gaea.js +782 -0
- package/public/Gaea.png +0 -0
- package/public/Gaea.png.import +35 -0
- package/public/Gaea.worker.js +1 -0
- package/public/GaeaApp.html +275 -0
- package/public/GaeaMethods.js +4342 -0
- package/public/GaeaModule.html +276 -0
- package/public/config.js +76 -0
- package/public/constants.js +185 -0
- package/public/favicon.ico +0 -0
- package/public/image/1.png +0 -0
- package/public/image/12-min-min.gif +0 -0
- package/public/image/3.png +0 -0
- package/public/image/labelImg//345/217/263/350/276/271.png +0 -0
- package/public/image/labelImg//345/267/246/350/276/271.png +0 -0
- package/public/image/labelImg//346/260/264/344/275/215.png +0 -0
- package/public/image/screenIcon//345/205/266/344/273/226.png +0 -0
- package/public/image/screenIcon//345/256/211/345/205/250/347/233/221/346/265/213/350/201/232/345/220/210-/347/272/242.png +0 -0
- package/public/image/screenIcon//345/256/211/345/205/250/347/233/221/346/265/213/350/201/232/345/220/210-/347/273/277.png +0 -0
- package/public/image/screenIcon//346/212/242/351/231/251/345/215/225/344/275/215.png +0 -0
- package/public/image/screenIcon//346/226/255/351/235/242.png +0 -0
- package/public/image/screenIcon//346/227/240/344/272/272/346/234/272.png +0 -0
- package/public/image/screenIcon//346/227/240/344/272/272/346/234/272/345/237/272/345/234/260.png +0 -0
- package/public/image/screenIcon//346/260/264/345/272/223/347/253/231.png +0 -0
- package/public/image/screenIcon//346/260/264/346/226/207/346/265/213/347/253/231.png +0 -0
- package/public/image/screenIcon//346/260/264/351/227/270.png +0 -0
- package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/346/227/240/346/225/260/346/215/256.png +0 -0
- package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/346/255/243/345/270/270.png +0 -0
- package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/350/266/205/344/277/235.png +0 -0
- package/public/image/screenIcon//346/262/263/351/201/223/347/253/231-/350/266/205/350/255/246.png +0 -0
- package/public/image/screenIcon//346/263/265/347/253/231-/347/201/260.png +0 -0
- package/public/image/screenIcon//346/263/265/347/253/231-/347/273/277.png +0 -0
- package/public/image/screenIcon//346/265/201/351/207/217/346/265/213/347/253/231.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-1/347/272/247.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-2/347/272/247.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-3/347/272/247.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-4/347/272/247.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-5/347/272/247.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-/346/251/231.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-/347/272/242.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-/347/273/277.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-/350/247/204/346/250/241/344/273/245/344/270/213.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230-/351/273/204.png +0 -0
- package/public/image/screenIcon//346/265/267/345/241/230.png +0 -0
- package/public/image/screenIcon//346/275/256/344/275/215.png +0 -0
- package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/346/227/240/346/225/260/346/215/256.png +0 -0
- package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/346/255/243/345/270/270.png +0 -0
- package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/350/266/205/344/277/235.png +0 -0
- package/public/image/screenIcon//346/275/256/344/275/215/347/253/231-/350/266/205/350/255/246.png +0 -0
- package/public/image/screenIcon//347/211/251/350/265/204/344/273/223/345/272/223.png +0 -0
- package/public/image/screenIcon//347/220/203/346/234/272-/345/205/263.png +0 -0
- package/public/image/screenIcon//347/220/203/346/234/272-/345/274/200.png +0 -0
- package/public/image/screenIcon//347/220/203/346/234/272-/347/272/242.png +0 -0
- package/public/image/screenIcon//350/247/206/351/242/221/347/233/221/346/216/247.png +0 -0
- package/public/image/screenIcon//351/227/270/351/227/250-/347/201/260.png +0 -0
- package/public/image/screenIcon//351/227/270/351/227/250-/347/273/277.png +0 -0
- package/public/image/screenIcon//351/230/262/346/264/252/344/273/223/345/272/223.png +0 -0
- package/public/image/screenIcon//351/232/220/346/202/243.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/346/265/205/350/223/235.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/201/260.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/262/211.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/272/242.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/347/273/277.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/350/223/235.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/351/273/204.png +0 -0
- package/public/image/screenIcon//351/233/250/351/207/217/347/253/231-/351/273/221.png +0 -0
- package/public/image/screenIcon//351/243/216/351/200/237.png +0 -0
- package/public/image/screenIcon//351/243/216/351/200/237/346/265/213/347/253/231.png +0 -0
- package/public/image//346/260/264/346/226/207.gif +0 -0
- package/public/image//350/211/262/345/270/246.png +0 -0
- package/public/index.html +22 -0
- package/public/index.js +185662 -0
- package/public/jsWebControl-1.0.0.min.js +31 -0
- package/public/jsencrypt.min.js +1 -0
- package/public/math/Box2.js +203 -0
- package/public/math/Box3.js +532 -0
- package/public/math/Color.js +605 -0
- package/public/math/ColorManagement.js +74 -0
- package/public/math/Cylindrical.js +61 -0
- package/public/math/EngineUtils.js +81 -0
- package/public/math/Euler.js +315 -0
- package/public/math/Frustum.js +162 -0
- package/public/math/Interpolant.js +241 -0
- package/public/math/Line3.js +115 -0
- package/public/math/MathUtils.js +345 -0
- package/public/math/Matrix3.js +365 -0
- package/public/math/Matrix4.js +858 -0
- package/public/math/Plane.js +205 -0
- package/public/math/Quaternion.js +724 -0
- package/public/math/Ray.js +493 -0
- package/public/math/Sphere.js +243 -0
- package/public/math/Spherical.js +86 -0
- package/public/math/SphericalHarmonics3.js +243 -0
- package/public/math/Triangle.js +299 -0
- package/public/math/Vector2.js +464 -0
- package/public/math/Vector3.js +715 -0
- package/public/math/Vector4.js +644 -0
- package/public/math/interpolants/CubicInterpolant.js +151 -0
- package/public/math/interpolants/DiscreteInterpolant.js +26 -0
- package/public/math/interpolants/LinearInterpolant.js +38 -0
- package/public/math/interpolants/QuaternionLinearInterpolant.js +39 -0
- package/public/static/Cloud.png +0 -0
- package/public/static/Global2.jpg +0 -0
- package/public/static/css/main.css +170 -0
- package/public/static/geojson//346/265/267/345/241/230.geojson +99 -0
- package/public/static/img/loading.gif +0 -0
- package/public/static/js/app.js +359 -0
- package/public/static/js/appcontroller.js +207 -0
- package/public/static/js/dist/game.dev.js +137 -0
- package/public/static/js/env.js +74 -0
- package/public/static/js/event/event.js +107 -0
- package/public/static/js/init.js +8 -0
- package/public/static/js/initcloudmorph.js +1 -0
- package/public/static/js/log.js +35 -0
- package/public/static/js/network/ajax.js +29 -0
- package/public/static/js/network/rtcp.js +172 -0
- package/public/static/js/network/socket.js +106 -0
- package/public/web-control.min.js +2 -0
- package/scripts/postinstall.mjs +127 -0
- package/src/GaeaMethods.js +68 -405
- package/src/components/FlyAlongRoute.vue +1 -0
- package/src/components/WeatherControl.vue +2 -0
- package/src/directives/vDrag.js +70 -0
- package/src/index.js +1 -8
- package/src/plugin.js +16 -0
- package/src/utils.js +10 -21
- package/src/vite-plugin.js +117 -0
- package/public/static/1111.res +0 -0
- package/src/config.js +0 -40
package/public/Gaea.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[remap]
|
|
2
|
+
|
|
3
|
+
importer="texture"
|
|
4
|
+
type="StreamTexture"
|
|
5
|
+
path="res://.import/Gaea.png-8864bdaff931cbd87b5383c3fc4827ca.stex"
|
|
6
|
+
metadata={
|
|
7
|
+
"vram_texture": false
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
[deps]
|
|
11
|
+
|
|
12
|
+
source_file="res://exports/html5/Gaea.png"
|
|
13
|
+
dest_files=[ "res://.import/Gaea.png-8864bdaff931cbd87b5383c3fc4827ca.stex" ]
|
|
14
|
+
|
|
15
|
+
[params]
|
|
16
|
+
|
|
17
|
+
compress/mode=0
|
|
18
|
+
compress/lossy_quality=0.7
|
|
19
|
+
compress/hdr_mode=0
|
|
20
|
+
compress/bptc_ldr=0
|
|
21
|
+
compress/normal_map=0
|
|
22
|
+
flags/repeat=0
|
|
23
|
+
flags/filter=true
|
|
24
|
+
flags/mipmaps=false
|
|
25
|
+
flags/anisotropic=false
|
|
26
|
+
flags/srgb=2
|
|
27
|
+
process/fix_alpha_border=true
|
|
28
|
+
process/premult_alpha=false
|
|
29
|
+
process/HDR_as_SRGB=false
|
|
30
|
+
process/invert_color=false
|
|
31
|
+
process/normal_map_invert_y=false
|
|
32
|
+
stream=false
|
|
33
|
+
size_limit=0
|
|
34
|
+
detect_3d=true
|
|
35
|
+
svg/scale=1.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var threadInfoStruct=0;var selfThreadId=0;var parentThreadId=0;var Module={};function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:selfThreadId})}var err=threadPrintErr;this.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);Module["wasmModule"]=null;receiveInstance(instance);return instance.exports};this.onmessage=function(e){try{if(e.data.cmd==="load"){Module["DYNAMIC_BASE"]=e.data.DYNAMIC_BASE;Module["DYNAMICTOP_PTR"]=e.data.DYNAMICTOP_PTR;Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob==="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}Godot(Module).then(function(instance){Module=instance;postMessage({"cmd":"loaded"})})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;threadInfoStruct=e.data.threadInfoStruct;Module["registerPthreadPtr"](threadInfoStruct,0,0);selfThreadId=e.data.selfThreadId;parentThreadId=e.data.parentThreadId;var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["_emscripten_tls_init"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].setThreadStatus(Module["_pthread_self"](),1);try{var result=Module["dynCall_ii"](e.data.start_routine,e.data.arg);if(!Module["getNoExitRuntime"]())Module["PThread"].threadExit(result)}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){Atomics.store(Module["HEAPU32"],threadInfoStruct+4>>2,ex instanceof Module["ExitStatus"]?ex.status:-2);Atomics.store(Module["HEAPU32"],threadInfoStruct+0>>2,1);Module["_emscripten_futex_wake"](threadInfoStruct+0,2147483647);if(!(ex instanceof Module["ExitStatus"]))throw ex}}}else if(e.data.cmd==="cancel"){if(threadInfoStruct){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(threadInfoStruct){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex.stack)err(ex.stack);throw ex}};if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){self={location:{href:__filename}};var onmessage=this.onmessage;var nodeWorkerThreads=require("worker_threads");global.Worker=nodeWorkerThreads.Worker;var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",function(data){onmessage({data:data})});var nodeFS=require("fs");var nodeRead=function(filename){return nodeFS.readFileSync(filename,"utf8")};function globalEval(x){global.require=require;global.Module=Module;eval.call(null,x)}importScripts=function(f){globalEval(nodeRead(f))};postMessage=function(msg){parentPort.postMessage(msg)};if(typeof performance==="undefined"){performance={now:function(){return Date.now()}}}}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset='utf-8' />
|
|
6
|
+
<meta name='viewport' content='width=device-width, user-scalable=no' />
|
|
7
|
+
<title>Gaea Explorer</title>
|
|
8
|
+
<style type='text/css'>
|
|
9
|
+
body {
|
|
10
|
+
touch-action: none;
|
|
11
|
+
margin: 0;
|
|
12
|
+
border: 0 none;
|
|
13
|
+
padding: 0;
|
|
14
|
+
text-align: center;
|
|
15
|
+
background-color: black;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#canvas {
|
|
19
|
+
display: block;
|
|
20
|
+
margin: 0;
|
|
21
|
+
color: white;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#canvas:focus {
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.godot {
|
|
29
|
+
font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
|
|
30
|
+
color: #e0e0e0;
|
|
31
|
+
background-color: #3b3943;
|
|
32
|
+
background-image: linear-gradient(to bottom, #403e48, #35333c);
|
|
33
|
+
border: 1px solid #45434e;
|
|
34
|
+
box-shadow: 0 0 1px 1px #2f2d35;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/* Status display
|
|
39
|
+
* ============== */
|
|
40
|
+
|
|
41
|
+
#status {
|
|
42
|
+
position: absolute;
|
|
43
|
+
left: 0;
|
|
44
|
+
top: 0;
|
|
45
|
+
right: 0;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
/* don't consume click events - make children visible explicitly */
|
|
51
|
+
visibility: hidden;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#status-progress {
|
|
55
|
+
width: 366px;
|
|
56
|
+
height: 7px;
|
|
57
|
+
background-color: #38363A;
|
|
58
|
+
border: 1px solid #444246;
|
|
59
|
+
padding: 1px;
|
|
60
|
+
box-shadow: 0 0 2px 1px #1B1C22;
|
|
61
|
+
border-radius: 2px;
|
|
62
|
+
visibility: visible;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media only screen and (orientation:portrait) {
|
|
66
|
+
#status-progress {
|
|
67
|
+
width: 61.8%;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#status-progress-inner {
|
|
72
|
+
height: 100%;
|
|
73
|
+
width: 0;
|
|
74
|
+
box-sizing: border-box;
|
|
75
|
+
transition: width 0.5s linear;
|
|
76
|
+
background-color: #202020;
|
|
77
|
+
border: 1px solid #222223;
|
|
78
|
+
box-shadow: 0 0 1px 1px #27282E;
|
|
79
|
+
border-radius: 3px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#status-indeterminate {
|
|
83
|
+
visibility: visible;
|
|
84
|
+
position: relative;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#status-indeterminate>div {
|
|
88
|
+
width: 4.5px;
|
|
89
|
+
height: 0;
|
|
90
|
+
border-style: solid;
|
|
91
|
+
border-width: 9px 3px 0 3px;
|
|
92
|
+
border-color: #2b2b2b transparent transparent transparent;
|
|
93
|
+
transform-origin: center 21px;
|
|
94
|
+
position: absolute;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#status-indeterminate>div:nth-child(1) {
|
|
98
|
+
transform: rotate(22.5deg);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
#status-indeterminate>div:nth-child(2) {
|
|
102
|
+
transform: rotate(67.5deg);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#status-indeterminate>div:nth-child(3) {
|
|
106
|
+
transform: rotate(112.5deg);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
#status-indeterminate>div:nth-child(4) {
|
|
110
|
+
transform: rotate(157.5deg);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#status-indeterminate>div:nth-child(5) {
|
|
114
|
+
transform: rotate(202.5deg);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#status-indeterminate>div:nth-child(6) {
|
|
118
|
+
transform: rotate(247.5deg);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
#status-indeterminate>div:nth-child(7) {
|
|
122
|
+
transform: rotate(292.5deg);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
#status-indeterminate>div:nth-child(8) {
|
|
126
|
+
transform: rotate(337.5deg);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
#status-notice {
|
|
130
|
+
margin: 0 100px;
|
|
131
|
+
line-height: 1.3;
|
|
132
|
+
visibility: visible;
|
|
133
|
+
padding: 4px 6px;
|
|
134
|
+
visibility: visible;
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
137
|
+
<link id='-gd-engine-icon' rel='icon' type='image/png' href='Gaea.icon.png' />
|
|
138
|
+
<link rel='apple-touch-icon' href='Gaea.apple-touch-icon.png' />
|
|
139
|
+
|
|
140
|
+
</head>
|
|
141
|
+
|
|
142
|
+
<body>
|
|
143
|
+
<canvas id='canvas'>
|
|
144
|
+
HTML5 canvas appears to be unsupported in the current browser.<br />
|
|
145
|
+
Please try updating or use a different browser.
|
|
146
|
+
</canvas>
|
|
147
|
+
<div id='status'>
|
|
148
|
+
<div id='status-progress' style='display: none;' oncontextmenu='event.preventDefault();'>
|
|
149
|
+
<div id='status-progress-inner'></div>
|
|
150
|
+
</div>
|
|
151
|
+
<div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
|
|
152
|
+
<div></div>
|
|
153
|
+
<div></div>
|
|
154
|
+
<div></div>
|
|
155
|
+
<div></div>
|
|
156
|
+
<div></div>
|
|
157
|
+
<div></div>
|
|
158
|
+
<div></div>
|
|
159
|
+
<div></div>
|
|
160
|
+
</div>
|
|
161
|
+
<div id='status-notice' class='godot' style='display: none;'></div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<script type='text/javascript' src='Gaea.js'></script>
|
|
165
|
+
<script type="module">
|
|
166
|
+
import app from './app.js'
|
|
167
|
+
const GODOT_CONFIG = { "args": [], "canvasResizePolicy": 2, "executable": "Gaea", "experimentalVK": false, "fileSizes": { "Gaea.pck": 45472704, "Gaea.wasm": 25295599 }, "focusCanvas": true, "gdnativeLibs": [] };
|
|
168
|
+
console.log("断点");
|
|
169
|
+
var engine = new Engine(GODOT_CONFIG);
|
|
170
|
+
|
|
171
|
+
(function () {
|
|
172
|
+
const INDETERMINATE_STATUS_STEP_MS = 100;
|
|
173
|
+
var statusProgress = document.getElementById('status-progress');
|
|
174
|
+
var statusProgressInner = document.getElementById('status-progress-inner');
|
|
175
|
+
var statusIndeterminate = document.getElementById('status-indeterminate');
|
|
176
|
+
var statusNotice = document.getElementById('status-notice');
|
|
177
|
+
|
|
178
|
+
var initializing = true;
|
|
179
|
+
var statusMode = 'hidden';
|
|
180
|
+
|
|
181
|
+
var animationCallbacks = [];
|
|
182
|
+
function animate(time) {
|
|
183
|
+
animationCallbacks.forEach(callback => callback(time));
|
|
184
|
+
requestAnimationFrame(animate);
|
|
185
|
+
}
|
|
186
|
+
requestAnimationFrame(animate);
|
|
187
|
+
|
|
188
|
+
function setStatusMode(mode) {
|
|
189
|
+
|
|
190
|
+
if (statusMode === mode || !initializing)
|
|
191
|
+
return;
|
|
192
|
+
[statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
|
|
193
|
+
elem.style.display = 'none';
|
|
194
|
+
});
|
|
195
|
+
animationCallbacks = animationCallbacks.filter(function (value) {
|
|
196
|
+
return (value != animateStatusIndeterminate);
|
|
197
|
+
});
|
|
198
|
+
switch (mode) {
|
|
199
|
+
case 'progress':
|
|
200
|
+
statusProgress.style.display = 'block';
|
|
201
|
+
break;
|
|
202
|
+
case 'indeterminate':
|
|
203
|
+
statusIndeterminate.style.display = 'block';
|
|
204
|
+
animationCallbacks.push(animateStatusIndeterminate);
|
|
205
|
+
break;
|
|
206
|
+
case 'notice':
|
|
207
|
+
statusNotice.style.display = 'block';
|
|
208
|
+
break;
|
|
209
|
+
case 'hidden':
|
|
210
|
+
break;
|
|
211
|
+
default:
|
|
212
|
+
throw new Error('Invalid status mode');
|
|
213
|
+
}
|
|
214
|
+
statusMode = mode;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function animateStatusIndeterminate(ms) {
|
|
218
|
+
var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
|
|
219
|
+
if (statusIndeterminate.children[i].style.borderTopColor == '') {
|
|
220
|
+
Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
|
|
221
|
+
child.style.borderTopColor = '';
|
|
222
|
+
});
|
|
223
|
+
statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function setStatusNotice(text) {
|
|
228
|
+
while (statusNotice.lastChild) {
|
|
229
|
+
statusNotice.removeChild(statusNotice.lastChild);
|
|
230
|
+
}
|
|
231
|
+
var lines = text.split('\n');
|
|
232
|
+
lines.forEach((line) => {
|
|
233
|
+
statusNotice.appendChild(document.createTextNode(line));
|
|
234
|
+
statusNotice.appendChild(document.createElement('br'));
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
function displayFailureNotice(err) {
|
|
239
|
+
var msg = err.message || err;
|
|
240
|
+
console.error(msg);
|
|
241
|
+
setStatusNotice(msg);
|
|
242
|
+
setStatusMode('notice');
|
|
243
|
+
initializing = false;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
if (!Engine.isWebGLAvailable()) {
|
|
247
|
+
displayFailureNotice('WebGL not available');
|
|
248
|
+
} else {
|
|
249
|
+
setStatusMode('indeterminate');
|
|
250
|
+
engine.startGame({
|
|
251
|
+
'onProgress': function (current, total) {
|
|
252
|
+
if (total > 0) {
|
|
253
|
+
statusProgressInner.style.width = current / total * 100 + '%';
|
|
254
|
+
setStatusMode('progress');
|
|
255
|
+
if (current === total) {
|
|
256
|
+
// wait for progress bar animation
|
|
257
|
+
setTimeout(() => {
|
|
258
|
+
setStatusMode('indeterminate');
|
|
259
|
+
}, 500);
|
|
260
|
+
}
|
|
261
|
+
} else {
|
|
262
|
+
setStatusMode('indeterminate');
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
}).then(() => {
|
|
266
|
+
setStatusMode('hidden');
|
|
267
|
+
initializing = false;
|
|
268
|
+
app.init()
|
|
269
|
+
}, displayFailureNotice);
|
|
270
|
+
}
|
|
271
|
+
})();
|
|
272
|
+
//]]></script>
|
|
273
|
+
</body>
|
|
274
|
+
|
|
275
|
+
</html>
|