Skip to content

Commit

Permalink
chores
Browse files Browse the repository at this point in the history
  • Loading branch information
lchzh3473 committed Mar 18, 2024
1 parent 01bab20 commit f6bbfc6
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 353 deletions.
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: "lchz\x683473" # Replace with a single Patreon username
patreon: "lchz\x683\x3473" # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
Expand All @@ -10,4 +10,4 @@ liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ["https://afdian.net/@lchz\x683473"] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: ["https://afdian.net/@lchz\x683\x3473"] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
32 changes: 16 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### [1.5.8] - 2024.1.4
### [1.5.8] - 2024-01-04

#### 优化

Expand All @@ -8,13 +8,13 @@

- 修复无音乐时播放超长谱面报错的问题

### [1.5.7] - 2023.12.2
### [1.5.7] - 2023-12-02

#### 优化

- 现在读取超过 100 条判定线的谱面会弹出警告

### [1.5.6] - 2023.10.27
### [1.5.6] - 2023-10-27

#### 优化

Expand All @@ -24,7 +24,7 @@

- 修复部分谱面读取逻辑与本体不一致的问题

### [1.5.5] - 2023.10.12
### [1.5.5] - 2023-10-12

#### 新内容

Expand All @@ -47,32 +47,32 @@
- 现在能够正常响应相同文件的连续上传,~~方便调试 qwq~~
- 背景模糊的逻辑由上传时执行改为选择并使用时执行,也许会提升性能

### [1.5.4] - 2023.10.2
### [1.5.4] - 2023-10-02

#### 修复

- 修复特定尺寸缩放时画面边缘出现模糊或黑边的问题

### [1.5.3] - 2023.9.22
### [1.5.3] - 2023-09-22

#### 新内容

- 画面右上角:在分数上方显示当前谱面格式标记,例如`PGS(1)`(本体格式 1)、`PGS(3)`(本体格式 3) 等

### [1.5.2] - 2023.9.9
### [1.5.2] - 2023-09-09

#### 优化

- 优化日志显示:折叠同类型日志以解决大量日志产生的卡顿

### [1.5.1] - 2023.9.1
### [1.5.1] - 2023-09-01

#### 修复

- 修复部分谱面`Note`因浮点误差显示异常的问题
- 修复部分谱面判定线不透明度大于 1 时不显示的问题

### [1.5.0] - 2023.7.31
### [1.5.0] - 2023-07-31

#### 新内容

Expand Down Expand Up @@ -138,7 +138,7 @@

- 移除`开启打击音效`复选框

### [1.4.21] - 2022.9.29
### [1.4.21] - 2022-09-29

#### 新内容

Expand All @@ -161,7 +161,7 @@

- 修复存在触摸点时新的触摸点移入画面会报错的问题

### [1.4.20] - 2022.8.30
### [1.4.20] - 2022-08-30

#### 优化

Expand All @@ -181,7 +181,7 @@
- 修复`info.csv`的按键缩放可能无法读取的问题
- 现在 Android 默认的文件选择器能够正确识别`zip`文件类型

### [1.4.19] - 2022.6.11
### [1.4.19] - 2022-06-11

#### 优化

Expand All @@ -191,7 +191,7 @@

- 修复长度超过一定值的`Hold`在旋转一定角度时显示异常的问题

### [1.4.18] - 2022.5.23
### [1.4.18] - 2022-05-23

#### 更改

Expand All @@ -201,7 +201,7 @@

- 修复部分谱面`Note`显示异常的问题 (感谢 [@MayLight39](https://space.bilibili.com/94735983) 提供反馈)

### [1.4.17] - 2022.5.17
### [1.4.17] - 2022-05-17

#### 新内容

Expand All @@ -211,7 +211,7 @@

- ~~针对 UA 标识为 iOS 和 MacOS 的设备禁用图片缓存~~

### [1.4.16] - 2022.5.1
### [1.4.16] - 2022-05-01

#### 新内容

Expand All @@ -232,7 +232,7 @@

- 修复系统时间可能的自动修正导致谱面瞬移的问题

### [1.4.15] - 2022.3.31
### [1.4.15] - 2022-03-31

#### 新内容

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ $\text{Phi\color{red}x\color{green}os}=\color{red}\xcancel{\text{\color{black}Ph

您因使用或修改代码所造成的一切后果由您自己承担;

如有任何疑问请 [联系 lchzh](mailto:lchz%683473@163.com?subject=[GitHub]lchz%683473/sim-phi)
如有任何疑问请 [联系 lchzh](mailto:lchz%683%3473@163.com?subject=[GitHub]lchz%683%3473/sim-phi)

Copyright © 2020-present, lchzh3473
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
"eslint:format": "eslint --fix \"src/**/*.{js,ts}\""
},
"dependencies": {
"@sim-phi/extends": "^0.3.2",
"@sim-phi/extends": "^0.3.4",
"jszip": "^3.10.1",
"md5": "^2.3.0",
"stackblur-canvas": "^2.6.0"
"stackblur-canvas": "^2.7.0"
},
"devDependencies": {
"@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.4",
"@stylistic/eslint-plugin": "^1.5.1",
"@types/eslint": "^8.56.0",
"@stylistic/eslint-plugin": "^1.7.0",
"@types/eslint": "^8.56.5",
"@types/md5": "^2.3.5",
"@types/prompts": "^2.4.9",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^8.56.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-plugin-rulesdir": "^0.2.2",
"picocolors": "^1.0.0",
"prompts": "^2.4.2",
"typescript": "^5.3.3",
"vite": "^5.0.10"
"typescript": "^5.4.2",
"vite": "^5.1.6"
}
}
10 changes: 1 addition & 9 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
});
}
</script>
<script>
(function () {
var src = '//fastly.jsdelivr.net/npm/eruda';
if (!new URLSearchParams(location.search).has('test')) return;
document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');
document.write('<scr' + 'ipt>eruda.init();</scr' + 'ipt>');
})();
</script>
<script>
eval('try{eval("\'use strict\';{async(a=1)=>1}")}catch(e){location.href="/412.html"}');
</script>
Expand Down Expand Up @@ -195,7 +187,7 @@ <h1 class="title"></h1>
</div>
</div>
</div>
<p class="footer">&copy;&nbsp;2020-2023&nbsp;lchz&#104;3473</p>
<p class="footer">&copy;&nbsp;2020-2024&nbsp;lchz&#104;3473</p>
</div>
</body>
</html>
10 changes: 5 additions & 5 deletions src/components/MessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ export abstract class MessageHandler {
text.textContent = `${msgbox.code ? `${msgbox.host}: 检测到 ${msgbox.list.length}${msgbox.name}\n` : ''}来自 ${msgbox.target}`;
nodePageNum.textContent = String(page.page);
nodePages.textContent = String(pages);
for (const i of nodeBMsg.querySelectorAll('[bm-ctrl]')) (i as HTMLElement).classList.toggle('hide', pages <= 1);
for (const i of nodeBMsg.querySelectorAll('[bm-cell]')) i.remove();
for (const i of msgbox.list.slice(start, start + page.size)) {
for (const elem of nodeBMsg.querySelectorAll('[bm-ctrl]')) elem.classList.toggle('hide', pages <= 1);
for (const elem of nodeBMsg.querySelectorAll('[bm-cell]')) elem.remove();
for (const bmsg of msgbox.list.slice(start, start + page.size)) {
const btnIgnore = document.createElement('a');
btnIgnore.innerText = '忽略';
btnIgnore.classList.add('bm-rbtn');
btnIgnore.onclick = () => {
msgbox.list.splice(msgbox.list.indexOf(i), 1);
msgbox.list.splice(msgbox.list.indexOf(bmsg), 1);
msgbox.updateHTML();
if (msgbox.list.length === 0) {
this.removeBetterMessageBox(msgbox);
Expand All @@ -128,7 +128,7 @@ export abstract class MessageHandler {
const div = document.createElement('div');
div.setAttribute('bm-cell', '');
div.classList.add('bm-item');
div.append(`${i.name}: ${i.message}`, btnIgnore);
div.append(`${bmsg.name}: ${bmsg.message}`, btnIgnore);
nodeBMsg.appendChild(div);
}
});
Expand Down
92 changes: 46 additions & 46 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,15 @@ export class Renderer {
this.holds.length = 0;
this.tapholds.length = 0;
const chartNew = chart.duplicate() as ChartExtends;
for (const i of chartNew.judgeLineList) {
let y = Math.fround(i.speedEvents[0].startTime / i.bpm * 1.875);
for (const line of chartNew.judgeLineList) {
let y = Math.fround(line.speedEvents[0].startTime / line.bpm * 1.875);
let y2 = y; // float32
for (const j of i.speedEvents) {
j.floorPosition = y;
j.floorPosition2 = y2;
const dy = (j.endTime - j.startTime) / i.bpm * 1.875;
y += dy * j.value;
y2 += Math.fround(Math.fround(dy) * j.value);
for (const evt of line.speedEvents) {
evt.floorPosition = y;
evt.floorPosition2 = y2;
const dy = (evt.endTime - evt.startTime) / line.bpm * 1.875;
y += dy * evt.value;
y2 += Math.fround(Math.fround(dy) * evt.value);
y = Math.fround(y);
y2 = Math.fround(y2);
}
Expand All @@ -285,11 +285,11 @@ export class Renderer {
};
// 添加seconds
const addSeconds = (events: EventSeconds[], bpm: number) => {
for (const i of events) {
i.startSeconds = i.startTime / bpm * 1.875;
i.endSeconds = i.endTime / bpm * 1.875;
if (i.startTime > 1 - 1e6) aniUpdate(i.startSeconds);
if (i.endTime < 1e9 && i.endTime !== events[events.length - 1].endTime) aniUpdate(i.endSeconds);
for (const evt of events) {
evt.startSeconds = evt.startTime / bpm * 1.875;
evt.endSeconds = evt.endTime / bpm * 1.875;
if (evt.startTime > 1 - 1e6) aniUpdate(evt.startSeconds);
if (evt.endTime < 1e9 && evt.endTime !== events[events.length - 1].endTime) aniUpdate(evt.endSeconds);
}
};
// 获取note最大可见位置
Expand Down Expand Up @@ -332,29 +332,29 @@ export class Renderer {
const sortNote = (a: NoteExtends, b: NoteExtends) => a.seconds - b.seconds || a.lineId - b.lineId || a.noteId - b.noteId;
// 优化events
chartNew.judgeLineList.forEach((i, lineId) => i.lineId = lineId);
for (const i of chartNew.judgeLineList) {
i.bpm *= this.speed;
i.offsetX = 0;
i.offsetY = 0;
i.alpha = 0;
i.rotation = 0;
i.positionY = 0; // 临时过渡用
i.positionY2 = 0;
// i.speedEvents = normalizeSpeedEvent(i.speedEvents) as SpeedEventExtends[];
// i.judgeLineDisappearEvents = normalizeLineEvent(i.judgeLineDisappearEvents) as LineEventExtends[];
// i.judgeLineMoveEvents = normalizeLineEvent(i.judgeLineMoveEvents) as LineEventExtends[];
// i.judgeLineRotateEvents = normalizeLineEvent(i.judgeLineRotateEvents) as LineEventExtends[];
i.disappearEventsIndex = 0;
i.moveEventsIndex = 0;
i.rotateEventsIndex = 0;
i.speedEventsIndex = 0;
addSeconds(i.speedEvents, i.bpm);
addSeconds(i.judgeLineDisappearEvents, i.bpm);
addSeconds(i.judgeLineMoveEvents, i.bpm);
addSeconds(i.judgeLineRotateEvents, i.bpm);
this.lines.push(i); // TODO: 可以定义新类避免函数在循环里定义
i.notesAbove.forEach((j, noteId) => addNote(j, 1.875 / i.bpm, i, noteId, true));
i.notesBelow.forEach((j, noteId) => addNote(j, 1.875 / i.bpm, i, noteId, false));
for (const line of chartNew.judgeLineList) {
line.bpm *= this.speed;
line.offsetX = 0;
line.offsetY = 0;
line.alpha = 0;
line.rotation = 0;
line.positionY = 0; // 临时过渡用
line.positionY2 = 0;
// line.speedEvents = normalizeSpeedEvent(line.speedEvents) as SpeedEventExtends[];
// line.judgeLineDisappearEvents = normalizeLineEvent(line.judgeLineDisappearEvents) as LineEventExtends[];
// line.judgeLineMoveEvents = normalizeLineEvent(line.judgeLineMoveEvents) as LineEventExtends[];
// line.judgeLineRotateEvents = normalizeLineEvent(line.judgeLineRotateEvents) as LineEventExtends[];
line.disappearEventsIndex = 0;
line.moveEventsIndex = 0;
line.rotateEventsIndex = 0;
line.speedEventsIndex = 0;
addSeconds(line.speedEvents, line.bpm);
addSeconds(line.judgeLineDisappearEvents, line.bpm);
addSeconds(line.judgeLineMoveEvents, line.bpm);
addSeconds(line.judgeLineRotateEvents, line.bpm);
this.lines.push(line); // TODO: 可以定义新类避免函数在循环里定义
line.notesAbove.forEach((j, noteId) => addNote(j, 1.875 / line.bpm, line, noteId, true));
line.notesBelow.forEach((j, noteId) => addNote(j, 1.875 / line.bpm, line, noteId, false));
}
this.notes.sort(sortNote);
this.taps.sort(sortNote);
Expand All @@ -370,8 +370,8 @@ export class Renderer {
this.tapholds.sort(sortNote);
// 多押标记
const timeOfMulti: Record<string, number> = {};
for (const i of this.notes) timeOfMulti[i.seconds.toFixed(6)] = timeOfMulti[i.seconds.toFixed(6)] ? 2 : 1;
for (const i of this.notes) i.isMulti = timeOfMulti[i.seconds.toFixed(6)] === 2;
for (const note of this.notes) timeOfMulti[note.seconds.toFixed(6)] = timeOfMulti[note.seconds.toFixed(6)] ? 2 : 1;
for (const note of this.notes) note.isMulti = timeOfMulti[note.seconds.toFixed(6)] === 2;
// 分析邻近Note(0.01s内标记,用于预处理Flick,TapHold重叠判定)
for (let i = 0; i < this.flicks.length; i++) {
const note = this.flicks[i];
Expand Down Expand Up @@ -482,15 +482,15 @@ export class Renderer {
} else i.alpha = Math.max(1 - (time - i.seconds) / 0.16, 0); // 过线后0.16s消失
}
};
for (const i of line.notesAbove) {
i.cosr = line.cosr;
i.sinr = line.sinr;
setAlpha(i, this.scaleX * i.positionX, this.scaleY * getBadY(i));
for (const note of line.notesAbove) {
note.cosr = line.cosr;
note.sinr = line.sinr;
setAlpha(note, this.scaleX * note.positionX, this.scaleY * getBadY(note));
}
for (const i of line.notesBelow) {
i.cosr = -line.cosr;
i.sinr = -line.sinr;
setAlpha(i, -this.scaleX * i.positionX, this.scaleY * getBadY(i));
for (const note of line.notesBelow) {
note.cosr = -line.cosr;
note.sinr = -line.sinr;
setAlpha(note, -this.scaleX * note.positionX, this.scaleY * getBadY(note));
}
}
}
Expand Down
Loading

0 comments on commit f6bbfc6

Please sign in to comment.