From 5691fc14e4f9f28834978c9a92b73eee7a92c2d8 Mon Sep 17 00:00:00 2001 From: adeFuLoDgu <64475795+adeFuLoDgu@users.noreply.github.com> Date: Fri, 1 Nov 2024 20:33:41 +0800 Subject: [PATCH] Update. 1. Add an extension. 2. Merge pull request #2067, #2068, #2069 from PR-branch. --- .../extension.js" | 75 +++++++++++++++++++ game/source.js | 1 + layout/others/dialog.css | 19 +++-- noname/library/index.js | 19 ++--- noname/ui/create/index.js | 47 +++++++++++- 5 files changed, 143 insertions(+), 18 deletions(-) create mode 100644 "extension/\350\241\245\345\272\224\345\217\230\345\215\241/extension.js" diff --git "a/extension/\350\241\245\345\272\224\345\217\230\345\215\241/extension.js" "b/extension/\350\241\245\345\272\224\345\217\230\345\215\241/extension.js" new file mode 100644 index 0000000000..615c53a243 --- /dev/null +++ "b/extension/\350\241\245\345\272\224\345\217\230\345\215\241/extension.js" @@ -0,0 +1,75 @@ +game.import("extension",function(lib,game,ui,get,ai,_status){return {name:"补应变卡",content:function(config,pack){ +},precontent:function(){ + let load_cards = false; + if (lib.config.cards.includes("yingbian")) { + load_cards = true; + lib.config.cards.remove("standard"); + lib.config.cards.remove("extra"); + game.saveConfig("cards", lib.config.cards); + } + if (!lib.config.connect_cards.includes("yingbian")) { + load_cards = true; + lib.config.connect_cards.add("standard"); + lib.config.connect_cards.add("extra"); + game.saveConfig("connect_cards", lib.config.connect_cards); + } + if (load_cards) { + let add_deleted_yinbian_card_pile = { + name:'add_deleted_yinbian_card_pile', + connect:true, + card:{ + }, + skill:{ + }, + translate:{ + }, + list:[], + } + add_deleted_yinbian_card_pile.list=[ + ["heart", 2, "huogong"], + ["heart", 3, "huogong"], + ["diamond", 12, "huogong"], + ["diamond", 1, "zhuque"], + ["club", 1, "baiyin"], + ["diamond", 12, "fangtian"], + ["heart", 7, "wuzhong"], + ["heart", 8, "wuzhong"], + ["heart", 9, "wuzhong"], + ["heart", 11, "wuzhong"], + ["club", 12, "jiedao"], + ["club", 13, "jiedao"], + ["spade", 2, "hanbing"], + ]; + game.import('card',function(lib,game,ui,get,ai,_status){ + return add_deleted_yinbian_card_pile; + }); + lib.translate['add_deleted_yinbian_card_pile_card_config']='补应变卡'; + lib.config.all.cards.push('add_deleted_yinbian_card_pile'); + if(!lib.config.cards.includes('add_deleted_yinbian_card_pile')) lib.config.cards.push('add_deleted_yinbian_card_pile'); + } +},help:{},config:{},package:{ + character:{ + character:{ + }, + translate:{ + }, + }, + card:{ + card:{ + }, + translate:{ + }, + list:[], + }, + skill:{ + skill:{ + }, + translate:{ + }, + }, + intro:"若应变卡牌包开启,补充应变篇卡牌包删除的卡牌(标准卡牌包、军争卡牌包。此扩展会关闭单人及联机模式的标准卡牌包和军争卡牌包,重启生效)。", + author:"", + diskURL:"", + forumURL:"", + version:"0.1", +},files:{"character":[],"card":[],"skill":[]},editable:false}}) \ No newline at end of file diff --git a/game/source.js b/game/source.js index 943b093731..bd42e3be4a 100644 --- a/game/source.js +++ b/game/source.js @@ -649,6 +649,7 @@ window.noname_source_list = [ "extension/十周年UI/skill.js", "extension/十周年UI/spine.js", "extension/挑战卡牌/extension.js", + "extension/补应变卡/extension.js", "extension/MVP扩展/extension.css", "extension/MVP扩展/extension.js", ]; diff --git a/layout/others/dialog.css b/layout/others/dialog.css index b06637a564..6056fd6e4a 100644 --- a/layout/others/dialog.css +++ b/layout/others/dialog.css @@ -1,3 +1,7 @@ +:root { + --tip-display: none; +} + /* addNewRow的对话框的样式 */ .dialog.addNewRow { --bgColor: #2f2f3557; @@ -89,7 +93,8 @@ } .popupContainer.deckMonitor .deckMonitor { - --bgColor: rgb(87 151 164); + --bgColor: #45362c; + border: 3px solid rgb(213 194 179); width: 80%; height: 75%; background-color: var(--bgColor); @@ -129,7 +134,8 @@ bottom: 0%; display: flex; justify-content: space-between; - background: #59bac4; + background: #45362c; + border: 2px solid #594d41; padding: 5px; box-sizing: border-box; /* 滚动方案开启,压缩方案关闭 */ @@ -141,7 +147,7 @@ } .popupContainer.deckMonitor .deckMonitor .contentContainer .columnContainer { - background-color: #9137c0; + background-color: #c2b597; height: 100%; flex-grow: 1; flex-shrink: 1; @@ -159,12 +165,13 @@ .popupContainer.deckMonitor .deckMonitor .contentContainer .columnContainer .subtitle { width: 100%; text-align: center; + color: black; flex-grow: 0; height: 10%; display: flex; justify-content: center; align-items: center; - font-size: 1.2em; + font-size: 1.3em; flex-shrink: 0; overflow: scroll; } @@ -189,7 +196,7 @@ .popupContainer.deckMonitor .deckMonitor .contentContainer .columnContainer .itemContainer .item { - background-color: #2f2e2e; + background-color: #45362c; display: flex; width: 96%; margin-top: 4px; @@ -244,7 +251,7 @@ width: 100%; bottom: max(48%, var(--bottom, 46%)); height: fit-content; - display: flex; + display: var(--tip-display); flex-flow: column nowrap; justify-content: flex-start; z-index: 2; diff --git a/noname/library/index.js b/noname/library/index.js index 9e8e49edf2..7ddb672961 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -4170,15 +4170,7 @@ export class Library { unfrequent: true, onclick(bool) { game.saveConfig("show_tip", bool); - if (lib.config.show_tip) { - game.css({ - ".tipContainer": { - display: "flex !important", - }, - }); - } else { - game.css({ ".tipContainer": { display: "none !important" } }); - } + document.documentElement.style.setProperty("--tip-display", bool ? "flex" : "none"); }, }, show_deckMonitor: { @@ -12309,6 +12301,15 @@ export class Library { cardPile = {}; message = { server: { + cardPile() { + this.send(JSON.stringify({ + type: "cardPile", + data: { + drawPile: Array.from(ui.cardPile.children), + discardPile: Array.from(ui.discardPile.children) + } + })); + }, /** * @this {import("./element/client.js").Client} */ diff --git a/noname/ui/create/index.js b/noname/ui/create/index.js index bc1a667d7c..ce769033db 100644 --- a/noname/ui/create/index.js +++ b/noname/ui/create/index.js @@ -2356,11 +2356,41 @@ export class Create { //------添加记牌器 by Curpond------- ui.deckMonitor = ui.create.system( "记牌器", - function () { + async function () { + function getResult() { + return new Promise((resolve, reject) => { + if (game.online) { + try { + game.ws.send(JSON.stringify(['cardPile'])); + game.ws.addEventListener('message', function (e) { + let data = JSON.parse(JSON.parse(e.data)[0]); + if (data.type == 'cardPile') { + resolve(data.data); + } + }, { once: true }); + + } catch (error) { + resolve(false); + } + + + } else { + resolve({ + drawPile: ui.cardPile.children, + discardPile: ui.discardPile.children + }); + } + }); + + } if (!_status.gameStarted) return; game.pause2(); - let drawPile = ui.cardPile.children; - let discardPile = ui.discardPile.children; + + let result = await getResult(); + if (!result) return; + let drawPile = result.drawPile; + let discardPile = result.discardPile; + let popupContainer = ui.create.div(".popupContainer.deckMonitor", ui.window, function () { this.delete(400); game.resume2(); @@ -2487,6 +2517,16 @@ export class Create { true, true ); + + lib.arenaReady?.push(function () { + if (lib.config.show_deckMonitor) { + ui.deckMonitor.style.display = ""; + } else { + ui.deckMonitor.style.display = "none"; + } + document.documentElement.style.setProperty("--tip-display", lib.config.show_tip ? "flex" : "none"); + }); + //--------------------------------- ui.playerids = ui.create.system( "显示身份", @@ -2671,6 +2711,7 @@ export class Create { ['十周年UI', true], ['挑战卡牌', true], ['MVP扩展', true], + ['补应变卡', true], ]; var need_reload=false; for(var i=0;i