mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
e8aacf1888
1. 新增隐藏礼物选项
2. 无效技能ui显示🔒
3. 过期房间字符串显示删除线
5. 按钮键长按查看技能详情
6. 筛选房间功能
7. “禁用lua扩展”禁用
8. 调整服务器“从收藏移除”的ui,改为三点展开
9. 调整红温缩进
10. 房间内限制玩家名称长度(自己除外)
11. 玩家详情显示判定区
12. 房间内一览
13. 武将一览语音键增加按钮复制代码与文本(长按复制代码),悬停显示
14. 手牌排序多选:(默认)类型、点数、花色
15. 技能次数提示,指定为正数或0显示
16. 修复ArrangeCardsBox的报错
17. 手牌拖拽排序
18. 武将技能按顺序添加
229 lines
5.4 KiB
QML
229 lines
5.4 KiB
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Fk.Common
|
|
import Fk.Pages
|
|
import Fk.RoomElement
|
|
|
|
Flickable {
|
|
id: root
|
|
anchors.fill: parent
|
|
property var extra_data: ({})
|
|
property int pid
|
|
|
|
signal finish()
|
|
|
|
contentHeight: details.height
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
ColumnLayout {
|
|
id: details
|
|
width: parent.width - 40
|
|
x: 20
|
|
|
|
RowLayout {
|
|
spacing: 8
|
|
Avatar {
|
|
id: avatar
|
|
Layout.preferredWidth: 56
|
|
Layout.preferredHeight: 56
|
|
general: "diaochan"
|
|
}
|
|
|
|
ColumnLayout {
|
|
Text {
|
|
id: screenName
|
|
font.pixelSize: 18
|
|
color: "#E4D5A0"
|
|
}
|
|
|
|
Text {
|
|
id: playerGameData
|
|
Layout.fillWidth: true
|
|
font.pixelSize: 18
|
|
color: "#E4D5A0"
|
|
}
|
|
}
|
|
}
|
|
|
|
RowLayout {
|
|
MetroButton {
|
|
text: luatr("Give Flower")
|
|
onClicked: {
|
|
enabled = false;
|
|
root.givePresent("Flower");
|
|
root.finish();
|
|
}
|
|
}
|
|
|
|
MetroButton {
|
|
text: luatr("Give Egg")
|
|
onClicked: {
|
|
enabled = false;
|
|
if (Math.random() < 0.03) {
|
|
root.givePresent("GiantEgg");
|
|
} else {
|
|
root.givePresent("Egg");
|
|
}
|
|
root.finish();
|
|
}
|
|
}
|
|
|
|
MetroButton {
|
|
text: luatr("Give Wine")
|
|
enabled: Math.random() < 0.3
|
|
onClicked: {
|
|
enabled = false;
|
|
root.givePresent("Wine");
|
|
root.finish();
|
|
}
|
|
}
|
|
|
|
MetroButton {
|
|
text: luatr("Give Shoe")
|
|
enabled: Math.random() < 0.3
|
|
onClicked: {
|
|
enabled = false;
|
|
root.givePresent("Shoe");
|
|
root.finish();
|
|
}
|
|
}
|
|
|
|
MetroButton {
|
|
text: {
|
|
const name = extra_data?.photo?.screenName;
|
|
const blocked = !config.blockedUsers.includes(name);
|
|
return blocked ? luatr("Block Chatter") : luatr("Unblock Chatter");
|
|
}
|
|
enabled: pid !== Self.id && pid > 0
|
|
onClicked: {
|
|
const name = extra_data?.photo?.screenName;
|
|
const idx = config.blockedUsers.indexOf(name);
|
|
if (idx === -1) {
|
|
config.blockedUsers.push(name);
|
|
} else {
|
|
config.blockedUsers.splice(idx, 1);
|
|
}
|
|
config.blockedUsersChanged();
|
|
}
|
|
}
|
|
|
|
MetroButton {
|
|
text: luatr("Kick From Room")
|
|
visible: !roomScene.isStarted && roomScene.isOwner
|
|
enabled: pid !== Self.id
|
|
onClicked: {
|
|
ClientInstance.notifyServer("KickPlayer", pid.toString());
|
|
root.finish();
|
|
}
|
|
}
|
|
}
|
|
|
|
RowLayout {
|
|
spacing: 20
|
|
ColumnLayout {
|
|
Layout.alignment: Qt.AlignTop
|
|
Layout.topMargin: 16
|
|
|
|
GeneralCardItem {
|
|
id: mainChara
|
|
name: "caocao"
|
|
visible: name !== ""
|
|
}
|
|
GeneralCardItem {
|
|
id: deputyChara
|
|
name: "caocao"
|
|
visible: name !== ""
|
|
}
|
|
}
|
|
|
|
TextEdit {
|
|
id: skillDesc
|
|
|
|
Layout.fillWidth: true
|
|
Layout.alignment: Qt.AlignTop
|
|
Layout.topMargin: 10
|
|
font.pixelSize: 18
|
|
color: "#E4D5A0"
|
|
|
|
readOnly: true
|
|
selectByKeyboard: true
|
|
selectByMouse: false
|
|
wrapMode: TextEdit.WordWrap
|
|
textFormat: TextEdit.RichText
|
|
}
|
|
}
|
|
}
|
|
|
|
function givePresent(p) {
|
|
ClientInstance.notifyServer(
|
|
"Chat",
|
|
JSON.stringify({
|
|
type: 2,
|
|
msg: "$!" + p + ":" + pid
|
|
})
|
|
);
|
|
}
|
|
|
|
onExtra_dataChanged: {
|
|
if (!extra_data.photo) return;
|
|
screenName.text = "";
|
|
playerGameData.text = "";
|
|
skillDesc.text = "";
|
|
|
|
const id = extra_data.photo.playerid;
|
|
if (id === 0) return;
|
|
root.pid = id;
|
|
|
|
avatar.general = extra_data.photo.avatar;
|
|
screenName.text = extra_data.photo.screenName;
|
|
mainChara.name = extra_data.photo.general;
|
|
deputyChara.name = extra_data.photo.deputyGeneral;
|
|
|
|
if (!config.observing) {
|
|
const gamedata = lcall("GetPlayerGameData", id);
|
|
const total = gamedata[0];
|
|
const win = gamedata[1];
|
|
const run = gamedata[2];
|
|
const totalTime = gamedata[3];
|
|
const winRate = (win / total) * 100;
|
|
const runRate = (run / total) * 100;
|
|
playerGameData.text = total === 0 ? luatr("Newbie") :
|
|
luatr("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2))
|
|
.arg(runRate.toFixed(2)).arg(total);
|
|
|
|
const h = (totalTime / 3600).toFixed(2);
|
|
const m = Math.floor(totalTime / 60);
|
|
if (m < 100) {
|
|
screenName.text += " (" + luatr("TotalGameTime: %1 min").arg(m) + ")";
|
|
} else {
|
|
screenName.text += " (" + luatr("TotalGameTime: %1 h").arg(h) + ")";
|
|
}
|
|
}
|
|
|
|
lcall("GetPlayerSkills", id).forEach(t => {
|
|
skillDesc.append("<b>" + luatr(t.name) + "</b>: " + t.description)
|
|
});
|
|
|
|
lcall("GetPlayerEquips", id).forEach(cid => {
|
|
const t = lcall("GetCardData", cid);
|
|
skillDesc.append("--------------------");
|
|
skillDesc.append("<b>" + luatr(t.name) + "</b>: " + luatr(":" + t.name));
|
|
});
|
|
|
|
const judge = leval(
|
|
`(function()
|
|
local p = ClientInstance:getPlayerById(${id})
|
|
return p.player_cards[Player.Judge]
|
|
end)()`
|
|
);
|
|
judge.forEach(cid => {
|
|
const t = lcall("GetCardData", cid);
|
|
skillDesc.append("--------------------");
|
|
skillDesc.append("<b>" + luatr(t.name) + "</b>: " + luatr(":" + t.name));
|
|
});
|
|
}
|
|
}
|