userVolume
This commit is contained in:
parent
0b866842dd
commit
8d70616d99
@ -1920,7 +1920,10 @@ actions.prototype._clickSwitchs = function (x, y) {
|
||||
var choices = core.status.event.ui.choices;
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
var selection = y - topIndex;
|
||||
if ((x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) && (x != this.HSIZE-2 && selection != 2) && (x != this.HSIZE+2 && selection != 2) && (x != this.HSIZE-2 && selection != 3) && (x != this.HSIZE+2 && selection != 3)) return;
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) {
|
||||
if (selection != 2 && selection != 3) return;
|
||||
if (x != this.HSIZE - 2 && x != this.HSIZE + 2) return;
|
||||
}
|
||||
if (selection >= 0 && selection < choices.length) {
|
||||
core.status.event.selection = selection;
|
||||
switch (selection) {
|
||||
@ -1929,12 +1932,12 @@ actions.prototype._clickSwitchs = function (x, y) {
|
||||
case 1:
|
||||
return this._clickSwitchs_sound();
|
||||
case 2:
|
||||
if (x == this.HSIZE-2) { return this._clickSwitchs_userVolume(-0.1); }
|
||||
else if (x == this.HSIZE+2) { return this._clickSwitchs_userVolume(0.1); }
|
||||
if (x == this.HSIZE - 2) return this._clickSwitchs_userVolume(-1);
|
||||
if (x == this.HSIZE + 2) return this._clickSwitchs_userVolume(1);
|
||||
return;
|
||||
case 3:
|
||||
if (x == this.HSIZE-2) { return this._clickSwitchs_moveSpeed(-10); }
|
||||
else if (x == this.HSIZE+2) { return this._clickSwitchs_moveSpeed(10); }
|
||||
if (x == this.HSIZE - 2) return this._clickSwitchs_moveSpeed(-10);
|
||||
if (x == this.HSIZE + 2) return this._clickSwitchs_moveSpeed(10);
|
||||
return;
|
||||
case 4:
|
||||
return this._clickSwitchs_displayEnemyDamage();
|
||||
@ -1966,24 +1969,21 @@ actions.prototype._clickSwitchs_sound = function () {
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_userVolume = function (delta) {
|
||||
//浮点运算精度 JS弱类型
|
||||
var value= parseFloat(Math.sqrt(core.musicStatus.userVolume).toFixed(1));
|
||||
core.musicStatus.userVolume = parseFloat(Math.pow(core.clamp(parseFloat(value + delta), 0, 1), 2).toFixed(2));
|
||||
var value = Math.round(Math.sqrt(100 * core.musicStatus.userVolume));
|
||||
core.musicStatus.userVolume = core.clamp(Math.pow(value + delta, 2) / 100, 0, 1);
|
||||
//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;
|
||||
core.setLocalStorage('userVolume', core.musicStatus.userVolume);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
actions.prototype._clickSwitchs_moveSpeed = function (delta) {
|
||||
var value = core.clamp(parseInt(core.values.moveSpeed + delta), 50, 200);
|
||||
core.values.moveSpeed = parseInt(value);
|
||||
core.values.moveSpeed = core.clamp(core.values.moveSpeed + delta, 50, 200);
|
||||
core.setLocalStorage("moveSpeed", core.values.moveSpeed);
|
||||
core.ui.drawSwitchs();
|
||||
}
|
||||
|
||||
|
||||
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
|
||||
core.flags.displayEnemyDamage = !core.flags.displayEnemyDamage;
|
||||
core.updateDamage();
|
||||
|
||||
@ -1497,9 +1497,9 @@ ui.prototype.drawSwitchs = function() {
|
||||
"背景音乐: "+(core.musicStatus.bgmStatus ? "[ON]" : "[OFF]"),
|
||||
"背景音效: "+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
|
||||
//显示为 0~10 十挡
|
||||
" < "+"音量:"+parseInt(parseFloat(Math.sqrt(core.musicStatus.userVolume).toFixed(1)) * 10)+" > ",
|
||||
" < 音量:" + Math.round(Math.sqrt(100 * core.musicStatus.userVolume)) + " > ",
|
||||
//数值越大耗时越长
|
||||
" < "+"步时:" + parseInt(core.values.moveSpeed) +" > ",
|
||||
" < 步时:" + core.values.moveSpeed + " > ",
|
||||
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
|
||||
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
|
||||
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user