* 修复录像可见性问题 并增加查看未知牌功能
* 给qml绑定上role_shown属性,以便更新
* 修复从非隐藏卡牌区域删除卡牌时卡牌的known不受moveData干涉
* 给askForCardChosen和poxi贴了个visible_data
* 修复捡垃圾会导致手牌重复触发onClicked
This commit is contained in:
notify 2024-10-25 23:13:05 +08:00 committed by GitHub
parent 3e75096e22
commit dedf769e97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 35 additions and 4 deletions

View File

@ -153,6 +153,14 @@ Flickable {
selectByMouse: false selectByMouse: false
wrapMode: TextEdit.WordWrap wrapMode: TextEdit.WordWrap
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
onLinkActivated: (link) => {
if (link === "back") {
text = savedtext.pop();
} else {
savedtext.push(text);
text = '<a href="back">点击返回</a><br>' + luatr(link);
}
}
} }
} }
} }

View File

@ -60,11 +60,13 @@ QtObject {
property bool enableFreeAssign: false property bool enableFreeAssign: false
property bool observing: false property bool observing: false
property bool replaying: false property bool replaying: false
property bool replayingShowCards: false
property list<string> blockedUsers: [] property list<string> blockedUsers: []
property int totalTime: 0 // FIXME: only for notifying property int totalTime: 0 // FIXME: only for notifying
onObservingChanged: lcall("SetObserving", observing); onObservingChanged: lcall("SetObserving", observing);
//onReplayingChanged: lcall("SetReplaying", replaying); onReplayingChanged: lcall("SetReplaying", replaying);
onReplayingShowCardsChanged: lcall("SetReplayingShowCards", replayingShowCards);
// onDisabledGeneralsChanged: { // onDisabledGeneralsChanged: {
// disableGeneralSchemes[disableSchemeIdx] = disabledGenerals; // disableGeneralSchemes[disableSchemeIdx] = disabledGenerals;

View File

@ -396,6 +396,7 @@ Item {
deputyGeneral: model.deputyGeneral deputyGeneral: model.deputyGeneral
screenName: model.screenName screenName: model.screenName
role: model.role role: model.role
role_shown: model.role_shown
kingdom: model.kingdom kingdom: model.kingdom
netstate: model.netstate netstate: model.netstate
maxHp: model.maxHp maxHp: model.maxHp
@ -588,6 +589,12 @@ Item {
} }
} }
Switch {
text: luatr("Show All Cards")
checked: config.replayingShowCards
onCheckedChanged: config.replayingShowCards = checked;
}
Switch { Switch {
text: luatr("Speed Resume") text: luatr("Speed Resume")
checked: false checked: false
@ -1396,6 +1403,7 @@ Item {
deputyGeneral: "", deputyGeneral: "",
screenName: i ? "" : Self.screenName, screenName: i ? "" : Self.screenName,
role: "unknown", role: "unknown",
role_shown: false,
kingdom: "unknown", kingdom: "unknown",
netstate: "online", netstate: "online",
maxHp: 0, maxHp: 0,

View File

@ -208,6 +208,7 @@ function moveCards(data) {
if (!from || !to || (from === to && move.fromArea !== Card.DiscardPile)) if (!from || !to || (from === to && move.fromArea !== Card.DiscardPile))
continue; continue;
const items = from.remove(move.ids, move.fromSpecialName, data); const items = from.remove(move.ids, move.fromSpecialName, data);
items.forEach((item) => item.known = !!data[item.cid.toString()]);
if (to === tablePile) { if (to === tablePile) {
let vanished = items.filter(c => c.cid === -1); let vanished = items.filter(c => c.cid === -1);
if (vanished.length > 0) { if (vanished.length > 0) {
@ -1019,6 +1020,7 @@ callbacks["AskForCardChosen"] = (data) => {
const box = roomScene.popupBox.item; const box = roomScene.popupBox.item;
box.prompt = prompt; box.prompt = prompt;
box.visible_data = data.visible_data ?? {};
for (let d of data.card_data) { for (let d of data.card_data) {
const arr = []; const arr = [];
const ids = d[1]; const ids = d[1];
@ -1053,6 +1055,7 @@ callbacks["AskForCardsChosen"] = (data) => {
box.min = min; box.min = min;
box.max = max; box.max = max;
box.prompt = prompt; box.prompt = prompt;
box.visible_data = data.visible_data ?? {};
for (let d of data.card_data) { for (let d of data.card_data) {
const arr = []; const arr = [];
const ids = d[1]; const ids = d[1];

View File

@ -49,7 +49,7 @@ Item {
card = result[i]; card = result[i];
card.draggable = false; card.draggable = false;
card.selectable = false; card.selectable = false;
card.clicked.connect(selectCard); card.clicked.disconnect(selectCard);
card.selectedChanged.disconnect(adjustCards); card.selectedChanged.disconnect(adjustCards);
card.released.disconnect(updateCardReleased); card.released.disconnect(updateCardReleased);
card.xChanged.disconnect(updateCardDragging); card.xChanged.disconnect(updateCardDragging);

View File

@ -18,6 +18,7 @@ Item {
property string deputyGeneral: "" property string deputyGeneral: ""
property string screenName: "" property string screenName: ""
property string role: "unknown" property string role: "unknown"
property bool role_shown: false
property string kingdom: "qun" property string kingdom: "qun"
property string netstate: "online" property string netstate: "online"
property alias handcards: handcardAreaItem.length property alias handcards: handcardAreaItem.length
@ -533,6 +534,7 @@ Item {
id: role id: role
value: { value: {
if (root.role === "hidden") return "hidden"; if (root.role === "hidden") return "hidden";
if (root.role_shown) return root.role;
lcall("RoleVisibility", root.playerid) ? root.role : "unknown"; lcall("RoleVisibility", root.playerid) ? root.role : "unknown";
} }
anchors.top: parent.top anchors.top: parent.top

View File

@ -25,6 +25,7 @@ GraphicsBox {
property int min: 0 property int min: 0
property int max: 1 property int max: 1
property var selected_ids: [] property var selected_ids: []
property var visible_data: ({})
ListModel { ListModel {
id: cardModel id: cardModel
@ -75,7 +76,10 @@ GraphicsBox {
suit: model.suit || "" suit: model.suit || ""
number: model.number || 0 number: model.number || 0
autoBack: false autoBack: false
known: model.known known: {
if (visible_data[cid.toString()] == false) return false;
return true;
}
selectable: true selectable: true
onClicked: { onClicked: {
if (!root.multiChoose) { if (!root.multiChoose) {

View File

@ -71,7 +71,11 @@ GraphicsBox {
suit: model.suit || "" suit: model.suit || ""
number: model.number || 0 number: model.number || 0
autoBack: false autoBack: false
known: model.known known: {
const visible_data = extra_data?.visible_data ?? {};
if (visible_data[cid.toString()] == false) return false;
return true;
}
selectable: chosenInBox || selectable: chosenInBox ||
lcall("PoxiFilter", root.poxi_type, model.cid, root.selected_ids, lcall("PoxiFilter", root.poxi_type, model.cid, root.selected_ids,
root.card_data, root.extra_data); root.card_data, root.extra_data);