使用game.addCardPack添加卡牌包时,可以使用closeable:true选项,令此卡牌包可以被关闭
This commit is contained in:
parent
10888caac1
commit
6ed9888486
|
@ -4482,6 +4482,7 @@ export class Game extends Uninstantable {
|
|||
packagename = packagename || extname;
|
||||
let packname = 'mode_extension_' + packagename;
|
||||
lib.cardPack[packname] = [];
|
||||
lib.cardPackInfo[packname] = pack;
|
||||
lib.translate[packname + '_card_config'] = packagename;
|
||||
for (let i in pack) {
|
||||
if (i == 'mode' || i == 'forbid') continue;
|
||||
|
|
|
@ -81,6 +81,7 @@ export class Library extends Uninstantable {
|
|||
return Reflect.set(target, prop, newValue);
|
||||
}
|
||||
});
|
||||
static cardPackInfo = {};
|
||||
/**
|
||||
* @type { SMap<number> }
|
||||
*/
|
||||
|
|
|
@ -164,6 +164,7 @@ export const cardPackMenu = function (connectMenu) {
|
|||
|
||||
var createModeConfig = function (mode, position) {
|
||||
var info = lib.cardPack[mode];
|
||||
let cardPack = lib.cardPackInfo[mode];
|
||||
var page = ui.create.div('');
|
||||
var node = ui.create.div('.menubutton.large', lib.translate[mode + '_card_config'], position, clickMode);
|
||||
if (node.innerHTML.length >= 5) {
|
||||
|
@ -237,7 +238,7 @@ export const cardPackMenu = function (connectMenu) {
|
|||
})(),
|
||||
onclick: togglePack
|
||||
});
|
||||
if (!mode.startsWith('mode_')) {
|
||||
if (!mode.startsWith('mode_') || (cardPack && cardPack.closeable)) {
|
||||
page.appendChild(cfgnode);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue