Skip to content

Commit

Permalink
bsr表示の新BeatSaver対応
Browse files Browse the repository at this point in the history
無駄なfailed処理の削除
デフォルトのIPアドレスをlocalhostから127.0.0.1に変更(IPv4指定)
  • Loading branch information
rynan4818 committed Aug 8, 2021
1 parent 3fbf9ac commit 5e1ea0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion js/manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function connect() {
var ip = query.get("ip") || "localhost";
var ip = query.get("ip") || "127.0.0.1";
var port = query.get("port") || 6557;

var socket = new WebSocket(`ws://${ip}:${port}/socket`);
Expand Down
14 changes: 4 additions & 10 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const ui = (() => {
var mod_instaFail = false;
var mod_batteryEnergy = false;
var obstacle_time = 0;
var failed = false;
var now_pp_enable = false;

const performance = (() => {
Expand Down Expand Up @@ -102,12 +101,8 @@ const ui = (() => {
}
}
if (now_energy > 100) now_energy = 100;
if (data.event === "failed") {
now_energy = 0;
failed = true;
}
if (data.event === "failed") now_energy = 0;
if (now_energy < 0) now_energy = 0;
if (failed) now_energy = 0;
if (html_id["energy"]) energy.innerText = Math.round(now_energy) + "%";
if (html_id["energy_bar"]) energy_bar.setAttribute("style", `width: ${Math.round(now_energy)}%`);
}
Expand Down Expand Up @@ -207,7 +202,7 @@ const ui = (() => {
})();

const beatmap = (() => {
const beatsaver_url = 'https://beatsaver.com/api/maps/by-hash/';
const beatsaver_url = 'https://beatsaver.com/api/maps/hash/';
const request_timeout = 5000; //msec
const min_subtitle_width_ratio = 0.3;
if (html_id["overlay"]) var dom_overlay = document.getElementById("overlay");
Expand Down Expand Up @@ -281,7 +276,6 @@ const ui = (() => {
console.log(diff_time);
}
now_pp_enable = false;
failed = false;
timer.start(beatmap.start + diff_time, beatmap.length, mod_data.songSpeedMultiplier);
mod_instaFail = mod_data.instaFail;
mod_batteryEnergy = mod_data.batteryEnergy;
Expand Down Expand Up @@ -321,7 +315,7 @@ const ui = (() => {
if(this.readyState == 4 && this.status == 200) {
now_map = this.response;
if (now_map !== null) {
if (html_id["bsr"]) dom_bsr.innerText = now_map.key;
if (html_id["bsr"]) dom_bsr.innerText = now_map.id;
if (html_id["bsr_text"]) dom_bsr_text.innerText = bsr_text_org;
}
ex_beatsaver_res.forEach(ex => ex(now_map));
Expand All @@ -330,7 +324,7 @@ const ui = (() => {

if (pre_songHash === beatmap.songHash) {
if (bsr_display && now_map !== null) {
if (html_id["bsr"]) dom_bsr.innerText = now_map.key;
if (html_id["bsr"]) dom_bsr.innerText = now_map.id;
if (html_id["bsr_text"]) dom_bsr_text.innerText = bsr_text_org;
}
} else {
Expand Down

0 comments on commit 5e1ea0d

Please sign in to comment.