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) {
|
if (keycode == 13 || keycode == 32 || keycode == 67) {
|
||||||
callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
|
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 == 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 == 39) callback.apply(this, [this.HSIZE + 2, topIndex + core.status.event.selection]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keycode >= 49 && keycode <= 57) {
|
if (keycode >= 49 && keycode <= 57) {
|
||||||
var index = keycode - 49;
|
var index = keycode - 49;
|
||||||
if (index < length) {
|
if (index < length) {
|
||||||
@ -1916,7 +1917,7 @@ actions.prototype._keyUpSL = function (keycode) {
|
|||||||
|
|
||||||
////// 系统设置界面时的点击操作 //////
|
////// 系统设置界面时的点击操作 //////
|
||||||
actions.prototype._clickSwitchs = function (x, y) {
|
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 choices = core.status.event.ui.choices;
|
||||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||||
if (y >= topIndex && y < topIndex + choices.length) {
|
if (y >= topIndex && y < topIndex + choices.length) {
|
||||||
@ -1928,11 +1929,13 @@ actions.prototype._clickSwitchs = function (x, y) {
|
|||||||
case 1:
|
case 1:
|
||||||
return this._clickSwitchs_sound();
|
return this._clickSwitchs_sound();
|
||||||
case 2:
|
case 2:
|
||||||
if (x == 4) return this._clickSwitchs_userVolume_down();
|
if (x == 4) { return this._clickSwitchs_userVolume_down(); }
|
||||||
else if (x == 8) return this._clickSwitchs_userVolume_up();
|
else if (x == 8) { return this._clickSwitchs_userVolume_up(); }
|
||||||
return;
|
return;
|
||||||
case 3:
|
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:
|
case 4:
|
||||||
return this._clickSwitchs_displayEnemyDamage();
|
return this._clickSwitchs_displayEnemyDamage();
|
||||||
case 5:
|
case 5:
|
||||||
@ -1963,8 +1966,9 @@ actions.prototype._clickSwitchs_sound = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actions.prototype._clickSwitchs_userVolume_down = function () {
|
actions.prototype._clickSwitchs_userVolume_down = function () {
|
||||||
//浮点运算精度
|
//浮点运算精度 JS弱类型
|
||||||
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);
|
||||||
//audioContext 音效 不受designVolume 影响
|
//audioContext 音效 不受designVolume 影响
|
||||||
if(core.musicStatus.gainNode != null) core.musicStatus.gainNode.gain.value = core.musicStatus.userVolume;
|
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;
|
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();
|
core.ui.drawSwitchs();
|
||||||
}
|
}
|
||||||
actions.prototype._clickSwitchs_userVolume_up = function () {
|
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.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;
|
if (core.musicStatus.playingBgm) core.material.bgms[core.musicStatus.playingBgm].volume = core.musicStatus.userVolume * core.musicStatus.designVolume;
|
||||||
core.setLocalStorage('userVolume', core.musicStatus.userVolume);
|
core.setLocalStorage('userVolume', core.musicStatus.userVolume);
|
||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
}
|
}
|
||||||
|
|
||||||
actions.prototype._clickSwitchs_moveSpeed = function () {
|
actions.prototype._clickSwitchs_moveSpeed_down = function () {
|
||||||
core.myprompt("请输入行走速度(每走一步的时间,单位毫秒,默认100)", core.values.moveSpeed, function (value) {
|
var value = core.clamp(parseInt(core.values.moveSpeed + 10), 60, 200);
|
||||||
value = parseInt(value) || core.values.moveSpeed;
|
core.values.moveSpeed = parseInt(value);
|
||||||
value = core.clamp(value, 10, 500);
|
core.setLocalStorage("moveSpeed", core.values.moveSpeed);
|
||||||
core.values.moveSpeed = value;
|
core.ui.drawSwitchs();
|
||||||
core.setLocalStorage("moveSpeed", value);
|
}
|
||||||
|
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();
|
core.ui.drawSwitchs();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
|
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user