* 拼点牌套壳虚拟牌;
* 修复展示牌相关bug
* 反选!
* 不可用的手牌暂且下移
This commit is contained in:
notify 2023-06-24 14:48:49 +08:00 committed by GitHub
parent f7f1bb8537
commit 37757abbad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 62 additions and 18 deletions

View File

@ -22,6 +22,7 @@ QtObject {
property string ladyImg
property real bgmVolume
property bool disableMsgAudio
property bool hideUseless
property var disabledGenerals: []
property int preferredTimeout
@ -60,6 +61,7 @@ QtObject {
Backend.volume = conf.effectVolume ?? 50.;
bgmVolume = conf.bgmVolume ?? 50.;
disableMsgAudio = conf.disableMsgAudio ?? false;
hideUseless = conf.hideUseless ?? false;
preferredTimeout = conf.preferredTimeout ?? 15;
preferredLuckTime = conf.preferredLuckTime ?? 0;
disabledGenerals = conf.disabledGenerals ?? [];
@ -84,6 +86,7 @@ QtObject {
conf.effectVolume = Backend.volume;
conf.bgmVolume = bgmVolume;
conf.disableMsgAudio = disableMsgAudio;
conf.hideUseless = hideUseless;
conf.preferredTimeout = preferredTimeout;
conf.preferredLuckTime = preferredLuckTime;
conf.disabledGenerals = disabledGenerals;

View File

@ -38,4 +38,13 @@ ColumnLayout {
checked: config.disableMsgAudio
onCheckedChanged: config.disableMsgAudio = checked;
}
Switch {
text: Backend.translate("Hide unselectable cards")
checked: config.hideUseless
onCheckedChanged: {
config.hideUseless = checked;
}
}
}

View File

@ -300,8 +300,13 @@ Item {
anchors.bottom: parent.bottom
ColumnLayout {
MetroButton {
text: Backend.translate("Trust")
text: Backend.translate("Revert Selection")
enabled: dashboard.pending_skill !== ""
onClicked: dashboard.revertSelection();
}
// MetroButton {
// text: Backend.translate("Trust")
// }
MetroButton {
text: Backend.translate("Sort Cards")
}

View File

@ -23,8 +23,8 @@ Item {
function remove(outputs)
{
let result = [];
for (let i = 0; i < cards.length; i++) {
for (let j = 0; j < outputs.length; j++) {
for (let j = 0; j < outputs.length; j++) {
for (let i = cards.length - 1; i >= 0; i--) {
if (outputs[j] === cards[i].cid) {
const state = JSON.parse(Backend.callLuaFunction("GetCardData", [cards[i].cid]));
cards[i].setData(state);

View File

@ -240,6 +240,26 @@ RowLayout {
}
}
function revertSelection() {
if (pending_skill !== "") {
let to_select_cards = handcardAreaItem.cards.filter(cd => {
if (pendings.indexOf(cd.cid) === -1) {
return true;
} else {
cd.selected = !cd.selected;
cd.clicked();
}
});
to_select_cards.forEach(cd => {
if (cd.selectable) {
cd.selected = !cd.selected;
cd.clicked();
}
});
}
}
function getSelectedCard() {
if (pending_skill !== "") {
return JSON.stringify({

View File

@ -55,30 +55,33 @@ Item {
function enableCards(cardIds)
{
let card, i;
for (i = 0; i < cards.length; i++) {
card = cards[i];
cards.forEach(card => {
card.selectable = cardIds.contains(card.cid);
if (!card.selectable) {
card.selected = false;
unselectCard(card);
}
}
});
updateCardPosition(true);
}
function updateCardPosition(animated)
{
cardArea.updateCardPosition(false);
let i, card;
for (i = 0; i < cards.length; i++) {
card = cards[i];
if (card.selected)
cards.forEach(card => {
if (card.selected) {
card.origY -= 20;
}
}
if (!card.selectable) {
if (config.hideUseless) {
card.origY += 60;
}
}
});
if (animated) {
for (i = 0; i < cards.length; i++)
cards[i].goBack(true)
cards.forEach(card => card.goBack(true));
}
}

View File

@ -23,6 +23,7 @@ Fk:loadTranslationTable{
["BG Settings"] = "游戏背景",
["Audio Settings"] = "音频",
["Disable message audio"] = "禁用聊天语音",
["Hide unselectable cards"] = "下移不可选卡牌",
["Back"] = "返回",
["Create Room"] = "创建房间",

View File

@ -41,14 +41,17 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
local moveInfos = {}
for _, p in ipairs(targets) do
local pindianCard
local _pindianCard
if p.reply_ready then
local replyCard = json.decode(p.client_reply).card
pindianCard = Fk:getCardById(json.decode(replyCard).subcards[1])
_pindianCard = Fk:getCardById(json.decode(replyCard).subcards[1])
else
pindianCard = Fk:getCardById(p:getCardIds(Player.Hand)[1])
_pindianCard = Fk:getCardById(p:getCardIds(Player.Hand)[1])
end
local pindianCard = _pindianCard:clone(_pindianCard.suit, _pindianCard.number)
pindianCard:addSubcard(_pindianCard.id)
if p == pindianData.from then
pindianData.fromCard = pindianCard
else
@ -57,7 +60,7 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
end
table.insert(moveInfos, {
ids = { pindianCard.id },
ids = { _pindianCard.id },
from = p.id,
toArea = Card.Processing,
moveReason = fk.ReasonPut,
@ -68,7 +71,7 @@ GameEvent.functions[GameEvent.Pindian] = function(self)
room:sendLog{
type = "#ShowPindianCard",
from = p.id,
card = { pindianCard.id },
card = { _pindianCard.id },
}
end