mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-15 19:22:25 +08:00
bugfix (#225)
- 修双头武将的双将和头像 - 修客户端不知道别人阶段 - 修出牌高亮 - 修无懈响应不准 - 以&结尾的牌堆如手牌使用打出
This commit is contained in:
parent
adafcfbae1
commit
620780ac08
|
@ -23,10 +23,10 @@ Item {
|
|||
Image {
|
||||
Layout.preferredWidth: 64
|
||||
Layout.preferredHeight: 64
|
||||
source: SkinBank.getGeneralPicture(Self.avatar)
|
||||
sourceSize.width: 250
|
||||
sourceSize.height: 292
|
||||
sourceClipRect: Qt.rect(61, 0, 128, 128)
|
||||
source: SkinBank.getGeneralExtraPic(Self.avatar, "avatar/") ?? SkinBank.getGeneralPicture(Self.avatar)
|
||||
// sourceSize.width: 250
|
||||
// sourceSize.height: 292
|
||||
sourceClipRect: sourceSize.width > 200 ? Qt.rect(61, 0, 128, 128) : undefined
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -661,6 +661,11 @@ callbacks["PropertyUpdate"] = (jsonData) => {
|
|||
if (typeof(model) !== "undefined") {
|
||||
model[property_name] = value;
|
||||
}
|
||||
|
||||
if (property_name === "phase") {
|
||||
let item = getPhoto(uid);
|
||||
item.playing = value < 8; // Player.NotActive
|
||||
}
|
||||
}
|
||||
|
||||
callbacks["UpdateCard"] = (j) => {
|
||||
|
@ -748,6 +753,7 @@ callbacks["MoveFocus"] = (jsonData) => {
|
|||
item.progressTip = Backend.translate(command)
|
||||
+ Backend.translate(" thinking...");
|
||||
|
||||
/*
|
||||
if (command === "PlayCard") {
|
||||
item.playing = true;
|
||||
}
|
||||
|
@ -756,6 +762,7 @@ callbacks["MoveFocus"] = (jsonData) => {
|
|||
if (command === "PlayCard") {
|
||||
item.playing = false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,12 @@ RowLayout {
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const pile_data = JSON.parse(Backend.callLuaFunction("GetAllPiles", [self.playerid]));
|
||||
for (let name in pile_data) {
|
||||
if (name.endsWith("&")) expandPile(name);
|
||||
}
|
||||
|
||||
if (cname) {
|
||||
const ids = [];
|
||||
let cards = handcardAreaItem.cards;
|
||||
|
@ -178,7 +184,6 @@ RowLayout {
|
|||
|
||||
// Must manually analyze pattern here
|
||||
let pile_list = cname.split("|")[4];
|
||||
const pile_data = JSON.parse(Backend.callLuaFunction("GetAllPiles", [self.playerid]));
|
||||
if (pile_list && pile_list !== "." && !(pile_data instanceof Array)) {
|
||||
pile_list = pile_list.split(",");
|
||||
for (let pile_name of pile_list) {
|
||||
|
|
|
@ -177,7 +177,16 @@ Item {
|
|||
height: parent.height
|
||||
smooth: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: (general != "") ? SkinBank.getGeneralPicture(general) : ""
|
||||
source: {
|
||||
if (general === "") {
|
||||
return "";
|
||||
}
|
||||
if (deputyGeneral) {
|
||||
return SkinBank.getGeneralExtraPic(general, "dual/") ?? SkinBank.getGeneralPicture(general);
|
||||
} else {
|
||||
return SkinBank.getGeneralPicture(general)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
|
@ -187,8 +196,14 @@ Item {
|
|||
height: parent.height
|
||||
smooth: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: (deputyGeneral != "") ?
|
||||
SkinBank.getGeneralPicture(deputyGeneral) : ""
|
||||
source: {
|
||||
const general = deputyGeneral;
|
||||
if (deputyGeneral != "") {
|
||||
return SkinBank.getGeneralExtraPic(general, "dual/") ?? SkinBank.getGeneralPicture(general);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
|
|
|
@ -19,6 +19,15 @@ var PIXANIM_DIR = AppPath + "/image/anim/"
|
|||
var TILE_ICON_DIR = AppPath + "/image/button/tileicon/"
|
||||
var LOBBY_IMG_DIR = AppPath + "/image/lobby/";
|
||||
|
||||
function getGeneralExtraPic(name, extra) {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
const extension = data.extension;
|
||||
const path = AppPath + "/packages/" + extension + "/image/generals/" + extra + name + ".jpg";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
function getGeneralPicture(name) {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
const extension = data.extension;
|
||||
|
|
|
@ -352,6 +352,18 @@ function Player:getPileNameOfId(id)
|
|||
end
|
||||
end
|
||||
|
||||
--- 返回所有“如手牌般使用或打出”的牌。
|
||||
--- 或者说,返回所有名字以“&”结尾的pile的牌。
|
||||
---@param include_hand boolean|nil @ 是否包含真正的手牌
|
||||
---@return integer[]
|
||||
function Player:getHandlyIds(include_hand)
|
||||
local ret = include_hand and self:getCardIds("h") or {}
|
||||
for k, v in pairs(self.special_cards) do
|
||||
if k:endsWith("&") then table.insertTable(ret, v) end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
-- for fkp only
|
||||
function Player:getHandcardNum()
|
||||
return #self:getCardIds(Player.Hand)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
local Util = {}
|
||||
Util.DummyFunc = function() end
|
||||
Util.TrueFunc = function() return true end
|
||||
Util.FalseFunc = function() return false end
|
||||
Util.DummyTable = setmetatable({}, {
|
||||
__newindex = function() error("Cannot assign to dummy table") end
|
||||
})
|
||||
|
|
|
@ -227,7 +227,7 @@ GameEvent.cleaners[GameEvent.Turn] = function(self)
|
|||
logic:trigger(fk.EventPhaseEnd, current, nil, true)
|
||||
|
||||
current.phase = Player.NotActive
|
||||
room:notifyProperty(current, current, "phase")
|
||||
room:broadcastProperty(current, "phase")
|
||||
logic:trigger(fk.EventPhaseChanging, current,
|
||||
{ from = Player.Finish, to = Player.NotActive }, true)
|
||||
logic:trigger(fk.EventPhaseStart, current, nil, true)
|
||||
|
|
|
@ -175,6 +175,13 @@ function Room:isReady()
|
|||
p._splayer:setThinking(false)
|
||||
end
|
||||
end
|
||||
|
||||
if self.race_request_list and table.contains(self.race_request_list, p) then
|
||||
local result = p.serverplayer:waitForReply(0)
|
||||
if result ~= "__notready" and result ~= "__cancel" and result ~= "" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return ret, (rest and rest > 1) and rest or nil
|
||||
end
|
||||
|
@ -645,6 +652,7 @@ end
|
|||
function Room:doRequest(player, command, jsonData, wait)
|
||||
if wait == nil then wait = true end
|
||||
self.request_queue = {}
|
||||
self.race_request_list = nil
|
||||
player:doRequest(command, jsonData, self.timeout)
|
||||
|
||||
if wait then
|
||||
|
@ -662,6 +670,7 @@ end
|
|||
function Room:doBroadcastRequest(command, players, jsonData)
|
||||
players = players or self.players
|
||||
self.request_queue = {}
|
||||
self.race_request_list = nil
|
||||
for _, p in ipairs(players) do
|
||||
p:doRequest(command, jsonData or p.request_data)
|
||||
end
|
||||
|
@ -695,6 +704,7 @@ function Room:doRaceRequest(command, players, jsonData)
|
|||
local player_len = #players
|
||||
-- self:notifyMoveFocus(players, command)
|
||||
self.request_queue = {}
|
||||
self.race_request_list = players
|
||||
for _, p in ipairs(players) do
|
||||
p:doRequest(command, jsonData or p.request_data)
|
||||
end
|
||||
|
|
|
@ -402,7 +402,7 @@ function ServerPlayer:changePhase(from_phase, to_phase)
|
|||
end
|
||||
|
||||
self.phase = to_phase
|
||||
room:notifyProperty(self, self, "phase")
|
||||
room:broadcastProperty(self, "phase")
|
||||
|
||||
if #self.phases > 0 then
|
||||
table.remove(self.phases, 1)
|
||||
|
@ -427,7 +427,7 @@ function ServerPlayer:gainAnExtraPhase(phase, delay)
|
|||
|
||||
local current = self.phase
|
||||
self.phase = phase
|
||||
room:notifyProperty(self, self, "phase")
|
||||
room:broadcastProperty(self, "phase")
|
||||
|
||||
room:sendLog{
|
||||
type = "#GainAnExtraPhase",
|
||||
|
@ -439,7 +439,7 @@ function ServerPlayer:gainAnExtraPhase(phase, delay)
|
|||
GameEvent(GameEvent.Phase, self):exec()
|
||||
|
||||
self.phase = current
|
||||
room:notifyProperty(self, self, "phase")
|
||||
room:broadcastProperty(self, "phase")
|
||||
end
|
||||
|
||||
---@param phase_table Phase[]|nil
|
||||
|
@ -494,7 +494,7 @@ function ServerPlayer:play(phase_table)
|
|||
phase_state[i].phase = phases[i]
|
||||
|
||||
self.phase = phases[i]
|
||||
room:notifyProperty(self, self, "phase")
|
||||
room:broadcastProperty(self, "phase")
|
||||
|
||||
local cancel_skip = true
|
||||
if phases[i] ~= Player.NotActive and (skip) then
|
||||
|
|
Loading…
Reference in New Issue
Block a user