Update actions.js
This commit is contained in:
parent
cfecb91bbe
commit
5087d4a4e5
@ -823,12 +823,13 @@ actions.prototype._selectChoices = function (length, keycode, callback) {
|
||||
if (keycode == 13 || keycode == 32 || keycode == 67) {
|
||||
callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
|
||||
}
|
||||
//左右方向键音量
|
||||
if(core.status.event.id == "switchs" && core.status.event.selection == 2)
|
||||
//左右方向键调整 音量 行走速度
|
||||
if(core.status.event.id == "switchs" && (core.status.event.selection == 2 || core.status.event.selection == 3))
|
||||
{
|
||||
if (keycode == 37) callback.apply(this, [this.HSIZE - 2, topIndex + core.status.event.selection]);
|
||||
if (keycode == 39) callback.apply(this, [this.HSIZE + 2, topIndex + core.status.event.selection]);
|
||||
}
|
||||
|
||||
if (keycode >= 49 && keycode <= 57) {
|
||||
var index = keycode - 49;
|
||||
if (index < length) {
|
||||
@ -1916,7 +1917,7 @@ actions.prototype._keyUpSL = function (keycode) {
|
||||
|
||||
////// 系统设置界面时的点击操作 //////
|
||||
actions.prototype._clickSwitchs = function (x, y) {
|
||||
if ((x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) && (x != 4 && y != 4) && (x != 8 && y != 4)) return;
|
||||
if ((x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) && (x != 4 && y != 4) && (x != 8 && y != 4) && (x != 4 && y != 5) && (x != 8 && y != 5)) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
@ -1928,11 +1929,13 @@ actions.prototype._clickSwitchs = function (x, y) {
|
||||
case 1:
|
||||
return this._clickSwitchs_sound();
|
||||
case 2:
|
||||
if (x == 4) return this._clickSwitchs_userVolume_down();
|
||||
else if (x == 8) return this._clickSwitchs_userVolume_up();
|
||||
return;
|
||||
if (x == 4) { return this._clickSwitchs_userVolume_down(); }
|
||||
else if (x == 8) { return this._clickSwitchs_userVolume_up(); }
|
||||
return;
|
||||
case 3:
|
||||
return this._clickSwitchs_moveSpeed();
|
||||
if (x == 4) { return this._clickSwitchs_moveSpeed_down(); }
|
||||
else if (x == 8) { return this._clickSwitchs_moveSpeed_up(); }
|
||||
return;
|
||||
case 4:
|
||||
return this._clickSwitchs_displayEnemyDamage();
|
||||
case 5:
|
||||
@ -1963,8 +1966,9 @@ actions.prototype._clickSwitchs_sound = function () {
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_userVolume_down = function () {
|
||||
//浮点运算精度
|
||||
core.musicStatus.userVolume = core.clamp(parseFloat(core.musicStatus.userVolume - 0.1).toFixed(1), 0, 1);
|
||||
//浮点运算精度 JS弱类型
|
||||
var value = Math.pow(core.clamp(parseFloat(Math.sqrt(Number(core.musicStatus.userVolume)).toFixed(1)) - 0.1, 0, 1), 2).toFixed(2);
|
||||
core.musicStatus.userVolume = parseFloat(value);
|
||||
//audioContext 音效 不受designVolume 影响
|
||||
if(core.musicStatus.gainNode != null) core.musicStatus.gainNode.gain.value = core.musicStatus.userVolume;
|
||||
if (core.musicStatus.playingBgm) core.material.bgms[core.musicStatus.playingBgm].volume = core.musicStatus.userVolume * core.musicStatus.designVolume;
|
||||
@ -1972,21 +1976,25 @@ actions.prototype._clickSwitchs_userVolume_down = function () {
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
actions.prototype._clickSwitchs_userVolume_up = function () {
|
||||
core.musicStatus.userVolume = core.clamp(parseFloat(core.musicStatus.userVolume + 0.1).toFixed(1), 0, 1);
|
||||
var value = Math.pow(core.clamp(parseFloat(Math.sqrt(Number(core.musicStatus.userVolume)).toFixed(1)) + 0.1, 0, 1), 2).toFixed(2);
|
||||
core.musicStatus.userVolume = parseFloat(value);
|
||||
if(core.musicStatus.gainNode != null) core.musicStatus.gainNode.gain.value = core.musicStatus.userVolume;
|
||||
if (core.musicStatus.playingBgm) core.material.bgms[core.musicStatus.playingBgm].volume = core.musicStatus.userVolume * core.musicStatus.designVolume;
|
||||
core.setLocalStorage('userVolume', core.musicStatus.userVolume);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_moveSpeed = function () {
|
||||
core.myprompt("请输入行走速度(每走一步的时间,单位毫秒,默认100)", core.values.moveSpeed, function (value) {
|
||||
value = parseInt(value) || core.values.moveSpeed;
|
||||
value = core.clamp(value, 10, 500);
|
||||
core.values.moveSpeed = value;
|
||||
core.setLocalStorage("moveSpeed", value);
|
||||
core.ui.drawSwitchs();
|
||||
});
|
||||
actions.prototype._clickSwitchs_moveSpeed_down = function () {
|
||||
var value = core.clamp(parseInt(core.values.moveSpeed + 10), 60, 200);
|
||||
core.values.moveSpeed = parseInt(value);
|
||||
core.setLocalStorage("moveSpeed", core.values.moveSpeed);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
actions.prototype._clickSwitchs_moveSpeed_up = function () {
|
||||
var value = core.clamp(parseInt(core.values.moveSpeed - 10), 60, 200);
|
||||
core.values.moveSpeed = parseInt(value);
|
||||
core.setLocalStorage("moveSpeed", core.values.moveSpeed);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user