Start migrating the appearance configuration menu.

This commit is contained in:
Tipx-L 2023-12-06 21:34:53 -08:00
parent 076b86f851
commit 47a1531291
84 changed files with 636 additions and 78 deletions

38
noname/gnc.js Normal file
View File

@ -0,0 +1,38 @@
import { Is } from "./gnc/is.js";
export const gnc = {
of(fn) {
return Is.generatorFunc(fn) ? function genCoroutine() {
let gen = fn.apply(this, arguments);
gen.status = "next";
gen.state = undefined;
const callback = (resolve, reject) => {
let result,
nexts = resolve,
throws = reject;
try {
result = gen[gen.status](gen.state);
} catch (error) {
reject(error);
return;
}
if (!result.done) {
nexts = (item) => {
gen.state = item;
gen.status = "next";
callback(resolve, reject);
}
throws = (err) => {
gen.state = err;
gen.status = "throw";
callback(resolve, reject);
}
}
result = result.value;
Promise.resolve(result).then(nexts, throws);
}
return new Promise(callback);
} : (() => { throw new TypeError("gnc.of needs a GeneratorFunction.") })();
},
is: Is
};

18
noname/gnc/is.js Normal file
View File

@ -0,0 +1,18 @@
const GeneratorFunction = (function* () { }).constructor;
export class Is {
static coroutine(item) {
return typeof item == "function" && item.name == "genCoroutine";
}
/**
* @returns {item is GeneratorFunction}
*/
static generatorFunc(item) {
return item instanceof GeneratorFunction;
}
static generator(item) {
return typeof item == "object" && "constructor" in item && item.constructor && "constructor" in item.constructor && item.constructor.constructor === GeneratorFunction;
}
}

View File

@ -10,7 +10,7 @@ import { characterPack } from "./library/character-pack.js";
import { characterReplace } from "./library/character-replace.js";
import { characterSort } from "./library/character-sort.js";
import { characterTitle } from "./library/character-title.js";
import { configMenu } from "./library/config-menu.js";
import { CONFIGURATION_MENU } from "./library/configuration-menu.js";
import { dynamicTranslate } from "./library/dynamic-translate.js";
import { element } from "./library/element.js";
import { emotionList } from "./library/emotion-list.js";
@ -100,7 +100,7 @@ export class Library {
["霹雳投石车", "霹雳车"]
])
static characterDialogGroup = CharacterDialogGroup;
static configMenu = configMenu;
static configMenu = CONFIGURATION_MENU;
constructor() {
throw new TypeError(`${new.target.name} is not a constructor`);

View File

@ -1,5 +1,5 @@
import { Get } from "../get.js";
import { config } from "./config.js";
import { configuration } from "./configuration.js";
export class CharacterDialogGroup {
constructor() {
@ -7,7 +7,7 @@ export class CharacterDialogGroup {
}
static 收藏(name, capt) {
return config.favouriteCharacter.includes(name) ? capt : null;
return configuration.favouriteCharacter.includes(name) ? capt : null;
}
static 最近(name, capt) {

View File

@ -1,5 +0,0 @@
import { general } from "./config-menu/general.js";
export const configMenu = {
general
};

View File

@ -1,6 +0,0 @@
import { config } from "./general/config.js";
export const general = {
name: "通用",
config
};

View File

@ -1,6 +0,0 @@
interface Config extends Record<string, any> {
extension_sources: Record<string, string>;
favouriteCharacter: string[];
}
export const config: Config;

View File

@ -1 +0,0 @@
export const config = {};

View File

@ -0,0 +1,7 @@
import { APPEARANCE } from "./configuration-menu/appearance.js";
import { GENERAL } from "./configuration-menu/general.js";
export const CONFIGURATION_MENU = {
general: GENERAL,
appearence: APPEARANCE
};

View File

@ -0,0 +1,6 @@
import { CONFIGURATION } from "./appearance/configuration.js";
export const APPEARANCE = {
name: "外观",
config: CONFIGURATION
};

View File

@ -0,0 +1,17 @@
import { IMAGE_BACKGROUND } from "./configuration/image-background.js";
import { LAYOUT } from "./configuration/layout.js";
import { PLAYER_HEIGHT_NOVA } from "./configuration/player-height-nova.js";
import { PLAYER_HEIGHT } from "./configuration/player-height.js";
import { SPLASH_STYLE } from "./configuration/splash-style.js";
import { THEME } from "./configuration/theme.js";
import { UI_ZOOM } from "./configuration/ui-zoom.js";
export const CONFIGURATION = {
theme: THEME,
layout: LAYOUT,
splash_style: SPLASH_STYLE,
player_height: PLAYER_HEIGHT,
player_height_nova: PLAYER_HEIGHT_NOVA,
ui_zoom: UI_ZOOM,
image_background: IMAGE_BACKGROUND
};

View File

@ -0,0 +1,159 @@
import { Game } from "../../../../game.js";
import { Create } from "../../../../ui/create.js";
import { configuration } from "../../../configuration.js";
import { Initialization } from "../../../initialization.js";
import { ITEM } from "./image-background/item.js";
export const IMAGE_BACKGROUND = {
name: "游戏背景",
init: "default",
item: ITEM,
visualBar(node, item, create) {
if (node.created) {
node.lastChild.classList.remove("active");
return;
}
node.created = true;
Create.filediv(".menubutton", "添加背景", node, function (file) {
if (file) {
var name = file.name;
if (name.includes(".")) {
name = name.slice(0, name.indexOf("."));
}
var link = `${Game.writeFile ? "cdv_" : "custom_"}${name}`;
if (item[link]) {
for (var i = 1; i < 1000; i++) {
if (!item[`${link}_${i}`]) {
link = `${link}_${i}`; break;
}
}
}
item[link] = name;
var callback = function () {
create(link, node.parentNode.defaultNode);
node.parentNode.updateBr();
configuration.customBackgroundPack.add(link);
Game.saveConfig("customBackgroundPack", configuration.customBackgroundPack);
};
if (Game.writeFile) {
Game.writeFile(file, "image/background", `${link}.jpg`, callback);
}
else {
Game.putDB("image", link, file, callback);
}
if (node.lastChild.classList.contains("active")) {
editbg.call(node.lastChild);
}
}
}).inputNode.accept = "image/*";
var editbg = function () {
this.classList.toggle("active");
var page = this.parentNode.parentNode;
for (var i = 0; i < page.childElementCount; i++) {
if (page.childNodes[i].classList.contains("button")) {
var link = page.childNodes[i]._link;
if (link && link != "default") {
var str;
if (this.classList.contains("active")) {
if (link.startsWith("custom_") || link.startsWith("cdv_")) {
str = "删除";
}
else {
str = "隐藏";
}
}
else {
str = item[link];
}
page.childNodes[i].firstChild.innerHTML = get.verticalStr(str);
}
}
}
};
Create.div(".menubutton", "编辑背景", node, editbg);
},
visualMenu(node, link, name, config) {
node.className = "button character";
node.style.backgroundImage = "";
node.style.backgroundSize = "";
if (node.firstChild) {
node.firstChild.innerHTML = get.verticalStr(name);
}
if (link == "default" || link.startsWith("custom_")) {
node.style.backgroundImage = "none";
node.classList.add("dashedmenubutton");
if (link.startsWith("custom_")) {
Game.getDB("image", link, function (fileToLoad) {
if (!fileToLoad) return;
var fileReader = new FileReader();
fileReader.onload = function (fileLoadedEvent) {
var data = fileLoadedEvent.target.result;
node.style.backgroundImage = `url(${data})`;
node.style.backgroundSize = "cover";
node.classList.remove("dashedmenubutton");
};
fileReader.readAsDataURL(fileToLoad, "UTF-8");
});
}
else {
node.parentNode.defaultNode = node;
}
}
else {
node.setBackgroundImage(`image/background/${link}.jpg`);
node.style.backgroundSize = "cover";
}
},
onclick(background, node) {
if (node && node.firstChild) {
var menu = node.parentNode;
if (node.firstChild.innerHTML == get.verticalStr("隐藏")) {
menu.parentNode.noclose = true;
node.remove();
menu.updateBr();
if (!configuration.prompt_hidebg) {
alert("隐藏的背景可通过选项-其它-重置隐藏内容恢复");
Game.saveConfig("prompt_hidebg", true);
}
configuration.hiddenBackgroundPack.add(background);
Game.saveConfig("hiddenBackgroundPack", configuration.hiddenBackgroundPack);
delete ITEM[background];
if (configuration.image_background == background) {
background = "default";
this.lastChild.innerHTML = "默认";
}
else {
this.lastChild.innerHTML = ITEM[configuration.image_background];
return;
}
}
else if (node.firstChild.innerHTML == get.verticalStr("删除")) {
menu.parentNode.noclose = true;
if (confirm("是否删除此背景?(此操作不可撤销)")) {
node.remove();
menu.updateBr();
configuration.customBackgroundPack.remove(background);
Game.saveConfig("customBackgroundPack", configuration.customBackgroundPack);
if (background.startsWith("cdv_")) {
Game.removeFile(`image/background/${background}.jpg`);
}
else {
Game.deleteDB("image", background);
}
delete ITEM[background];
if (configuration.image_background == background) {
background = "default";
this.lastChild.innerHTML = "默认";
}
else {
this.lastChild.innerHTML = ITEM[configuration.image_background];
return;
}
}
}
}
Game.saveConfig("image_background", background);
Initialization.background();
Game.updateBackground();
},
};

View File

@ -0,0 +1 @@
export const ITEM = {};

View File

@ -0,0 +1,158 @@
import { Game } from "../../../../game.js";
import { Library } from "../../../../library.js";
import { Create } from "../../../../ui/create.js";
import { configuration } from "../../../configuration.js";
import { Initialization } from "../../../initialization.js";
import { ITEM } from "./layout/item.js";
export const LAYOUT = {
name: "布局",
init: "mobile",
item: ITEM,
visualMenu(node, link) {
node.className = `button character themebutton ${configuration.theme}`;
if (!node.created) {
node.created = true;
node.style.overflow = "hidden";
node.firstChild.style.display = "none";
var me = Create.div(node);
me.style.top = "auto";
if (link == "default" || link == "newlayout") {
me.style.width = "calc(100% - 6px)";
me.style.left = "3px";
me.style.bottom = "3px";
me.style.height = "25px";
if (link == "newlayout") {
me.style.height = "23px";
me.style.bottom = "4px";
}
}
else if (link == "long2" || link == "nova") {
me.style.display = "none";
}
else {
me.style.width = "120%";
me.style.left = "-10%";
me.style.bottom = "0";
me.style.height = "22px";
}
me.style.borderRadius = "2px";
var list = ["re_caocao", "re_liubei", "sp_zhangjiao", "sunquan"];
for (var i = 0; i < 4; i++) {
var player = Create.div(".fakeplayer", node);
Create.div(".avatar", player).setBackground(list.randomRemove(), "character");
player.style.borderRadius = "2px";
if (i != 3) {
player.style.top = "auto";
}
if (link == "default") {
player.style.height = "19px";
player.style.width = "38px";
player.classList.add("oldlayout")
}
else if (link == "mobile" || link == "newlayout") {
player.style.width = "24px";
player.style.height = "29px";
}
else if (link == "nova") {
player.style.width = "20px";
player.style.height = "24px";
}
else {
player.style.width = "20px";
player.style.height = "34px";
}
if (i == 1) {
player.style.left = "3px";
}
if (i == 2) {
player.style.left = "auto";
player.style.right = "3px";
}
if (i == 3) {
player.style.top = "3px";
}
if (link == "default") {
if (i == 0) {
player.style.bottom = "6px";
}
if (i == 0 || i == 3) {
player.style.left = "calc(50% - 18px)";
}
if (i == 1 || i == 2) {
player.style.bottom = "36px";
}
}
else if (link == "newlayout") {
if (i == 0) {
player.style.bottom = "1px";
}
if (i == 0 || i == 3) {
player.style.left = "calc(50% - 12px)";
}
if (i == 1 || i == 2) {
player.style.bottom = "32px";
}
}
else if (link == "mobile") {
if (i == 0 || i == 3) {
player.style.left = "calc(50% - 12px)";
}
if (i == 1 || i == 2) {
player.style.bottom = "30px";
}
}
else if (link == "long") {
if (i == 0 || i == 3) {
player.style.left = "calc(50% - 10px)";
}
if (i == 1 || i == 2) {
player.style.bottom = "45px";
}
}
else if (link == "long2") {
if (i == 0) {
player.style.bottom = "2px";
player.style.left = "3px";
}
if (i == 3) {
player.style.left = "calc(50% - 10px)";
}
if (i == 1 || i == 2) {
player.style.bottom = "45px";
}
}
else if (link == "nova") {
if (i == 0) {
player.style.bottom = "2px";
player.style.left = "3px";
}
if (i == 3) {
player.style.left = "calc(50% - 10px)";
}
if (i == 1 || i == 2) {
player.style.left = "3px";
player.style.bottom = (i * 30) + "px";
}
}
if (i == 0 && (link == "mobile" || link == "long")) {
player.classList.add("me");
player.style.borderRadius = "0px";
player.style.width = "25px";
player.style.height = "25px";
player.style.bottom = "-3px";
player.style.left = "-3px";
}
}
}
},
onclick(layout) {
if (Library.layoutfixed.includes(configuration.mode)) {
Game.saveConfig("layout", layout);
}
else {
Initialization.layout(layout);
}
}
};

View File

@ -0,0 +1,7 @@
export const ITEM = {
newlayout: "对称",
mobile: "默认",
long: "宽屏",
long2: "手杀",
nova: "新版"
};

View File

@ -0,0 +1,12 @@
import { UI } from "../../../../ui.js";
import { ITEM } from "./player-height-nova/item.js";
export const PLAYER_HEIGHT_NOVA = {
name: "角色高度",
init: "short",
item: ITEM,
onclick(item) {
game.saveConfig("player_height_nova", item);
UI.arena.dataset.player_height_nova = item;
}
};

View File

@ -0,0 +1,5 @@
export const ITEM = {
short: "矮",
default: "中",
long: "高"
};

View File

@ -0,0 +1,13 @@
import { Game } from "../../../../game.js";
import { UI } from "../../../../ui.js";
import { ITEM } from "./player-height/item.js";
export const PLAYER_HEIGHT = {
name: "角色高度",
init: "long",
item: ITEM,
onclick(item) {
Game.saveConfig("player_height", item);
UI.arena.dataset.player_height = item;
}
};

View File

@ -0,0 +1,5 @@
export const ITEM = {
short: "矮",
default: "中",
long: "高"
};

View File

@ -0,0 +1,16 @@
import { ITEM } from "./splash-style/item.js";
export const SPLASH_STYLE = {
name: "启动页",
item: ITEM,
visualMenu(node, link) {
node.className = "button character";
node.style.width = "200px";
node.style.height = `${node.offsetWidth * 1080 / 2400}px`;
node.style.display = "flex";
node.style.flexDirection = "column";
node.style.alignItems = "center";
node.style.backgroundSize = "100% 100%";
node.setBackgroundImage(`image/splash/${link}.jpg`);
}
};

View File

@ -0,0 +1,4 @@
export const ITEM = {
style1: "样式一",
style2: "样式二"
};

View File

@ -0,0 +1,46 @@
import { Game } from "../../../../game.js";
import { gnc } from "../../../../gnc.js";
import { Library } from "../../../../library.js";
import { UI } from "../../../../ui.js";
import { Create } from "../../../../ui/create.js";
import { css } from "../../../../ui/css.js";
import { announce } from "../../../announce.js";
import { configuration } from "../../../configuration.js";
import { Initialization } from "../../../initialization.js";
import { ITEM } from "./theme/item.js";
export const THEME = {
name: "主题",
init: "woodden",
item: ITEM,
visualMenu(node, link) {
if (!node.menu) {
node.className = `button character themebutton ${link}`;
node.menu = Create.div(node, "", "<div></div><div></div><div></div><div></div>");
}
},
onclick: gnc.of(function* (theme) {
Game.saveConfig("theme", theme);
UI.arena.hide();
Initialization.background();
if (configuration.autostyle) {
if (theme === "simple") {
Library.configMenu.appearence.config.player_border.onclick("slim");
}
else {
Library.configMenu.appearence.config.player_border.onclick("normal");
}
}
announce.publish("Noname.Apperaence.Theme.onChanging", theme);
yield new Promise(resolve => setTimeout(resolve, 500));
const deletingTheme = css.theme;
css.theme = Initialization.css(`${Library.assetURL}theme/${configuration.theme}`, "style");
deletingTheme.remove();
announce.publish("Noname.Apperaence.Theme.onChanged", theme);
yield new Promise(resolve => setTimeout(resolve, 100));
UI.arena.show();
announce.publish("Noname.Apperaence.Theme.onChangeFinished", theme);
})
};

View File

@ -0,0 +1 @@
export const ITEM = {};

View File

@ -0,0 +1,33 @@
import { Game } from "../../../../game.js";
import { Library } from "../../../../library.js";
import { UI } from "../../../../ui.js";
import { ITEM } from "./ui-zoom/item.js";
export const UI_ZOOM = {
name: "界面缩放",
unfrequent: true,
init: "normal",
item: ITEM,
onclick(zoom) {
Game.saveConfig("ui_zoom", zoom);
switch (zoom) {
case "esmall": zoom = 0.8; break;
case "vsmall": zoom = 0.9; break;
case "small": zoom = 0.93; break;
case "big": zoom = 1.05; break;
case "vbig": zoom = 1.1; break;
case "ebig": zoom = 1.2; break;
case "eebig": zoom = 1.5; break;
case "eeebig": zoom = 1.8; break;
case "eeeebig": zoom = 2; break;
default: zoom = 1;
}
Game.documentZoom = Game.deviceZoom * zoom;
UI.updatez();
if (Array.isArray(Library.onresize)) {
Library.onresize.forEach(fun => {
if (typeof fun == "function") fun();
});
}
}
};

View File

@ -0,0 +1,12 @@
export const ITEM = {
esmall: "80%",
vsmall: "90%",
small: "95%",
normal: "100%",
big: "105%",
vbig: "110%",
ebig: "120%",
eebig: "150%",
eeebig: "180%",
eeeebig: "200%"
};

View File

@ -0,0 +1,6 @@
import { CONFIGURATION } from "./general/configuration.js";
export const GENERAL = {
name: "通用",
config: CONFIGURATION
};

View File

@ -1,50 +1,50 @@
import { Is } from "../../../get/is.js";
import { Library } from "../../../library.js";
import { AUTO_CHECK_UPDATE } from "./config/auto-check-update.js";
import { AUTO_CONFIRM } from "./config/auto-confirm.js";
import { COMPATIBLE_MODE } from "./config/compatible-mode.js";
import { CONFIRM_EXIT } from "./config/confirm-exit.js";
import { DEVELOPER } from "./config/developer.js";
import { DOUBLE_CLICK_INTRODUCTION } from "./config/double-click-introduction.js";
import { ENABLE_DRAG_LINE } from "./config/enable-drag-line.js";
import { ENABLE_DRAG } from "./config/enable-drag.js";
import { ENABLE_TOUCH_DRAG_LINE } from "./config/enable-touch-drag-line.js";
import { ENABLE_VIBRATE } from "./config/enable-vibrate.js";
import { ERROR_STOP } from "./config/error-stop.js";
import { EXTENSION_CREATE } from "./config/extension-create.js";
import { EXTENSION_DELETE } from "./config/extension-delete.js";
import { EXTENSION_SOURCE } from "./config/extension-source.js";
import { FUCK_SO_JSON } from "./config/fuck-so-json.js";
import { GAME_SPEED } from "./config/game-speed.js";
import { HOVER_ALL } from "./config/hover-all.js";
import { HOVER_HAND_CARD } from "./config/hover-hand-card.js";
import { HOVERATION } from "./config/hoveration.js";
import { KEEP_AWAKE } from "./config/keep-awake.js";
import { LONG_PRESS_INFORMATION } from "./config/long-press-information.js";
import { LOW_PERFORMANCE } from "./config/low-performance.js";
import { LUCKY_STAR } from "./config/lucky-star.js";
import { MAXIMUM_LOAD_TIME } from "./config/maximum-load-time.js";
import { MOUNT_COMBINE } from "./config/mount-combine.js";
import { MOUSE_WHEEL } from "./config/mouse-wheel.js";
import { RIGHT_CLICK } from "./config/right-click.js";
import { RIGHT_INFORMATION } from "./config/right-information.js";
import { ROUND_MENU_FUNCTION } from "./config/round-menu-function.js";
import { SHOW_SPLASH } from "./config/show-splash.js";
import { SKIP_SHAN } from "./config/skip-shan.js";
import { SWIPE_DOWN } from "./config/swipe-down.js";
import { SWIPE_LEFT } from "./config/swipe-left.js";
import { SWIPE_RIGHT } from "./config/swipe-right.js";
import { SWIPE_UP } from "./config/swipe-up.js";
import { SWIPE } from "./config/swipe.js";
import { SYNCHRONIZE_SPEED } from "./config/synchronize-speed.js";
import { TAO_ENEMY } from "./config/tao-enemy.js";
import { TOUCHSCREEN } from "./config/touchscreen.js";
import { UN_AUTO_CHOOSE } from "./config/un-auto-choose.js";
import { UPDATE_LINK } from "./config/update-link.js";
import { VIDEO } from "./config/video.js";
import { WUXIE_SELF } from "./config/wuxie-self.js";
import { AUTO_CHECK_UPDATE } from "./configuration/auto-check-update.js";
import { AUTO_CONFIRM } from "./configuration/auto-confirm.js";
import { COMPATIBLE_MODE } from "./configuration/compatible-mode.js";
import { CONFIRM_EXIT } from "./configuration/confirm-exit.js";
import { DEVELOPER } from "./configuration/developer.js";
import { DOUBLE_CLICK_INTRODUCTION } from "./configuration/double-click-introduction.js";
import { ENABLE_DRAG_LINE } from "./configuration/enable-drag-line.js";
import { ENABLE_DRAG } from "./configuration/enable-drag.js";
import { ENABLE_TOUCH_DRAG_LINE } from "./configuration/enable-touch-drag-line.js";
import { ENABLE_VIBRATE } from "./configuration/enable-vibrate.js";
import { ERROR_STOP } from "./configuration/error-stop.js";
import { EXTENSION_CREATE } from "./configuration/extension-create.js";
import { EXTENSION_DELETE } from "./configuration/extension-delete.js";
import { EXTENSION_SOURCE } from "./configuration/extension-source.js";
import { FUCK_SO_JSON } from "./configuration/fuck-so-json.js";
import { GAME_SPEED } from "./configuration/game-speed.js";
import { HOVER_ALL } from "./configuration/hover-all.js";
import { HOVER_HAND_CARD } from "./configuration/hover-hand-card.js";
import { HOVERATION } from "./configuration/hoveration.js";
import { KEEP_AWAKE } from "./configuration/keep-awake.js";
import { LONG_PRESS_INFORMATION } from "./configuration/long-press-information.js";
import { LOW_PERFORMANCE } from "./configuration/low-performance.js";
import { LUCKY_STAR } from "./configuration/lucky-star.js";
import { MAXIMUM_LOAD_TIME } from "./configuration/maximum-load-time.js";
import { MOUNT_COMBINE } from "./configuration/mount-combine.js";
import { MOUSE_WHEEL } from "./configuration/mouse-wheel.js";
import { RIGHT_CLICK } from "./configuration/right-click.js";
import { RIGHT_INFORMATION } from "./configuration/right-information.js";
import { ROUND_MENU_FUNCTION } from "./configuration/round-menu-function.js";
import { SHOW_SPLASH } from "./configuration/show-splash.js";
import { SKIP_SHAN } from "./configuration/skip-shan.js";
import { SWIPE_DOWN } from "./configuration/swipe-down.js";
import { SWIPE_LEFT } from "./configuration/swipe-left.js";
import { SWIPE_RIGHT } from "./configuration/swipe-right.js";
import { SWIPE_UP } from "./configuration/swipe-up.js";
import { SWIPE } from "./configuration/swipe.js";
import { SYNCHRONIZE_SPEED } from "./configuration/synchronize-speed.js";
import { TAO_ENEMY } from "./configuration/tao-enemy.js";
import { TOUCHSCREEN } from "./configuration/touchscreen.js";
import { UN_AUTO_CHOOSE } from "./configuration/un-auto-choose.js";
import { UPDATE_LINK } from "./configuration/update-link.js";
import { VIDEO } from "./configuration/video.js";
import { WUXIE_SELF } from "./configuration/wuxie-self.js";
export const config = {
export const CONFIGURATION = {
mount_combine: MOUNT_COMBINE,
low_performance: LOW_PERFORMANCE,
compatiblemode: COMPATIBLE_MODE,

View File

@ -1,7 +1,7 @@
import { Game } from "../../../../game.js";
import { UI } from "../../../../ui.js";
import { Create } from "../../../../ui/create.js";
import { config } from "../../../config.js";
import { configuration } from "../../../configuration.js";
export const EXTENSION_CREATE = {
name: "添加获取扩展地址",
@ -11,7 +11,7 @@ export const EXTENSION_CREATE = {
Game.prompt("请输入地址名称", str => {
if (!str) return;
var map = config.extension_sources;
var map = configuration.extension_sources;
Game.prompt(`请输入${str}的地址`, str2 => {
if (!str2) return;

View File

@ -1,15 +1,15 @@
import { Game } from "../../../../game.js";
import { UI } from "../../../../ui.js";
import { config } from "../../../config.js";
import { configuration } from "../../../configuration.js";
export const EXTENSION_DELETE = {
name: "删除当前扩展地址",
clear: true,
unfrequent: true,
onclick() {
var bool = false, map = config.extension_sources;
var bool = false, map = configuration.extension_sources;
for (var i in map) {
if (i != config.extension_source) {
if (i != configuration.extension_source) {
bool = true;
break;
}
@ -18,7 +18,7 @@ export const EXTENSION_DELETE = {
alert("不能删除最后一个扩展地址!");
return;
}
var name = config.extension_source;
var name = configuration.extension_source;
Game.saveConfig("extension_source", i);
delete map[name];
Game.saveConfig("extension_sources", map);

View File

@ -1,13 +1,13 @@
import { config } from "../../../config.js";
import { configuration } from "../../../configuration.js";
export const EXTENSION_SOURCE = {
name: "获取扩展地址",
init: "GitHub Proxy",
unfrequent: true,
get item() {
return config.extension_sources;
return configuration.extension_sources;
},
intro() {
return `获取在线扩展时的地址。当前地址:${document.createElement("br").outerHTML}${config.extension_sources[config.extension_source]}`;
return `获取在线扩展时的地址。当前地址:${document.createElement("br").outerHTML}${configuration.extension_sources[configuration.extension_source]}`;
}
};

View File

@ -1,7 +1,7 @@
import { Game } from "../../../../game.js";
import { UI } from "../../../../ui.js";
import { Click } from "../../../../ui/click.js";
import { config } from "../../../config.js";
import { configuration } from "../../../configuration.js";
export const MOUSE_WHEEL = {
name: "滚轮控制手牌",
@ -10,8 +10,8 @@ export const MOUSE_WHEEL = {
intro: "开启后滚轮可使手牌横向滚动在mac等可横向滚动的设备上建议关闭",
onclick(bool) {
Game.saveConfig("mousewheel", bool);
if (config.touchscreen) return;
if (config.mousewheel) {
if (configuration.touchscreen) return;
if (configuration.mousewheel) {
UI.handcards1Container.onmousewheel = Click.mousewheel;
UI.handcards2Container.onmousewheel = Click.mousewheel;
}

6
noname/library/configuration.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
interface Configuration extends Record<string, any> {
extension_sources: Record<string, string>;
favouriteCharacter: string[];
}
export const configuration: Configuration;

View File

@ -0,0 +1 @@
export const configuration = {};

View File

@ -0,0 +1 @@
export class Initialization { }

3
noname/ui/css.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
interface CSS extends Record<string, HTMLStyleElement> { }
export const css: CSS;

1
noname/ui/css.js Normal file
View File

@ -0,0 +1 @@
export const css = {};