mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-09 08:27:27 +08:00
fix: use rating numbers from dds, swap userplate font again
changed font to Gothic A1, added new DDS to userbox (all users wishing to benefit MUST update aquabox), added rating numbers
This commit is contained in:
BIN
AquaNet/public/assets/fonts/GothicA1.woff2
Normal file
BIN
AquaNet/public/assets/fonts/GothicA1.woff2
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { DDS } from "../../../libs/userbox/dds"
|
import { DDS, type RGB } from "../../../libs/userbox/dds"
|
||||||
import { ddsDB } from "../../../libs/userbox/userbox"
|
import { ddsDB } from "../../../libs/userbox/userbox"
|
||||||
|
|
||||||
const DDSreader = new DDS(ddsDB);
|
const DDSreader = new DDS(ddsDB);
|
||||||
@@ -15,6 +15,26 @@
|
|||||||
let ratingToString = (rating: number) => {
|
let ratingToString = (rating: number) => {
|
||||||
return rating.toFixed(2)
|
return rating.toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface RatingRange {
|
||||||
|
min: number,
|
||||||
|
offset: number,
|
||||||
|
color?: RGB
|
||||||
|
};
|
||||||
|
// https://en.wikipedia.org/wiki/Chunithm#Rating
|
||||||
|
const ratingColors: RatingRange[] = ([
|
||||||
|
{min: 0.00, offset: 4, color: {r: 0, g: 191, b: 64}},
|
||||||
|
{min: 4.00, offset: 4, color: {r: 255, g: 111, b: 0}},
|
||||||
|
{min: 7.00, offset: 4, color: {r: 255, g: 64, b: 64}},
|
||||||
|
{min: 10.00, offset: 4, color: {r: 147, g: 38, b: 255}},
|
||||||
|
{min: 12.00, offset: 3},
|
||||||
|
{min: 13.25, offset: 2},
|
||||||
|
{min: 14.50, offset: 1},
|
||||||
|
{min: 15.25, offset: 0},
|
||||||
|
{min: 16.00, offset: 5}
|
||||||
|
]).filter(f => f.min <= chuniRating);
|
||||||
|
const ratingDigitOrder = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."]
|
||||||
|
const ratingColorData = (ratingColors[ratingColors.length - 1] ?? ratingColors[0]);
|
||||||
</script>
|
</script>
|
||||||
{#await DDSreader?.getFile(`nameplate:${chuniNameplate.toString().padStart(8, "0")}`, `nameplate:00000001`) then nameplateURL}
|
{#await DDSreader?.getFile(`nameplate:${chuniNameplate.toString().padStart(8, "0")}`, `nameplate:00000001`) then nameplateURL}
|
||||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||||
@@ -41,11 +61,25 @@
|
|||||||
{chuniName}
|
{chuniName}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="chuni-user-rating">
|
<div class={`chuni-user-rating color-${ratingColorData.color}`}>
|
||||||
RATING
|
|
||||||
<span class="chuni-user-rating-number">
|
{#await DDSreader?.getFileFromSheet("surfboard:CHU_UI_Common_01_v11.dds", 485, 5 + (28 * ratingColorData.offset), 62, 15, undefined, ratingColorData.color) then url}
|
||||||
{ratingToString(chuniRating)}
|
{#if url}
|
||||||
</span>
|
<img src={url} alt="Rating">
|
||||||
|
<span class="chuni-user-rating-number">
|
||||||
|
{#each ratingToString(chuniRating).split("") as digit}
|
||||||
|
{#await DDSreader?.getFileFromSheet("surfboard:CHU_UI_Common_01_v11.dds", 552 + (24 * (ratingDigitOrder.indexOf(digit) ?? 0)), 1 + (28 * ratingColorData.offset), 16, 20, undefined, ratingColorData.color) then url}
|
||||||
|
<img src={url} alt="Rating Digit">
|
||||||
|
{/await}
|
||||||
|
{/each}
|
||||||
|
</span>
|
||||||
|
{:else}
|
||||||
|
RATING
|
||||||
|
<span class="chuni-user-rating-number">
|
||||||
|
{ratingToString(chuniRating)}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
{/await}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -54,8 +88,8 @@
|
|||||||
@use "../../../vars"
|
@use "../../../vars"
|
||||||
|
|
||||||
@font-face
|
@font-face
|
||||||
font-family: "Zen Maru Gothic"
|
font-family: "Gothic A1"
|
||||||
src: url("/assets/fonts/ZenMaru.woff2")
|
src: url("/assets/fonts/GothicA1.woff2")
|
||||||
|
|
||||||
.chuni-nameplate
|
.chuni-nameplate
|
||||||
width: 576px
|
width: 576px
|
||||||
@@ -83,7 +117,7 @@
|
|||||||
top: 40px
|
top: 40px
|
||||||
|
|
||||||
font-size: 1.15em
|
font-size: 1.15em
|
||||||
font-family: "Zen Maru Gothic", sans-serif
|
font-family: "Gothic A1", sans-serif
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
|
|
||||||
overflow-x: hidden
|
overflow-x: hidden
|
||||||
@@ -128,7 +162,7 @@
|
|||||||
display: flex
|
display: flex
|
||||||
align-items: center
|
align-items: center
|
||||||
color: black
|
color: black
|
||||||
font-family: "Zen Maru Gothic", sans-serif
|
font-family: "Gothic A1", sans-serif
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
|
|
||||||
.chuni-user-name
|
.chuni-user-name
|
||||||
@@ -149,7 +183,7 @@
|
|||||||
flex: 1 0 35%
|
flex: 1 0 35%
|
||||||
font-size: 0.875em
|
font-size: 0.875em
|
||||||
text-shadow: #333 1px 1px, #333 1px -1px, #333 -1px 1px, #333 -1px -1px
|
text-shadow: #333 1px 1px, #333 1px -1px, #333 -1px 1px, #333 -1px -1px
|
||||||
color: #ddf
|
color: #fff
|
||||||
|
|
||||||
.chuni-user-rating-number
|
.chuni-user-rating-number
|
||||||
font-size: 1.5em
|
font-size: 1.5em
|
||||||
|
|||||||
@@ -56,6 +56,12 @@ void main() {
|
|||||||
gl_FragColor = texture2D(uTexture, vTextureCoord);
|
gl_FragColor = texture2D(uTexture, vTextureCoord);
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
export interface RGB {
|
||||||
|
r: number,
|
||||||
|
g: number,
|
||||||
|
b: number
|
||||||
|
}
|
||||||
|
|
||||||
export class DDS {
|
export class DDS {
|
||||||
constructor(db: IDBDatabase | undefined) {
|
constructor(db: IDBDatabase | undefined) {
|
||||||
this.cache = new DDSCache(db);
|
this.cache = new DDSCache(db);
|
||||||
@@ -241,13 +247,27 @@ export class DDS {
|
|||||||
* @param s Scale factor
|
* @param s Scale factor
|
||||||
* @returns An object URL which correlates to a Blob
|
* @returns An object URL which correlates to a Blob
|
||||||
*/
|
*/
|
||||||
async getFileFromSheet(path: string, x: number, y: number, w: number, h: number, s?: number): Promise<string> {
|
async getFileFromSheet(path: string, x: number, y: number, w: number, h: number, s?: number, color?: RGB): Promise<string> {
|
||||||
if (!await this.loadFile(path))
|
if (!await this.loadFile(path))
|
||||||
return "";
|
return "";
|
||||||
this.canvas2D.width = w * (s ?? 1);
|
this.canvas2D.width = w * (s ?? 1);
|
||||||
this.canvas2D.height = h * (s ?? 1);
|
this.canvas2D.height = h * (s ?? 1);
|
||||||
this.ctx.drawImage(this.canvasGL, x, y, w, h, 0, 0, w * (s ?? 1), h * (s ?? 1));
|
this.ctx.drawImage(this.canvasGL, x, y, w, h, 0, 0, w * (s ?? 1), h * (s ?? 1));
|
||||||
|
|
||||||
|
if (color) {
|
||||||
|
let colorData = this.ctx.getImageData(0, 0, this.canvas2D.width, this.canvas2D.height);
|
||||||
|
for (let i = 0; colorData.data.length > i; i++)
|
||||||
|
switch (i % 4) {
|
||||||
|
case 0:
|
||||||
|
colorData.data[i] *= (color.r / 255); break;
|
||||||
|
case 1:
|
||||||
|
colorData.data[i] *= (color.g / 255); break;
|
||||||
|
case 2:
|
||||||
|
colorData.data[i] *= (color.b / 255); break;
|
||||||
|
}
|
||||||
|
this.ctx.putImageData(colorData, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* We don't want to cache this, it's a spritesheet piece. */
|
/* We don't want to cache this, it's a spritesheet piece. */
|
||||||
return URL.createObjectURL(await this.get2DBlob("image/png") ?? new Blob([]));
|
return URL.createObjectURL(await this.get2DBlob("image/png") ?? new Blob([]));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ const DIRECTORY_PATHS = ([
|
|||||||
([
|
([
|
||||||
"CHU_UI_Common_Avatar_body_00.dds",
|
"CHU_UI_Common_Avatar_body_00.dds",
|
||||||
"CHU_UI_Common_Avatar_face_00.dds",
|
"CHU_UI_Common_Avatar_face_00.dds",
|
||||||
|
"CHU_UI_Common_01_v11.dds",
|
||||||
|
"CHU_UI_TeamEmblem_01_v14.dds",
|
||||||
"CHU_UI_title_rank_00_v10.dds"
|
"CHU_UI_title_rank_00_v10.dds"
|
||||||
]).includes(name),
|
]).includes(name),
|
||||||
id: (name: string) => name
|
id: (name: string) => name
|
||||||
|
|||||||
Reference in New Issue
Block a user