高层塔优化
This commit is contained in:
parent
fba7f31309
commit
c70a466091
@ -305,6 +305,22 @@ loader.prototype.loadImagesFromZip = function (url, names, toSave, onprogress, o
|
|||||||
loader.prototype._loadAnimates_sync = function () {
|
loader.prototype._loadAnimates_sync = function () {
|
||||||
this._setStartLoadTipText("正在加载动画文件...");
|
this._setStartLoadTipText("正在加载动画文件...");
|
||||||
|
|
||||||
|
if (main.supportBunch) {
|
||||||
|
if (core.animates.length > 0) {
|
||||||
|
core.http('GET', '__all_animates__?v=' + main.version + '&id=' + core.animates.join(','), null, function (content) {
|
||||||
|
var u = content.split('@@@~~~###~~~@@@');
|
||||||
|
for (var i = 0; i < core.animates.length; ++i) {
|
||||||
|
if (u[i] != '') {
|
||||||
|
core.material.animates[core.animates[i]] = core.loader._loadAnimate(u[i]);
|
||||||
|
} else {
|
||||||
|
console.error('无法找到动画文件' + core.animates[i] + '!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "text/plain; charset=x-user-defined");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
core.animates.forEach(function (t) {
|
core.animates.forEach(function (t) {
|
||||||
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) {
|
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) {
|
||||||
core.material.animates[t] = core.loader._loadAnimate(content);
|
core.material.animates[t] = core.loader._loadAnimate(content);
|
||||||
|
|||||||
14
main.js
14
main.js
@ -290,8 +290,19 @@ main.prototype.loadFloors = function (callback) {
|
|||||||
main.dom.mainTips.style.display = 'none';
|
main.dom.mainTips.style.display = 'none';
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
// 高层塔优化
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.src = '__all_floors__.js?v=' + this.version + '&id=' + main.floorIds.join(',');
|
||||||
|
script.onload = function () {
|
||||||
|
main.dom.mainTips.style.display = 'none';
|
||||||
|
main.supportBunch = true;
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
script.onerror = script.onabort = script.ontimeout = function (e) {
|
||||||
|
console.clear();
|
||||||
for (var i = 0; i < main.floorIds.length; i++) {
|
for (var i = 0; i < main.floorIds.length; i++) {
|
||||||
main.loadFloor(main.floorIds[i], function (modName) {
|
main.loadFloor(main.floorIds[i], function (modName) {
|
||||||
main.setMainTipsText("楼层 " + modName + '.js 加载完毕');
|
main.setMainTipsText("楼层 " + modName + '.js 加载完毕');
|
||||||
@ -302,6 +313,7 @@ main.prototype.loadFloors = function (callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
main.dom.body.appendChild(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 加载某一个楼层 //////
|
////// 加载某一个楼层 //////
|
||||||
|
|||||||
22
server.py
22
server.py
@ -60,6 +60,28 @@ def get_file(path):
|
|||||||
def root():
|
def root():
|
||||||
return static_file('index.html')
|
return static_file('index.html')
|
||||||
|
|
||||||
|
@app.route('/__all_floors__.js', methods=['GET'])
|
||||||
|
def all_floors():
|
||||||
|
ids = request.args.get('id', '').split(',')
|
||||||
|
if len(ids) == 0:
|
||||||
|
abort(404)
|
||||||
|
return None
|
||||||
|
return Response('\n'.join([get_file('project/floors/%s.js' % id) for id in ids]), mimetype = 'text/javascript')
|
||||||
|
|
||||||
|
@app.route('/__all_animates__', methods=['GET'])
|
||||||
|
def all_animates():
|
||||||
|
ids = request.args.get('id', '').split(',')
|
||||||
|
if len(ids) == 0:
|
||||||
|
abort(404)
|
||||||
|
return None
|
||||||
|
content = []
|
||||||
|
for id in ids:
|
||||||
|
animate = 'project/animates/%s.animate' % id
|
||||||
|
if os.path.exists(animate):
|
||||||
|
content.append(get_file(animate))
|
||||||
|
else: content.append('')
|
||||||
|
return '@@@~~~###~~~@@@'.join(content)
|
||||||
|
|
||||||
@app.route('/<path:path>', methods=['GET'])
|
@app.route('/<path:path>', methods=['GET'])
|
||||||
def static_file(path):
|
def static_file(path):
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user