* 拼点牌套壳虚拟牌;
* 修复展示牌相关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 string ladyImg
property real bgmVolume property real bgmVolume
property bool disableMsgAudio property bool disableMsgAudio
property bool hideUseless
property var disabledGenerals: [] property var disabledGenerals: []
property int preferredTimeout property int preferredTimeout
@ -60,6 +61,7 @@ QtObject {
Backend.volume = conf.effectVolume ?? 50.; Backend.volume = conf.effectVolume ?? 50.;
bgmVolume = conf.bgmVolume ?? 50.; bgmVolume = conf.bgmVolume ?? 50.;
disableMsgAudio = conf.disableMsgAudio ?? false; disableMsgAudio = conf.disableMsgAudio ?? false;
hideUseless = conf.hideUseless ?? false;
preferredTimeout = conf.preferredTimeout ?? 15; preferredTimeout = conf.preferredTimeout ?? 15;
preferredLuckTime = conf.preferredLuckTime ?? 0; preferredLuckTime = conf.preferredLuckTime ?? 0;
disabledGenerals = conf.disabledGenerals ?? []; disabledGenerals = conf.disabledGenerals ?? [];
@ -84,6 +86,7 @@ QtObject {
conf.effectVolume = Backend.volume; conf.effectVolume = Backend.volume;
conf.bgmVolume = bgmVolume; conf.bgmVolume = bgmVolume;
conf.disableMsgAudio = disableMsgAudio; conf.disableMsgAudio = disableMsgAudio;
conf.hideUseless = hideUseless;
conf.preferredTimeout = preferredTimeout; conf.preferredTimeout = preferredTimeout;
conf.preferredLuckTime = preferredLuckTime; conf.preferredLuckTime = preferredLuckTime;
conf.disabledGenerals = disabledGenerals; conf.disabledGenerals = disabledGenerals;

View File

@ -38,4 +38,13 @@ ColumnLayout {
checked: config.disableMsgAudio checked: config.disableMsgAudio
onCheckedChanged: config.disableMsgAudio = checked; 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 anchors.bottom: parent.bottom
ColumnLayout { ColumnLayout {
MetroButton { MetroButton {
text: Backend.translate("Trust") text: Backend.translate("Revert Selection")
enabled: dashboard.pending_skill !== ""
onClicked: dashboard.revertSelection();
} }
// MetroButton {
// text: Backend.translate("Trust")
// }
MetroButton { MetroButton {
text: Backend.translate("Sort Cards") text: Backend.translate("Sort Cards")
} }

View File

@ -23,8 +23,8 @@ Item {
function remove(outputs) function remove(outputs)
{ {
let result = []; 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) { if (outputs[j] === cards[i].cid) {
const state = JSON.parse(Backend.callLuaFunction("GetCardData", [cards[i].cid])); const state = JSON.parse(Backend.callLuaFunction("GetCardData", [cards[i].cid]));
cards[i].setData(state); 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() { function getSelectedCard() {
if (pending_skill !== "") { if (pending_skill !== "") {
return JSON.stringify({ return JSON.stringify({

View File

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

View File

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

View File

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