refactor: just updated scripts for better reading
This commit is contained in:
@@ -1,41 +1,32 @@
|
||||
import fs from "node:fs";
|
||||
import { PATHS } from "./shared";
|
||||
|
||||
const PATHS = {
|
||||
ORIGINAL: "../_sprites/original",
|
||||
TRANSLATE: "../_sprites/translation",
|
||||
};
|
||||
let DATA: { [key: string]: any } = {};
|
||||
|
||||
let DATA = {};
|
||||
for (const chapter of fs.readdirSync(PATHS.ORIGINAL)) DATA[chapter] = {};
|
||||
|
||||
// Сбор списка глав
|
||||
for (const chapter of fs.readdirSync(PATHS.ORIGINAL)) {
|
||||
if (chapter != ".DS_Store") DATA[chapter] = {};
|
||||
}
|
||||
function add_singles(path: string) {
|
||||
const chapter_sprites = fs.readdirSync(path, "utf-8");
|
||||
const temp: { [key: string]: any } = {};
|
||||
|
||||
// Внос всех одно-кадровых спрайтов
|
||||
function add_singles(path) {
|
||||
const chapter_dir = fs.readdirSync(path, "utf-8");
|
||||
let temp = {};
|
||||
|
||||
for (const sprite of chapter_dir)
|
||||
for (const sprite of chapter_sprites)
|
||||
if (sprite.includes(".png")) temp[sprite.slice(0, -4)] = [0];
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
// Внос всех много-кадровых спрайтов
|
||||
function add_animations(path) {
|
||||
const chapter_dir = fs.readdirSync(path, "utf-8");
|
||||
let temp = {};
|
||||
function add_animations(path: string) {
|
||||
const chapter_sprites = fs.readdirSync(path, "utf-8");
|
||||
const temp: { [key: string]: any } = {};
|
||||
|
||||
for (const sprite of chapter_dir) {
|
||||
if (!(sprite.endsWith(".png") || sprite.endsWith(".DS_Store"))) {
|
||||
let frames = new Array();
|
||||
for (const sprite of chapter_sprites) {
|
||||
if (!sprite.endsWith(".png")) {
|
||||
const frames = new Array();
|
||||
|
||||
const animation_dir = fs.readdirSync(`${path}/${sprite}`, "utf-8");
|
||||
for (let frame of animation_dir) {
|
||||
let frame_number = frame.split("_").at(-1) ?? "fuck";
|
||||
if (frame.endsWith(".png"))
|
||||
const animated_sprite = fs.readdirSync(`${path}/${sprite}`, "utf-8");
|
||||
for (let frame of animated_sprite) {
|
||||
let frame_number = frame.split("_").at(-1);
|
||||
if (frame.endsWith(".png") && frame_number !== undefined)
|
||||
frames.push(Number(frame_number.slice(0, -4)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user