setInterval time & load statusBar
This commit is contained in:
parent
7671a92586
commit
ccb89e422f
@ -354,9 +354,6 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
|
||||
// 清除游戏数据
|
||||
core.clearStatus();
|
||||
|
||||
// 显示状态栏
|
||||
core.control.triggerStatusBar("show");
|
||||
|
||||
// 初始化status
|
||||
core.status = core.clone(core.initStatus);
|
||||
// 初始化maps
|
||||
@ -398,6 +395,7 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
|
||||
|
||||
core.events.initGame();
|
||||
this.updateGlobalAttribute(Object.keys(core.status.globalAttribute));
|
||||
this.triggerStatusBar(core.getFlag('hideStatusBar', false)?'hide':'show');
|
||||
core.status.played = true;
|
||||
}
|
||||
|
||||
@ -1556,15 +1554,15 @@ control.prototype.setFg = function(color, time, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
var step=0;
|
||||
// core.status.replay.animate=true;
|
||||
var per_time = 10, step=0, steps = parseInt(time / per_time);
|
||||
|
||||
var changeAnimate = setInterval(function() {
|
||||
step++;
|
||||
|
||||
var nowA = fromColor[3]+(color[3]-fromColor[3])*step/25;
|
||||
var nowR = parseInt(fromColor[0]+(color[0]-fromColor[0])*step/25);
|
||||
var nowG = parseInt(fromColor[1]+(color[1]-fromColor[1])*step/25);
|
||||
var nowB = parseInt(fromColor[2]+(color[2]-fromColor[2])*step/25);
|
||||
var nowA = fromColor[3]+(color[3]-fromColor[3])*step/steps;
|
||||
var nowR = parseInt(fromColor[0]+(color[0]-fromColor[0])*step/steps);
|
||||
var nowG = parseInt(fromColor[1]+(color[1]-fromColor[1])*step/steps);
|
||||
var nowB = parseInt(fromColor[2]+(color[2]-fromColor[2])*step/steps);
|
||||
core.clearMap('curtain');
|
||||
core.fillRect('curtain', 0, 0, 416, 416, core.arrayToRGBA([nowR,nowG,nowB,nowA]));
|
||||
|
||||
@ -1575,7 +1573,7 @@ control.prototype.setFg = function(color, time, callback) {
|
||||
// core.status.replay.animate=false;
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
}, time/25/core.status.replay.speed);
|
||||
}, per_time);
|
||||
|
||||
core.animateFrame.asyncId[changeAnimate] = true;
|
||||
}
|
||||
@ -2832,6 +2830,7 @@ control.prototype.triggerStatusBar = function (name) {
|
||||
var statusItems = core.dom.status;
|
||||
var toolItems = core.dom.tools;
|
||||
core.domStyle.showStatusBar = name == 'show';
|
||||
core.setFlag('hideStatusBar', core.domStyle.showStatusBar?null:true);
|
||||
if (!core.domStyle.showStatusBar) {
|
||||
for (var i = 0; i < statusItems.length; ++i)
|
||||
statusItems[i].style.opacity = 0;
|
||||
|
||||
@ -1575,10 +1575,11 @@ events.prototype.animateImage = function (type, image, loc, time, keep, callback
|
||||
core.canvas.data.drawImage(image, x, y);
|
||||
core.setAlpha('data', 1);
|
||||
|
||||
// core.status.replay.animate=true;
|
||||
var per_time = 10, steps = parseInt(time / per_time), delta = 1 / steps;
|
||||
|
||||
var animate = setInterval(function () {
|
||||
if (type=='show') alpha += 0.1;
|
||||
else alpha -= 0.1;
|
||||
if (type=='show') alpha += delta;
|
||||
else alpha -= delta;
|
||||
core.clearMap('data', x, y, image.width, image.height);
|
||||
if (alpha >=1 || alpha<=0) {
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
@ -1593,7 +1594,7 @@ events.prototype.animateImage = function (type, image, loc, time, keep, callback
|
||||
core.canvas.data.drawImage(image, x, y);
|
||||
core.setAlpha('data', 1);
|
||||
}
|
||||
}, time / 10);
|
||||
}, per_time);
|
||||
|
||||
core.animateFrame.asyncId[animate] = true;
|
||||
}
|
||||
@ -1653,21 +1654,20 @@ events.prototype.setVolume = function (value, time, callback) {
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
}
|
||||
// core.status.replay.animate=true;
|
||||
|
||||
var currVolume = core.musicStatus.volume;
|
||||
var step = 0;
|
||||
var per_time = 10, step = 0, steps = parseInt(time / per_time);
|
||||
var fade = setInterval(function () {
|
||||
step++;
|
||||
var nowVolume = currVolume+(value-currVolume)*step/32;
|
||||
var nowVolume = currVolume+(value-currVolume)*step/steps;
|
||||
set(nowVolume);
|
||||
if (step>=32) {
|
||||
if (step>=steps) {
|
||||
delete core.animateFrame.asyncId[fade];
|
||||
clearInterval(fade);
|
||||
// core.status.replay.animate=false;
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
}
|
||||
}, time / 32);
|
||||
}, per_time);
|
||||
|
||||
core.animateFrame.asyncId[fade] = true;
|
||||
}
|
||||
|
||||
@ -1091,9 +1091,10 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
|
||||
core.setAlpha('route', alpha);
|
||||
draw();
|
||||
|
||||
var animate = window.setInterval(function () {
|
||||
if (type=='show') alpha += 0.1;
|
||||
else alpha -= 0.1;
|
||||
var per_time = 10, steps = parseInt(time / per_time), delta = 1 / steps;
|
||||
var animate = setInterval(function () {
|
||||
if (type=='show') alpha += delta;
|
||||
else alpha -= delta;
|
||||
clear();
|
||||
if (alpha >=1 || alpha<=0) {
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
@ -1115,7 +1116,7 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
|
||||
core.setAlpha('route', alpha);
|
||||
draw();
|
||||
}
|
||||
}, time / 10 / core.status.replay.speed);
|
||||
}, per_time);
|
||||
|
||||
core.animateFrame.asyncId[animate] = true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user