Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
1. Add an extension.
2. Merge pull request libnoname#2067, libnoname#2068, libnoname#2069 from PR-branch.
  • Loading branch information
adeFuLoDgu committed Nov 1, 2024
1 parent c7d38d8 commit 5691fc1
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 18 deletions.
75 changes: 75 additions & 0 deletions extension/补应变卡/extension.js
Original file line number Diff line number Diff line change
@@ -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}})
1 change: 1 addition & 0 deletions game/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
];
19 changes: 13 additions & 6 deletions layout/others/dialog.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
:root {
--tip-display: none;
}

/* addNewRow的对话框的样式 */
.dialog.addNewRow {
--bgColor: #2f2f3557;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
/* 滚动方案开启,压缩方案关闭 */
Expand All @@ -141,7 +147,7 @@
}

.popupContainer.deckMonitor .deckMonitor .contentContainer .columnContainer {
background-color: #9137c0;
background-color: #c2b597;
height: 100%;
flex-grow: 1;
flex-shrink: 1;
Expand All @@ -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;
}
Expand All @@ -189,7 +196,7 @@

.popupContainer.deckMonitor .deckMonitor .contentContainer .columnContainer .itemContainer .item {

background-color: #2f2e2e;
background-color: #45362c;
display: flex;
width: 96%;
margin-top: 4px;
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 10 additions & 9 deletions noname/library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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}
*/
Expand Down
47 changes: 44 additions & 3 deletions noname/ui/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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(
"显示身份",
Expand Down Expand Up @@ -2671,6 +2711,7 @@ export class Create {
['十周年UI', true],
['挑战卡牌', true],
['MVP扩展', true],
['补应变卡', true],
];
var need_reload=false;
for(var i=0;i<addtional_extention_names.length;i++){
Expand Down

0 comments on commit 5691fc1

Please sign in to comment.