fix starting animates

remove animates and bgms
This commit is contained in:
bdf1 2022-11-04 04:17:58 +13:00
parent 2ce883886c
commit f8308d9b7f
5 changed files with 380 additions and 312 deletions

4
.gitignore vendored
View File

@ -1 +1,5 @@
_saves/ _saves/
project/bgms/
project/animates/
_docs/
常用工具/

View File

@ -1 +1 @@
{"viewportLoc":[0,0],"editorLastFloorId":"MT1"} {"viewportLoc":[0,0],"editorLastFloorId":"QISHI"}

View File

@ -668,7 +668,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"startVerticalBackground": "project/images/bg.jpg", "startVerticalBackground": "project/images/bg.jpg",
"startLogoStyle": "display:none", "startLogoStyle": "display:none",
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;", "startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;",
"statusLeftBackground": "url(project/images/heng.png) 0 0/100% 100% no-repeat", "statusLeftBackground": "url(project/images/black.png) 0 0/100% 100% no-repeat",
"statusTopBackground": "url(project/images/shu.png) 0 0/100% 100% no-repeat", "statusTopBackground": "url(project/images/shu.png) 0 0/100% 100% no-repeat",
"toolsBackground": "url(project/images/dibu.png) 0 0/100% 100% no-repeat", "toolsBackground": "url(project/images/dibu.png) 0 0/100% 100% no-repeat",
"floorChangingStyle": "background-color: black; color: white", "floorChangingStyle": "background-color: black; color: white",
@ -734,7 +734,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"x": -1, "x": -1,
"y": 0 "y": 0
}, },
"flags": {}, "flags": {
"hideStatusBar": true
},
"followers": [], "followers": [],
"steps": 0 "steps": 0
}, },

View File

@ -1594,9 +1594,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
.sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/); .sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/);
}, },
"drawStatusBar": function () { "drawStatusBar": function () {
core.dom.caidan1Ctx.drawImage(core.material.images.images['caidan.png'],0,0) if (!core.status.floorId) return;
if (core.status.floorId == 'nandu') core.clearMap('caidan'); if (core.status.floorId == 'nandu') core.clearMap('caidan');
else core.drawImage('caidan','caidan.png',-161,0); else core.drawImage('caidan','caidan.png',-161,0);
core.dom.caidan1Ctx.drawImage(core.material.images.images['caidan.png'],0,0)
var ctx, fill = function (text, x, y, style) { var ctx, fill = function (text, x, y, style) {
core.ui.setFont(ctx, /*(/\w+/.test(text) ? 'italic ' : '') + */'18px fzchyjw'); core.ui.setFont(ctx, /*(/\w+/.test(text) ? 'italic ' : '') + */'18px fzchyjw');
core.ui.fillText(ctx, text, x, y, style); core.ui.fillText(ctx, text, x, y, style);

View File

@ -4,9 +4,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this._afterLoadResources = function () { this._afterLoadResources = function () {
// 本函数将在所有资源加载完毕后,游戏开启前被执行 // 本函数将在所有资源加载完毕后,游戏开启前被执行
} }
core.control.hideStatusBar();
core.control.resize = function () { core.control.resize = function () {
if (main.mode == 'editor') return; if (main.mode == 'editor') return;
var clientWidth = main.dom.body.clientWidth, clientHeight = main.dom.body.clientHeight; var clientWidth = main.dom.body.clientWidth,
clientHeight = main.dom.body.clientHeight;
var BORDER = 0; var BORDER = 0;
var extendToolbar = core.flags.extendToolbar; var extendToolbar = core.flags.extendToolbar;
var BAR_WIDTH = extendToolbar ? 0 : Math.round(core._PY_ / 3); var BAR_WIDTH = extendToolbar ? 0 : Math.round(core._PY_ / 3);
@ -26,8 +28,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) { if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) {
core.domStyle.scale = Math.min(1, horizontalMaxRatio); core.domStyle.scale = Math.min(1, horizontalMaxRatio);
} }
} } else {
else {
// 竖屏 // 竖屏
core.domStyle.isVertical = true; core.domStyle.isVertical = true;
core.domStyle.scale = Math.min((clientWidth - 2 * BORDER) / core._PX_); core.domStyle.scale = Math.min((clientWidth - 2 * BORDER) / core._PX_);
@ -36,8 +37,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
BAR_WIDTH = Math.round(core._PX_ * 0.3); BAR_WIDTH = Math.round(core._PX_ * 0.3);
} }
var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length; var statusDisplayArr = this._shouldDisplayStatus(),
var statusCanvas = core.flags.statusCanvas, statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3; count = statusDisplayArr.length;
var statusCanvas = core.flags.statusCanvas,
statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3;
var col = statusCanvas ? statusCanvasRows : Math.ceil(count / 3); var col = statusCanvas ? statusCanvasRows : Math.ceil(count / 3);
if (col > 5) { if (col > 5) {
if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过5"); if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过5");
@ -77,8 +80,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
statusBar.style.height = obj.statusBarHeightInVertical + "px"; statusBar.style.height = obj.statusBarHeightInVertical + "px";
statusBar.style.background = obj.globalAttribute.statusTopBackground; statusBar.style.background = obj.globalAttribute.statusTopBackground;
statusBar.style.fontSize = 16 * core.domStyle.scale + "px"; statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
} } else {
else {
statusBar.style.width = (obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER) + "px"; statusBar.style.width = (obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER) + "px";
statusBar.style.height = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px"; statusBar.style.height = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
statusBar.style.background = obj.globalAttribute.statusLeftBackground; statusBar.style.background = obj.globalAttribute.statusLeftBackground;
@ -98,8 +100,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.dom.statusCanvas.style.width = core._PX_ * core.domStyle.scale + "px"; core.dom.statusCanvas.style.width = core._PX_ * core.domStyle.scale + "px";
core.dom.statusCanvas.style.height = obj.statusBarHeightInVertical - 3 + "px"; core.dom.statusCanvas.style.height = obj.statusBarHeightInVertical - 3 + "px";
core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, core._PX_, obj.col * 32 + 9); core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, core._PX_, obj.col * 32 + 9);
} } else {
else {
core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px"; core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
core.dom.statusCanvas.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px"; core.dom.statusCanvas.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0)); core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0));
@ -108,8 +109,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.dom.caidan1.style.width = core._PX_ * core.domStyle.scale + "px"; core.dom.caidan1.style.width = core._PX_ * core.domStyle.scale + "px";
core.dom.caidan1.style.height = obj.statusBarHeightInVertical - 3 + "px"; core.dom.caidan1.style.height = obj.statusBarHeightInVertical - 3 + "px";
core.maps._setHDCanvasSize(core.dom.caidan1Ctx, core._PX_, obj.col * 32 + 9); core.maps._setHDCanvasSize(core.dom.caidan1Ctx, core._PX_, obj.col * 32 + 9);
} } else {
else {
core.dom.caidan1.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px"; core.dom.caidan1.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
core.dom.caidan1.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px"; core.dom.caidan1.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
core.maps._setHDCanvasSize(core.dom.caidan1Ctx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0)); core.maps._setHDCanvasSize(core.dom.caidan1Ctx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0));
@ -129,8 +129,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (core.domStyle.isVertical) { if (core.domStyle.isVertical) {
totalWidth = obj.outerWidth; totalWidth = obj.outerWidth;
totalHeight = obj.outerHeight + obj.statusBarHeightInVertical + obj.toolbarHeightInVertical totalHeight = obj.outerHeight + obj.statusBarHeightInVertical + obj.toolbarHeightInVertical
} } else {
else {
totalWidth = obj.outerWidth + obj.BAR_WIDTH * core.domStyle.scale + (obj.extendToolbar ? 0 : obj.BORDER); totalWidth = obj.outerWidth + obj.BAR_WIDTH * core.domStyle.scale + (obj.extendToolbar ? 0 : obj.BORDER);
totalHeight = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0); totalHeight = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0);
} }
@ -153,8 +152,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// musicBtn // musicBtn
if (core.domStyle.isVertical || core.domStyle.scale < 1) { if (core.domStyle.isVertical || core.domStyle.scale < 1) {
core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px"; core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px";
} } else {
else {
core.dom.musicBtn.style.right = (obj.clientWidth - totalWidth) / 2 + "px"; core.dom.musicBtn.style.right = (obj.clientWidth - totalWidth) / 2 + "px";
core.dom.musicBtn.style.bottom = (obj.clientHeight - totalHeight) / 2 - 27 + "px"; core.dom.musicBtn.style.bottom = (obj.clientHeight - totalHeight) / 2 - 27 + "px";
} }
@ -192,8 +190,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.drawFg(floorId, config); this.drawFg(floorId, config);
if (floorId == "nandu") { if (floorId == "nandu") {
core.maps._drawFloorImages(floorId, core.dom.wholeCtx, 'whole', null, null, (config || {}).onMap); core.maps._drawFloorImages(floorId, core.dom.wholeCtx, 'whole', null, null, (config || {}).onMap);
} } else core.dom.wholeCtx.clearRect(0, 0, core.dom.whole.width, core.dom.whole.height);
else core.dom.wholeCtx.clearRect(0, 0, core.dom.whole.width, core.dom.whole.height);
} }
core.control._animationFrame_globalAnimate = function (timestamp) { core.control._animationFrame_globalAnimate = function (timestamp) {
if (timestamp - core.animateFrame.globalTime <= core.values.animateSpeed) return; if (timestamp - core.animateFrame.globalTime <= core.values.animateSpeed) return;
@ -275,13 +272,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return; return;
} }
sloc = sloc || []; sloc = sloc || [];
var sx = core.calValue(sloc[0]) || 0, sy = core.calValue(sloc[1]) || 0; var sx = core.calValue(sloc[0]) || 0,
var sw = core.calValue(sloc[2]), sh = core.calValue(sloc[3]); sy = core.calValue(sloc[1]) || 0;
var sw = core.calValue(sloc[2]),
sh = core.calValue(sloc[3]);
if (sw == null) sw = image.width; if (sw == null) sw = image.width;
if (sh == null) sh = image.height; if (sh == null) sh = image.height;
loc = loc || []; loc = loc || [];
var x = core.calValue(loc[0]) || 0, y = core.calValue(loc[1]) || 0; var x = core.calValue(loc[0]) || 0,
var w = core.calValue(loc[2]), h = core.calValue(loc[3]); y = core.calValue(loc[1]) || 0;
var w = core.calValue(loc[2]),
h = core.calValue(loc[3]);
if (w == null) w = sw; if (w == null) w = sw;
if (h == null) h = sh; if (h == null) h = sh;
var zIndex = code + 100; var zIndex = code + 100;
@ -307,7 +308,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.status.event.id = 'centerFly'; core.status.event.id = 'centerFly';
var fillstyle = 'rgba(255,0,0,0.5)'; var fillstyle = 'rgba(255,0,0,0.5)';
if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)'; if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
var toX = core.bigmap.width - 1 - core.getHeroLoc('x'), toY = core.bigmap.height - 3 - core.getHeroLoc('y'); var toX = core.bigmap.width - 1 - core.getHeroLoc('x'),
toY = core.bigmap.height - 3 - core.getHeroLoc('y');
this.clearUI(); this.clearUI();
core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000'); core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
core.drawThumbnail(null, null, { heroLoc: core.status.hero.loc, heroIcon: core.status.hero.image, ctx: 'ui', centerX: toX, centerY: toY }); core.drawThumbnail(null, null, { heroLoc: core.status.hero.loc, heroIcon: core.status.hero.image, ctx: 'ui', centerX: toX, centerY: toY });
@ -319,7 +321,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.drawTip("请确认当前" + core.material.items['centerFly'].name + "的位置", 'centerFly'); core.drawTip("请确认当前" + core.material.items['centerFly'].name + "的位置", 'centerFly');
return; return;
} }
}, },
"drawLight": function () { "drawLight": function () {
// 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...) // 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...)
@ -2180,5 +2182,64 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.events._changeFloor_afterChange(info, callback); core.events._changeFloor_afterChange(info, callback);
});*/ });*/
} }
},
"标题动画": function () {
var start = document.getElementById('startPanel');
var list = [];
var id = 0;
// 标题
var title = document.getElementById('startTitle');
core.registerResize('startTitle', function () {
title.style.width = 300 * core.domStyle.scale + 'px';
title.style.height = 187 * core.domStyle.scale + 'px';
});
// 星星动画使用sprite化方法
function draw() {
if (start.style.display === 'none') return;
// 每帧有10%的概率出
if (Math.random() < 0.1) {
var config = {
x: Math.random() * 450 * core.domStyle.scale,
y: -187 * core.domStyle.scale,
id: id++
};
if (id > 100) id -= 100;
list.push(config);
// 追加新的ele
var img = document.createElement('img');
img.src = './project/images/Title_starlong.png';
img.style.position = 'absolute';
img.style.zIndex = '280';
img.style.left = config.x + 'px';
img.style.top = '0px';
img.style.transform = 'scale(' + core.domStyle.scale * 100 + '%)'
img.id = id + '_star';
list[list.length - 1].ele = img;
start.appendChild(img);
}
update();
}
// 每帧更新动画
function update() {
for (var i = 0; i < list.length; i++) {
// 一定要匀速运动
var one = list[i];
if (one.x < -154 * core.domStyle.scale) {
list.splice(i, 1);
i--;
one.ele.remove();
continue;
}
one.x -= 3 * core.domStyle.scale;
one.y += 3 * core.domStyle.scale;
one.ele.style.top = one.y + 'px';
one.ele.style.left = one.x + 'px';
}
}
core.registerAnimationFrame('startAnimation', false, draw);
} }
} }