Merge remote-tracking branch 'origin/master' into dev-YuQi
This commit is contained in:
commit
aff3f4e7a9
|
@ -32,6 +32,7 @@ jobs:
|
|||
target: 'desktop'
|
||||
arch: 'win64_mingw'
|
||||
modules: 'qtmultimedia qt5compat qtshadertools'
|
||||
tools: 'tools_opensslv3_x64'
|
||||
|
||||
- name: Disable PCH
|
||||
shell: bash
|
||||
|
@ -46,6 +47,9 @@ jobs:
|
|||
working-directory: ${{github.workspace}}
|
||||
env:
|
||||
CMAKE_PREFIX_PATH: ${{env.Qt6_Dir}}
|
||||
OPENSSL_ROOT_DIR: ${{env.Qt6_Dir}}/../../Tools/OpenSSLv3/Win_x64
|
||||
OPENSSL_INCLUDE_DIR: ${{env.OPENSSL_ROOT_DIR}}/include
|
||||
OPENSSL_CRYPTO_LIBRARY: ${{env.OPENSSL_ROOT_DIR}}/bin/libcrypto-3-x64.dll
|
||||
run: |
|
||||
cmake -DCMAKE_BUILD_TYPE=MinSizeRel -G "MinGW Makefiles" -B ${{github.workspace}}/build
|
||||
|
||||
|
@ -74,7 +78,7 @@ jobs:
|
|||
cp build/zh_CN.qm FreeKill-release
|
||||
cp build/en_US.qm FreeKill-release
|
||||
cp ../Qt/6.5.3/mingw_64/bin/li*.dll FreeKill-release
|
||||
cp '/c/Program Files/OpenSSL/bin/libcrypto-1_1-x64.dll' FreeKill-release
|
||||
cp ../Qt/Tools/OpenSSLv3/Win_x64/bin/libcrypto-3-x64.dll FreeKill-release
|
||||
7z a -t7z FreeKill-release.7z FreeKill-release -r -mx=9 -m0=LZMA2 -ms=10m -mf=on -mhc=on -mmt=on
|
||||
|
||||
- name: Upload Release
|
||||
|
|
76
CHANGELOG.md
76
CHANGELOG.md
|
@ -1,5 +1,81 @@
|
|||
# ChangeLog
|
||||
|
||||
## v0.4.8 & v0.4.9
|
||||
|
||||
- Qml: 新增leval函数可获得lua表达式的值
|
||||
- 新增AbstractRoom类 去除冗余
|
||||
- 修gameOver相关bug(或许)
|
||||
- 从Utility那里搬运了askForYiji和doYiji两个函数,负责分配
|
||||
虽然暂时没实现单烧条,但先这么用着
|
||||
- 修复了askForCardAndPlayers的选择中可以选择复数张牌的bug
|
||||
- 为prohibitDiscard添加了输入id选项
|
||||
- 正式添加对多后缀标记的支持
|
||||
- 添加了一点注释
|
||||
- 搬运了moveCardIntoEquip和canMoveCardIntoEquip
|
||||
- 为选牌的默认prompt添加了目标
|
||||
- 完善了朱雀羽扇的判定
|
||||
- 修复了抽选武将牌堆时未删除已选武将的bug
|
||||
- 修复了maxCard标记不识别“-turn”以外标记的bug
|
||||
- 修复了obtaincard实际不能接受id数组的bug
|
||||
- CardItem一律可长按,除了卡牌一览
|
||||
- Qml Mark在QML中可获得主人的id
|
||||
- Qml Mark可实现某某视角完全不可见
|
||||
- 隐藏#开头的pile
|
||||
- 可自定义interaction了
|
||||
- LogMessage新增toast成员
|
||||
- 修复投降杀人bug
|
||||
|
||||
___
|
||||
|
||||
## v0.4.6 & v0.4.7
|
||||
|
||||
- 攻击范围状态技类新增基础值修正函数
|
||||
- 伤害值在一个技能处理后小于1会终止当前事件
|
||||
- 不向不能使用【无懈可击】的角色询问使用【无懈可击】
|
||||
- 修正在濒死插结中有人死亡后仍然会向该角色求桃的情况
|
||||
- 将PreCardUse和PreCardRespond时机移至实体牌移动之前
|
||||
- 调整改判函数原判定牌置入弃牌堆的原因
|
||||
- 修正【朱雀羽扇】、【借刀杀人】、【酒】
|
||||
- 为使用流程和Aim流程增加属性additionalEffect,用于指定额外结算次数(OL版),顺带移动【五谷丰登】开启和关
|
||||
闭AG的位置;
|
||||
- 为视为技新增after_use方法处理转化牌后的后续操作;
|
||||
- 修复伤害流程时机触发者不变问题;
|
||||
- 修复旁观休整的问题;
|
||||
- 修复可移动场上牌判断函数未判断虚拟牌名的问题。
|
||||
- 修复传入数组的extraPile无法收回
|
||||
- 被弃置牌的log添加操作者
|
||||
- beforeMaxHpChanged的num可以被修改
|
||||
- 额外回合增加skillName
|
||||
- 修复亮将技能和禁止亮将
|
||||
- 水一些注释和格式
|
||||
- git报错优化
|
||||
- 防止反复shutdown同一事件
|
||||
- 将Utility如canUseCardTo的一些函数搬运到了本体
|
||||
- 为技能添加hooked_piles属性,当失去技能时自动弃置hooked_piles内的所有私人牌堆
|
||||
- 修复了添加技能没写source_skill的bug
|
||||
- 修复了ActiveSkill的interaction不传入Skill本身而是metatable的bug
|
||||
- 修复了主动询问canUse时没有传入extra_data的bug
|
||||
- 修复了多选时按钮选项变回空白的bug
|
||||
- 修复了判定阶段被中途拿走判定牌后报错的bug
|
||||
|
||||
___
|
||||
|
||||
## v0.4.4 & 0.4.5
|
||||
|
||||
禁将增强;修复bug
|
||||
|
||||
UsableSkill的expand_pile功能加强
|
||||
|
||||
___
|
||||
|
||||
## v0.4.3
|
||||
|
||||
1. 事件栈和实际的函数调用栈分离
|
||||
2. 2v2选将专用的MiniGame
|
||||
3. 各种小修小补
|
||||
|
||||
___
|
||||
|
||||
## v0.4.2 && v0.4.1
|
||||
|
||||
1. 修复和完善qml mark
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# ------------------------------------------------------------
|
||||
# 此为新月杀的项目组织文件,采用CMake+QT
|
||||
# 2022-01-24 新建文件夹 2023-02-21 发布v0.0.1版本
|
||||
# ------------------------------------------------------------
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(FreeKill VERSION 0.4.2)
|
||||
project(FreeKill VERSION 0.4.9)
|
||||
add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\")
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS
|
||||
|
|
|
@ -46,7 +46,8 @@ Item {
|
|||
}
|
||||
|
||||
ScriptAction {
|
||||
script: Backend.playSound("./audio/system/fly" + (Math.floor(Math.random() * 2) + 1));
|
||||
script: Backend.playSound("./audio/system/fly" +
|
||||
(Math.floor(Math.random() * 2) + 1));
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
|
@ -91,7 +92,8 @@ Item {
|
|||
}
|
||||
|
||||
ScriptAction {
|
||||
script: Backend.playSound("./audio/system/egg" + (Math.floor(Math.random() * 2) + 1));
|
||||
script: Backend.playSound("./audio/system/egg" +
|
||||
(Math.floor(Math.random() * 2) + 1));
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
|
|
|
@ -43,7 +43,8 @@ Item {
|
|||
id: pointToAnimation
|
||||
running: false
|
||||
ScriptAction {
|
||||
script: Backend.playSound("./audio/system/fly" + (Math.floor(Math.random() * 2) + 1));
|
||||
script: Backend.playSound("./audio/system/fly" +
|
||||
(Math.floor(Math.random() * 2) + 1));
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
|
@ -80,7 +81,8 @@ Item {
|
|||
}
|
||||
|
||||
ScriptAction {
|
||||
script: Backend.playSound("./audio/system/flower" + (Math.floor(Math.random() * 2) + 1));
|
||||
script: Backend.playSound("./audio/system/flower" +
|
||||
(Math.floor(Math.random() * 2) + 1));
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
|
|
|
@ -46,7 +46,8 @@ Item {
|
|||
}
|
||||
|
||||
ScriptAction {
|
||||
script: Backend.playSound("./audio/system/fly" + (Math.floor(Math.random() * 2) + 1));
|
||||
script: Backend.playSound("./audio/system/fly" +
|
||||
(Math.floor(Math.random() * 2) + 1));
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
|
@ -91,7 +92,8 @@ Item {
|
|||
}
|
||||
|
||||
ScriptAction {
|
||||
script: Backend.playSound("./audio/system/egg" + (Math.floor(Math.random() * 2) + 1));
|
||||
script: Backend.playSound("./audio/system/egg" +
|
||||
(Math.floor(Math.random() * 2) + 1));
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
|
|
|
@ -64,7 +64,8 @@ Item {
|
|||
script: {
|
||||
egg.opacity = 0;
|
||||
whip.opacity = 1;
|
||||
Backend.playSound("./audio/system/egg" + (Math.floor(Math.random() * 2) + 1));
|
||||
Backend.playSound("./audio/system/egg" +
|
||||
(Math.floor(Math.random() * 2) + 1));
|
||||
}
|
||||
}
|
||||
PropertyAnimation {
|
||||
|
|
|
@ -27,7 +27,8 @@ Item {
|
|||
y: start.y - height / 2 + yOffset
|
||||
scale: 0.7
|
||||
opacity: 0
|
||||
rotation: (Math.atan(Math.abs(end.y - start.y) / Math.abs(end.x - start.x))
|
||||
rotation: (Math.atan(Math.abs(end.y - start.y)
|
||||
/ Math.abs(end.x - start.x))
|
||||
/ Math.PI * 180 - 90) * (end.x > start.x ? -1 : 1)
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ Flickable {
|
|||
if (!card) return;
|
||||
cardPic.setData(card.toData());
|
||||
const name = card.virt_name ? card.virt_name : card.name;
|
||||
screenName.text = Backend.translate(name);
|
||||
skillDesc.text = Backend.translate(":" + name);
|
||||
screenName.text = luatr(name);
|
||||
skillDesc.text = luatr(":" + name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ Item {
|
|||
ToolButton {
|
||||
opacity: stack.depth > 1 ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||
text: Backend.translate("Back")
|
||||
text: luatr("Back")
|
||||
onClicked: stack.pop()
|
||||
}
|
||||
|
||||
Label {
|
||||
text: Backend.translate("Enable free assign")
|
||||
text: luatr("Enable free assign")
|
||||
elide: Label.ElideRight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
|
@ -46,12 +46,11 @@ Item {
|
|||
}
|
||||
|
||||
ToolButton {
|
||||
text: Backend.translate("Search")
|
||||
text: luatr("Search")
|
||||
enabled: word.text !== ""
|
||||
onClicked: {
|
||||
if (stack.depth > 1) stack.pop();
|
||||
generalModel = JSON.parse(Backend.callLuaFunction("SearchAllGenerals",
|
||||
[word.text]));
|
||||
generalModel = lcall("SearchAllGenerals", word.text);
|
||||
stack.push(generalList);
|
||||
word.text = "";
|
||||
}
|
||||
|
@ -88,14 +87,13 @@ Item {
|
|||
height: 40
|
||||
|
||||
Text {
|
||||
text: Backend.translate(name)
|
||||
text: luatr(name)
|
||||
color: "#E4D5A0"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
generalModel = JSON.parse(Backend.callLuaFunction("GetGenerals",
|
||||
[packages.get(index).name]));
|
||||
generalModel = lcall("GetGenerals", packages.get(index).name);
|
||||
stack.push(generalList);
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +132,7 @@ Item {
|
|||
}
|
||||
|
||||
function load() {
|
||||
const packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
const packs = lcall("GetAllGeneralPack");
|
||||
packs.forEach((name) => packages.append({ name: name }));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,21 +39,23 @@ Flickable {
|
|||
skillDesc.text = "";
|
||||
|
||||
extra_data.generals.forEach((g) => {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [g]));
|
||||
skillDesc.append(Backend.translate(data.kingdom) + " " + Backend.translate(g) + " " + data.hp + "/" + data.maxHp);
|
||||
const data = lcall("GetGeneralDetail", g);
|
||||
skillDesc.append(luatr(data.kingdom) + " " + luatr(g) + " " + data.hp +
|
||||
"/" + data.maxHp);
|
||||
if (data.companions.length > 0){
|
||||
let ret = '';
|
||||
ret += "<font color=\"slategrey\"><b>" + Backend.translate("Companions") + "</b>: ";
|
||||
ret +="<font color=\"slategrey\"><b>" + luatr("Companions") + "</b>: ";
|
||||
data.companions.forEach(t => {
|
||||
ret += Backend.translate(t) + ' '
|
||||
ret += luatr(t) + ' '
|
||||
});
|
||||
skillDesc.append(ret)
|
||||
}
|
||||
data.skill.forEach(t => {
|
||||
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
||||
skillDesc.append("<b>" + luatr(t.name) + "</b>: " + t.description)
|
||||
});
|
||||
data.related_skill.forEach(t => {
|
||||
skillDesc.append("<font color=\"purple\"><b>" + Backend.translate(t.name) + "</b>: " + t.description + "</font>")
|
||||
skillDesc.append("<font color=\"purple\"><b>" + luatr(t.name) +
|
||||
"</b>: " + t.description + "</font>")
|
||||
});
|
||||
skillDesc.append("\n");
|
||||
});
|
||||
|
|
|
@ -38,7 +38,7 @@ Flickable {
|
|||
|
||||
RowLayout {
|
||||
MetroButton {
|
||||
text: Backend.translate("Give Flower")
|
||||
text: luatr("Give Flower")
|
||||
onClicked: {
|
||||
enabled = false;
|
||||
root.givePresent("Flower");
|
||||
|
@ -47,7 +47,7 @@ Flickable {
|
|||
}
|
||||
|
||||
MetroButton {
|
||||
text: Backend.translate("Give Egg")
|
||||
text: luatr("Give Egg")
|
||||
onClicked: {
|
||||
enabled = false;
|
||||
if (Math.random() < 0.03) {
|
||||
|
@ -60,7 +60,7 @@ Flickable {
|
|||
}
|
||||
|
||||
MetroButton {
|
||||
text: Backend.translate("Give Wine")
|
||||
text: luatr("Give Wine")
|
||||
enabled: Math.random() < 0.3
|
||||
onClicked: {
|
||||
enabled = false;
|
||||
|
@ -70,7 +70,7 @@ Flickable {
|
|||
}
|
||||
|
||||
MetroButton {
|
||||
text: Backend.translate("Give Shoe")
|
||||
text: luatr("Give Shoe")
|
||||
enabled: Math.random() < 0.3
|
||||
onClicked: {
|
||||
enabled = false;
|
||||
|
@ -80,7 +80,10 @@ Flickable {
|
|||
}
|
||||
|
||||
MetroButton {
|
||||
text: config.blockedUsers.indexOf(screenName.text) === -1 ? Backend.translate("Block Chatter") : Backend.translate("Unblock Chatter")
|
||||
text: {
|
||||
const blocked = !config.blockedUsers.includes(screenName.text);
|
||||
return blocked ? luatr("Block Chatter") : luatr("Unblock Chatter");
|
||||
}
|
||||
enabled: pid !== Self.id && pid > 0
|
||||
onClicked: {
|
||||
const idx = config.blockedUsers.indexOf(screenName.text);
|
||||
|
@ -94,7 +97,7 @@ Flickable {
|
|||
}
|
||||
|
||||
MetroButton {
|
||||
text: Backend.translate("Kick From Room")
|
||||
text: luatr("Kick From Room")
|
||||
visible: !roomScene.isStarted && roomScene.isOwner
|
||||
enabled: pid !== Self.id
|
||||
onClicked: {
|
||||
|
@ -157,7 +160,7 @@ Flickable {
|
|||
skillDesc.text = "";
|
||||
|
||||
const id = extra_data.photo.playerid;
|
||||
if (id == 0) return;
|
||||
if (id === 0) return;
|
||||
root.pid = id;
|
||||
|
||||
screenName.text = extra_data.photo.screenName;
|
||||
|
@ -165,36 +168,34 @@ Flickable {
|
|||
deputyChara.name = extra_data.photo.deputyGeneral;
|
||||
|
||||
if (!config.observing) {
|
||||
const gamedata = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [id]));
|
||||
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 ? Backend.translate("Newbie") :
|
||||
Backend.translate("Win=%1 Run=%2 Total=%3").arg(winRate.toFixed(2))
|
||||
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) {
|
||||
playerGameData.text += " " + Backend.translate("TotalGameTime: %1 min").arg(m);
|
||||
playerGameData.text += " " + luatr("TotalGameTime: %1 min").arg(m);
|
||||
} else {
|
||||
playerGameData.text += " " + Backend.translate("TotalGameTime: %1 h").arg(h);
|
||||
playerGameData.text += " " + luatr("TotalGameTime: %1 h").arg(h);
|
||||
}
|
||||
}
|
||||
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [id]));
|
||||
data.forEach(t => {
|
||||
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
||||
lcall("GetPlayerSkills", id).forEach(t => {
|
||||
skillDesc.append("<b>" + luatr(t.name) + "</b>: " + t.description)
|
||||
});
|
||||
|
||||
const equips = JSON.parse(Backend.callLuaFunction("GetPlayerEquips", [id]));
|
||||
equips.forEach(cid => {
|
||||
const t = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
lcall("GetPlayerEquips", id).forEach(cid => {
|
||||
const t = lcall("GetCardData", cid);
|
||||
skillDesc.append("--------------------");
|
||||
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + Backend.translate(":" + t.name));
|
||||
skillDesc.append("<b>" + luatr(t.name) + "</b>: " + luatr(":" + t.name));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ Item {
|
|||
ColumnLayout {
|
||||
Text {
|
||||
color: "#E4D5A0"
|
||||
text: Backend.translate(gname)
|
||||
text: luatr(gname)
|
||||
}
|
||||
GridLayout {
|
||||
columns: 6
|
||||
|
||||
Repeater {
|
||||
model: JSON.parse(Backend.callLuaFunction("GetSameGenerals", [gname]))
|
||||
model: lcall("GetSameGenerals", gname)
|
||||
|
||||
GeneralCardItem {
|
||||
name: modelData
|
||||
|
|
|
@ -6,7 +6,8 @@ Image {
|
|||
|
||||
width: 64
|
||||
height: 64
|
||||
source: SkinBank.getGeneralExtraPic(general, "avatar/") ?? SkinBank.getGeneralPicture(general)
|
||||
source: SkinBank.getGeneralExtraPic(general, "avatar/")
|
||||
?? SkinBank.getGeneralPicture(general)
|
||||
// sourceSize.width: 250
|
||||
// sourceSize.height: 292
|
||||
property bool useSmallPic: !!SkinBank.getGeneralExtraPic(general, "avatar/")
|
||||
|
|
|
@ -18,7 +18,8 @@ Rectangle {
|
|||
avatar = "__observer";
|
||||
}
|
||||
chatLogBox.append({
|
||||
avatar: data.general || roomScene.getPhoto(data.sender)?.general || avatar || "unknown",
|
||||
avatar: data.general || roomScene.getPhoto(data.sender)?.general ||
|
||||
avatar || "unknown",
|
||||
general: general,
|
||||
msg: data.msg,
|
||||
userName: data.userName,
|
||||
|
@ -28,7 +29,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
function loadSkills() {
|
||||
for (let i = 1; i <= 16; i++) {
|
||||
for (let i = 1; i <= 23; i++) {
|
||||
skills.append({ name: "fastchat_m", idx: i });
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ Rectangle {
|
|||
anchors.right: !isSelf ? undefined : avatarPic.left
|
||||
anchors.margins: 6
|
||||
font.pixelSize: 14
|
||||
text: userName + (general ? (" (" + Backend.translate(general) + ")") : "")
|
||||
text: userName + (general ? (" (" + luatr(general) + ")") : "")
|
||||
+ ' <font color="grey">[' + time + "]</font>"
|
||||
}
|
||||
|
||||
|
@ -123,7 +124,8 @@ Rectangle {
|
|||
anchors.centerIn: parent
|
||||
source: "../../image/emoji/" + index
|
||||
}
|
||||
onClicked: chatEdit.insert(chatEdit.cursorPosition, "{emoji" + index + "}");
|
||||
onClicked: chatEdit.insert(chatEdit.cursorPosition,
|
||||
"{emoji" + index + "}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,14 +144,14 @@ Rectangle {
|
|||
delegate: ItemDelegate {
|
||||
width: soundSelector.width
|
||||
height: 30
|
||||
text: Backend.translate("$" + name + (idx ? idx.toString() : ""))
|
||||
text: luatr("$" + name + (idx ? idx.toString() : ""))
|
||||
|
||||
onClicked: {
|
||||
opTimer.start();
|
||||
const general = roomScene.getPhoto(Self.id).general;
|
||||
let skill = "fastchat_m";
|
||||
if (general !== "") {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
|
||||
const data = lcall("GetGeneralDetail", general);
|
||||
const gender = data.gender;
|
||||
if (gender !== 1) {
|
||||
skill = "fastchat_f";
|
||||
|
|
|
@ -13,7 +13,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
function loadSkills() {
|
||||
for (let i = 1; i <= 16; i++) {
|
||||
for (let i = 1; i <= 23; i++) {
|
||||
skills.append({ name: "fastchat_m", idx: i });
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,8 @@ Rectangle {
|
|||
anchors.centerIn: parent
|
||||
source: "../../image/emoji/" + index
|
||||
}
|
||||
onClicked: chatEdit.insert(chatEdit.cursorPosition, "{emoji" + index + "}");
|
||||
onClicked: chatEdit.insert(chatEdit.cursorPosition,
|
||||
"{emoji" + index + "}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,14 +74,14 @@ Rectangle {
|
|||
delegate: ItemDelegate {
|
||||
width: soundSelector.width
|
||||
height: 30
|
||||
text: Backend.translate("$" + name + (idx ? idx.toString() : ""))
|
||||
text: luatr("$" + name + (idx ? idx.toString() : ""))
|
||||
|
||||
onClicked: {
|
||||
opTimer.start();
|
||||
const general = roomScene.getPhoto(Self.id).general;
|
||||
let skill = "fastchat_m";
|
||||
if (general !== "") {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
|
||||
const data = lcall("GetGeneralDetail", general);
|
||||
const gender = data.gender;
|
||||
if (gender !== 1) {
|
||||
skill = "fastchat_f";
|
||||
|
|
|
@ -15,7 +15,7 @@ QtObject {
|
|||
property string roomBg
|
||||
property string bgmFile
|
||||
property string language
|
||||
property list<string> disabledPack: []
|
||||
// property list<string> disabledPack: []
|
||||
property string preferedMode
|
||||
property int preferedPlayerNum
|
||||
property int preferredGeneralNum
|
||||
|
@ -23,9 +23,12 @@ QtObject {
|
|||
property real bgmVolume
|
||||
property bool disableMsgAudio
|
||||
property bool hideUseless
|
||||
property list<string> disabledGenerals: []
|
||||
property list<var> disableGeneralSchemes: []
|
||||
property int disableSchemeIdx: 0
|
||||
// property list<string> disabledGenerals: []
|
||||
// property list<var> disableGeneralSchemes: []
|
||||
// property int disableSchemeIdx: 0
|
||||
property list<var> disableSchemes: []
|
||||
property int currentDisableIdx: 0
|
||||
property var curScheme
|
||||
|
||||
property int preferredTimeout
|
||||
property int preferredLuckTime
|
||||
|
@ -52,9 +55,9 @@ QtObject {
|
|||
property list<string> blockedUsers: []
|
||||
property int totalTime: 0 // FIXME: only for notifying
|
||||
|
||||
onDisabledGeneralsChanged: {
|
||||
disableGeneralSchemes[disableSchemeIdx] = disabledGenerals;
|
||||
}
|
||||
// onDisabledGeneralsChanged: {
|
||||
// disableGeneralSchemes[disableSchemeIdx] = disabledGenerals;
|
||||
// }
|
||||
|
||||
function loadConf() {
|
||||
conf = JSON.parse(Backend.loadConf());
|
||||
|
@ -75,7 +78,7 @@ QtObject {
|
|||
return 'en_US';
|
||||
}
|
||||
})();
|
||||
disabledPack = conf.disabledPack ?? [ "test_p_0" ];
|
||||
// disabledPack = conf.disabledPack ?? [ "test_p_0" ];
|
||||
preferedMode = conf.preferedMode ?? "aaa_role_mode";
|
||||
preferedPlayerNum = conf.preferedPlayerNum ?? 2;
|
||||
preferredGeneralNum = conf.preferredGeneralNum ?? 3;
|
||||
|
@ -87,9 +90,17 @@ QtObject {
|
|||
preferredTimeout = conf.preferredTimeout ?? 15;
|
||||
preferredLuckTime = conf.preferredLuckTime ?? 0;
|
||||
firstRun = conf.firstRun ?? true;
|
||||
disabledGenerals = conf.disabledGenerals ?? [];
|
||||
disableGeneralSchemes = conf.disableGeneralSchemes ?? [ disabledGenerals ];
|
||||
disableSchemeIdx = conf.disableSchemeIdx ?? 0;
|
||||
// disabledGenerals = conf.disabledGenerals ?? [];
|
||||
// disableGeneralSchemes = conf.disableGeneralSchemes ?? [ disabledGenerals ];
|
||||
// disableSchemeIdx = conf.disableSchemeIdx ?? 0;
|
||||
disableSchemes = conf.disableSchemes ?? [{
|
||||
name: "",
|
||||
banPkg: {}, // 被禁用的包,内部数据为 包名: 白名单武将名数组
|
||||
normalPkg: {}, // 未被禁用的包,内部数据为 包名: 黑名单武将名数组
|
||||
banCardPkg: [], // 被禁用的卡包
|
||||
}];
|
||||
currentDisableIdx = conf.currentDisableIdx ?? 0;
|
||||
curScheme = disableSchemes[currentDisableIdx];
|
||||
blockedUsers = conf.blockedUsers ?? [];
|
||||
}
|
||||
|
||||
|
@ -104,7 +115,7 @@ QtObject {
|
|||
conf.roomBg = roomBg;
|
||||
conf.bgmFile = bgmFile;
|
||||
conf.language = language;
|
||||
conf.disabledPack = disabledPack;
|
||||
// conf.disabledPack = disabledPack;
|
||||
conf.preferedMode = preferedMode;
|
||||
conf.preferedPlayerNum = preferedPlayerNum;
|
||||
conf.ladyImg = ladyImg;
|
||||
|
@ -116,9 +127,12 @@ QtObject {
|
|||
conf.preferredTimeout = preferredTimeout;
|
||||
conf.preferredLuckTime = preferredLuckTime;
|
||||
conf.firstRun = firstRun;
|
||||
conf.disabledGenerals = disabledGenerals;
|
||||
conf.disableGeneralSchemes = disableGeneralSchemes;
|
||||
conf.disableSchemeIdx = disableSchemeIdx;
|
||||
// conf.disabledGenerals = disabledGenerals;
|
||||
// conf.disableGeneralSchemes = disableGeneralSchemes;
|
||||
// conf.disableSchemeIdx = disableSchemeIdx;
|
||||
disableSchemes[currentDisableIdx] = curScheme;
|
||||
conf.disableSchemes = disableSchemes;
|
||||
conf.currentDisableIdx = currentDisableIdx;
|
||||
conf.blockedUsers = blockedUsers;
|
||||
|
||||
Backend.saveConf(JSON.stringify(conf, undefined, 2));
|
||||
|
|
|
@ -9,7 +9,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("BGM Volume")
|
||||
text: luatr("BGM Volume")
|
||||
}
|
||||
Slider {
|
||||
Layout.rightMargin: 16
|
||||
|
@ -25,7 +25,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Effect Volume")
|
||||
text: luatr("Effect Volume")
|
||||
}
|
||||
Slider {
|
||||
Layout.rightMargin: 16
|
||||
|
@ -38,13 +38,13 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
Switch {
|
||||
text: Backend.translate("Disable message audio")
|
||||
text: luatr("Disable message audio")
|
||||
checked: config.disableMsgAudio
|
||||
onCheckedChanged: config.disableMsgAudio = checked;
|
||||
}
|
||||
|
||||
Switch {
|
||||
text: Backend.translate("Hide unselectable cards")
|
||||
text: luatr("Hide unselectable cards")
|
||||
checked: config.hideUseless
|
||||
onCheckedChanged: {
|
||||
config.hideUseless = checked;
|
||||
|
|
|
@ -10,7 +10,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Lobby BG")
|
||||
text: luatr("Lobby BG")
|
||||
}
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
@ -30,7 +30,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Room BG")
|
||||
text: luatr("Room BG")
|
||||
}
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
@ -50,7 +50,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Game BGM")
|
||||
text: luatr("Game BGM")
|
||||
}
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
@ -70,7 +70,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Poster Girl")
|
||||
text: luatr("Poster Girl")
|
||||
}
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
|
|
|
@ -11,73 +11,103 @@ Item {
|
|||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Ban List")
|
||||
text: luatr("Ban List")
|
||||
}
|
||||
ComboBox {
|
||||
id: banCombo
|
||||
textRole: "name"
|
||||
Layout.fillWidth: true
|
||||
model: ListModel {
|
||||
id: banComboList
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
config.disableSchemeIdx = currentIndex;
|
||||
config.disabledGenerals = config.disableGeneralSchemes[currentIndex];
|
||||
word.text = "";
|
||||
config.disableSchemes[config.currentDisableIdx] = config.curScheme;
|
||||
config.currentDisableIdx = currentIndex;
|
||||
config.curScheme = config.disableSchemes[currentIndex];
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
|
||||
Button {
|
||||
text: Backend.translate("New")
|
||||
text: luatr("New")
|
||||
onClicked: {
|
||||
const i = config.disableGeneralSchemes.length;
|
||||
const i = config.disableSchemes.length;
|
||||
banComboList.append({
|
||||
name: Backend.translate("List") + (i + 1),
|
||||
name: luatr("List") + (i + 1),
|
||||
});
|
||||
config.disableSchemes.push({
|
||||
name: "",
|
||||
banPkg: {},
|
||||
normalPkg: {},
|
||||
banCardPkg: [],
|
||||
});
|
||||
config.disableGeneralSchemes.push([]);
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Clear")
|
||||
text: luatr("Clear")
|
||||
onClicked: {
|
||||
config.disabledGenerals = [];
|
||||
config.curScheme.banPkg = {};
|
||||
config.curScheme.normalPkg = {};
|
||||
config.curScheme.banCardPkg = [];
|
||||
config.curSchemeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Export")
|
||||
text: luatr("Export")
|
||||
onClicked: {
|
||||
Backend.copyToClipboard(JSON.stringify(config.disabledGenerals));
|
||||
toast.show(Backend.translate("Export Success"));
|
||||
Backend.copyToClipboard(JSON.stringify(config.curScheme));
|
||||
toast.show(luatr("Export Success"));
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Import")
|
||||
text: luatr("Import")
|
||||
onClicked: {
|
||||
const str = Backend.readClipboard();
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(str);
|
||||
} catch (e) {
|
||||
toast.show(Backend.translate("Not Legal"));
|
||||
toast.show(luatr("Not Legal"));
|
||||
return;
|
||||
}
|
||||
if (!data instanceof Array) {
|
||||
toast.show(Backend.translate("Not JSON"));
|
||||
if (!data instanceof Object || !data.banPkg || !data.normalPkg
|
||||
|| !data.banCardPkg) {
|
||||
toast.show(luatr("Not JSON"));
|
||||
return;
|
||||
}
|
||||
let d = [];
|
||||
for (let e of data) {
|
||||
if (typeof e === "string" && Backend.translate(e) !== e) {
|
||||
d.push(e);
|
||||
config.curScheme = data;
|
||||
if (data.name) {
|
||||
banComboList.get(banCombo.currentIndex).name = data.name;
|
||||
}
|
||||
}
|
||||
config.disabledGenerals = d;
|
||||
toast.show(Backend.translate("Import Success"));
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: word
|
||||
clip: true
|
||||
leftPadding: 5
|
||||
rightPadding: 5
|
||||
}
|
||||
|
||||
Button {
|
||||
text: luatr("Rename")
|
||||
enabled: word.text !== ""
|
||||
onClicked: {
|
||||
banComboList.get(banCombo.currentIndex).name = word.text;
|
||||
config.curScheme.name = word.text;
|
||||
word.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,38 +116,122 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
Layout.margins: 8
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: Backend.translate("Help_Ban_List")
|
||||
text: luatr("Help_Ban_List")
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: grid
|
||||
flow: GridLayout.TopToBottom
|
||||
rows: 2
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Text {
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: luatr("Ban_Generals")
|
||||
font.pixelSize: 18
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: listView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
clip: true
|
||||
cellWidth: width / 4
|
||||
cellWidth: width / 2
|
||||
cellHeight: 24
|
||||
model: config.disabledGenerals
|
||||
model: {
|
||||
let ret = [], k;
|
||||
const s = config.curScheme;
|
||||
for (k in s.normalPkg) {
|
||||
ret.push(...s.normalPkg[k]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
delegate: Text {
|
||||
width: listView.width
|
||||
//width: banChara.width
|
||||
text: {
|
||||
const prefix = modelData.split("__")[0];
|
||||
let name = Backend.translate(modelData);
|
||||
let name = luatr(modelData);
|
||||
if (prefix !== modelData) {
|
||||
name += (" (" + Backend.translate(prefix) + ")");
|
||||
name += (" (" + luatr(prefix) + ")");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
font.pixelSize: 16
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: luatr("Ban_Packages")
|
||||
font.pixelSize: 18
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
GridView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
clip: true
|
||||
cellWidth: width / 2
|
||||
cellHeight: 24
|
||||
model: {
|
||||
let ret = [], k;
|
||||
const s = config.curScheme;
|
||||
for (k in s.banPkg) {
|
||||
ret.push(k);
|
||||
}
|
||||
ret.push(...s.banCardPkg)
|
||||
return ret;
|
||||
}
|
||||
delegate: Text {
|
||||
text: luatr(modelData)
|
||||
font.pixelSize: 16
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: luatr("Whitelist_Generals")
|
||||
font.pixelSize: 18
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
GridView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
clip: true
|
||||
cellWidth: width / 2
|
||||
cellHeight: 24
|
||||
model: {
|
||||
let ret = [], k;
|
||||
const s = config.curScheme;
|
||||
for (k in s.banPkg) {
|
||||
ret.push(...s.banPkg[k]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
delegate: Text {
|
||||
text: {
|
||||
const prefix = modelData.split("__")[0];
|
||||
let name = luatr(modelData);
|
||||
if (prefix !== modelData) {
|
||||
name += (" (" + luatr(prefix) + ")");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
font.pixelSize: 16
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
for (let i = 0; i < config.disableGeneralSchemes.length; i++) {
|
||||
for (let i = 0; i < config.disableSchemes.length; i++) {
|
||||
banComboList.append({
|
||||
name: Backend.translate("List") + (i + 1),
|
||||
name: config.disableSchemes[i]?.name || (luatr("List") + (i + 1)),
|
||||
});
|
||||
}
|
||||
banCombo.currentIndex = config.disableSchemeIdx;
|
||||
banCombo.currentIndex = config.currentDisableIdx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ Item {
|
|||
width: root.height
|
||||
background: Rectangle { color: "#EEEEEEEE" }
|
||||
TabButton {
|
||||
text: Backend.translate("General Settings")
|
||||
text: luatr("General Settings")
|
||||
}
|
||||
TabButton {
|
||||
text: Backend.translate("Package Settings")
|
||||
text: luatr("Package Settings")
|
||||
}
|
||||
TabButton {
|
||||
text: Backend.translate("Ban General Settings")
|
||||
text: luatr("Ban General Settings")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ Item {
|
|||
width: root.height
|
||||
background: Rectangle { color: "#EEEEEEEE" }
|
||||
TabButton {
|
||||
text: Backend.translate("Userinfo Settings")
|
||||
text: luatr("Userinfo Settings")
|
||||
}
|
||||
TabButton {
|
||||
text: Backend.translate("BG Settings")
|
||||
text: luatr("BG Settings")
|
||||
}
|
||||
TabButton {
|
||||
text: Backend.translate("Audio Settings")
|
||||
text: luatr("Audio Settings")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ Item {
|
|||
Text {
|
||||
text: {
|
||||
config.totalTime;
|
||||
const gamedata = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [Self.id]));
|
||||
const gamedata = lcall("GetPlayerGameData", Self.id);
|
||||
const totalTime = gamedata[3];
|
||||
const h = (totalTime / 3600).toFixed(2);
|
||||
const m = Math.floor(totalTime / 60);
|
||||
if (m < 100) {
|
||||
return Backend.translate("TotalGameTime: %1 min").arg(m);
|
||||
return luatr("TotalGameTime: %1 min").arg(m);
|
||||
} else {
|
||||
return Backend.translate("TotalGameTime: %1 h").arg(h);
|
||||
return luatr("TotalGameTime: %1 h").arg(h);
|
||||
}
|
||||
}
|
||||
x: 12; y: 1
|
||||
|
|
|
@ -16,7 +16,7 @@ Flickable {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Room Name")
|
||||
text: luatr("Room Name")
|
||||
}
|
||||
TextField {
|
||||
id: roomName
|
||||
|
@ -24,7 +24,7 @@ Flickable {
|
|||
font.pixelSize: 18
|
||||
Layout.rightMargin: 16
|
||||
Layout.fillWidth: true
|
||||
text: Backend.translate("$RoomName").arg(Self.screenName)
|
||||
text: luatr("$RoomName").arg(Self.screenName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ Flickable {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Game Mode")
|
||||
text: luatr("Game Mode")
|
||||
}
|
||||
ComboBox {
|
||||
id: gameModeCombo
|
||||
|
@ -57,16 +57,16 @@ Flickable {
|
|||
columnSpacing: 20
|
||||
columns: 4
|
||||
Text {
|
||||
text: Backend.translate("Player num")
|
||||
text: luatr("Player num")
|
||||
}
|
||||
Text {
|
||||
text: Backend.translate("Select generals num")
|
||||
text: luatr("Select generals num")
|
||||
}
|
||||
Text {
|
||||
text: Backend.translate("Operation timeout")
|
||||
text: luatr("Operation timeout")
|
||||
}
|
||||
Text {
|
||||
text: Backend.translate("Luck Card Times")
|
||||
text: luatr("Luck Card Times")
|
||||
}
|
||||
SpinBox {
|
||||
id: playerNum
|
||||
|
@ -109,24 +109,26 @@ Flickable {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Text {
|
||||
id: warning
|
||||
anchors.rightMargin: 8
|
||||
visible: {
|
||||
//config.disabledPack; // 没什么用,只是为了禁包刷新时刷新visible罢了
|
||||
const avail = JSON.parse(Backend.callLuaFunction("GetAvailableGeneralsNum", []));
|
||||
const ret = avail < config.preferredGeneralNum * config.preferedPlayerNum;
|
||||
const avail = lcall("GetAvailableGeneralsNum");
|
||||
const ret = avail <
|
||||
config.preferredGeneralNum * config.preferedPlayerNum;
|
||||
return ret;
|
||||
}
|
||||
text: Backend.translate("No enough generals")
|
||||
text: luatr("No enough generals")
|
||||
color: "red"
|
||||
}
|
||||
*/
|
||||
|
||||
RowLayout {
|
||||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Room Password")
|
||||
text: luatr("Room Password")
|
||||
}
|
||||
TextField {
|
||||
id: roomPassword
|
||||
|
@ -143,13 +145,13 @@ Flickable {
|
|||
Switch {
|
||||
id: freeAssignCheck
|
||||
checked: Debugging ? true : false
|
||||
text: Backend.translate("Enable free assign")
|
||||
text: luatr("Enable free assign")
|
||||
}
|
||||
|
||||
Switch {
|
||||
id: deputyCheck
|
||||
checked: Debugging ? true : false
|
||||
text: Backend.translate("Enable deputy general")
|
||||
text: luatr("Enable deputy general")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,44 +159,43 @@ Flickable {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Button {
|
||||
text: Backend.translate("OK")
|
||||
enabled: !(warning.visible)
|
||||
text: luatr("OK")
|
||||
// enabled: !(warning.visible)
|
||||
onClicked: {
|
||||
config.saveConf();
|
||||
root.finished();
|
||||
mainWindow.busy = true;
|
||||
let k, arr;
|
||||
|
||||
let disabledGenerals = config.disabledGenerals.slice();
|
||||
if (disabledGenerals.length) {
|
||||
const availablePack = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", [])).
|
||||
filter((pack) => !config.disabledPack.includes(pack));
|
||||
disabledGenerals = disabledGenerals.filter((general) => {
|
||||
return availablePack.find((pack) => JSON.parse(Backend.callLuaFunction("GetGenerals", [pack])).includes(general));
|
||||
});
|
||||
|
||||
disabledGenerals = Array.from(new Set(disabledGenerals));
|
||||
let disabledGenerals = [];
|
||||
for (k in config.curScheme.banPkg) {
|
||||
arr = config.curScheme.banPkg[k];
|
||||
if (arr.length !== 0) {
|
||||
const generals = lcall("GetGenerals", k);
|
||||
disabledGenerals.push(...generals.filter(g => !arr.includes(g)));
|
||||
}
|
||||
}
|
||||
for (k in config.curScheme.normalPkg) {
|
||||
arr = config.curScheme.normalPkg[k] ?? [];
|
||||
if (arr.length !== 0)
|
||||
disabledGenerals.push(...arr);
|
||||
}
|
||||
|
||||
let disabledPack = config.disabledPack.slice();
|
||||
let disabledPack = config.curScheme.banCardPkg.slice();
|
||||
for (k in config.curScheme.banPkg) {
|
||||
if (config.curScheme.banPkg[k].length === 0)
|
||||
disabledPack.push(k);
|
||||
}
|
||||
config.serverHiddenPacks.forEach(p => {
|
||||
if (!disabledPack.includes(p)) {
|
||||
disabledPack.push(p);
|
||||
}
|
||||
});
|
||||
const generalPacks = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
for (let pk of generalPacks) {
|
||||
if (disabledPack.includes(pk)) continue;
|
||||
let generals = JSON.parse(Backend.callLuaFunction("GetGenerals", [pk]));
|
||||
let t = generals.filter(g => !disabledGenerals.includes(g));
|
||||
if (t.length === 0) {
|
||||
disabledPack.push(pk);
|
||||
disabledGenerals = disabledGenerals.filter(g1 => !generals.includes(g1));
|
||||
}
|
||||
}
|
||||
|
||||
ClientInstance.notifyServer(
|
||||
"CreateRoom",
|
||||
JSON.stringify([roomName.text, playerNum.value, config.preferredTimeout, {
|
||||
JSON.stringify([roomName.text, playerNum.value,
|
||||
config.preferredTimeout, {
|
||||
enableFreeAssign: freeAssignCheck.checked,
|
||||
enableDeputy: deputyCheck.checked,
|
||||
gameMode: config.preferedMode,
|
||||
|
@ -208,7 +209,7 @@ Flickable {
|
|||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Cancel")
|
||||
text: luatr("Cancel")
|
||||
onClicked: {
|
||||
root.finished();
|
||||
}
|
||||
|
@ -216,11 +217,11 @@ Flickable {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
const mode_data = JSON.parse(Backend.callLuaFunction("GetGameModes", []));
|
||||
const mode_data = lcall("GetGameModes");
|
||||
let i = 0;
|
||||
for (let d of mode_data) {
|
||||
gameModeList.append(d);
|
||||
if (d.orig_name == config.preferedMode) {
|
||||
if (d.orig_name === config.preferedMode) {
|
||||
gameModeCombo.currentIndex = i;
|
||||
}
|
||||
i += 1;
|
||||
|
@ -228,10 +229,12 @@ Flickable {
|
|||
|
||||
playerNum.value = config.preferedPlayerNum;
|
||||
|
||||
config.disabledPack.forEach(p => {
|
||||
Backend.callLuaFunction("UpdatePackageEnable", [p, false]);
|
||||
});
|
||||
config.disabledPackChanged();
|
||||
for (let k in config.curScheme.banPkg) {
|
||||
lcall("UpdatePackageEnable", k, false);
|
||||
}
|
||||
config.curScheme.banCardPkg.forEach(p =>
|
||||
lcall("UpdatePackageEnable", p, false));
|
||||
config.curSchemeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,16 +23,16 @@ Flickable {
|
|||
anchors.topMargin: 8
|
||||
|
||||
Switch {
|
||||
text: Backend.translate("Disable Extension")
|
||||
text: luatr("Disable Extension")
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Text {
|
||||
text: Backend.translate("General Packages")
|
||||
text: luatr("General Packages")
|
||||
font.bold: true
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Select All")
|
||||
text: luatr("Select All")
|
||||
onClicked: {
|
||||
for (let i = 0; i < gpacks.count; i++) {
|
||||
const item = gpacks.itemAt(i);
|
||||
|
@ -41,7 +41,7 @@ Flickable {
|
|||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Revert Selection")
|
||||
text: luatr("Revert Selection")
|
||||
onClicked: {
|
||||
for (let i = 0; i < gpacks.count; i++) {
|
||||
const item = gpacks.itemAt(i);
|
||||
|
@ -76,11 +76,11 @@ Flickable {
|
|||
|
||||
RowLayout {
|
||||
Text {
|
||||
text: Backend.translate("Card Packages")
|
||||
text: luatr("Card Packages")
|
||||
font.bold: true
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Select All")
|
||||
text: luatr("Select All")
|
||||
onClicked: {
|
||||
for (let i = 0; i < cpacks.count; i++) {
|
||||
const item = cpacks.itemAt(i);
|
||||
|
@ -89,7 +89,7 @@ Flickable {
|
|||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Revert Selection")
|
||||
text: luatr("Revert Selection")
|
||||
onClicked: {
|
||||
for (let i = 0; i < cpacks.count; i++) {
|
||||
const item = cpacks.itemAt(i);
|
||||
|
@ -113,7 +113,15 @@ Flickable {
|
|||
checked: pkg_enabled
|
||||
|
||||
onCheckedChanged: {
|
||||
checkPackage(orig_name, checked);
|
||||
const packs = config.curScheme.banCardPkg;
|
||||
if (checked) {
|
||||
const idx = packs.indexOf(orig_name);
|
||||
if (idx !== -1) packs.splice(idx, 1);
|
||||
} else {
|
||||
packs.push(orig_name);
|
||||
}
|
||||
lcall("UpdatePackageEnable", orig_name, checked);
|
||||
config.curSchemeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,40 +129,42 @@ Flickable {
|
|||
}
|
||||
|
||||
function checkPackage(orig_name, checked) {
|
||||
const packs = config.disabledPack;
|
||||
if (checked) {
|
||||
const idx = packs.indexOf(orig_name);
|
||||
if (idx !== -1) packs.splice(idx, 1);
|
||||
const s = config.curScheme;
|
||||
if (!checked) {
|
||||
s.banPkg[orig_name] = [];
|
||||
delete s.normalPkg[orig_name];
|
||||
} else {
|
||||
packs.push(orig_name);
|
||||
delete s.normalPkg[orig_name];
|
||||
delete s.banPkg[orig_name];
|
||||
}
|
||||
Backend.callLuaFunction("UpdatePackageEnable", [orig_name, checked]);
|
||||
config.disabledPackChanged();
|
||||
lcall("UpdatePackageEnable", orig_name, checked);
|
||||
config.curSchemeChanged();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
loading = true;
|
||||
const g = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
for (let orig of g) {
|
||||
const g = lcall("GetAllGeneralPack");
|
||||
let orig;
|
||||
for (orig of g) {
|
||||
if (config.serverHiddenPacks.includes(orig)) {
|
||||
continue;
|
||||
}
|
||||
gpacklist.append({
|
||||
name: Backend.translate(orig),
|
||||
name: luatr(orig),
|
||||
orig_name: orig,
|
||||
pkg_enabled: !config.disabledPack.includes(orig),
|
||||
pkg_enabled: !config.curScheme.banPkg[orig],
|
||||
});
|
||||
}
|
||||
|
||||
const c = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
||||
for (let orig of c) {
|
||||
const c = lcall("GetAllCardPack");
|
||||
for (orig of c) {
|
||||
if (config.serverHiddenPacks.includes(orig)) {
|
||||
continue;
|
||||
}
|
||||
cpacklist.append({
|
||||
name: Backend.translate(orig),
|
||||
name: luatr(orig),
|
||||
orig_name: orig,
|
||||
pkg_enabled: !config.disabledPack.includes(orig),
|
||||
pkg_enabled: !config.curScheme.banCardPkg.includes(orig),
|
||||
});
|
||||
}
|
||||
loading = false;
|
||||
|
|
|
@ -11,7 +11,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Username")
|
||||
text: luatr("Username")
|
||||
}
|
||||
Text {
|
||||
text: Self.screenName
|
||||
|
@ -28,7 +28,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Avatar")
|
||||
text: luatr("Avatar")
|
||||
}
|
||||
TextField {
|
||||
id: avatarName
|
||||
|
@ -38,7 +38,7 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Update Avatar")
|
||||
text: luatr("Update Avatar")
|
||||
enabled: avatarName.text !== "" && !opTimer.running
|
||||
onClicked: {
|
||||
mainWindow.busy = true;
|
||||
|
@ -55,7 +55,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("Old Password")
|
||||
text: luatr("Old Password")
|
||||
}
|
||||
TextField {
|
||||
id: oldPassword
|
||||
|
@ -70,7 +70,7 @@ ColumnLayout {
|
|||
anchors.rightMargin: 8
|
||||
spacing: 16
|
||||
Text {
|
||||
text: Backend.translate("New Password")
|
||||
text: luatr("New Password")
|
||||
}
|
||||
TextField {
|
||||
id: newPassword
|
||||
|
@ -79,8 +79,9 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Update Password")
|
||||
enabled: oldPassword.text !== "" && newPassword.text !== "" && !opTimer.running
|
||||
text: luatr("Update Password")
|
||||
enabled: oldPassword.text !== "" && newPassword.text !== ""
|
||||
&& !opTimer.running
|
||||
onClicked: {
|
||||
mainWindow.busy = true;
|
||||
opTimer.start();
|
||||
|
|
13
Fk/Logic.js
13
Fk/Logic.js
|
@ -46,8 +46,8 @@ callbacks["NetworkDelayTest"] = (jsonData) => {
|
|||
// jsonData: RSA pub key
|
||||
let cipherText;
|
||||
let aeskey;
|
||||
if (config.savedPassword[config.serverAddr] !== undefined
|
||||
&& config.savedPassword[config.serverAddr].shorten_password === config.password) {
|
||||
const savedPw = config.savedPassword[config.serverAddr];
|
||||
if (savedPw?.shorten_password === config.password) {
|
||||
cipherText = config.savedPassword[config.serverAddr].password;
|
||||
aeskey = config.savedPassword[config.serverAddr].key;
|
||||
config.aeskey = aeskey ?? "";
|
||||
|
@ -173,7 +173,7 @@ callbacks["Chat"] = (jsonData) => {
|
|||
const data = JSON.parse(jsonData);
|
||||
const pid = data.sender;
|
||||
const userName = data.userName;
|
||||
const general = Backend.translate(data.general);
|
||||
const general = luatr(data.general);
|
||||
const time = data.time;
|
||||
const msg = data.msg;
|
||||
|
||||
|
@ -181,10 +181,13 @@ callbacks["Chat"] = (jsonData) => {
|
|||
return;
|
||||
}
|
||||
|
||||
let text;
|
||||
if (general === "")
|
||||
current.addToChat(pid, data, `<font color="#3598E8">[${time}] ${userName}:</font> ${msg}`);
|
||||
text = `<font color="#3598E8">[${time}] ${userName}:</font> ${msg}`;
|
||||
else
|
||||
current.addToChat(pid, data, `<font color="#3598E8">[${time}] ${userName}(${general}):</font> ${msg}`);
|
||||
text = `<font color="#3598E8">[${time}] ${userName}` +
|
||||
`(${general}):</font> ${msg}`;
|
||||
current.addToChat(pid, data, text);
|
||||
}
|
||||
|
||||
callbacks["ServerMessage"] = (jsonData) => {
|
||||
|
|
|
@ -36,7 +36,9 @@ ColumnLayout {
|
|||
id: edit
|
||||
font.pixelSize: 18
|
||||
Layout.fillWidth: true
|
||||
validator: RegularExpressionValidator { regularExpression: /[0-9A-Za-z_]+/ }
|
||||
validator: RegularExpressionValidator {
|
||||
regularExpression: /[0-9A-Za-z_]+/
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
|
|
|
@ -19,7 +19,8 @@ QtObject {
|
|||
conf.email = email;
|
||||
conf.modList = modList;
|
||||
|
||||
ModBackend.saveToFile("mymod/config.json", JSON.stringify(conf, undefined, 2));
|
||||
ModBackend.saveToFile("mymod/config.json",
|
||||
JSON.stringify(conf, undefined, 2));
|
||||
}
|
||||
|
||||
function addMod(mod) {
|
||||
|
|
|
@ -62,7 +62,8 @@ Item {
|
|||
SwipeDelegate.onClicked: deletePackage(modelData);
|
||||
|
||||
background: Rectangle {
|
||||
color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
|
||||
color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1)
|
||||
: "tomato"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,14 +119,19 @@ Item {
|
|||
toast.show(qsTr("cannot use this package name"));
|
||||
return;
|
||||
}
|
||||
|
||||
const path = modPath + new_name + "/";
|
||||
ModBackend.mkdir(path);
|
||||
mod.packages.push(new_name);
|
||||
ModBackend.saveToFile(modPath + "mod.json", JSON.stringify(mod, undefined, 2));
|
||||
ModBackend.saveToFile(modPath + "mod.json",
|
||||
JSON.stringify(mod, undefined, 2));
|
||||
|
||||
const pkgInfo = {
|
||||
name: new_name,
|
||||
};
|
||||
ModBackend.saveToFile(path + "pkg.json", JSON.stringify(pkgInfo, undefined, 2));
|
||||
ModBackend.saveToFile(path + "pkg.json",
|
||||
JSON.stringify(pkgInfo, undefined, 2));
|
||||
|
||||
root.modChanged();
|
||||
}
|
||||
|
||||
|
@ -133,7 +139,9 @@ Item {
|
|||
const path = modPath + name + "/";
|
||||
ModBackend.rmrf(path);
|
||||
mod.packages.splice(mod.packages.indexOf(name), 1);
|
||||
ModBackend.saveToFile(modPath + "mod.json", JSON.stringify(mod, undefined, 2));
|
||||
ModBackend.saveToFile(modPath + "mod.json",
|
||||
JSON.stringify(mod, undefined, 2));
|
||||
|
||||
root.modChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,8 @@ Item {
|
|||
SwipeDelegate.onClicked: deleteMod(modelData);
|
||||
|
||||
background: Rectangle {
|
||||
color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
|
||||
color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1)
|
||||
: "tomato"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +137,8 @@ Item {
|
|||
|
||||
function createNewMod(name) {
|
||||
const banned = [ "test", "standard", "standard_cards", "maneuvering" ];
|
||||
if (banned.indexOf(name) !== -1 || modConfig.modList.indexOf(name) !== -1) {
|
||||
if (banned.indexOf(name) !== -1 ||
|
||||
modConfig.modList.indexOf(name) !== -1) {
|
||||
toast.show(qsTr("cannot use this mod name"));
|
||||
return;
|
||||
}
|
||||
|
@ -146,10 +148,12 @@ Item {
|
|||
descrption: "",
|
||||
author: modConfig.userName,
|
||||
};
|
||||
ModBackend.saveToFile(`mymod/${name}/mod.json`, JSON.stringify(modInfo, undefined, 2));
|
||||
ModBackend.saveToFile(`mymod/${name}/mod.json`,
|
||||
JSON.stringify(modInfo, undefined, 2));
|
||||
ModBackend.saveToFile(`mymod/${name}/.gitignore`, "init.lua");
|
||||
ModBackend.stageFiles(name);
|
||||
ModBackend.commitChanges(name, "Initial commit", modConfig.userName, modConfig.email);
|
||||
ModBackend.commitChanges(name, "Initial commit", modConfig.userName,
|
||||
modConfig.email);
|
||||
modConfig.addMod(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ Item {
|
|||
anchors.left: logo.right
|
||||
anchors.leftMargin: 16
|
||||
width: parent.width * 0.65
|
||||
text: Backend.translate("about_" + dest + "_description")
|
||||
text: luatr("about_" + dest + "_description")
|
||||
wrapMode: Text.WordWrap
|
||||
textFormat: Text.MarkdownText
|
||||
font.pixelSize: 18
|
||||
|
@ -73,7 +73,7 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Quit")
|
||||
text: luatr("Quit")
|
||||
anchors.right: parent.right
|
||||
onClicked: {
|
||||
swipe.opacity = 0;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Fk
|
||||
import Fk.RoomElement
|
||||
|
||||
Item {
|
||||
|
@ -35,7 +36,7 @@ Item {
|
|||
height: 40
|
||||
|
||||
Text {
|
||||
text: Backend.translate(name)
|
||||
text: luatr(name)
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
|
@ -62,6 +63,7 @@ Item {
|
|||
|
||||
delegate: CardItem {
|
||||
autoBack: false
|
||||
showDetail: false
|
||||
property int dupCount: 0
|
||||
|
||||
Text {
|
||||
|
@ -115,10 +117,9 @@ Item {
|
|||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
onFinished: {
|
||||
const pkg = [listView.model.get(listView.currentIndex).name];
|
||||
const idList = JSON.parse(Backend.callLuaFunction("GetCards", pkg));
|
||||
const cardList = idList.map(id => JSON.parse(Backend.callLuaFunction
|
||||
("GetCardData",[id])));
|
||||
const pkg = listView.model.get(listView.currentIndex).name;
|
||||
const idList = lcall("GetCards", pkg);
|
||||
const cardList = idList.map(id => lcall("GetCardData", id));
|
||||
|
||||
const groupedCardList = [];
|
||||
let groupedCards = {};
|
||||
|
@ -194,25 +195,11 @@ Item {
|
|||
property int cid: 1
|
||||
property var cards
|
||||
function updateCard() {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
const data = lcall("GetCardData", cid);
|
||||
const suitTable = {
|
||||
spade: "♠", heart: '<font color="red">♥</font>',
|
||||
club: "♣", diamond: '<font color="red">♦</font>',
|
||||
}
|
||||
const getNumString = n => {
|
||||
switch (n) {
|
||||
case 1:
|
||||
return "A";
|
||||
case 11:
|
||||
return "J";
|
||||
case 12:
|
||||
return "Q";
|
||||
case 13:
|
||||
return "K";
|
||||
default:
|
||||
return n.toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (!cards) {
|
||||
detailCard.setData(data);
|
||||
|
@ -227,22 +214,21 @@ Item {
|
|||
detailCard.known = true;
|
||||
cardText.clear();
|
||||
audioRow.clear();
|
||||
cardText.append(Backend.translate(":" + data.name));
|
||||
cardText.append(luatr(":" + data.name));
|
||||
addCardAudio(data)
|
||||
const skills = JSON.parse(Backend.callLuaFunction
|
||||
("GetCardSpecialSkills", [cid]));
|
||||
const skills = lcall("GetCardSpecialSkills", cid);
|
||||
if (skills.length > 0) {
|
||||
cardText.append("<br/>" + Backend.translate("Special card skills:"));
|
||||
cardText.append("<br/>" + luatr("Special card skills:"));
|
||||
skills.forEach(t => {
|
||||
cardText.append("<b>" + Backend.translate(t) + "</b>: "
|
||||
+ Backend.translate(":" + t));
|
||||
cardText.append("<b>" + luatr(t) + "</b>: "
|
||||
+ luatr(":" + t));
|
||||
});
|
||||
}
|
||||
|
||||
if (cards) {
|
||||
cardText.append("<br/>" + Backend.translate("Every suit & number:"));
|
||||
cardText.append("<br/>" + luatr("Every suit & number:"));
|
||||
cardText.append(cards.map(c => {
|
||||
return (suitTable[c.suit] + getNumString(c.number))
|
||||
return (suitTable[c.suit] + Util.convertNumber(c.number))
|
||||
}).join(", "));
|
||||
}
|
||||
}
|
||||
|
@ -265,6 +251,7 @@ Item {
|
|||
Layout.alignment: Qt.AlignHCenter
|
||||
cid: 1
|
||||
known: false
|
||||
showDetail: false
|
||||
|
||||
property int dupCount: 0
|
||||
Text {
|
||||
|
@ -303,16 +290,17 @@ Item {
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
text: {
|
||||
if (gender === "male") {
|
||||
return Backend.translate("Male Audio");
|
||||
return luatr("Male Audio");
|
||||
} else {
|
||||
return Backend.translate("Female Audio");
|
||||
return luatr("Female Audio");
|
||||
}
|
||||
}
|
||||
font.pixelSize: 14
|
||||
}
|
||||
onClicked: {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cardDetail.cid]));
|
||||
Backend.playSound("./packages/" + extension + "/audio/card/" + gender + "/" + data.name);
|
||||
const data = lcall("GetCardData", cardDetail.cid);
|
||||
Backend.playSound("./packages/" + extension + "/audio/card/"
|
||||
+ gender + "/" + data.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +310,7 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Quit")
|
||||
text: luatr("Quit")
|
||||
anchors.right: parent.right
|
||||
onClicked: {
|
||||
mainStack.pop();
|
||||
|
@ -331,21 +319,23 @@ Item {
|
|||
|
||||
function addCardAudio(card) {
|
||||
const extension = card.extension;
|
||||
const orig_extension = Backend.callLuaFunction("GetCardExtensionByName", [card.name]);
|
||||
let fname = AppPath + "/packages/" + extension + "/audio/card/male/" + card.name + ".mp3";
|
||||
const orig_extension = lcall("GetCardExtensionByName", card.name);
|
||||
const prefix = AppPath + "/packages/";
|
||||
const suffix = card.name + ".mp3";
|
||||
let fname = prefix + extension + "/audio/card/male/" + suffix;
|
||||
if (Backend.exists(fname)) {
|
||||
audioRow.append( { gender: "male", extension: extension } );
|
||||
} else {
|
||||
fname = AppPath + "/packages/" + orig_extension + "/audio/card/male/" + card.name + ".mp3";
|
||||
fname = prefix + orig_extension + "/audio/card/male/" + suffix;
|
||||
if (Backend.exists(fname)) {
|
||||
audioRow.append( {gender: "male", extension: orig_extension} );
|
||||
}
|
||||
}
|
||||
fname = AppPath + "/packages/" + extension + "/audio/card/female/" + card.name + ".mp3";
|
||||
fname = prefix + extension + "/audio/card/female/" + suffix;
|
||||
if (Backend.exists(fname)) {
|
||||
audioRow.append( { gender: "female", extension: extension } );
|
||||
}else {
|
||||
fname = AppPath + "/packages/" + orig_extension + "/audio/card/female/" + card.name + ".mp3";
|
||||
fname = prefix + orig_extension + "/audio/card/female/" + suffix;
|
||||
if (Backend.exists(fname)) {
|
||||
audioRow.append( { gender: "female", extension: orig_extension } );
|
||||
}
|
||||
|
@ -354,7 +344,7 @@ Item {
|
|||
|
||||
function loadPackages() {
|
||||
if (loaded) return;
|
||||
const packs = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
||||
const packs = lcall("GetAllCardPack");
|
||||
packs.forEach(name => {
|
||||
if (!config.serverHiddenPacks.includes(name)) {
|
||||
packages.append({ name: name });
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Fk
|
||||
import Fk.RoomElement
|
||||
import "RoomLogic.js" as RoomLogic
|
||||
|
||||
|
@ -10,39 +11,98 @@ Item {
|
|||
id: root
|
||||
|
||||
property bool loaded: false
|
||||
property int stat: 0 // 0=normal 1=banPkg 2=banChara
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: listView
|
||||
color: "#88EEEEEE"
|
||||
id: listBg
|
||||
width: 260; height: parent.height
|
||||
color: "snow"
|
||||
radius: 6
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
id: modList
|
||||
width: 130; height: parent.height
|
||||
anchors.top: listBg.top; anchors.left: listBg.left
|
||||
clip: true
|
||||
width: 130
|
||||
height: parent.height - 20
|
||||
y: 10
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
model: ListModel {
|
||||
id: packages
|
||||
id: mods
|
||||
}
|
||||
|
||||
highlight: Rectangle { color: "#E91E63"; radius: 5 }
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#A48959"
|
||||
z: -1
|
||||
}
|
||||
|
||||
highlight: Rectangle { color: "snow" }
|
||||
highlightMoveDuration: 500
|
||||
|
||||
delegate: Item {
|
||||
width: listView.width
|
||||
width: modList.width
|
||||
height: 40
|
||||
|
||||
Text {
|
||||
text: Backend.translate(name)
|
||||
text: luatr(name)
|
||||
color: modList.currentIndex === index ? "black" : "white"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
listView.currentIndex = index;
|
||||
modList.currentIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: pkgList
|
||||
width: 130; height: parent.height
|
||||
anchors.top: listBg.top; anchors.left: modList.right
|
||||
|
||||
clip: true
|
||||
model: JSON.parse(mods.get(modList.currentIndex)?.pkgs ?? "[]")
|
||||
|
||||
highlight: Rectangle { color: "#FFCC3F"; radius: 5; scale: 0.8 }
|
||||
highlightMoveDuration: 500
|
||||
|
||||
delegate: Item {
|
||||
width: pkgList.width
|
||||
height: 40
|
||||
|
||||
Text {
|
||||
text: luatr(modelData)
|
||||
color: !config.curScheme.banPkg[modelData] ? "black" : "grey"
|
||||
Behavior on color { ColorAnimation { duration: 200 } }
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
Image {
|
||||
source: AppPath + "/image/button/skill/locked.png"
|
||||
opacity: !config.curScheme.banPkg[modelData] ? 0 : 1
|
||||
Behavior on opacity { NumberAnimation { duration: 200 } }
|
||||
anchors.centerIn: parent
|
||||
scale: 0.8
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
if (stat === 1) {
|
||||
const name = modelData;
|
||||
let s = config.curScheme;
|
||||
if (s.banPkg[name]) {
|
||||
delete s.banPkg[name];
|
||||
delete s.normalPkg[name];
|
||||
} else {
|
||||
delete s.normalPkg[name];
|
||||
s.banPkg[name] = [];
|
||||
}
|
||||
console.log(JSON.stringify(config.curScheme))
|
||||
config.curSchemeChanged();
|
||||
} else {
|
||||
pkgList.currentIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,13 +110,106 @@ Item {
|
|||
onCurrentIndexChanged: { vanishAnim.start(); }
|
||||
}
|
||||
|
||||
ToolBar {
|
||||
id: bar
|
||||
width: root.width - listBg.width - 16
|
||||
anchors.left: listBg.right
|
||||
anchors.leftMargin: 8
|
||||
y: 8
|
||||
|
||||
background: Rectangle {
|
||||
color: stat === 0 ? "#5cb3cc" : "#869d9d"
|
||||
Behavior on color { ColorAnimation { duration: 200 } }
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
Item { Layout.preferredWidth: 20 }
|
||||
|
||||
Label {
|
||||
text: {
|
||||
switch (stat) {
|
||||
case 0: return luatr("Generals Overview");
|
||||
case 1: return luatr("$BanPkgHelp");
|
||||
case 2: return luatr("$BanCharaHelp");
|
||||
}
|
||||
}
|
||||
elide: Label.ElideLeft
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: 28
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
TextField {
|
||||
id: word
|
||||
clip: true
|
||||
leftPadding: 5
|
||||
rightPadding: 5
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
text: luatr("Search")
|
||||
font.pixelSize: 20
|
||||
enabled: word.text !== ""
|
||||
onClicked: {
|
||||
pkgList.currentIndex = 0;
|
||||
vanishAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: banButton
|
||||
font.pixelSize: 20
|
||||
text: {
|
||||
if (stat === 2) return luatr("OK");
|
||||
return luatr("BanGeneral");
|
||||
}
|
||||
enabled: stat !== 1
|
||||
onClicked: {
|
||||
if (stat === 0) {
|
||||
stat = 2;
|
||||
} else {
|
||||
stat = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: banPkgButton
|
||||
font.pixelSize: 20
|
||||
text: {
|
||||
if (stat === 1) return luatr("OK");
|
||||
return luatr("BanPackage");
|
||||
}
|
||||
enabled: stat !== 2
|
||||
onClicked: {
|
||||
if (stat === 0) {
|
||||
stat = 1;
|
||||
} else {
|
||||
stat = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
text: luatr("Quit")
|
||||
font.pixelSize: 20
|
||||
onClicked: {
|
||||
mainStack.pop();
|
||||
config.saveConf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: gridView
|
||||
clip: true
|
||||
width: root.width - listView.width - generalDetail.width - 16
|
||||
height: parent.height - 20
|
||||
y: 10
|
||||
anchors.left: listView.right
|
||||
width: root.width - listBg.width - 16
|
||||
height: parent.height - bar.height - 24
|
||||
y: 16 + bar.height
|
||||
anchors.left: listBg.right
|
||||
anchors.leftMargin: 8 + (width % 100) / 2
|
||||
cellHeight: 140
|
||||
cellWidth: 100
|
||||
|
@ -65,24 +218,77 @@ Item {
|
|||
autoBack: false
|
||||
name: modelData
|
||||
onClicked: {
|
||||
if (stat === 2) {
|
||||
const s = config.curScheme;
|
||||
const gdata = lcall("GetGeneralData", modelData);
|
||||
const pack = gdata.package;
|
||||
let arr;
|
||||
if (s.banPkg[pack]) {
|
||||
arr = s.banPkg[pack];
|
||||
} else {
|
||||
if (!s.normalPkg[pack]) {
|
||||
s.normalPkg[pack] = [];
|
||||
}
|
||||
arr = s.normalPkg[pack];
|
||||
}
|
||||
// TODO: 根据手动全禁/全白名单自动改为禁包
|
||||
const idx = arr.indexOf(modelData);
|
||||
if (idx !== -1) {
|
||||
arr.splice(idx, 1);
|
||||
} else {
|
||||
arr.push(modelData);
|
||||
}
|
||||
config.curSchemeChanged();
|
||||
} else {
|
||||
generalText.clear();
|
||||
generalDetail.general = modelData;
|
||||
generalDetail.updateGeneral();
|
||||
// generalDetail.open();
|
||||
generalDetail.open();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "black"
|
||||
opacity: config.disabledGenerals.includes(modelData) ? 0.7 : 0
|
||||
opacity: {
|
||||
const s = config.curScheme;
|
||||
const gdata = lcall("GetGeneralData", modelData);
|
||||
const pack = gdata.package;
|
||||
if (s.banPkg[pack]) {
|
||||
if (!s.banPkg[pack].includes(modelData)) return 0.5;
|
||||
} else {
|
||||
if (!!s.normalPkg[pack]?.includes(modelData)) return 0.5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Behavior on opacity {
|
||||
NumberAnimation {}
|
||||
}
|
||||
}
|
||||
|
||||
GlowText {
|
||||
visible: config.disabledGenerals.includes(modelData)
|
||||
text: '禁'
|
||||
id: banText
|
||||
visible: {
|
||||
const s = config.curScheme;
|
||||
const gdata = lcall("GetGeneralData", modelData);
|
||||
const pack = gdata.package;
|
||||
if (s.banPkg[pack]) {
|
||||
return s.banPkg[pack].includes(modelData);
|
||||
} else {
|
||||
return !!s.normalPkg[pack]?.includes(modelData);
|
||||
}
|
||||
}
|
||||
text: {
|
||||
if (!visible) return '';
|
||||
const s = config.curScheme;
|
||||
const gdata = lcall("GetGeneralData", modelData);
|
||||
const pack = gdata.package;
|
||||
if (s.banPkg[pack]) {
|
||||
if (s.banPkg[pack].includes(modelData)) return '启用';
|
||||
} else {
|
||||
if (!!s.normalPkg[pack]?.includes(modelData)) return '禁';
|
||||
}
|
||||
}
|
||||
anchors.centerIn: parent
|
||||
font.family: fontLi2.name
|
||||
color: "#E4D5A0"
|
||||
|
@ -107,17 +313,16 @@ Item {
|
|||
PropertyAnimation {
|
||||
target: gridView
|
||||
property: "y"
|
||||
to: 30
|
||||
to: 36 + bar.height
|
||||
duration: 150
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
onFinished: {
|
||||
if (word.text !== "") {
|
||||
gridView.model = JSON.parse(Backend.callLuaFunction("SearchAllGenerals",
|
||||
[word.text]));
|
||||
gridView.model = lcall("SearchAllGenerals", word.text);
|
||||
} else {
|
||||
gridView.model = JSON.parse(Backend.callLuaFunction("SearchGenerals",
|
||||
[listView.model.get(listView.currentIndex).name, word.text]));
|
||||
gridView.model = lcall("SearchGenerals",
|
||||
pkgList.model[pkgList.currentIndex], word.text);
|
||||
}
|
||||
word.text = "";
|
||||
appearAnim.start();
|
||||
|
@ -138,138 +343,16 @@ Item {
|
|||
PropertyAnimation {
|
||||
target: gridView
|
||||
property: "y"
|
||||
from: 20
|
||||
to: 10
|
||||
from: 36 + bar.height
|
||||
to: 16 + bar.height
|
||||
duration: 150
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: generalDetail
|
||||
width: 310
|
||||
height: parent.height - searcher.height - 20
|
||||
y: 10
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 10
|
||||
color: "#88EEEEEE"
|
||||
radius: 8
|
||||
|
||||
property string general: "caocao"
|
||||
|
||||
function addSpecialSkillAudio(skill) {
|
||||
const gdata = JSON.parse(Backend.callLuaFunction("GetGeneralData", [general]));
|
||||
const extension = gdata.extension;
|
||||
let ret = false;
|
||||
for (let i = 0; i < 999; i++) {
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
skill + "_" + general + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
if (Backend.exists(fname)) {
|
||||
ret = true;
|
||||
audioModel.append({ name: skill, idx: i });
|
||||
} else {
|
||||
if (i > 0) break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function addSkillAudio(skill) {
|
||||
if (addSpecialSkillAudio(skill)) return;
|
||||
const skilldata = JSON.parse(Backend.callLuaFunction("GetSkillData", [skill]));
|
||||
if (!skilldata) return;
|
||||
const extension = skilldata.extension;
|
||||
for (let i = 0; i < 999; i++) {
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
skill + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
if (Backend.exists(fname)) {
|
||||
audioModel.append({ name: skill, idx: i });
|
||||
} else {
|
||||
if (i > 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findDeathAudio(general) {
|
||||
const extension = JSON.parse(Backend.callLuaFunction("GetGeneralData", [general])).extension;
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/death/" + general + ".mp3";
|
||||
if (Backend.exists(fname)) {
|
||||
audioDeath.visible = true;
|
||||
} else {
|
||||
audioDeath.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
function updateGeneral() {
|
||||
detailGeneralCard.name = general;
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
|
||||
generalText.clear();
|
||||
audioModel.clear();
|
||||
|
||||
if (data.companions.length > 0){
|
||||
let ret = '';
|
||||
ret += "<font color=\"slategrey\"><b>" + Backend.translate("Companions") + "</b>: ";
|
||||
data.companions.forEach(t => {
|
||||
ret += Backend.translate(t) + ' '
|
||||
});
|
||||
generalText.append(ret)
|
||||
}
|
||||
|
||||
data.skill.forEach(t => {
|
||||
generalText.append("<b>" + Backend.translate(t.name) +
|
||||
"</b>: " + t.description);
|
||||
|
||||
addSkillAudio(t.name);
|
||||
});
|
||||
data.related_skill.forEach(t => {
|
||||
generalText.append("<font color=\"purple\"><b>" + Backend.translate(t.name) +
|
||||
"</b>: " + t.description + "</font>");
|
||||
|
||||
addSkillAudio(t.name);
|
||||
});
|
||||
findDeathAudio(general);
|
||||
|
||||
addSkillAudio(general + "_win_audio");
|
||||
}
|
||||
|
||||
Flickable {
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
contentHeight: detailLayout.height
|
||||
width: parent.width - 40
|
||||
height: parent.height - 40
|
||||
clip: true
|
||||
anchors.centerIn: parent
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
ColumnLayout {
|
||||
id: detailLayout
|
||||
width: parent.width
|
||||
|
||||
GeneralCardItem {
|
||||
id: detailGeneralCard
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
name: "caocao"
|
||||
}
|
||||
|
||||
TextEdit {
|
||||
id: generalText
|
||||
|
||||
Layout.fillWidth: true
|
||||
readOnly: true
|
||||
selectByKeyboard: true
|
||||
selectByMouse: false
|
||||
wrapMode: TextEdit.WordWrap
|
||||
textFormat: TextEdit.RichText
|
||||
font.pixelSize: 16
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: ListModel {
|
||||
id: audioModel
|
||||
}
|
||||
Component {
|
||||
id: skillAudioBtn
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
|
@ -277,9 +360,10 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
text: {
|
||||
if (name.endsWith("_win_audio")) {
|
||||
return "胜利语音";
|
||||
return luatr("Win audio");
|
||||
}
|
||||
return Backend.translate(name) + (idx ? " (" + idx.toString() + ")" : "");
|
||||
return luatr(name) + (idx ? " (" + idx.toString() + ")"
|
||||
: "");
|
||||
}
|
||||
font.bold: true
|
||||
font.pixelSize: 14
|
||||
|
@ -288,11 +372,12 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
text: {
|
||||
const orig = '$' + name + (idx ? idx.toString() : "");
|
||||
const orig_trans = Backend.translate(orig);
|
||||
const orig_trans = luatr(orig);
|
||||
|
||||
// try general specific
|
||||
const orig_g = '$' + name + '_' + detailGeneralCard.name + (idx ? idx.toString() : "");
|
||||
const orig_g_trans = Backend.translate(orig_g);
|
||||
const orig_g = '$' + name + '_' + detailGeneralCard.name
|
||||
+ (idx ? idx.toString() : "");
|
||||
const orig_g_trans = luatr(orig_g);
|
||||
|
||||
if (orig_g_trans !== orig_g) {
|
||||
return orig_g_trans;
|
||||
|
@ -319,95 +404,137 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: audioDeath
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: Backend.translate("Death audio")
|
||||
font.bold: true
|
||||
font.pixelSize: 14
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: Backend.translate("~" + generalDetail.general) == "~" + generalDetail.general ? "" : Backend.translate("~" + generalDetail.general)
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
Popup {
|
||||
id: generalDetail
|
||||
width: realMainWin.width * 0.6
|
||||
height: realMainWin.height * 0.8
|
||||
anchors.centerIn: parent
|
||||
background: Rectangle {
|
||||
color: "#EEEEEEEE"
|
||||
radius: 5
|
||||
border.color: "#A6967A"
|
||||
border.width: 1
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
const general = generalDetail.general
|
||||
const extension = JSON.parse(Backend.callLuaFunction("GetGeneralData", [general])).extension;
|
||||
Backend.playSound("./packages/" + extension + "/audio/death/" + general);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
id: searcher
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
color: "snow"
|
||||
opacity: 0.75
|
||||
anchors.top: parent.bottom
|
||||
radius: 8
|
||||
property string general: "caocao"
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: word
|
||||
Layout.fillWidth: true
|
||||
clip: true
|
||||
leftPadding: 5
|
||||
rightPadding: 5
|
||||
}
|
||||
function addSpecialSkillAudio(skill) {
|
||||
const gdata = lcall("GetGeneralData", general);
|
||||
const extension = gdata.extension;
|
||||
let ret = false;
|
||||
for (let i = 0; i < 999; i++) {
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
skill + "_" + general + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Search")
|
||||
enabled: word.text !== ""
|
||||
onClicked: {
|
||||
listView.currentIndex = 0;
|
||||
vanishAnim.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.right: parent.right
|
||||
Button {
|
||||
text: Backend.translate("Quit")
|
||||
onClicked: {
|
||||
mainStack.pop();
|
||||
config.saveConf();
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: banButton
|
||||
text: Backend.translate(config.disabledGenerals.includes(detailGeneralCard.name) ? 'ResumeGeneral' : 'BanGeneral')
|
||||
visible: detailGeneralCard.name
|
||||
onClicked: {
|
||||
const { disabledGenerals } = config;
|
||||
const { name } = detailGeneralCard;
|
||||
|
||||
if (banButton.text === Backend.translate('ResumeGeneral')) {
|
||||
const deleteIndex = disabledGenerals.findIndex((general) => general === name);
|
||||
if (deleteIndex === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
disabledGenerals.splice(deleteIndex, 1);
|
||||
if (Backend.exists(fname)) {
|
||||
ret = true;
|
||||
audioModel.append({ name: skill, idx: i });
|
||||
} else {
|
||||
if (disabledGenerals.includes(name)) {
|
||||
return;
|
||||
if (i > 0) break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
disabledGenerals.push(name);
|
||||
function addSkillAudio(skill) {
|
||||
if (addSpecialSkillAudio(skill)) return;
|
||||
const skilldata = lcall("GetSkillData", skill);
|
||||
if (!skilldata) return;
|
||||
const extension = skilldata.extension;
|
||||
for (let i = 0; i < 999; i++) {
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
skill + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
if (Backend.exists(fname)) {
|
||||
audioModel.append({ name: skill, idx: i });
|
||||
} else {
|
||||
if (i > 0) break;
|
||||
}
|
||||
config.disabledGeneralsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
function findDeathAudio(general) {
|
||||
const extension = lcall("GetGeneralData", general).extension;
|
||||
const fname = AppPath + "/packages/" + extension + "/audio/death/"
|
||||
+ general + ".mp3";
|
||||
if (Backend.exists(fname)) {
|
||||
audioDeath.visible = true;
|
||||
} else {
|
||||
audioDeath.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
function updateGeneral() {
|
||||
detailGeneralCard.name = general;
|
||||
const data = lcall("GetGeneralDetail", general);
|
||||
generalText.clear();
|
||||
audioModel.clear();
|
||||
|
||||
if (data.companions.length > 0){
|
||||
let ret = "<font color=\"slategrey\"><b>" + luatr("Companions")
|
||||
+ "</b>: ";
|
||||
data.companions.forEach(t => {
|
||||
ret += luatr(t) + ' '
|
||||
});
|
||||
generalText.append(ret)
|
||||
}
|
||||
|
||||
data.skill.forEach(t => {
|
||||
generalText.append("<b>" + luatr(t.name) +
|
||||
"</b>: " + t.description);
|
||||
|
||||
addSkillAudio(t.name);
|
||||
});
|
||||
data.related_skill.forEach(t => {
|
||||
generalText.append("<font color=\"purple\"><b>" + luatr(t.name) +
|
||||
"</b>: " + t.description + "</font>");
|
||||
|
||||
addSkillAudio(t.name);
|
||||
});
|
||||
findDeathAudio(general);
|
||||
|
||||
addSkillAudio(general + "_win_audio");
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width / mainWindow.scale
|
||||
height: parent.height / mainWindow.scale
|
||||
scale: mainWindow.scale
|
||||
|
||||
Item {
|
||||
id: generalInfo
|
||||
width: 150
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
GeneralCardItem {
|
||||
id: detailGeneralCard
|
||||
name: "caocao"
|
||||
scale: 1.5; transformOrigin: Item.TopLeft
|
||||
}
|
||||
|
||||
Item { Layout.preferredHeight: 130 * 0.5 }
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
textFormat: TextEdit.RichText
|
||||
font.pixelSize: 16
|
||||
function trans(str) {
|
||||
const ret = luatr(str);
|
||||
if (ret === str) {
|
||||
return luatr("Official");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
text: {
|
||||
const general = generalDetail.general;
|
||||
return [
|
||||
luatr(lcall("GetGeneralData", general).package),
|
||||
luatr("Title") + trans("#" + general),
|
||||
luatr("Designer") + trans("designer:" + general),
|
||||
luatr("Voice Actor") + trans("cv:" + general),
|
||||
luatr("Illustrator") + trans("illustrator:" + general),
|
||||
].join("<br>");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,8 +544,9 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Set as Avatar")
|
||||
enabled: detailGeneralCard.name !== "" && !opTimer.running && Self.avatar !== detailGeneralCard.name
|
||||
text: luatr("Set as Avatar")
|
||||
enabled: detailGeneralCard.name !== "" && !opTimer.running
|
||||
&& Self.avatar !== detailGeneralCard.name
|
||||
onClicked: {
|
||||
mainWindow.busy = true;
|
||||
opTimer.start();
|
||||
|
@ -429,16 +557,92 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
contentHeight: detailLayout.height
|
||||
width: parent.width - 40 - generalInfo.width
|
||||
height: parent.height - 40
|
||||
clip: true
|
||||
anchors.left: generalInfo.right
|
||||
anchors.leftMargin: 20
|
||||
y: 20
|
||||
|
||||
ColumnLayout {
|
||||
id: detailLayout
|
||||
width: parent.width
|
||||
|
||||
TextEdit {
|
||||
id: generalText
|
||||
|
||||
Layout.fillWidth: true
|
||||
readOnly: true
|
||||
selectByKeyboard: true
|
||||
selectByMouse: false
|
||||
wrapMode: TextEdit.WordWrap
|
||||
textFormat: TextEdit.RichText
|
||||
font.pixelSize: 18
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
columns: 2
|
||||
Repeater {
|
||||
model: ListModel {
|
||||
id: audioModel
|
||||
}
|
||||
delegate: skillAudioBtn
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: audioDeath
|
||||
Layout.fillWidth: true
|
||||
contentItem: ColumnLayout {
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: luatr("Death audio")
|
||||
font.bold: true
|
||||
font.pixelSize: 14
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: {
|
||||
const orig = "~" + generalDetail.general;
|
||||
const tr = luatr(orig);
|
||||
if (tr === orig) {
|
||||
return "";
|
||||
}
|
||||
return tr;
|
||||
}
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
const general = generalDetail.general
|
||||
const extension = lcall("GetGeneralData", general).extension;
|
||||
Backend.playSound("./packages/" + extension + "/audio/death/"
|
||||
+ general);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadPackages() {
|
||||
if (loaded) return;
|
||||
const packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
||||
packs.forEach(name => {
|
||||
if (!config.serverHiddenPacks.includes(name)) {
|
||||
packages.append({ name: name });
|
||||
}
|
||||
const _mods = lcall("GetAllModNames")
|
||||
const modData = lcall("GetAllMods")
|
||||
const packs = lcall("GetAllGeneralPack");
|
||||
_mods.forEach(name => {
|
||||
const pkgs = modData[name].filter(p => packs.includes(p)
|
||||
&& !config.serverHiddenPacks.includes(p));
|
||||
if (pkgs.length > 0)
|
||||
mods.append({ name: name, pkgs: JSON.stringify(pkgs) });
|
||||
});
|
||||
generalDetail.updateGeneral();
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,8 @@ Item {
|
|||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
mainStack.push(Qt.createComponent("../Tutorial.qml").createObject());
|
||||
mainStack.push(Qt.createComponent("../Tutorial.qml")
|
||||
.createObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,8 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
placeholderText: qsTr("Password")
|
||||
text: ""
|
||||
echoMode: showPasswordCheck.checked ? TextInput.Normal : TextInput.Password
|
||||
echoMode: showPasswordCheck.checked ? TextInput.Normal
|
||||
: TextInput.Password
|
||||
passwordCharacter: "*"
|
||||
}
|
||||
|
||||
|
@ -215,10 +216,12 @@ Item {
|
|||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
enabled: serverAddrEdit.text !== "" && screenNameEdit.text !== "" && passwordEdit.text !== ""
|
||||
enabled: serverAddrEdit.text !== "" && screenNameEdit.text !== ""
|
||||
&& passwordEdit.text !== ""
|
||||
text: "OK"
|
||||
onClicked: {
|
||||
root.addNewServer(serverAddrEdit.text, screenNameEdit.text, passwordEdit.text);
|
||||
root.addNewServer(serverAddrEdit.text, screenNameEdit.text,
|
||||
passwordEdit.text);
|
||||
finished();
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +262,8 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
placeholderText: qsTr("Password")
|
||||
text: ""
|
||||
echoMode: showPasswordCheck.checked ? TextInput.Normal : TextInput.Password
|
||||
echoMode: showPasswordCheck.checked ? TextInput.Normal
|
||||
: TextInput.Password
|
||||
passwordCharacter: "*"
|
||||
}
|
||||
|
||||
|
@ -371,7 +375,11 @@ Item {
|
|||
const item = serverModel.get(i);
|
||||
const ip = item.serverIP;
|
||||
if (addr.endsWith(ip)) { // endsWith是为了应付IPv6格式的ip
|
||||
item.misMatchMsg = FkVersion === ver ? "" : qsTr("@VersionMismatch").arg(ver);
|
||||
item.misMatchMsg = "";
|
||||
if (FkVersion !== ver) {
|
||||
item.misMatchMsg = qsTr("@VersionMismatch").arg(ver);
|
||||
}
|
||||
|
||||
item.description = desc;
|
||||
item.favicon = icon;
|
||||
item.online = count.toString();
|
||||
|
|
|
@ -41,7 +41,7 @@ Item {
|
|||
width: parent.width
|
||||
wrapMode: TextEdit.WordWrap
|
||||
textFormat: Text.MarkdownText
|
||||
text: config.serverMotd + "\n___\n" + Backend.translate('Bulletin Info')
|
||||
text: config.serverMotd + "\n___\n" + luatr('Bulletin Info')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,23 @@ Item {
|
|||
Text {
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
Layout.fillWidth: true
|
||||
text: (hasPassword ? Backend.translate("Has Password") : "") + roomName
|
||||
text: roomName
|
||||
font.pixelSize: 20
|
||||
elide: Label.ElideRight
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 16
|
||||
Image {
|
||||
source: AppPath + "/image/button/skill/locked.png"
|
||||
visible: hasPassword
|
||||
anchors.centerIn: parent
|
||||
scale: 0.8
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: Backend.translate(gameMode)
|
||||
text: luatr(gameMode)
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -81,8 +91,8 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
text: (playerNum < capacity) ? Backend.translate("Enter") :
|
||||
Backend.translate("Observe")
|
||||
text: (playerNum < capacity) ? luatr("Enter") :
|
||||
luatr("Observe")
|
||||
|
||||
enabled: !opTimer.running
|
||||
|
||||
|
@ -124,7 +134,7 @@ Item {
|
|||
height: root.height - 80
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: Backend.translate("Refresh Room List")
|
||||
text: luatr("Refresh Room List")
|
||||
enabled: !opTimer.running
|
||||
onClicked: {
|
||||
opTimer.start();
|
||||
|
@ -142,7 +152,7 @@ Item {
|
|||
Text {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: Backend.translate("Room List").arg(roomModel.count)
|
||||
text: luatr("Room List").arg(roomModel.count)
|
||||
}
|
||||
ListView {
|
||||
id: roomList
|
||||
|
@ -166,9 +176,10 @@ Item {
|
|||
width: 120
|
||||
display: AbstractButton.TextUnderIcon
|
||||
icon.name: "media-playback-start"
|
||||
text: Backend.translate("Create Room")
|
||||
text: luatr("Create Room")
|
||||
onClicked: {
|
||||
lobby_dialog.sourceComponent = Qt.createComponent("../LobbyElement/CreateRoom.qml");
|
||||
lobby_dialog.sourceComponent =
|
||||
Qt.createComponent("../LobbyElement/CreateRoom.qml");
|
||||
lobby_drawer.open();
|
||||
config.observing = false;
|
||||
config.replaying = false;
|
||||
|
@ -180,33 +191,33 @@ Item {
|
|||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
Button {
|
||||
text: Backend.translate("Generals Overview")
|
||||
text: luatr("Generals Overview")
|
||||
onClicked: {
|
||||
mainStack.push(mainWindow.generalsOverviewPage);
|
||||
mainStack.currentItem.loadPackages();
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Cards Overview")
|
||||
text: luatr("Cards Overview")
|
||||
onClicked: {
|
||||
mainStack.push(mainWindow.cardsOverviewPage);
|
||||
mainStack.currentItem.loadPackages();
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Scenarios Overview")
|
||||
text: luatr("Scenarios Overview")
|
||||
onClicked: {
|
||||
mainStack.push(mainWindow.modesOverviewPage);
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Replay")
|
||||
text: luatr("Replay")
|
||||
onClicked: {
|
||||
mainStack.push(mainWindow.replayPage);
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("About")
|
||||
text: luatr("About")
|
||||
onClicked: {
|
||||
mainStack.push(mainWindow.aboutPage);
|
||||
}
|
||||
|
@ -216,7 +227,7 @@ Item {
|
|||
Button {
|
||||
id: exitButton
|
||||
anchors.right: parent.right
|
||||
text: Backend.translate("Exit Lobby")
|
||||
text: luatr("Exit Lobby")
|
||||
display: AbstractButton.TextBesideIcon
|
||||
icon.name: "application-exit"
|
||||
onClicked: {
|
||||
|
@ -269,7 +280,7 @@ Item {
|
|||
anchors.margins: 16
|
||||
|
||||
Text {
|
||||
text: Backend.translate("Please input room's password")
|
||||
text: luatr("Please input room's password")
|
||||
}
|
||||
|
||||
TextField {
|
||||
|
@ -295,7 +306,7 @@ Item {
|
|||
config.replaying = false;
|
||||
if (playerNum < capacity) {
|
||||
config.observing = false;
|
||||
Backend.callLuaFunction("SetObserving", [false]);
|
||||
lcall("SetObserving", false);
|
||||
mainWindow.busy = true;
|
||||
ClientInstance.notifyServer(
|
||||
"EnterRoom",
|
||||
|
@ -303,7 +314,7 @@ Item {
|
|||
);
|
||||
} else {
|
||||
config.observing = true;
|
||||
Backend.callLuaFunction("SetObserving", [true]);
|
||||
lcall("SetObserving", true);
|
||||
mainWindow.busy = true;
|
||||
ClientInstance.notifyServer(
|
||||
"ObserveRoom",
|
||||
|
@ -334,7 +345,7 @@ Item {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
x: 4; y: 2
|
||||
font.pixelSize: 16
|
||||
text: Backend.translate("$OnlineInfo")
|
||||
text: luatr("$OnlineInfo")
|
||||
.arg(lobbyPlayerNum).arg(serverPlayerNum) + "\n"
|
||||
+ "Powered by FreeKill " + FkVersion
|
||||
}
|
||||
|
@ -357,8 +368,10 @@ Item {
|
|||
|
||||
function addToChat(pid, raw, msg) {
|
||||
if (raw.type !== 1) return;
|
||||
msg = msg.replace(/\{emoji([0-9]+)\}/g, '<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
raw.msg = raw.msg.replace(/\{emoji([0-9]+)\}/g, '<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
msg = msg.replace(/\{emoji([0-9]+)\}/g,
|
||||
'<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
raw.msg = raw.msg.replace(/\{emoji([0-9]+)\}/g,
|
||||
'<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
lobbyChat.append(msg);
|
||||
danmaku.sendLog("<b>" + raw.userName + "</b>: " + raw.msg);
|
||||
}
|
||||
|
@ -369,6 +382,6 @@ Item {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toast.show(Backend.translate("$WelcomeToLobby"));
|
||||
toast.show(luatr("$WelcomeToLobby"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ Item {
|
|||
id: modeDesc
|
||||
width: parent.width - 16
|
||||
wrapMode: Text.WordWrap
|
||||
text: Backend.translate(":" + modeList.get(listView.currentIndex).orig_name)
|
||||
text: luatr(":" + modeList.get(listView.currentIndex).orig_name)
|
||||
textFormat: Text.MarkdownText
|
||||
font.pixelSize: 16
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Quit")
|
||||
text: luatr("Quit")
|
||||
anchors.bottom: parent.bottom
|
||||
onClicked: {
|
||||
mainStack.pop();
|
||||
|
@ -68,7 +68,7 @@ Item {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
const mode_data = JSON.parse(Backend.callLuaFunction("GetGameModes", []));
|
||||
const mode_data = lcall("GetGameModes");
|
||||
for (let d of mode_data) {
|
||||
modeList.append(d);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ Item {
|
|||
onClicked: mainStack.pop();
|
||||
}
|
||||
Label {
|
||||
text: Backend.translate("Replay Manager")
|
||||
text: luatr("Replay Manager")
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
@ -75,8 +75,9 @@ Item {
|
|||
Text {
|
||||
text: {
|
||||
const win = winner.split("+").indexOf(role) !== -1;
|
||||
const winStr = win ? Backend.translate("Game Win") : Backend.translate("Game Lose");
|
||||
return "<b>" + Backend.translate(_general) + "</b> " + Backend.translate(role) + " " + winStr;
|
||||
const winStr = win ? luatr("Game Win") : luatr("Game Lose");
|
||||
return "<b>" + luatr(_general) + "</b> " + luatr(role)
|
||||
+ " " + winStr;
|
||||
}
|
||||
font.pixelSize: 20
|
||||
textFormat: Text.RichText
|
||||
|
@ -89,16 +90,16 @@ Item {
|
|||
const h = repDate.slice(8,10);
|
||||
const m = repDate.slice(10,12);
|
||||
const s = repDate.slice(12,14);
|
||||
const dateStr = y + "-" + month + "-" + d + " " + h + ":" + m + ":" + s;
|
||||
const dateStr = `${y}-${month}-${d} ${h}:${m}:${s}`;
|
||||
|
||||
return playerName + " " + Backend.translate(gameMode) + " " + dateStr
|
||||
return playerName + " " + luatr(gameMode) + " " + dateStr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: replayBtn
|
||||
text: Backend.translate("Play the Replay")
|
||||
text: luatr("Play the Replay")
|
||||
anchors.right: delBtn.left
|
||||
anchors.rightMargin: 8
|
||||
onClicked: {
|
||||
|
@ -110,7 +111,7 @@ Item {
|
|||
|
||||
Button {
|
||||
id: delBtn
|
||||
text: Backend.translate("Delete Replay")
|
||||
text: luatr("Delete Replay")
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 8
|
||||
onClicked: {
|
||||
|
|
|
@ -73,6 +73,7 @@ Item {
|
|||
|
||||
onIsStartedChanged: {
|
||||
if (isStarted) {
|
||||
Backend.playSound("./audio/system/gamestart");
|
||||
bgm.play();
|
||||
canKickOwner = false;
|
||||
kickOwnerTimer.stop();
|
||||
|
@ -87,7 +88,7 @@ Item {
|
|||
anchors.topMargin: 12
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
text: Backend.translate("Menu")
|
||||
text: luatr("Menu")
|
||||
onClicked: {
|
||||
if (menuContainer.visible){
|
||||
menuContainer.close();
|
||||
|
@ -103,7 +104,7 @@ Item {
|
|||
|
||||
MenuItem {
|
||||
id: quitButton
|
||||
text: Backend.translate("Quit")
|
||||
text: luatr("Quit")
|
||||
onClicked: {
|
||||
if (config.replaying) {
|
||||
Backend.controlReplayer("shutdown");
|
||||
|
@ -119,14 +120,18 @@ Item {
|
|||
MenuItem {
|
||||
id: surrenderButton
|
||||
enabled: !config.observing && !config.replaying
|
||||
text: Backend.translate("Surrender")
|
||||
text: luatr("Surrender")
|
||||
onClicked: {
|
||||
if (isStarted && !getPhoto(Self.id).dead) {
|
||||
const surrenderCheck = JSON.parse(Backend.callLuaFunction('CheckSurrenderAvailable', [miscStatus.playedTime]));
|
||||
const photo = getPhoto(Self.id);
|
||||
if (isStarted && !(photo.dead && photo.rest <= 0)) {
|
||||
const surrenderCheck = lcall('CheckSurrenderAvailable', miscStatus.playedTime);
|
||||
if (!surrenderCheck.length) {
|
||||
surrenderDialog.informativeText = Backend.translate('Surrender is disabled in this mode');
|
||||
surrenderDialog.informativeText =
|
||||
luatr('Surrender is disabled in this mode');
|
||||
} else {
|
||||
surrenderDialog.informativeText = surrenderCheck.map(str => `${Backend.translate(str.text)}(${str.passed ? '√' : '×'})`).join('<br>');
|
||||
surrenderDialog.informativeText = surrenderCheck
|
||||
.map(str => `${luatr(str.text)}(${str.passed ? '√' : '×'})`)
|
||||
.join('<br>');
|
||||
}
|
||||
surrenderDialog.open();
|
||||
}
|
||||
|
@ -135,7 +140,7 @@ Item {
|
|||
|
||||
MenuItem {
|
||||
id: volumeButton
|
||||
text: Backend.translate("Audio Settings")
|
||||
text: luatr("Audio Settings")
|
||||
onClicked: {
|
||||
volumeDialog.open();
|
||||
}
|
||||
|
@ -144,7 +149,7 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Add Robot")
|
||||
text: luatr("Add Robot")
|
||||
visible: isOwner && !isStarted && !isFull
|
||||
anchors.centerIn: parent
|
||||
enabled: config.serverEnableBot
|
||||
|
@ -153,7 +158,7 @@ Item {
|
|||
}
|
||||
}
|
||||
Button {
|
||||
text: Backend.translate("Start Game")
|
||||
text: luatr("Start Game")
|
||||
visible: isOwner && !isStarted && isFull
|
||||
enabled: isAllReady
|
||||
anchors.centerIn: parent
|
||||
|
@ -166,7 +171,7 @@ Item {
|
|||
interval: 1000
|
||||
}
|
||||
Button {
|
||||
text: isReady ? Backend.translate("Cancel Ready") : Backend.translate("Ready")
|
||||
text: isReady ? luatr("Cancel Ready") : luatr("Ready")
|
||||
visible: !isOwner && !isStarted
|
||||
enabled: !opTimer.running
|
||||
anchors.centerIn: parent
|
||||
|
@ -205,6 +210,7 @@ Item {
|
|||
canKickOwner = false;
|
||||
kickOwnerTimer.stop();
|
||||
} else {
|
||||
Backend.playSound("./audio/system/ready");
|
||||
kickOwnerTimer.start();
|
||||
}
|
||||
}
|
||||
|
@ -237,25 +243,25 @@ Item {
|
|||
width: parent.width
|
||||
wrapMode: TextEdit.WordWrap
|
||||
Component.onCompleted: {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetRoomConfig", []));
|
||||
let cardpack = JSON.parse(Backend.callLuaFunction("GetAllCardPack", []));
|
||||
const data = lcall("GetRoomConfig");
|
||||
let cardpack = lcall("GetAllCardPack");
|
||||
cardpack = cardpack.filter(p => !data.disabledPack.includes(p));
|
||||
|
||||
text = Backend.translate("GameMode") + Backend.translate(data.gameMode) + "<br />"
|
||||
+ Backend.translate("LuckCardNum") + "<b>" + data.luckTime + "</b><br />"
|
||||
+ Backend.translate("ResponseTime") + "<b>" + config.roomTimeout + "</b><br />"
|
||||
+ Backend.translate("GeneralBoxNum") + "<b>" + data.generalNum + "</b>"
|
||||
+ (data.enableFreeAssign ? "<br />" + Backend.translate("IncludeFreeAssign") : "")
|
||||
+ (data.enableDeputy ? " " + Backend.translate("IncludeDeputy") : "")
|
||||
+ '<br />' + Backend.translate('CardPackages') + cardpack.map(e => {
|
||||
let ret = Backend.translate(e);
|
||||
if (ret.search(/特殊牌|衍生牌/) === -1) { // TODO: 这种东西最好还是变量名规范化= =
|
||||
text = luatr("GameMode") + luatr(data.gameMode) + "<br />"
|
||||
+ luatr("LuckCardNum") + "<b>" + data.luckTime + "</b><br />"
|
||||
+ luatr("ResponseTime") + "<b>" + config.roomTimeout + "</b><br />"
|
||||
+ luatr("GeneralBoxNum") + "<b>" + data.generalNum + "</b>"
|
||||
+ (data.enableFreeAssign ? "<br />" + luatr("IncludeFreeAssign")
|
||||
: "")
|
||||
+ (data.enableDeputy ? " " + luatr("IncludeDeputy") : "")
|
||||
+ '<br />' + luatr('CardPackages') + cardpack.map(e => {
|
||||
let ret = luatr(e);
|
||||
// TODO: 这种东西最好还是变量名规范化= =
|
||||
if (ret.search(/特殊牌|衍生牌/) === -1) {
|
||||
ret = "<b>" + ret + "</b>";
|
||||
}
|
||||
return ret;
|
||||
}).join(',')
|
||||
//+ '<br /><b>禁包</b>:' + data.disabledPack.map(e => Backend.translate(e)).join(',')
|
||||
//+ '<br /><b>禁将</b>:' + data.disabledGenerals.map(e => Backend.translate(e)).join(',')
|
||||
}).join(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,13 +442,14 @@ Item {
|
|||
anchors.leftMargin: 8
|
||||
ColumnLayout {
|
||||
MetroButton {
|
||||
text: Backend.translate("Choose one handcard")
|
||||
text: luatr("Choose one handcard")
|
||||
textFont.pixelSize: 28
|
||||
visible: {
|
||||
if (dashboard.handcardArea.length <= 15) {
|
||||
return false;
|
||||
}
|
||||
if (roomScene.state == "notactive" || roomScene.state == "replying") {
|
||||
if (roomScene.state === "notactive"
|
||||
|| roomScene.state === "replying") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -450,21 +457,21 @@ Item {
|
|||
onClicked: roomScene.startCheat("../RoomElement/ChooseHandcard");
|
||||
}
|
||||
MetroButton {
|
||||
text: Backend.translate("Revert Selection")
|
||||
text: luatr("Revert Selection")
|
||||
textFont.pixelSize: 28
|
||||
enabled: dashboard.pending_skill !== ""
|
||||
onClicked: dashboard.revertSelection();
|
||||
}
|
||||
// MetroButton {
|
||||
// text: Backend.translate("Trust")
|
||||
// text: luatr("Trust")
|
||||
// }
|
||||
MetroButton {
|
||||
text: Backend.translate("Sort Cards")
|
||||
text: luatr("Sort Cards")
|
||||
textFont.pixelSize: 28
|
||||
onClicked: Logic.resortHandcards();
|
||||
}
|
||||
MetroButton {
|
||||
text: Backend.translate("Chat")
|
||||
text: luatr("Chat")
|
||||
textFont.pixelSize: 28
|
||||
onClicked: roomDrawer.open();
|
||||
}
|
||||
|
@ -479,21 +486,21 @@ Item {
|
|||
|
||||
onCardSelected: function(card) {
|
||||
Logic.enableTargets(card);
|
||||
if (typeof card === "number" && card !== -1 && roomScene.state === "playing"
|
||||
&& JSON.parse(Backend.callLuaFunction("GetPlayerHandcards", [Self.id])).includes(card)) {
|
||||
if (typeof card === "number" && card !== -1
|
||||
&& roomScene.state === "playing"
|
||||
&& lcall("GetPlayerHandcards", Self.id).includes(card)) {
|
||||
|
||||
const skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [card]));
|
||||
if (JSON.parse(Backend.callLuaFunction("CanUseCard", [card, Self.id]))) {
|
||||
const skills = lcall("GetCardSpecialSkills", card);
|
||||
if (lcall("CanUseCard", card, Self.id,
|
||||
JSON.stringify(roomScene.extra_data))) {
|
||||
skills.unshift("_normal_use");
|
||||
}
|
||||
specialCardSkills.model = skills;
|
||||
const skillName = Backend.callLuaFunction("GetCardSkill", [card]);
|
||||
const prompt = JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveSkillPrompt",
|
||||
[skillName, card, selected_targets]
|
||||
));
|
||||
const skillName = lcall("GetCardSkill", card);
|
||||
const prompt = lcall("ActiveSkillPrompt", skillName, card,
|
||||
selected_targets);
|
||||
if (prompt !== "") {
|
||||
roomScene.setPrompt(processPrompt(prompt));
|
||||
roomScene.setPrompt(Util.processPrompt(prompt));
|
||||
}
|
||||
} else {
|
||||
specialCardSkills.model = [];
|
||||
|
@ -524,18 +531,19 @@ Item {
|
|||
const totalMin = Math.floor(replayerDuration / 60);
|
||||
const totalSec = replayerDuration % 60;
|
||||
|
||||
return elapsedMin.toString() + ":" + elapsedSec + "/" + totalMin + ":" + totalSec;
|
||||
return elapsedMin.toString() + ":" + elapsedSec + "/" + totalMin
|
||||
+ ":" + totalSec;
|
||||
}
|
||||
}
|
||||
|
||||
Switch {
|
||||
text: Backend.translate("Speed Resume")
|
||||
text: luatr("Speed Resume")
|
||||
checked: false
|
||||
onCheckedChanged: Backend.controlReplayer("uniform");
|
||||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Speed Down")
|
||||
text: luatr("Speed Down")
|
||||
onClicked: Backend.controlReplayer("slowdown");
|
||||
}
|
||||
|
||||
|
@ -546,13 +554,13 @@ Item {
|
|||
}
|
||||
|
||||
Button {
|
||||
text: Backend.translate("Speed Up")
|
||||
text: luatr("Speed Up")
|
||||
onClicked: Backend.controlReplayer("speedup");
|
||||
}
|
||||
|
||||
Button {
|
||||
property bool running: true
|
||||
text: Backend.translate(running ? "Pause" : "Resume")
|
||||
text: luatr(running ? "Pause" : "Resume")
|
||||
onClicked: {
|
||||
running = !running;
|
||||
Backend.controlReplayer("toggle");
|
||||
|
@ -657,7 +665,7 @@ Item {
|
|||
id: specialCardSkills
|
||||
RadioButton {
|
||||
property string orig_text: modelData
|
||||
text: Backend.translate(modelData)
|
||||
text: luatr(modelData)
|
||||
checked: index === 0
|
||||
onCheckedChanged: {
|
||||
roomScene.resetPrompt();
|
||||
|
@ -665,23 +673,19 @@ Item {
|
|||
let prompt = ""
|
||||
if (modelData === "_normal_use") {
|
||||
Logic.enableTargets(card);
|
||||
const skillName = Backend.callLuaFunction("GetCardSkill", [card]);
|
||||
prompt = JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveSkillPrompt",
|
||||
[skillName, card, selected_targets]
|
||||
));
|
||||
const skillName = lcall("GetCardSkill", card);
|
||||
prompt = lcall("ActiveSkillPrompt", skillName, card,
|
||||
selected_targets);
|
||||
} else {
|
||||
Logic.enableTargets(JSON.stringify({
|
||||
skill: modelData,
|
||||
subcards: [card],
|
||||
}));
|
||||
prompt = JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveSkillPrompt",
|
||||
[modelData, card, selected_targets]
|
||||
));
|
||||
prompt = lcall("ActiveSkillPrompt", modelData, card,
|
||||
selected_targets);
|
||||
}
|
||||
if (prompt !== "") {
|
||||
roomScene.setPrompt(processPrompt(prompt));
|
||||
roomScene.setPrompt(Util.processPrompt(prompt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -707,8 +711,9 @@ Item {
|
|||
|
||||
Button {
|
||||
id: skipNullificationButton
|
||||
text: Backend.translate("SkipNullification")
|
||||
visible: !!extra_data.useEventId && !skippedUseEventId.find(id => id === extra_data.useEventId)
|
||||
text: luatr("SkipNullification")
|
||||
visible: !!extra_data.useEventId
|
||||
&& !skippedUseEventId.find(id => id === extra_data.useEventId)
|
||||
onClicked: {
|
||||
skippedUseEventId.push(extra_data.useEventId);
|
||||
Logic.doCancelButton();
|
||||
|
@ -717,20 +722,20 @@ Item {
|
|||
|
||||
Button {
|
||||
id: okButton
|
||||
text: Backend.translate("OK")
|
||||
text: luatr("OK")
|
||||
onClicked: Logic.doOkButton();
|
||||
}
|
||||
|
||||
Button {
|
||||
id: cancelButton
|
||||
text: Backend.translate("Cancel")
|
||||
text: luatr("Cancel")
|
||||
onClicked: Logic.doCancelButton();
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: endPhaseButton
|
||||
text: Backend.translate("End")
|
||||
text: luatr("End")
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 40
|
||||
anchors.right: parent.right
|
||||
|
@ -793,12 +798,13 @@ Item {
|
|||
|
||||
function activateSkill(skill_name, pressed) {
|
||||
if (pressed) {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetInteractionOfSkill", [skill_name]));
|
||||
const data = lcall("GetInteractionOfSkill", skill_name);
|
||||
if (data) {
|
||||
Backend.callLuaFunction("SetInteractionDataOfSkill", [skill_name, "null"]);
|
||||
lcall("SetInteractionDataOfSkill", skill_name, "null");
|
||||
switch (data.type) {
|
||||
case "combo":
|
||||
skillInteraction.sourceComponent = Qt.createComponent("../SkillInteraction/SkillCombo.qml");
|
||||
skillInteraction.sourceComponent =
|
||||
Qt.createComponent("../SkillInteraction/SkillCombo.qml");
|
||||
skillInteraction.item.skill = skill_name;
|
||||
skillInteraction.item.default_choice = data["default"];
|
||||
skillInteraction.item.choices = data.choices;
|
||||
|
@ -807,11 +813,18 @@ Item {
|
|||
// skillInteraction.item.clicked();
|
||||
break;
|
||||
case "spin":
|
||||
skillInteraction.sourceComponent = Qt.createComponent("../SkillInteraction/SkillSpin.qml");
|
||||
skillInteraction.sourceComponent =
|
||||
Qt.createComponent("../SkillInteraction/SkillSpin.qml");
|
||||
skillInteraction.item.skill = skill_name;
|
||||
skillInteraction.item.from = data.from;
|
||||
skillInteraction.item.to = data.to;
|
||||
break;
|
||||
case "custom":
|
||||
skillInteraction.sourceComponent =
|
||||
Qt.createComponent(AppPath + "/" + data.qml_path + ".qml");
|
||||
skillInteraction.item.skill = skill_name;
|
||||
skillInteraction.item.extra_data = data;
|
||||
break;
|
||||
default:
|
||||
skillInteraction.sourceComponent = undefined;
|
||||
break;
|
||||
|
@ -866,11 +879,11 @@ Item {
|
|||
width: roomDrawer.width
|
||||
TabButton {
|
||||
width: roomDrawer.width / 2
|
||||
text: Backend.translate("Log")
|
||||
text: luatr("Log")
|
||||
}
|
||||
TabButton {
|
||||
width: roomDrawer.width / 2
|
||||
text: Backend.translate("Chat")
|
||||
text: luatr("Chat")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -913,8 +926,8 @@ Item {
|
|||
|
||||
MessageDialog {
|
||||
id: quitDialog
|
||||
title: Backend.translate("Quit")
|
||||
informativeText: Backend.translate("Are you sure to quit?")
|
||||
title: luatr("Quit")
|
||||
informativeText: luatr("Are you sure to quit?")
|
||||
buttons: MessageDialog.Ok | MessageDialog.Cancel
|
||||
onButtonClicked: function (button) {
|
||||
switch (button) {
|
||||
|
@ -931,14 +944,17 @@ Item {
|
|||
|
||||
MessageDialog {
|
||||
id: surrenderDialog
|
||||
title: Backend.translate("Surrender")
|
||||
title: luatr("Surrender")
|
||||
informativeText: ''
|
||||
buttons: MessageDialog.Ok | MessageDialog.Cancel
|
||||
onButtonClicked: function (button, role) {
|
||||
switch (button) {
|
||||
case MessageDialog.Ok: {
|
||||
const surrenderCheck = JSON.parse(Backend.callLuaFunction('CheckSurrenderAvailable', [miscStatus.playedTime]));
|
||||
if (surrenderCheck.length && !surrenderCheck.find(check => !check.passed)) {
|
||||
const surrenderCheck =
|
||||
lcall('CheckSurrenderAvailable', miscStatus.playedTime);
|
||||
if (surrenderCheck.length &&
|
||||
!surrenderCheck.find(check => !check.passed)) {
|
||||
|
||||
ClientInstance.notifyServer("PushRequest", [
|
||||
"surrender", true
|
||||
]);
|
||||
|
@ -977,7 +993,7 @@ Item {
|
|||
GlowText {
|
||||
anchors.centerIn: dashboard
|
||||
visible: Logic.getPhoto(Self.id).rest > 0 && !config.observing
|
||||
text: Backend.translate("Resting, don't leave!")
|
||||
text: luatr("Resting, don't leave!")
|
||||
color: "#DBCC69"
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 28
|
||||
|
@ -991,60 +1007,13 @@ Item {
|
|||
color: "transparent"
|
||||
GlowText {
|
||||
anchors.centerIn: parent
|
||||
text: Backend.translate("Observing ...")
|
||||
text: luatr("Observing ...")
|
||||
color: "#4B83CD"
|
||||
font.family: fontLi2.name
|
||||
font.pixelSize: 48
|
||||
}
|
||||
}
|
||||
|
||||
/* 这东西似乎一直不好使啊
|
||||
Rectangle {
|
||||
id: easyChat
|
||||
width: parent.width
|
||||
height: 28
|
||||
anchors.bottom: parent.bottom
|
||||
visible: false
|
||||
color: "#040403"
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: "#A6967A"
|
||||
|
||||
TextInput {
|
||||
id: easyChatEdit
|
||||
anchors.fill: parent
|
||||
anchors.margins: 6
|
||||
color: "white"
|
||||
clip: true
|
||||
font.pixelSize: 14
|
||||
|
||||
onAccepted: {
|
||||
if (text != "") {
|
||||
ClientInstance.notifyServer(
|
||||
"Chat",
|
||||
JSON.stringify({
|
||||
type: 0,
|
||||
msg: text
|
||||
})
|
||||
);
|
||||
text = "";
|
||||
easyChat.visible = false;
|
||||
easyChatEdit.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: "T"
|
||||
onActivated: {
|
||||
easyChat.visible = true;
|
||||
easyChatEdit.enabled = true;
|
||||
easyChatEdit.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
MiscStatus {
|
||||
id: miscStatus
|
||||
anchors.right: menuButton.left
|
||||
|
@ -1077,10 +1046,9 @@ Item {
|
|||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: "Esc"
|
||||
sequence: "T"
|
||||
onActivated: {
|
||||
easyChat.visible = false;
|
||||
easyChatEdit.enabled = false;
|
||||
roomDrawer.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1096,20 +1064,9 @@ Item {
|
|||
onActivated: Logic.doCancelButton();
|
||||
}
|
||||
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = Backend.translate(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src")) raw = raw.replace(/%src/g, Backend.translate(getPhoto(src).general));
|
||||
if (raw.match("%dest")) raw = raw.replace(/%dest/g, Backend.translate(getPhoto(dest).general));
|
||||
if (raw.match("%arg2")) raw = raw.replace(/%arg2/g, Backend.translate(data[4]));
|
||||
if (raw.match("%arg")) raw = raw.replace(/%arg/g, Backend.translate(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
function getCurrentCardUseMethod() {
|
||||
if (specialCardSkills.count === 1 && specialCardSkills.model[0] !== "_normal_use") {
|
||||
if (specialCardSkills.count === 1
|
||||
&& specialCardSkills.model[0] !== "_normal_use") {
|
||||
return specialCardSkills.model[0];
|
||||
}
|
||||
|
||||
|
@ -1125,8 +1082,10 @@ Item {
|
|||
function addToChat(pid, raw, msg) {
|
||||
if (raw.type === 1) return;
|
||||
|
||||
msg = msg.replace(/\{emoji([0-9]+)\}/g, '<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
raw.msg = raw.msg.replace(/\{emoji([0-9]+)\}/g, '<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
msg = msg.replace(/\{emoji([0-9]+)\}/g,
|
||||
'<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
raw.msg = raw.msg.replace(/\{emoji([0-9]+)\}/g,
|
||||
'<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
||||
|
||||
if (raw.msg.startsWith("$")) {
|
||||
if (specialChat(pid, raw, raw.msg.slice(1))) return;
|
||||
|
@ -1149,7 +1108,7 @@ Item {
|
|||
|
||||
const time = data.time;
|
||||
const userName = data.userName;
|
||||
const general = Backend.translate(data.general);
|
||||
const general = luatr(data.general);
|
||||
|
||||
if (msg.startsWith("!")) {
|
||||
const splited = msg.split(":");
|
||||
|
@ -1167,10 +1126,15 @@ Item {
|
|||
// return false;
|
||||
|
||||
const fromItem = Logic.getPhotoOrDashboard(fromId);
|
||||
const fromPos = mapFromItem(fromItem, fromItem.width / 2, fromItem.height / 2);
|
||||
const fromPos = mapFromItem(fromItem, fromItem.width / 2,
|
||||
fromItem.height / 2);
|
||||
const toItem = Logic.getPhoto(toId);
|
||||
const toPos = mapFromItem(toItem, toItem.width / 2, toItem.height / 2);
|
||||
const egg = component.createObject(roomScene, { start: fromPos, end: toPos });
|
||||
const toPos = mapFromItem(toItem, toItem.width / 2,
|
||||
toItem.height / 2);
|
||||
const egg = component.createObject(roomScene, {
|
||||
start: fromPos,
|
||||
end: toPos
|
||||
});
|
||||
egg.finished.connect(() => egg.destroy());
|
||||
egg.running = true;
|
||||
|
||||
|
@ -1181,11 +1145,11 @@ Item {
|
|||
}
|
||||
} else if (msg.startsWith("~")) {
|
||||
const g = msg.slice(1);
|
||||
const extension = JSON.parse(Backend.callLuaFunction("GetGeneralData", [g])).extension;
|
||||
const extension = lcall("GetGeneralData", g).extension;
|
||||
if (!config.disableMsgAudio)
|
||||
Backend.playSound("./packages/" + extension + "/audio/death/" + g);
|
||||
|
||||
const m = Backend.translate("~" + g);
|
||||
const m = luatr("~" + g);
|
||||
data.msg = m;
|
||||
if (general === "")
|
||||
chat.append(`[${time}] ${userName}: ${m}`, data);
|
||||
|
@ -1207,6 +1171,7 @@ Item {
|
|||
const idx = parseInt(splited[1]);
|
||||
const gene = splited[2];
|
||||
|
||||
if (!config.disableMsgAudio)
|
||||
try {
|
||||
callbacks["LogEvent"](JSON.stringify({
|
||||
type: "PlaySkillSound",
|
||||
|
@ -1215,7 +1180,8 @@ Item {
|
|||
i: idx,
|
||||
}));
|
||||
} catch (e) {}
|
||||
const m = Backend.translate("$" + skill + (gene ? "_" + gene : "") + (idx ? idx.toString() : ""));
|
||||
const m = luatr("$" + skill + (gene ? "_" + gene : "")
|
||||
+ (idx ? idx.toString() : ""));
|
||||
data.msg = m;
|
||||
if (general === "")
|
||||
chat.append(`[${time}] ${userName}: ${m}`, data);
|
||||
|
@ -1253,8 +1219,7 @@ Item {
|
|||
for (let i = 0; i < photoModel.count; i++) {
|
||||
const item = photos.itemAt(i);
|
||||
if (show) {
|
||||
const dis = Backend.callLuaFunction("DistanceTo",[Self.id, item.playerid]);
|
||||
item.distance = parseInt(dis);
|
||||
item.distance = lcall("DistanceTo", Self.id, item.playerid);
|
||||
} else {
|
||||
item.distance = -1;
|
||||
}
|
||||
|
@ -1273,7 +1238,7 @@ Item {
|
|||
const item = photoModel.get(i);
|
||||
let gameData;
|
||||
try {
|
||||
gameData = JSON.parse(Backend.callLuaFunction("GetPlayerGameData", [item.id]));
|
||||
gameData = lcall("GetPlayerGameData", item.id);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
gameData = [0, 0, 0, 0];
|
||||
|
@ -1290,7 +1255,7 @@ Item {
|
|||
}
|
||||
}
|
||||
mainStack.pop();
|
||||
Backend.callLuaFunction("ResetClientLua", []);
|
||||
lcall("ResetClientLua");
|
||||
mainStack.push(room);
|
||||
mainStack.currentItem.loadPlayerData(datalist);
|
||||
}
|
||||
|
@ -1306,12 +1271,13 @@ Item {
|
|||
|
||||
function loadPlayerData(datalist) {
|
||||
datalist.forEach(d => {
|
||||
if (d.id == Self.id) {
|
||||
if (d.id === Self.id) {
|
||||
roomScene.isOwner = d.isOwner;
|
||||
} else {
|
||||
Backend.callLuaFunction("ResetAddPlayer", [JSON.stringify([d.id, d.name, d.avatar, d.ready, d.gameData[3]])]);
|
||||
lcall("ResetAddPlayer",
|
||||
JSON.stringify([d.id, d.name, d.avatar, d.ready, d.gameData[3]]));
|
||||
}
|
||||
Backend.callLuaFunction("SetPlayerGameData", [d.id, d.gameData]);
|
||||
lcall("SetPlayerGameData", d.id, d.gameData);
|
||||
Logic.getPhotoModel(d.id).isOwner = d.isOwner;
|
||||
});
|
||||
}
|
||||
|
@ -1321,7 +1287,7 @@ Item {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toast.show(Backend.translate("$EnterRoom"));
|
||||
toast.show(luatr("$EnterRoom"));
|
||||
playerNum = config.roomCapacity;
|
||||
|
||||
for (let i = 0; i < playerNum; i++) {
|
||||
|
|
|
@ -28,11 +28,13 @@ function arrangeManyPhotos() {
|
|||
const roomAreaPadding = -16;
|
||||
|
||||
let horizontalSpacing = 8;
|
||||
let photoWidth = (roomArea.width - horizontalSpacing * playerNum) / (playerNum - 1);
|
||||
let photoWidth = (roomArea.width - horizontalSpacing * playerNum)
|
||||
/ (playerNum - 1);
|
||||
let photoScale = 0.75;
|
||||
if (photoWidth > photoMaxWidth) {
|
||||
photoWidth = photoMaxWidth;
|
||||
horizontalSpacing = (roomArea.width - photoWidth * (playerNum - 1)) / playerNum;
|
||||
horizontalSpacing = (roomArea.width - photoWidth * (playerNum - 1))
|
||||
/ playerNum;
|
||||
} else {
|
||||
photoScale = photoWidth / photoBaseWidth;
|
||||
}
|
||||
|
@ -134,14 +136,13 @@ function arrangePhotos() {
|
|||
|
||||
function doOkButton() {
|
||||
if (roomScene.state === "playing" || roomScene.state === "responding") {
|
||||
const reply = JSON.stringify(
|
||||
{
|
||||
const reply = JSON.stringify({
|
||||
card: dashboard.getSelectedCard(),
|
||||
targets: selected_targets,
|
||||
special_skill: roomScene.getCurrentCardUseMethod(),
|
||||
interaction_data: roomScene.skillInteraction.item ? roomScene.skillInteraction.item.answer : undefined,
|
||||
}
|
||||
);
|
||||
interaction_data: roomScene.skillInteraction.item ?
|
||||
roomScene.skillInteraction.item.answer : undefined,
|
||||
});
|
||||
replyToServer(reply);
|
||||
return;
|
||||
}
|
||||
|
@ -244,7 +245,8 @@ function getPhotoOrDashboard(id) {
|
|||
function getAreaItem(area, id) {
|
||||
if (area === Card.DrawPile) {
|
||||
return drawPile;
|
||||
} else if (area === Card.DiscardPile || area === Card.Processing || area === Card.Void) {
|
||||
} else if (area === Card.DiscardPile || area === Card.Processing ||
|
||||
area === Card.Void) {
|
||||
return tablePile;
|
||||
} else if (area === Card.AG) {
|
||||
return popupBox.item;
|
||||
|
@ -372,7 +374,8 @@ function setEmotion(id, emotion, isCardId) {
|
|||
}
|
||||
}
|
||||
|
||||
const animation = component.createObject(photo, {source: (OS === "Win" ? "file:///" : "") + path});
|
||||
const animation = component.createObject(photo,
|
||||
{ source: (OS === "Win" ? "file:///" : "") + path });
|
||||
animation.anchors.centerIn = photo;
|
||||
if (isCardId) {
|
||||
animation.started.connect(() => photo.busy = true);
|
||||
|
@ -452,7 +455,8 @@ function doIndicate(from, tos) {
|
|||
return;
|
||||
|
||||
const fromItem = getPhotoOrDashboard(from);
|
||||
const fromPos = mapFromItem(fromItem, fromItem.width / 2, fromItem.height / 2);
|
||||
const fromPos = mapFromItem(fromItem, fromItem.width / 2,
|
||||
fromItem.height / 2);
|
||||
|
||||
const end = [];
|
||||
for (let i = 0; i < tos.length; i++) {
|
||||
|
@ -464,11 +468,31 @@ function doIndicate(from, tos) {
|
|||
}
|
||||
|
||||
const color = "#96943D";
|
||||
const line = component.createObject(roomScene, {start: fromPos, end: end, color: color});
|
||||
const line = component.createObject(roomScene, {
|
||||
start: fromPos,
|
||||
end: end,
|
||||
color: color
|
||||
});
|
||||
line.finished.connect(() => line.destroy());
|
||||
line.running = true;
|
||||
}
|
||||
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = luatr(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src"))
|
||||
raw = raw.replace(/%src/g, luatr(getPhoto(src).general));
|
||||
if (raw.match("%dest"))
|
||||
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
|
||||
if (raw.match("%arg2"))
|
||||
raw = raw.replace(/%arg2/g, luatr(data[4]));
|
||||
if (raw.match("%arg"))
|
||||
raw = raw.replace(/%arg/g, luatr(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
callbacks["MaxCard"] = (jsonData) => {
|
||||
const data = JSON.parse(jsonData);
|
||||
const id = data.id;
|
||||
|
@ -480,7 +504,7 @@ callbacks["MaxCard"] = (jsonData) => {
|
|||
}
|
||||
|
||||
function changeSelf(id) {
|
||||
Backend.callLuaFunction("ChangeSelf", [id]);
|
||||
lcall("ChangeSelf", id);
|
||||
|
||||
// move new selfPhoto to dashboard
|
||||
let order = new Array(photoModel.count);
|
||||
|
@ -533,15 +557,15 @@ callbacks["AddPlayer"] = (jsonData) => {
|
|||
}
|
||||
}
|
||||
|
||||
function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
||||
// card: int | { skill: string, subcards: int[] }
|
||||
function enableTargets(card) {
|
||||
if (roomScene.respond_play) {
|
||||
const candidate = (!isNaN(card) && card !== -1) || typeof(card) === "string";
|
||||
const candidate = (!isNaN(card) && card !== -1)
|
||||
|| typeof(card) === "string";
|
||||
if (candidate) {
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFitPattern",
|
||||
[card, roomScene.responding_card]
|
||||
)) && !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedResponse", [card]));
|
||||
okButton.enabled =
|
||||
lcall("CardFitPattern", card, roomScene.responding_card) &&
|
||||
!lcall("CardProhibitedResponse", card);
|
||||
} else {
|
||||
okButton.enabled = false;
|
||||
}
|
||||
|
@ -568,10 +592,8 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
|||
all_photos.forEach(photo => {
|
||||
photo.state = "candidate";
|
||||
const id = photo.playerid;
|
||||
const ret = JSON.parse(Backend.callLuaFunction(
|
||||
"CanUseCardToTarget",
|
||||
[card, id, selected_targets]
|
||||
));
|
||||
const ret = lcall("CanUseCardToTarget", card, id, selected_targets,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
photo.selectable = ret;
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
|
@ -588,22 +610,20 @@ function enableTargets(card) { // card: int | { skill: string, subcards: int[] }
|
|||
if (included instanceof Array) {
|
||||
if (included.filter((val) => {
|
||||
return selected_targets.indexOf(val) !== -1;
|
||||
}).length === 0 && included.indexOf(id) === -1) photo.selectable = false;
|
||||
}).length === 0 && included.indexOf(id) === -1)
|
||||
photo.selectable = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFeasible", [card, selected_targets]
|
||||
));
|
||||
okButton.enabled = lcall("CardFeasible", card, selected_targets);
|
||||
if (okButton.enabled && roomScene.state === "responding") {
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFitPattern",
|
||||
[card, roomScene.responding_card]
|
||||
)) && (roomScene.autoPending || !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedUse", [card])));
|
||||
okButton.enabled =
|
||||
lcall("CardFitPattern", card, roomScene.responding_card) &&
|
||||
(roomScene.autoPending || !lcall("CardProhibitedUse", card));
|
||||
} else if (okButton.enabled && roomScene.state === "playing") {
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction("CanUseCard", [card, Self.id]));
|
||||
okButton.enabled = lcall("CanUseCard", card, Self.id,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
}
|
||||
if (okButton.enabled) {
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
|
@ -646,10 +666,8 @@ function updateSelectedTargets(playerid, selected) {
|
|||
all_photos.forEach(photo => {
|
||||
if (photo.selected) return;
|
||||
const id = photo.playerid;
|
||||
const ret = JSON.parse(Backend.callLuaFunction(
|
||||
"CanUseCardToTarget",
|
||||
[card, id, selected_targets]
|
||||
));
|
||||
const ret = lcall("CanUseCardToTarget", card, id, selected_targets,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
photo.selectable = ret;
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
const must = roomScene.extra_data.must_targets;
|
||||
|
@ -666,22 +684,20 @@ function updateSelectedTargets(playerid, selected) {
|
|||
if (included instanceof Array) {
|
||||
if (included.filter((val) => {
|
||||
return selected_targets.indexOf(val) !== -1;
|
||||
}).length === 0 && included.indexOf(id) === -1) photo.selectable = false;
|
||||
}).length === 0 && included.indexOf(id) === -1)
|
||||
photo.selectable = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFeasible", [card, selected_targets]
|
||||
));
|
||||
okButton.enabled = lcall("CardFeasible", card, selected_targets);
|
||||
if (okButton.enabled && roomScene.state === "responding") {
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFitPattern",
|
||||
[card, roomScene.responding_card]
|
||||
)) && (roomScene.autoPending || !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedUse", [card])));
|
||||
okButton.enabled =
|
||||
lcall("CardFitPattern", card, roomScene.responding_card) &&
|
||||
(roomScene.autoPending || !lcall("CardProhibitedUse", card));
|
||||
} else if (okButton.enabled && roomScene.state === "playing") {
|
||||
okButton.enabled = JSON.parse(Backend.callLuaFunction("CanUseCard", [card, Self.id]));
|
||||
okButton.enabled = lcall("CanUseCard", card, Self.id,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
}
|
||||
if (okButton.enabled) {
|
||||
if (roomScene.extra_data instanceof Object) {
|
||||
|
@ -819,8 +835,7 @@ callbacks["UpdateCard"] = (j) => {
|
|||
return;
|
||||
}
|
||||
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [id]));
|
||||
card.setData(data);
|
||||
card.setData(lcall("GetCardData", id));
|
||||
}
|
||||
|
||||
callbacks["StartGame"] = (jsonData) => {
|
||||
|
@ -878,8 +893,8 @@ callbacks["MoveFocus"] = (jsonData) => {
|
|||
if (focuses.indexOf(model.id) != -1) {
|
||||
item = photos.itemAt(i);
|
||||
item.progressBar.visible = true;
|
||||
item.progressTip = Backend.translate(command)
|
||||
+ Backend.translate(" thinking...");
|
||||
item.progressTip = luatr(command)
|
||||
+ luatr(" thinking...");
|
||||
|
||||
/*
|
||||
if (command === "PlayCard") {
|
||||
|
@ -914,9 +929,10 @@ callbacks["AskForGeneral"] = (jsonData) => {
|
|||
const n = data[1];
|
||||
const convert = data[2];
|
||||
const heg = data[3];
|
||||
roomScene.setPrompt(Backend.translate("#AskForGeneral"), true);
|
||||
roomScene.setPrompt(luatr("#AskForGeneral"), true);
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/ChooseGeneralBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/ChooseGeneralBox.qml");
|
||||
const box = roomScene.popupBox.item;
|
||||
box.accepted.connect(() => {
|
||||
replyToServer(JSON.stringify(box.choices));
|
||||
|
@ -934,8 +950,8 @@ callbacks["AskForSkillInvoke"] = (jsonData) => {
|
|||
const data = JSON.parse(jsonData);
|
||||
const skill = data[0];
|
||||
const prompt = data[1];
|
||||
roomScene.promptText = prompt ? processPrompt(prompt) : Backend.translate("#AskForSkillInvoke")
|
||||
.arg(Backend.translate(skill));
|
||||
roomScene.promptText = prompt ? processPrompt(prompt)
|
||||
: luatr("#AskForSkillInvoke").arg(luatr(skill));
|
||||
roomScene.state = "replying";
|
||||
roomScene.okCancel.visible = true;
|
||||
roomScene.okButton.enabled = true;
|
||||
|
@ -953,26 +969,24 @@ callbacks["AskForGuanxing"] = (jsonData) => {
|
|||
const bottom_area_name = data.bottom_area_name;
|
||||
const prompt = data.prompt;
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/GuanxingBox.qml");
|
||||
data.cards.forEach(id => {
|
||||
const d = Backend.callLuaFunction("GetCardData", [id]);
|
||||
cards.push(JSON.parse(d));
|
||||
});
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/GuanxingBox.qml");
|
||||
data.cards.forEach(id => cards.push(lcall("GetCardData", id)));
|
||||
const box = roomScene.popupBox.item;
|
||||
box.prompt = prompt;
|
||||
if (max_top_cards === 0) {
|
||||
box.areaCapacities = [max_bottom_cards];
|
||||
box.areaLimits = [min_bottom_cards];
|
||||
box.areaNames = [Backend.translate(bottom_area_name)];
|
||||
box.areaNames = [luatr(bottom_area_name)];
|
||||
} else {
|
||||
if (max_bottom_cards === 0) {
|
||||
box.areaCapacities = [max_top_cards];
|
||||
box.areaLimits = [min_top_cards];
|
||||
box.areaNames = [Backend.translate(top_area_name)];
|
||||
box.areaNames = [luatr(top_area_name)];
|
||||
} else {
|
||||
box.areaCapacities = [max_top_cards, max_bottom_cards];
|
||||
box.areaLimits = [min_top_cards, min_bottom_cards];
|
||||
box.areaNames = [Backend.translate(top_area_name), Backend.translate(bottom_area_name)];
|
||||
box.areaNames = [luatr(top_area_name), luatr(bottom_area_name)];
|
||||
}
|
||||
}
|
||||
box.cards = cards;
|
||||
|
@ -989,18 +1003,16 @@ callbacks["AskForExchange"] = (jsonData) => {
|
|||
const capacities = [];
|
||||
const limits = [];
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/GuanxingBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/GuanxingBox.qml");
|
||||
let for_i = 0;
|
||||
const box = roomScene.popupBox.item;
|
||||
data.piles.forEach(ids => {
|
||||
if (ids.length > 0) {
|
||||
ids.forEach(id => {
|
||||
const d = Backend.callLuaFunction("GetCardData", [id]);
|
||||
cards.push(JSON.parse(d));
|
||||
});
|
||||
ids.forEach(id => cards.push(lcall("GetCardData", id)));
|
||||
capacities.push(ids.length);
|
||||
limits.push(0);
|
||||
cards_name.push(Backend.translate(data.piles_name[for_i]));
|
||||
cards_name.push(luatr(data.piles_name[for_i]));
|
||||
for_i ++;
|
||||
}
|
||||
});
|
||||
|
@ -1024,8 +1036,8 @@ callbacks["AskForChoice"] = (jsonData) => {
|
|||
const prompt = data[3];
|
||||
const detailed = data[4];
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = Backend.translate("#AskForChoice")
|
||||
.arg(Backend.translate(skill_name));
|
||||
roomScene.promptText = luatr("#AskForChoice")
|
||||
.arg(luatr(skill_name));
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
}
|
||||
|
@ -1059,8 +1071,8 @@ callbacks["AskForChoices"] = (jsonData) => {
|
|||
const prompt = data[5];
|
||||
const detailed = data[6];
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = Backend.translate("#AskForChoices")
|
||||
.arg(Backend.translate(skill_name));
|
||||
roomScene.promptText = luatr("#AskForChoices")
|
||||
.arg(luatr(skill_name));
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
}
|
||||
|
@ -1095,13 +1107,14 @@ callbacks["AskForCardChosen"] = (jsonData) => {
|
|||
const reason = data._reason;
|
||||
const prompt = data._prompt;
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = Backend.translate("#AskForChooseCard")
|
||||
.arg(Backend.translate(reason));
|
||||
roomScene.promptText = luatr(processPrompt("#AskForChooseCard:" + data._id))
|
||||
.arg(luatr(reason));
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
}
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/PlayerCardBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/PlayerCardBox.qml");
|
||||
|
||||
const box = roomScene.popupBox.item;
|
||||
box.prompt = prompt;
|
||||
|
@ -1109,17 +1122,12 @@ callbacks["AskForCardChosen"] = (jsonData) => {
|
|||
const arr = [];
|
||||
const ids = d[1];
|
||||
|
||||
ids.forEach(id => {
|
||||
const card_data = JSON.parse(Backend.callLuaFunction("GetCardData", [id]));
|
||||
arr.push(card_data);
|
||||
});
|
||||
ids.forEach(id => arr.push(lcall("GetCardData", id)));
|
||||
box.addCustomCards(d[0], arr);
|
||||
}
|
||||
|
||||
roomScene.popupBox.moveToCenter();
|
||||
box.cardSelected.connect(function(cid){
|
||||
replyToServer(cid);
|
||||
});
|
||||
box.cardSelected.connect(cid => replyToServer(cid));
|
||||
}
|
||||
|
||||
callbacks["AskForCardsChosen"] = (jsonData) => {
|
||||
|
@ -1131,14 +1139,15 @@ callbacks["AskForCardsChosen"] = (jsonData) => {
|
|||
const reason = data._reason;
|
||||
const prompt = data._prompt;
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = Backend.translate("#AskForChooseCards")
|
||||
.arg(Backend.translate(reason)).arg(min).arg(max);
|
||||
roomScene.promptText = luatr(processPrompt("#AskForChooseCards:" + data._id))
|
||||
.arg(luatr(reason)).arg(min).arg(max);
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
}
|
||||
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/PlayerCardBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/PlayerCardBox.qml");
|
||||
const box = roomScene.popupBox.item;
|
||||
box.multiChoose = true;
|
||||
box.min = min;
|
||||
|
@ -1148,10 +1157,7 @@ callbacks["AskForCardsChosen"] = (jsonData) => {
|
|||
const arr = [];
|
||||
const ids = d[1];
|
||||
|
||||
ids.forEach(id => {
|
||||
const card_data = JSON.parse(Backend.callLuaFunction("GetCardData", [id]));
|
||||
arr.push(card_data);
|
||||
});
|
||||
ids.forEach(id => arr.push(lcall("GetCardData", id)));
|
||||
box.addCustomCards(d[0], arr);
|
||||
}
|
||||
|
||||
|
@ -1165,7 +1171,8 @@ callbacks["AskForPoxi"] = (jsonData) => {
|
|||
const { type, data, extra_data, cancelable } = JSON.parse(jsonData);
|
||||
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/PoxiBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/PoxiBox.qml");
|
||||
const box = roomScene.popupBox.item;
|
||||
box.poxi_type = type;
|
||||
box.card_data = data;
|
||||
|
@ -1175,10 +1182,7 @@ callbacks["AskForPoxi"] = (jsonData) => {
|
|||
const arr = [];
|
||||
const ids = d[1];
|
||||
|
||||
ids.forEach(id => {
|
||||
const card_data = JSON.parse(Backend.callLuaFunction("GetCardData", [id]));
|
||||
arr.push(card_data);
|
||||
});
|
||||
ids.forEach(id => arr.push(lcall("GetCardData", id)));
|
||||
box.addCustomCards(d[0], arr);
|
||||
}
|
||||
|
||||
|
@ -1193,13 +1197,14 @@ callbacks["AskForMoveCardInBoard"] = (jsonData) => {
|
|||
const { cards, cardsPosition, generalNames, playerIds } = data;
|
||||
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/MoveCardInBoardBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/MoveCardInBoardBox.qml");
|
||||
|
||||
const boxCards = [];
|
||||
cards.forEach(id => {
|
||||
const cardPos = cardsPosition[cards.findIndex(cid => cid === id)];
|
||||
const d = Backend.callLuaFunction("GetCardData", [id, playerIds[cardPos]]);
|
||||
boxCards.push(JSON.parse(d));
|
||||
const d = lcall("GetCardData", id, playerIds[cardPos]);
|
||||
boxCards.push(d);
|
||||
});
|
||||
|
||||
const box = roomScene.popupBox.item;
|
||||
|
@ -1208,7 +1213,10 @@ callbacks["AskForMoveCardInBoard"] = (jsonData) => {
|
|||
box.playerIds = playerIds;
|
||||
box.generalNames = generalNames.map(name => {
|
||||
const namesSplited = name.split('/');
|
||||
return namesSplited.length > 1 ? namesSplited.map(nameSplited => Backend.translate(nameSplited)).join('/') : Backend.translate(name)
|
||||
if (namesSplited.length > 1) {
|
||||
return namesSplited.map(nameSplited => luatr(nameSplited)).join('/');
|
||||
}
|
||||
return luatr(name);
|
||||
});
|
||||
|
||||
box.arrangeCards();
|
||||
|
@ -1227,7 +1235,7 @@ callbacks["PlayCard"] = (jsonData) => {
|
|||
// jsonData: int playerId
|
||||
const playerId = parseInt(jsonData);
|
||||
if (playerId === Self.id) {
|
||||
roomScene.setPrompt(Backend.translate("#PlayCard"), true);
|
||||
roomScene.setPrompt(luatr("#PlayCard"), true);
|
||||
roomScene.state = "playing";
|
||||
okButton.enabled = false;
|
||||
}
|
||||
|
@ -1263,19 +1271,6 @@ callbacks["PrelightSkill"] = (jsonData) => {
|
|||
dashboard.prelightSkill(skill_name, prelight);
|
||||
}
|
||||
|
||||
// prompt: 'string:<src>:<dest>:<arg>:<arg2>'
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = Backend.translate(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src")) raw = raw.replace(/%src/g, Backend.translate(getPhoto(src).general));
|
||||
if (raw.match("%dest")) raw = raw.replace(/%dest/g, Backend.translate(getPhoto(dest).general));
|
||||
if (raw.match("%arg2")) raw = raw.replace(/%arg2/g, Backend.translate(data[4]));
|
||||
if (raw.match("%arg")) raw = raw.replace(/%arg/g, Backend.translate(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
callbacks["AskForUseActiveSkill"] = (jsonData) => {
|
||||
// jsonData: string skill_name, string prompt
|
||||
const data = JSON.parse(jsonData);
|
||||
|
@ -1284,8 +1279,8 @@ callbacks["AskForUseActiveSkill"] = (jsonData) => {
|
|||
const cancelable = data[2];
|
||||
const extra_data = data[3] ?? {};
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = Backend.translate("#AskForUseActiveSkill")
|
||||
.arg(Backend.translate(skill_name));
|
||||
roomScene.promptText = luatr("#AskForUseActiveSkill")
|
||||
.arg(luatr(skill_name));
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
}
|
||||
|
@ -1293,7 +1288,7 @@ callbacks["AskForUseActiveSkill"] = (jsonData) => {
|
|||
roomScene.respond_play = false;
|
||||
roomScene.state = "responding";
|
||||
|
||||
if (JSON.parse(Backend.callLuaFunction('GetSkillData', [skill_name])).isViewAsSkill) {
|
||||
if (lcall('GetSkillData', skill_name).isViewAsSkill) {
|
||||
roomScene.responding_card = ".";
|
||||
}
|
||||
|
||||
|
@ -1321,7 +1316,8 @@ callbacks["AskForUseCard"] = (jsonData) => {
|
|||
const extra_data = data[4];
|
||||
const disabledSkillNames = data[5];
|
||||
if (extra_data != null) {
|
||||
if (extra_data.effectTo !== Self.id && roomScene.skippedUseEventId.find(id => id === extra_data.useEventId)) {
|
||||
if (extra_data.effectTo !== Self.id &&
|
||||
roomScene.skippedUseEventId.find(id => id === extra_data.useEventId)) {
|
||||
doCancelButton();
|
||||
return;
|
||||
} else {
|
||||
|
@ -1330,8 +1326,8 @@ callbacks["AskForUseCard"] = (jsonData) => {
|
|||
}
|
||||
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = Backend.translate("#AskForUseCard")
|
||||
.arg(Backend.translate(cardname));
|
||||
roomScene.promptText = luatr("#AskForUseCard")
|
||||
.arg(luatr(cardname));
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
}
|
||||
|
@ -1352,8 +1348,8 @@ callbacks["AskForResponseCard"] = (jsonData) => {
|
|||
const disabledSkillNames = data[5];
|
||||
|
||||
if (prompt === "") {
|
||||
roomScene.promptText = Backend.translate("#AskForResponseCard")
|
||||
.arg(Backend.translate(cardname));
|
||||
roomScene.promptText = luatr("#AskForResponseCard")
|
||||
.arg(luatr(cardname));
|
||||
} else {
|
||||
roomScene.setPrompt(processPrompt(prompt), true);
|
||||
}
|
||||
|
@ -1422,7 +1418,8 @@ callbacks["Animate"] = (jsonData) => {
|
|||
}
|
||||
case "InvokeSkill": {
|
||||
const id = data.player;
|
||||
const component = Qt.createComponent("../RoomElement/SkillInvokeAnimation.qml");
|
||||
const component =
|
||||
Qt.createComponent("../RoomElement/SkillInvokeAnimation.qml");
|
||||
if (component.status !== Component.Ready)
|
||||
return;
|
||||
|
||||
|
@ -1432,7 +1429,7 @@ callbacks["Animate"] = (jsonData) => {
|
|||
}
|
||||
|
||||
const animation = component.createObject(photo, {
|
||||
skill_name: Backend.translate(data.name),
|
||||
skill_name: luatr(data.name),
|
||||
skill_type: (data.skill_type ? data.skill_type : "special"),
|
||||
});
|
||||
animation.anchors.centerIn = photo;
|
||||
|
@ -1467,7 +1464,8 @@ callbacks["LogEvent"] = (jsonData) => {
|
|||
setEmotion(data.to, "damage");
|
||||
item.tremble();
|
||||
data.damageType = data.damageType || "normal_damage";
|
||||
Backend.playSound("./audio/system/" + data.damageType + (data.damageNum > 1 ? "2" : ""));
|
||||
Backend.playSound("./audio/system/" + data.damageType +
|
||||
(data.damageNum > 1 ? "2" : ""));
|
||||
break;
|
||||
}
|
||||
case "LoseHP": {
|
||||
|
@ -1489,9 +1487,10 @@ callbacks["LogEvent"] = (jsonData) => {
|
|||
|
||||
// try main general
|
||||
if (data.general) {
|
||||
dat = JSON.parse(Backend.callLuaFunction("GetGeneralData", [data.general]));
|
||||
dat = lcall("GetGeneralData", data.general);
|
||||
extension = dat.extension;
|
||||
path = "./packages/" + extension + "/audio/skill/" + skill + "_" + data.general;
|
||||
path = "./packages/" + extension + "/audio/skill/" + skill + "_"
|
||||
+ data.general;
|
||||
if (Backend.exists(path + ".mp3") || Backend.exists(path + "1.mp3")) {
|
||||
Backend.playSound(path, data.i);
|
||||
break;
|
||||
|
@ -1500,9 +1499,10 @@ callbacks["LogEvent"] = (jsonData) => {
|
|||
|
||||
// secondly try deputy general
|
||||
if (data.deputy) {
|
||||
dat = JSON.parse(Backend.callLuaFunction("GetGeneralData", [data.deputy]));
|
||||
dat = lcall("GetGeneralData", data.deputy);
|
||||
extension = dat.extension;
|
||||
path = "./packages/" + extension + "/audio/skill/" + skill + "_" + data.deputy;
|
||||
path = "./packages/" + extension + "/audio/skill/" + skill + "_"
|
||||
+ data.deputy;
|
||||
if (Backend.exists(path + ".mp3") || Backend.exists(path + "1.mp3")) {
|
||||
Backend.playSound(path, data.i);
|
||||
break;
|
||||
|
@ -1510,7 +1510,7 @@ callbacks["LogEvent"] = (jsonData) => {
|
|||
}
|
||||
|
||||
// finally normal skill
|
||||
dat = JSON.parse(Backend.callLuaFunction("GetSkillData", [skill]));
|
||||
dat = lcall("GetSkillData", skill);
|
||||
extension = dat.extension;
|
||||
path = "./packages/" + extension + "/audio/skill/" + skill;
|
||||
Backend.playSound(path, data.i);
|
||||
|
@ -1522,8 +1522,10 @@ callbacks["LogEvent"] = (jsonData) => {
|
|||
}
|
||||
case "Death": {
|
||||
const item = getPhoto(data.to);
|
||||
const extension = JSON.parse(Backend.callLuaFunction("GetGeneralData", [item.general])).extension;
|
||||
Backend.playSound("./packages/" + extension + "/audio/death/" + item.general);
|
||||
const extension = lcall("GetGeneralData", item.general).extension;
|
||||
Backend.playSound("./packages/" + extension + "/audio/death/"
|
||||
+ item.general);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
@ -1532,7 +1534,8 @@ callbacks["LogEvent"] = (jsonData) => {
|
|||
|
||||
callbacks["GameOver"] = (jsonData) => {
|
||||
roomScene.state = "notactive";
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/GameOverBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/GameOverBox.qml");
|
||||
const box = roomScene.popupBox.item;
|
||||
box.winner = jsonData;
|
||||
// roomScene.isStarted = false;
|
||||
|
@ -1541,7 +1544,8 @@ callbacks["GameOver"] = (jsonData) => {
|
|||
callbacks["FillAG"] = (j) => {
|
||||
const data = JSON.parse(j);
|
||||
const ids = data[0];
|
||||
roomScene.manualBox.sourceComponent = Qt.createComponent("../RoomElement/AG.qml");
|
||||
roomScene.manualBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/AG.qml");
|
||||
roomScene.manualBox.item.addIds(ids);
|
||||
}
|
||||
|
||||
|
@ -1556,7 +1560,7 @@ callbacks["TakeAG"] = (j) => {
|
|||
const pid = data[0];
|
||||
const cid = data[1];
|
||||
const item = getPhoto(pid);
|
||||
const general = Backend.translate(item.general);
|
||||
const general = luatr(item.general);
|
||||
|
||||
// the item should be AG box
|
||||
roomScene.manualBox.item.takeAG(general, cid);
|
||||
|
@ -1575,6 +1579,25 @@ callbacks["CustomDialog"] = (j) => {
|
|||
}
|
||||
}
|
||||
|
||||
callbacks["MiniGame"] = (j) => {
|
||||
const data = JSON.parse(j);
|
||||
const game = data.type;
|
||||
const dat = data.data;
|
||||
const gdata = lcall("GetMiniGame", game, Self.id, JSON.stringify(dat));
|
||||
roomScene.state = "replying";
|
||||
roomScene.popupBox.source = AppPath + "/" + gdata.qml_path + ".qml";
|
||||
if (dat) {
|
||||
roomScene.popupBox.item.loadData(dat);
|
||||
}
|
||||
}
|
||||
|
||||
callbacks["UpdateMiniGame"] = (j) => {
|
||||
const data = JSON.parse(j);
|
||||
if (roomScene.popupBox.item) {
|
||||
roomScene.popupBox.item.updateData(data);
|
||||
}
|
||||
}
|
||||
|
||||
callbacks["UpdateLimitSkill"] = (j) => {
|
||||
const data = JSON.parse(j);
|
||||
const id = data[0];
|
||||
|
@ -1633,7 +1656,7 @@ callbacks["AskForLuckCard"] = (j) => {
|
|||
// jsonData: int time
|
||||
if (config.observing || config.replaying) return;
|
||||
const time = parseInt(j);
|
||||
roomScene.setPrompt(Backend.translate("#AskForLuckCard").arg(time), true);
|
||||
roomScene.setPrompt(luatr("#AskForLuckCard").arg(time), true);
|
||||
roomScene.state = "replying";
|
||||
roomScene.extra_data = {
|
||||
luckCard: true,
|
||||
|
|
|
@ -35,7 +35,7 @@ Item {
|
|||
Image {
|
||||
height: 55 * 0.8
|
||||
width: 47 * 0.8
|
||||
source: SkinBank.getDelayedTrickPicture(name) // SkinBank.DELAYED_TRICK_DIR + name
|
||||
source: SkinBank.getDelayedTrickPicture(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ Item {
|
|||
inputs = [inputs];
|
||||
}
|
||||
inputs.forEach(card => {
|
||||
const v = JSON.parse(Backend.callLuaFunction("GetVirtualEquip", [parent.playerid, card.cid]));
|
||||
const v = lcall("GetVirtualEquip", parent.playerid, card.cid);
|
||||
if (v !== null) {
|
||||
cards.append(v);
|
||||
} else {
|
||||
|
|
|
@ -17,9 +17,15 @@ Item {
|
|||
|
||||
height: 70
|
||||
width: 138
|
||||
property int itemHeight: (treasureItem.name === "" && !treasureItem.sealed) ? height / 3 : height / 4
|
||||
property var items: [treasureItem, weaponItem, armorItem, defensiveHorseItem, offensiveHorseItem]
|
||||
property var subtypes: ["treasure", "weapon", "armor", "defensive_horse", "offensive_horse"]
|
||||
property int itemHeight: {
|
||||
if (treasureItem.name === "" && !treasureItem.sealed)
|
||||
return height / 3;
|
||||
return height / 4;
|
||||
}
|
||||
property var items: [treasureItem, weaponItem, armorItem,
|
||||
defensiveHorseItem, offensiveHorseItem]
|
||||
property var subtypes: ["treasure", "weapon", "armor",
|
||||
"defensive_horse", "offensive_horse"]
|
||||
property int length: area.length
|
||||
|
||||
// FIXME: Qt 6.6
|
||||
|
|
|
@ -30,7 +30,11 @@ Item {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: 3
|
||||
|
||||
source: sealed ? (SkinBank.EQUIP_ICON_DIR + "sealed") : (icon ? SkinBank.getEquipIcon(cid, icon) : "")
|
||||
source: {
|
||||
if (sealed)
|
||||
return SkinBank.EQUIP_ICON_DIR + "sealed";
|
||||
return icon ? SkinBank.getEquipIcon(cid, icon) : "";
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
|
@ -44,7 +48,7 @@ Item {
|
|||
GlowText {
|
||||
id: numberItem
|
||||
visible: !sealed && number > 0 && number < 14
|
||||
text: Utility.convertNumber(number)
|
||||
text: Util.convertNumber(number)
|
||||
color: "white"
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 16
|
||||
|
@ -132,7 +136,7 @@ Item {
|
|||
text = "-1"
|
||||
icon = "horse";
|
||||
} else {
|
||||
text = Backend.translate(name);
|
||||
text = luatr(name);
|
||||
if (card.virt_name) {
|
||||
icon = card.virt_name;
|
||||
} else {
|
||||
|
@ -159,6 +163,6 @@ Item {
|
|||
x = 0;
|
||||
|
||||
opacity = sealed ? 1 : 0;
|
||||
text = ' ' + Backend.translate(subtype + "_sealed")
|
||||
text = ' ' + luatr(subtype + "_sealed")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,13 +20,24 @@ Column {
|
|||
id: repeater
|
||||
model: column.visible ? 0 : maxValue
|
||||
Magatama {
|
||||
state: (maxValue - 1 - index) >= value ? 0 : (value >= 3 || value >= maxValue ? 3 : (value <= 0 ? 0 : value))
|
||||
state: {
|
||||
if (maxValue - 1 - index >= value) {
|
||||
return 0;
|
||||
} else if (value >= 3 || value >= maxValue) {
|
||||
return 3;
|
||||
} else if (value <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column
|
||||
visible: maxValue > 4 || value > maxValue || (shieldNum > 0 && maxValue > 3)
|
||||
visible: maxValue > 4 || value > maxValue ||
|
||||
(shieldNum > 0 && maxValue > 3)
|
||||
spacing: -4
|
||||
|
||||
Magatama {
|
||||
|
@ -37,7 +48,17 @@ Column {
|
|||
id: hpItem
|
||||
width: root.width
|
||||
text: value
|
||||
color: root.colors[(value >= 3 || value >= maxValue) ? 3 : (value <= 0 ? 0 : value)]
|
||||
color: {
|
||||
let idx;
|
||||
if (value >= 3 || value >= maxValue) {
|
||||
idx = 3;
|
||||
} else if (value <= 0) {
|
||||
idx = 0;
|
||||
} else {
|
||||
idx = value;
|
||||
}
|
||||
return root.colors[idx];
|
||||
}
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 22
|
||||
font.bold: true
|
||||
|
|
|
@ -25,7 +25,7 @@ Item {
|
|||
font.family: fontLi2.name
|
||||
style: Text.Outline
|
||||
styleColor: "#3D2D1C"
|
||||
text: Backend.translate(skillname);
|
||||
text: luatr(skillname);
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -39,8 +39,7 @@ Item {
|
|||
}
|
||||
|
||||
onSkillnameChanged: {
|
||||
let data = Backend.callLuaFunction("GetSkillData", [skillname]);
|
||||
data = JSON.parse(data);
|
||||
let data = lcall("GetSkillData", skillname);
|
||||
if (data.frequency || data.switchSkillName) {
|
||||
skilltype = data.switchSkillName ? 'switch' : data.frequency;
|
||||
visible = true;
|
||||
|
@ -64,7 +63,8 @@ Item {
|
|||
}
|
||||
} else if (skilltype === 'switch') {
|
||||
visible = true;
|
||||
bg.source = SkinBank.LIMIT_SKILL_DIR + (usedtimes < 1 ? 'switch' : 'switch-yin');
|
||||
bg.source = SkinBank.LIMIT_SKILL_DIR +
|
||||
(usedtimes < 1 ? 'switch' : 'switch-yin');
|
||||
} else if (skilltype === 'quest') {
|
||||
visible = true
|
||||
if (usedtimes > 1) {
|
||||
|
|
|
@ -34,7 +34,8 @@ Item {
|
|||
width: childrenRect.width
|
||||
height: 22
|
||||
Text {
|
||||
text: Backend.translate(mark_name) + ' ' + (special_value !== '' ? special_value : mark_extra)
|
||||
text: luatr(mark_name) + ' '
|
||||
+ (special_value !== '' ? special_value : mark_extra)
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 22
|
||||
font.letterSpacing: -0.6
|
||||
|
@ -76,15 +77,17 @@ Item {
|
|||
|
||||
const mark_type = mark_name.slice(2, close_br);
|
||||
const _data = mark_extra;
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetQmlMark", [mark_type, mark_name, _data, root.parent?.playerid]));
|
||||
let data = lcall("GetQmlMark", mark_type, mark_name, _data,
|
||||
root.parent?.playerid);
|
||||
if (data && data.qml_path) {
|
||||
params.data = JSON.parse(_data);
|
||||
params.owner = root.parent?.playerid;
|
||||
roomScene.startCheat("../../" + data.qml_path, params);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (!root.parent.playerid) return;
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetPile", [root.parent.playerid, mark_name]));
|
||||
let data = lcall("GetPile", root.parent.playerid, mark_name);
|
||||
data = data.filter((e) => e !== -1);
|
||||
if (data.length === 0)
|
||||
return;
|
||||
|
@ -92,7 +95,7 @@ Item {
|
|||
params.ids = data;
|
||||
}
|
||||
|
||||
// Just for using room's right drawer
|
||||
// Just for using right drawer of the room
|
||||
roomScene.startCheat("../RoomElement/ViewPile", params);
|
||||
}
|
||||
}
|
||||
|
@ -123,13 +126,16 @@ Item {
|
|||
if (close_br !== -1) {
|
||||
const mark_type = mark.slice(2, close_br);
|
||||
data = JSON.stringify(data);
|
||||
const _data = JSON.parse(Backend.callLuaFunction("GetQmlMark", [mark_type, mark, data, root.parent?.playerid]));
|
||||
const _data = lcall("GetQmlMark", mark_type, mark, data,
|
||||
root.parent?.playerid);
|
||||
if (_data && _data.text) {
|
||||
special_value = _data.text;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = data instanceof Array ? data.map((markText) => Backend.translate(markText)).join(' ') : Backend.translate(data);
|
||||
data = data instanceof Array
|
||||
? data.map((markText) => luatr(markText)).join(' ')
|
||||
: luatr(data);
|
||||
}
|
||||
|
||||
if (modelItem) {
|
||||
|
|
|
@ -8,7 +8,7 @@ GraphicsBox {
|
|||
property bool interactive: false
|
||||
|
||||
id: root
|
||||
title.text: Backend.translate("Please choose cards")
|
||||
title.text: luatr("Please choose cards")
|
||||
width: cards.count * 100 + spacing * (cards.count - 1) + 25
|
||||
height: 180
|
||||
|
||||
|
@ -46,8 +46,7 @@ GraphicsBox {
|
|||
|
||||
function addIds(ids) {
|
||||
ids.forEach((id) => {
|
||||
let data = Backend.callLuaFunction("GetCardData", [id]);
|
||||
data = JSON.parse(data);
|
||||
let data = lcall("GetCardData", id);
|
||||
data.selectable = true;
|
||||
data.footnote = "";
|
||||
cards.append(data);
|
||||
|
|
|
@ -26,7 +26,7 @@ Item {
|
|||
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]));
|
||||
const state = lcall("GetCardData", cards[i].cid);
|
||||
cards[i].setData(state);
|
||||
result.push(cards[i]);
|
||||
cards.splice(i, 1);
|
||||
|
|
|
@ -51,7 +51,7 @@ Item {
|
|||
property bool selected: false
|
||||
property bool draggable: false
|
||||
property bool autoBack: true
|
||||
property bool showDetail: false
|
||||
property bool showDetail: true
|
||||
property int origX: 0
|
||||
property int origY: 0
|
||||
property int initialZ: 0
|
||||
|
@ -76,7 +76,7 @@ Item {
|
|||
signal hoverChanged(bool enter)
|
||||
|
||||
onRightClicked: {
|
||||
if (!showDetail) return;
|
||||
if (!showDetail || !known) return;
|
||||
roomScene.startCheat("CardDetail", { card: this });
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,8 @@ Item {
|
|||
Image {
|
||||
id: suitItem
|
||||
visible: known
|
||||
source: (suit !== "" && suit !== "nosuit") ? SkinBank.CARD_SUIT_DIR + suit : ""
|
||||
source: (suit !== "" && suit !== "nosuit") ? SkinBank.CARD_SUIT_DIR + suit
|
||||
: ""
|
||||
x: 3
|
||||
y: 19
|
||||
width: 21
|
||||
|
@ -122,8 +123,10 @@ Item {
|
|||
|
||||
Image {
|
||||
id: colorItem
|
||||
visible: known && (suit === "" || suit === "nosuit") // && number <= 0 // <- FIXME: 需要区分“黑色有点数”和“无色有点数”
|
||||
source: (visible && color !== "") ? SkinBank.CARD_SUIT_DIR + "/" + color : ""
|
||||
visible: known && (suit === "" || suit === "nosuit")
|
||||
// && number <= 0 // <- FIXME: 需要区分“黑色有点数”和“无色有点数”
|
||||
source: (visible && color !== "") ? SkinBank.CARD_SUIT_DIR + "/" + color
|
||||
: ""
|
||||
x: 1
|
||||
}
|
||||
|
||||
|
@ -146,7 +149,7 @@ Item {
|
|||
font.pixelSize: 16
|
||||
font.family: fontLibian.name
|
||||
font.letterSpacing: -0.6
|
||||
text: Backend.translate(root.virt_name)
|
||||
text: luatr(root.virt_name)
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -195,7 +198,7 @@ Item {
|
|||
font.family: fontLibian.name
|
||||
font.letterSpacing: -0.6
|
||||
text: {
|
||||
let ret = Backend.translate(modelData.k);
|
||||
let ret = luatr(modelData.k);
|
||||
if (!modelData.k.startsWith("@@")) {
|
||||
ret += modelData.v.toString();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Fk
|
||||
import Fk.Pages
|
||||
|
||||
GraphicsBox {
|
||||
|
@ -14,22 +15,10 @@ GraphicsBox {
|
|||
property var result: []
|
||||
|
||||
id: root
|
||||
title.text: Backend.translate("$Choice").arg(Backend.translate(skill_name))
|
||||
title.text: luatr("$Choice").arg(luatr(skill_name))
|
||||
width: Math.max(140, body.width + 20)
|
||||
height: buttons.height + body.height + title.height + 20
|
||||
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = Backend.translate(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src")) raw = raw.replace(/%src/g, Backend.translate(getPhoto(src).general));
|
||||
if (raw.match("%dest")) raw = raw.replace(/%dest/g, Backend.translate(getPhoto(dest).general));
|
||||
if (raw.match("%arg2")) raw = raw.replace(/%arg2/g, Backend.translate(data[4]));
|
||||
if (raw.match("%arg")) raw = raw.replace(/%arg/g, Backend.translate(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: body
|
||||
// x: 10
|
||||
|
@ -43,9 +32,10 @@ GraphicsBox {
|
|||
model: all_options
|
||||
|
||||
MetroToggleButton {
|
||||
// Layout.fillWidth: true
|
||||
text: processPrompt(modelData)
|
||||
enabled: options.indexOf(modelData) !== -1 && (root.result.length < max_num || triggered)
|
||||
Layout.fillWidth: true
|
||||
text: Util.processPrompt(modelData)
|
||||
enabled: options.indexOf(modelData) !== -1
|
||||
&& (root.result.length < max_num || triggered)
|
||||
|
||||
onClicked: {
|
||||
if (triggered) {
|
||||
|
@ -68,7 +58,7 @@ GraphicsBox {
|
|||
|
||||
MetroButton {
|
||||
Layout.fillWidth: true
|
||||
text: processPrompt("OK")
|
||||
text: luatr("OK")
|
||||
enabled: root.result.length >= min_num
|
||||
|
||||
onClicked: {
|
||||
|
@ -78,7 +68,7 @@ GraphicsBox {
|
|||
|
||||
MetroButton {
|
||||
Layout.fillWidth: true
|
||||
text: processPrompt("Cancel")
|
||||
text: luatr("Cancel")
|
||||
visible: cancelable
|
||||
|
||||
onClicked: {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Fk
|
||||
import Fk.Pages
|
||||
|
||||
GraphicsBox {
|
||||
|
@ -11,22 +12,10 @@ GraphicsBox {
|
|||
property int result
|
||||
|
||||
id: root
|
||||
title.text: Backend.translate("$Choice").arg(Backend.translate(skill_name))
|
||||
title.text: luatr("$Choice").arg(luatr(skill_name))
|
||||
width: Math.max(140, body.width + 20)
|
||||
height: body.height + title.height + 20
|
||||
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = Backend.translate(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src")) raw = raw.replace(/%src/g, Backend.translate(getPhoto(src).general));
|
||||
if (raw.match("%dest")) raw = raw.replace(/%dest/g, Backend.translate(getPhoto(dest).general));
|
||||
if (raw.match("%arg2")) raw = raw.replace(/%arg2/g, Backend.translate(data[4]));
|
||||
if (raw.match("%arg")) raw = raw.replace(/%arg/g, Backend.translate(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: body
|
||||
x: 10
|
||||
|
@ -40,7 +29,7 @@ GraphicsBox {
|
|||
|
||||
MetroButton {
|
||||
Layout.fillWidth: true
|
||||
text: processPrompt(modelData)
|
||||
text: Util.processPrompt(modelData)
|
||||
enabled: options.indexOf(modelData) !== -1
|
||||
|
||||
onClicked: {
|
||||
|
|
|
@ -19,10 +19,11 @@ GraphicsBox {
|
|||
}
|
||||
|
||||
id: root
|
||||
title.text: Backend.translate("$ChooseGeneral").arg(choiceNum) +
|
||||
(config.enableFreeAssign ? "(" + Backend.translate("Enable free assign") + ")" : "")
|
||||
title.text: luatr("$ChooseGeneral").arg(choiceNum) +
|
||||
(config.enableFreeAssign ? "(" + luatr("Enable free assign") + ")" : "")
|
||||
width: generalArea.width + body.anchors.leftMargin + body.anchors.rightMargin
|
||||
height: body.implicitHeight + body.anchors.topMargin + body.anchors.bottomMargin
|
||||
height: body.implicitHeight + body.anchors.topMargin +
|
||||
body.anchors.bottomMargin
|
||||
|
||||
Column {
|
||||
id: body
|
||||
|
@ -32,7 +33,8 @@ GraphicsBox {
|
|||
|
||||
Item {
|
||||
id: generalArea
|
||||
width: (generalList.count > 8 ? Math.ceil(generalList.count / 2) : Math.max(3, generalList.count)) * 97
|
||||
width: (generalList.count > 8 ? Math.ceil(generalList.count / 2)
|
||||
: Math.max(3, generalList.count)) * 97
|
||||
height: generalList.count > 8 ? 290 : 150
|
||||
z: 1
|
||||
|
||||
|
@ -43,8 +45,23 @@ GraphicsBox {
|
|||
Item {
|
||||
width: 93
|
||||
height: 130
|
||||
x: (index % Math.ceil(generalList.count / (generalList.count > 8 ? 2 : 1))) * 98 + (generalList.count > 8 && index > generalList.count / 2 && generalList.count % 2 == 1 ? 50 : 0)
|
||||
y: generalList.count <= 8 ? 0 : (index < generalList.count / 2 ? 0 : 135)
|
||||
x: {
|
||||
const count = generalList.count;
|
||||
let columns = generalList.count;
|
||||
if (columns > 8) {
|
||||
columns = Math.ceil(columns / 2);
|
||||
}
|
||||
|
||||
let ret = (index % columns) * 98;
|
||||
if (count > 8 && index > count / 2 && count % 2 == 1)
|
||||
ret += 50;
|
||||
return ret;
|
||||
}
|
||||
y: {
|
||||
if (generalList.count <= 8)
|
||||
return 0;
|
||||
return index < generalList.count / 2 ? 0 : 135;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,13 +110,15 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
id: convertBtn
|
||||
visible: !convertDisabled
|
||||
text: Backend.translate("Same General Convert")
|
||||
onClicked: roomScene.startCheat("SameConvert", { cards: generalList });
|
||||
text: luatr("Same General Convert")
|
||||
onClicked: {
|
||||
roomScene.startCheat("SameConvert", { cards: generalList });
|
||||
}
|
||||
}
|
||||
|
||||
MetroButton {
|
||||
id: fightButton
|
||||
text: Backend.translate("Fight")
|
||||
text: luatr("Fight")
|
||||
width: 120
|
||||
height: 35
|
||||
enabled: false
|
||||
|
@ -110,7 +129,7 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
id: detailBtn
|
||||
enabled: choices.length > 0
|
||||
text: Backend.translate("Show General Detail")
|
||||
text: luatr("Show General Detail")
|
||||
onClicked: roomScene.startCheat(
|
||||
"GeneralDetail",
|
||||
{ generals: choices }
|
||||
|
@ -233,7 +252,8 @@ GraphicsBox {
|
|||
|
||||
for (i = 0; i < generalCardList.count; i++) {
|
||||
item = generalCardList.itemAt(i);
|
||||
item.selectable = needSameKingdom ? isHegPair(selectedItem[0], item) : true;
|
||||
item.selectable = needSameKingdom ? isHegPair(selectedItem[0], item)
|
||||
: true;
|
||||
if (selectedItem.indexOf(item) != -1)
|
||||
continue;
|
||||
|
||||
|
@ -247,9 +267,7 @@ GraphicsBox {
|
|||
}
|
||||
|
||||
for (let i = 0; i < generalList.count; i++) {
|
||||
if (JSON.parse(Backend.callLuaFunction(
|
||||
"GetSameGenerals", [generalList.get(i).name])
|
||||
).length > 0) {
|
||||
if (lcall("GetSameGenerals", generalList.get(i).name).length > 0) {
|
||||
convertBtn.enabled = true;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ ColumnLayout {
|
|||
property var cards: []
|
||||
|
||||
Text {
|
||||
text: Backend.translate("Handcard selector")
|
||||
text: luatr("Handcard selector")
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: 18
|
||||
|
@ -46,7 +46,7 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
setData(JSON.parse(Backend.callLuaFunction("GetCardData", [modelData.cid])));
|
||||
setData(lcall("GetCardData", modelData.cid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import Fk
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
|
@ -18,6 +19,7 @@ RowLayout {
|
|||
property alias skillButtons: skillPanel.skill_buttons
|
||||
|
||||
property var expanded_piles: ({}) // name -> int[]
|
||||
property var extra_cards: []
|
||||
|
||||
property var disabledSkillNames: []
|
||||
|
||||
|
@ -70,7 +72,7 @@ RowLayout {
|
|||
handcardAreaItem.unselectAll(expectId);
|
||||
}
|
||||
|
||||
function expandPile(pile) {
|
||||
function expandPile(pile, extra_ids, extra_footnote) {
|
||||
const expanded_pile_names = Object.keys(expanded_piles);
|
||||
if (expanded_pile_names.indexOf(pile) !== -1)
|
||||
return;
|
||||
|
@ -79,31 +81,29 @@ RowLayout {
|
|||
const parentPos = roomScene.mapFromItem(self, 0, 0);
|
||||
|
||||
expanded_piles[pile] = [];
|
||||
let ids, footnote;
|
||||
if (pile === "_equip") {
|
||||
const equips = self.equipArea.getAllCards();
|
||||
equips.forEach(data => {
|
||||
data.x = parentPos.x;
|
||||
data.y = parentPos.y;
|
||||
const card = component.createObject(roomScene, data);
|
||||
card.footnoteVisible = true;
|
||||
card.footnote = Backend.translate("$Equip");
|
||||
handcardAreaItem.add(card);
|
||||
})
|
||||
handcardAreaItem.updateCardPosition();
|
||||
ids = self.equipArea.getAllCards().map(e => e.cid);
|
||||
footnote = "$Equip";
|
||||
} else if (pile === "_extra") {
|
||||
ids = extra_ids;
|
||||
extra_cards = ids;
|
||||
footnote = extra_footnote;
|
||||
} else {
|
||||
const ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
ids = lcall("GetPile", self.playerid, pile);
|
||||
footnote = pile;
|
||||
}
|
||||
ids.forEach(id => {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [id]));
|
||||
const data = lcall("GetCardData", id);
|
||||
data.x = parentPos.x;
|
||||
data.y = parentPos.y;
|
||||
const card = component.createObject(roomScene, data);
|
||||
card.footnoteVisible = true;
|
||||
card.footnote = Backend.translate(pile);
|
||||
card.footnote = luatr(footnote);
|
||||
handcardAreaItem.add(card);
|
||||
});
|
||||
handcardAreaItem.updateCardPosition();
|
||||
}
|
||||
}
|
||||
|
||||
function retractPile(pile) {
|
||||
const expanded_pile_names = Object.keys(expanded_piles);
|
||||
|
@ -124,7 +124,13 @@ RowLayout {
|
|||
})
|
||||
handcardAreaItem.updateCardPosition();
|
||||
} else {
|
||||
const ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
let ids = [];
|
||||
if (pile === "_extra") {
|
||||
ids = extra_cards;
|
||||
extra_cards = [];
|
||||
} else {
|
||||
ids = lcall("GetPile", self.playerid, pile);
|
||||
}
|
||||
ids.forEach(id => {
|
||||
const card = handcardAreaItem.remove([id])[0];
|
||||
card.origX = parentPos.x;
|
||||
|
@ -145,25 +151,23 @@ RowLayout {
|
|||
// If cname is set, we are responding card.
|
||||
function enableCards(cname) {
|
||||
const cardValid = (cid, cname) => {
|
||||
let ret = JSON.parse(Backend.callLuaFunction(
|
||||
"CardFitPattern", [cid, cname]));
|
||||
let ret = lcall("CardFitPattern", cid, cname);
|
||||
|
||||
if (ret) {
|
||||
if (roomScene.respond_play) {
|
||||
ret = ret && !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedResponse", [cid]));
|
||||
ret = ret && !lcall("CardProhibitedResponse", cid);
|
||||
} else {
|
||||
ret = ret && !JSON.parse(Backend.callLuaFunction(
|
||||
"CardProhibitedUse", [cid]));
|
||||
ret = ret && !lcall("CardProhibitedUse", cid);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const pile_data = JSON.parse(Backend.callLuaFunction("GetAllPiles", [self.playerid]));
|
||||
const pile_data = lcall("GetAllPiles", self.playerid);
|
||||
extractWoodenOx();
|
||||
|
||||
const handleMethod = roomScene.respond_play ? "response" : "use";
|
||||
if (cname) {
|
||||
const ids = [];
|
||||
let cards = handcardAreaItem.cards;
|
||||
|
@ -172,10 +176,8 @@ RowLayout {
|
|||
if (cardValid(cards[i].cid, cname)) {
|
||||
ids.push(cards[i].cid);
|
||||
} else {
|
||||
const prohibitReason = Backend.callLuaFunction(
|
||||
"GetCardProhibitReason",
|
||||
[cards[i].cid, roomScene.respond_play ? "response" : "use", cname]
|
||||
);
|
||||
const prohibitReason = lcall("GetCardProhibitReason", cards[i].cid,
|
||||
handleMethod, cname);
|
||||
if (prohibitReason) {
|
||||
cards[i].prohibitReason = prohibitReason;
|
||||
}
|
||||
|
@ -190,10 +192,8 @@ RowLayout {
|
|||
expandPile("_equip");
|
||||
}
|
||||
} else {
|
||||
const prohibitReason = Backend.callLuaFunction(
|
||||
"GetCardProhibitReason",
|
||||
[c.cid, roomScene.respond_play ? "response" : "use", cname]
|
||||
);
|
||||
const prohibitReason = lcall("GetCardProhibitReason", c.cid,
|
||||
handleMethod, cname);
|
||||
if (prohibitReason) {
|
||||
c.prohibitReason = prohibitReason;
|
||||
}
|
||||
|
@ -223,14 +223,15 @@ RowLayout {
|
|||
const ids = [], cards = handcardAreaItem.cards;
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
cards[i].prohibitReason = "";
|
||||
if (JSON.parse(Backend.callLuaFunction("CanUseCard", [cards[i].cid, Self.id]))) {
|
||||
if (lcall("CanUseCard", cards[i].cid, Self.id,
|
||||
JSON.stringify(roomScene.extra_data))) {
|
||||
ids.push(cards[i].cid);
|
||||
} else {
|
||||
// cannot use? considering special_skills
|
||||
const skills = JSON.parse(Backend.callLuaFunction("GetCardSpecialSkills", [cards[i].cid]));
|
||||
const skills = lcall("GetCardSpecialSkills", cards[i].cid);
|
||||
for (let j = 0; j < skills.length; j++) {
|
||||
const s = skills[j];
|
||||
if (JSON.parse(Backend.callLuaFunction("ActiveCanUse", [s]))) {
|
||||
if (lcall("ActiveCanUse", s, JSON.stringify(roomScene.extra_data))) {
|
||||
ids.push(cards[i].cid);
|
||||
break;
|
||||
}
|
||||
|
@ -238,7 +239,8 @@ RowLayout {
|
|||
|
||||
// still cannot use? show message on card
|
||||
if (!ids.includes(cards[i].cid)) {
|
||||
const prohibitReason = Backend.callLuaFunction("GetCardProhibitReason", [cards[i].cid, "play"]);
|
||||
const prohibitReason = lcall("GetCardProhibitReason", cards[i].cid,
|
||||
"play");
|
||||
if (prohibitReason) {
|
||||
cards[i].prohibitReason = prohibitReason;
|
||||
}
|
||||
|
@ -304,21 +306,10 @@ RowLayout {
|
|||
}
|
||||
}
|
||||
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = Backend.translate(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src")) raw = raw.replace(/%src/g, Backend.translate(getPhoto(src).general));
|
||||
if (raw.match("%dest")) raw = raw.replace(/%dest/g, Backend.translate(getPhoto(dest).general));
|
||||
if (raw.match("%arg2")) raw = raw.replace(/%arg2/g, Backend.translate(data[4]));
|
||||
if (raw.match("%arg")) raw = raw.replace(/%arg/g, Backend.translate(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
function extractWoodenOx() {
|
||||
const pile_data = JSON.parse(Backend.callLuaFunction("GetAllPiles", [self.playerid]));
|
||||
if (!roomScene.autoPending) { // 先屏蔽AskForUseActiveSkill再说,这下只剩使用打出以及出牌阶段了
|
||||
const pile_data = lcall("GetAllPiles", self.playerid);
|
||||
if (!roomScene.autoPending) {
|
||||
// 先屏蔽AskForUseActiveSkill再说,这下只剩使用打出以及出牌阶段了
|
||||
for (let name in pile_data) {
|
||||
if (name.endsWith("&")) expandPile(name);
|
||||
}
|
||||
|
@ -331,28 +322,21 @@ RowLayout {
|
|||
|
||||
const enabled_cards = [];
|
||||
const targets = roomScene.selected_targets;
|
||||
const prompt = JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveSkillPrompt",
|
||||
[pending_skill, pendings, targets]
|
||||
));
|
||||
const prompt = lcall("ActiveSkillPrompt", pending_skill, pendings,
|
||||
targets);
|
||||
if (prompt !== "") {
|
||||
roomScene.setPrompt(processPrompt(prompt));
|
||||
roomScene.setPrompt(Util.processPrompt(prompt));
|
||||
}
|
||||
|
||||
handcardAreaItem.cards.forEach((card) => {
|
||||
if (card.selected || JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveCardFilter",
|
||||
[pending_skill, card.cid, pendings, targets]
|
||||
)))
|
||||
if (card.selected || lcall("ActiveCardFilter", pending_skill, card.cid,
|
||||
pendings, targets))
|
||||
enabled_cards.push(card.cid);
|
||||
});
|
||||
|
||||
const cards = self.equipArea.getAllCards();
|
||||
cards.forEach(c => {
|
||||
if (JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveCardFilter",
|
||||
[pending_skill, c.cid, pendings, targets]
|
||||
))) {
|
||||
if (lcall("ActiveCardFilter", pending_skill, c.cid, pendings, targets)) {
|
||||
enabled_cards.push(c.cid);
|
||||
if (!expanded_piles["_equip"]) {
|
||||
expandPile("_equip");
|
||||
|
@ -360,26 +344,26 @@ RowLayout {
|
|||
}
|
||||
})
|
||||
|
||||
const pile = Backend.callLuaFunction("GetExpandPileOfSkill", [pending_skill]);
|
||||
const pile_ids = JSON.parse(Backend.callLuaFunction("GetPile", [self.playerid, pile]));
|
||||
let pile = lcall("GetExpandPileOfSkill", pending_skill);
|
||||
let pile_ids = pile;
|
||||
if (typeof pile === "string") {
|
||||
pile_ids = lcall("GetPile", self.playerid, pile);
|
||||
} else {
|
||||
pile = "_extra";
|
||||
}
|
||||
|
||||
pile_ids.forEach(cid => {
|
||||
if (JSON.parse(Backend.callLuaFunction(
|
||||
"ActiveCardFilter",
|
||||
[pending_skill, cid, pendings, targets]
|
||||
))) {
|
||||
if (lcall("ActiveCardFilter", pending_skill, cid, pendings, targets)) {
|
||||
enabled_cards.push(cid);
|
||||
};
|
||||
if (!expanded_piles[pile]) {
|
||||
expandPile(pile);
|
||||
expandPile(pile, pile_ids, pending_skill);
|
||||
}
|
||||
});
|
||||
|
||||
handcardAreaItem.enableCards(enabled_cards);
|
||||
|
||||
if (JSON.parse(Backend.callLuaFunction(
|
||||
"CanViewAs",
|
||||
[pending_skill, pendings]
|
||||
))) {
|
||||
if (lcall("CanViewAs", pending_skill, pendings)) {
|
||||
pending_card = {
|
||||
skill: pending_skill,
|
||||
subcards: pendings
|
||||
|
@ -462,8 +446,8 @@ RowLayout {
|
|||
continue;
|
||||
}
|
||||
|
||||
const fitpattern = JSON.parse(Backend.callLuaFunction("SkillFitPattern", [item.orig, cname]));
|
||||
const canresp = JSON.parse(Backend.callLuaFunction("SkillCanResponse", [item.orig, cardResponsing]));
|
||||
const fitpattern = lcall("SkillFitPattern", item.orig, cname);
|
||||
const canresp = lcall("SkillCanResponse", item.orig, cardResponsing);
|
||||
item.enabled = fitpattern && canresp;
|
||||
}
|
||||
return;
|
||||
|
@ -475,7 +459,8 @@ RowLayout {
|
|||
continue;
|
||||
}
|
||||
|
||||
item.enabled = JSON.parse(Backend.callLuaFunction("ActiveCanUse", [item.orig]));
|
||||
item.enabled = lcall("ActiveCanUse", item.orig,
|
||||
JSON.stringify(roomScene.extra_data));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,10 +475,9 @@ RowLayout {
|
|||
}
|
||||
|
||||
function updateHandcards() {
|
||||
Backend.callLuaFunction("FilterMyHandcards", []);
|
||||
lcall("FilterMyHandcards");
|
||||
handcardAreaItem.cards.forEach(v => {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [v.cid]));
|
||||
v.setData(data);
|
||||
v.setData(lcall("GetCardData", v.cid));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -514,12 +498,12 @@ RowLayout {
|
|||
|
||||
skillPanel.clearSkills();
|
||||
|
||||
const skills = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [Self.id]));
|
||||
const skills = lcall("GetPlayerSkills", Self.id);
|
||||
for (let s of skills) {
|
||||
addSkill(s.name);
|
||||
}
|
||||
|
||||
cards = roomScene.drawPile.remove(JSON.parse(Backend.callLuaFunction("GetPlayerHandcards", [Self.id])));
|
||||
cards = roomScene.drawPile.remove(lcall("GetPlayerHandcards", Self.id));
|
||||
handcardAreaItem.add(cards);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ GraphicsBox {
|
|||
property var result: []
|
||||
|
||||
id: root
|
||||
title.text: Backend.translate("$Choice").arg(Backend.translate(skill_name))
|
||||
title.text: luatr("$Choice").arg(luatr(skill_name))
|
||||
width: Math.max(140, body.width + 20)
|
||||
height: buttons.height + body.height + title.height + 20
|
||||
|
||||
|
@ -38,8 +38,10 @@ GraphicsBox {
|
|||
MetroToggleButton {
|
||||
id: choicetitle
|
||||
width: parent.width
|
||||
text: Backend.translate(modelData)
|
||||
enabled: options.indexOf(modelData) !== -1 && (root.result.length < max_num || triggered)
|
||||
text: luatr(modelData)
|
||||
triggered: root.result.includes(index)
|
||||
enabled: options.indexOf(modelData) !== -1
|
||||
&& (root.result.length < max_num || triggered)
|
||||
textFont.pixelSize: 24
|
||||
anchors.top: choiceDetail.bottom
|
||||
anchors.topMargin: 8
|
||||
|
@ -64,7 +66,7 @@ GraphicsBox {
|
|||
Text {
|
||||
id: detail
|
||||
width: parent.width
|
||||
text: Backend.translate(":" + modelData)
|
||||
text: luatr(":" + modelData)
|
||||
color: "white"
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: 16
|
||||
|
@ -84,7 +86,7 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
width: 120
|
||||
height: 35
|
||||
text: Backend.translate("OK")
|
||||
text: luatr("OK")
|
||||
enabled: root.result.length >= min_num
|
||||
|
||||
onClicked: {
|
||||
|
@ -95,7 +97,7 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
width: 120
|
||||
height: 35
|
||||
text: Backend.translate("Cancel")
|
||||
text: luatr("Cancel")
|
||||
visible: root.cancelable
|
||||
|
||||
onClicked: {
|
||||
|
|
|
@ -12,7 +12,7 @@ GraphicsBox {
|
|||
property int result
|
||||
|
||||
id: root
|
||||
title.text: Backend.translate("$Choice").arg(Backend.translate(skill_name))
|
||||
title.text: luatr("$Choice").arg(luatr(skill_name))
|
||||
width: Math.max(140, body.width + 20)
|
||||
height: body.height + title.height + 20
|
||||
|
||||
|
@ -35,7 +35,7 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
id: choicetitle
|
||||
width: parent.width
|
||||
text: Backend.translate(modelData)
|
||||
text: luatr(modelData)
|
||||
enabled: options.indexOf(modelData) !== -1
|
||||
textFont.pixelSize: 24
|
||||
anchors.top: choiceDetail.bottom
|
||||
|
@ -57,7 +57,7 @@ GraphicsBox {
|
|||
Text {
|
||||
id: detail
|
||||
width: parent.width
|
||||
text: Backend.translate(":" + modelData)
|
||||
text: luatr(":" + modelData)
|
||||
color: "white"
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: 16
|
||||
|
|
|
@ -7,7 +7,7 @@ GraphicsBox {
|
|||
property string winner: ""
|
||||
|
||||
id: root
|
||||
title.text: Backend.translate("$GameOver")
|
||||
title.text: luatr("$GameOver")
|
||||
width: Math.max(140, body.width + 20)
|
||||
height: body.height + title.height + 20
|
||||
|
||||
|
@ -18,12 +18,13 @@ GraphicsBox {
|
|||
spacing: 10
|
||||
|
||||
Text {
|
||||
text: winner !== "" ? Backend.translate("$Winner").arg(Backend.translate(winner)) : Backend.translate("$NoWinner")
|
||||
text: winner !== "" ? luatr("$Winner").arg(luatr(winner))
|
||||
: luatr("$NoWinner")
|
||||
color: "#E4D5A0"
|
||||
}
|
||||
|
||||
MetroButton {
|
||||
text: Backend.translate("Back To Room")
|
||||
text: luatr("Back To Room")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: !config.observing
|
||||
|
||||
|
@ -34,7 +35,7 @@ GraphicsBox {
|
|||
}
|
||||
|
||||
MetroButton {
|
||||
text: Backend.translate("Back To Lobby")
|
||||
text: luatr("Back To Lobby")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
onClicked: {
|
||||
|
@ -49,13 +50,13 @@ GraphicsBox {
|
|||
|
||||
MetroButton {
|
||||
id: repBtn
|
||||
text: Backend.translate("Save Replay")
|
||||
text: luatr("Save Replay")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: !config.replaying
|
||||
|
||||
onClicked: {
|
||||
repBtn.visible = false;
|
||||
Backend.callLuaFunction("SaveRecord", []);
|
||||
lcall("SaveRecord");
|
||||
toast.show("OK.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,11 +29,13 @@ CardItem {
|
|||
suit: ""
|
||||
number: 0
|
||||
footnote: ""
|
||||
card.source: known ? SkinBank.getGeneralPicture(name) : (SkinBank.GENERALCARD_DIR + 'card-back')
|
||||
card.source: known ? SkinBank.getGeneralPicture(name)
|
||||
: (SkinBank.GENERALCARD_DIR + 'card-back')
|
||||
glow.color: "white" //Engine.kingdomColor[kingdom]
|
||||
|
||||
// FIXME: 藕!!
|
||||
property bool heg: name.startsWith('hs__') || name.startsWith('ld__') || name.includes('heg__')
|
||||
property bool heg: name.startsWith('hs__') || name.startsWith('ld__') ||
|
||||
name.includes('heg__')
|
||||
|
||||
Image {
|
||||
source: known ? (SkinBank.GENERALCARD_DIR + "border") : ""
|
||||
|
@ -51,7 +53,8 @@ CardItem {
|
|||
scale: 0.6; x: 9; y: 12
|
||||
transformOrigin: Item.TopLeft
|
||||
width: 34; fillMode: Image.PreserveAspectFit
|
||||
source: subkingdom ? SkinBank.getGeneralCardDir(subkingdom) + subkingdom : ""
|
||||
source: subkingdom ? SkinBank.getGeneralCardDir(subkingdom) + subkingdom
|
||||
: ""
|
||||
visible: detailed && known
|
||||
}
|
||||
|
||||
|
@ -72,7 +75,8 @@ CardItem {
|
|||
Image {
|
||||
id: subkingdomMagatama
|
||||
visible: false
|
||||
source: subkingdom ? SkinBank.getGeneralCardDir(subkingdom) + subkingdom + "-magatama" : ""
|
||||
source: subkingdom ? SkinBank.getGeneralCardDir(subkingdom) +
|
||||
subkingdom + "-magatama" : ""
|
||||
}
|
||||
LinearGradient {
|
||||
id: subkingdomMask
|
||||
|
@ -153,8 +157,8 @@ CardItem {
|
|||
height: 80
|
||||
x: 2
|
||||
y: lineCount > 6 ? 30 : 34
|
||||
text: name !== "" ? Backend.translate(name) : "nil"
|
||||
visible: Backend.translate(name).length <= 6 && detailed && known
|
||||
text: name !== "" ? luatr(name) : "nil"
|
||||
visible: luatr(name).length <= 6 && detailed && known
|
||||
color: "white"
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 18
|
||||
|
@ -168,8 +172,8 @@ CardItem {
|
|||
y: 12
|
||||
rotation: 90
|
||||
transformOrigin: Item.BottomLeft
|
||||
text: Backend.translate(name)
|
||||
visible: Backend.translate(name).length > 6 && detailed && known
|
||||
text: luatr(name)
|
||||
visible: luatr(name).length > 6 && detailed && known
|
||||
color: "white"
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 18
|
||||
|
@ -191,7 +195,7 @@ CardItem {
|
|||
border.color: "white"
|
||||
border.width: 1
|
||||
Text {
|
||||
text: Backend.translate(pkgName)
|
||||
text: luatr(pkgName)
|
||||
x: 2; y: 1
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 14
|
||||
|
@ -202,7 +206,7 @@ CardItem {
|
|||
}
|
||||
|
||||
onNameChanged: {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
const data = lcall("GetGeneralData", name);
|
||||
kingdom = data.kingdom;
|
||||
subkingdom = (data.subkingdom !== kingdom && data.subkingdom) || "";
|
||||
hp = data.hp;
|
||||
|
|
|
@ -14,7 +14,7 @@ GraphicsBox {
|
|||
property var areaNames: []
|
||||
property int padding: 25
|
||||
|
||||
title.text: Backend.translate(prompt !== "" ? prompt : "Please arrange cards")
|
||||
title.text: luatr(prompt !== "" ? prompt : "Please arrange cards")
|
||||
width: body.width + padding * 2
|
||||
height: title.height + body.height + padding * 2
|
||||
|
||||
|
@ -32,7 +32,8 @@ GraphicsBox {
|
|||
spacing: 5
|
||||
|
||||
property int areaCapacity: modelData
|
||||
property string areaName: index < areaNames.length ? qsTr(areaNames[index]) : ""
|
||||
property string areaName: index < areaNames.length
|
||||
? qsTr(areaNames[index]) : ""
|
||||
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
@ -81,7 +82,7 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
id: buttonConfirm
|
||||
text: Backend.translate("OK")
|
||||
text: luatr("OK")
|
||||
width: 120
|
||||
height: 35
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ Item {
|
|||
card.autoBack = true;
|
||||
card.draggable = true;
|
||||
card.selectable = false;
|
||||
card.showDetail = true;
|
||||
card.clicked.connect(adjustCards);
|
||||
}
|
||||
|
||||
|
@ -46,7 +45,6 @@ Item {
|
|||
card = result[i];
|
||||
card.draggable = false;
|
||||
card.selectable = false;
|
||||
card.showDetail = false;
|
||||
card.selectedChanged.disconnect(adjustCards);
|
||||
card.prohibitReason = "";
|
||||
}
|
||||
|
@ -57,7 +55,7 @@ Item {
|
|||
{
|
||||
let card, i;
|
||||
cards.forEach(card => {
|
||||
card.selectable = cardIds.contains(card.cid);
|
||||
card.selectable = cardIds.includes(card.cid);
|
||||
if (!card.selectable) {
|
||||
card.selected = false;
|
||||
unselectCard(card);
|
||||
|
@ -93,10 +91,10 @@ Item {
|
|||
for (let i = 0; i < cards.length; i++) {
|
||||
const card = cards[i];
|
||||
if (card.selected) {
|
||||
if (!selectedCards.contains(card))
|
||||
if (!selectedCards.includes(card))
|
||||
selectCard(card);
|
||||
} else {
|
||||
if (selectedCards.contains(card))
|
||||
if (selectedCards.includes(card))
|
||||
unselectCard(card);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ Item {
|
|||
|
||||
Rectangle {
|
||||
width: 6
|
||||
height: Math.sqrt(Math.pow(modelData.x - start.x, 2) + Math.pow(modelData.y - start.y, 2)) * ratio
|
||||
height: Math.sqrt(Math.pow(modelData.x - start.x, 2) +
|
||||
Math.pow(modelData.y - start.y, 2)) * ratio
|
||||
x: start.x
|
||||
y: start.y
|
||||
antialiasing: true
|
||||
|
|
|
@ -59,7 +59,7 @@ Item {
|
|||
const items = [];
|
||||
for (let i = 0; i < outputs.length; i++) {
|
||||
if (_contains(outputs[i])) {
|
||||
const state = JSON.parse(Backend.callLuaFunction("GetCardData", [outputs[i]]))
|
||||
const state = lcall("GetCardData", outputs[i]);
|
||||
state.x = parentPos.x;
|
||||
state.y = parentPos.y;
|
||||
state.opacity = 0;
|
||||
|
@ -93,7 +93,8 @@ Item {
|
|||
const parentPos = roomScene.mapFromItem(root, 0, 0);
|
||||
for (i = 0; i < pendingInput.length; i++) {
|
||||
card = pendingInput[i];
|
||||
card.origX = parentPos.x - card.width / 2 + ((i - pendingInput.length / 2) * 15);
|
||||
card.origX = parentPos.x - card.width / 2
|
||||
+ ((i - pendingInput.length / 2) * 15);
|
||||
card.origY = parentPos.y - card.height / 2;
|
||||
card.origOpacity = 0;
|
||||
card.destroyOnStop();
|
||||
|
|
|
@ -19,7 +19,7 @@ Item {
|
|||
Text {
|
||||
id: roundTxt
|
||||
anchors.right: parent.right
|
||||
text: Backend.translate("#currentRoundNum").arg(roundNum)
|
||||
text: luatr("#currentRoundNum").arg(roundNum)
|
||||
color: "#F0E5DA"
|
||||
font.pixelSize: 18
|
||||
font.family: fontLibian.name
|
||||
|
|
|
@ -13,7 +13,7 @@ GraphicsBox {
|
|||
property var result
|
||||
property int padding: 25
|
||||
|
||||
title.text: Backend.translate("Please click to move card")
|
||||
title.text: luatr("Please click to move card")
|
||||
width: body.width + padding * 2
|
||||
height: title.height + body.height + padding * 2
|
||||
|
||||
|
@ -65,7 +65,7 @@ GraphicsBox {
|
|||
Text {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.centerIn: parent
|
||||
text: Backend.translate(modelData.subtype)
|
||||
text: luatr(modelData.subtype)
|
||||
color: "#90765F"
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 16
|
||||
|
@ -81,7 +81,7 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
id: buttonConfirm
|
||||
text: Backend.translate("OK")
|
||||
text: luatr("OK")
|
||||
width: 120
|
||||
height: 35
|
||||
enabled: false
|
||||
|
@ -131,7 +131,8 @@ GraphicsBox {
|
|||
const index = cards.findIndex(data => item.cid === data.cid);
|
||||
result && (result.pos = cardsPosition[index]);
|
||||
|
||||
const cardPos = cardsPosition[index] === 0 ? (result ? 1 : 0) : (result ? 0 : 1);
|
||||
const cardPos = cardsPosition[index] === 0 ? (result ? 1 : 0)
|
||||
: (result ? 0 : 1);
|
||||
const curArea = areaRepeater.itemAt(cardPos);
|
||||
const curBox = curArea.cardRepeater.itemAt(index);
|
||||
const curPos = mapFromItem(curArea, curBox.x, curBox.y);
|
||||
|
|
|
@ -179,6 +179,7 @@ Item {
|
|||
Image {
|
||||
id: generalImage
|
||||
width: deputyGeneral ? parent.width / 2 : parent.width
|
||||
Behavior on width { NumberAnimation { duration: 100 } }
|
||||
height: parent.height
|
||||
smooth: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
@ -187,7 +188,8 @@ Item {
|
|||
return "";
|
||||
}
|
||||
if (deputyGeneral) {
|
||||
return SkinBank.getGeneralExtraPic(general, "dual/") ?? SkinBank.getGeneralPicture(general);
|
||||
return SkinBank.getGeneralExtraPic(general, "dual/")
|
||||
?? SkinBank.getGeneralPicture(general);
|
||||
} else {
|
||||
return SkinBank.getGeneralPicture(general)
|
||||
}
|
||||
|
@ -204,7 +206,8 @@ Item {
|
|||
source: {
|
||||
const general = deputyGeneral;
|
||||
if (deputyGeneral != "") {
|
||||
return SkinBank.getGeneralExtraPic(general, "dual/") ?? SkinBank.getGeneralPicture(general);
|
||||
return SkinBank.getGeneralExtraPic(general, "dual/")
|
||||
?? SkinBank.getGeneralPicture(general);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
@ -231,7 +234,7 @@ Item {
|
|||
color: "white"
|
||||
width: 24
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: Backend.translate(deputyGeneral)
|
||||
text: luatr(deputyGeneral)
|
||||
style: Text.Outline
|
||||
}
|
||||
}
|
||||
|
@ -247,16 +250,18 @@ Item {
|
|||
}
|
||||
|
||||
OpacityMask {
|
||||
id: photoMaskEffect
|
||||
anchors.fill: photoMask
|
||||
source: generalImgItem
|
||||
maskSource: photoMask
|
||||
}
|
||||
|
||||
Colorize {
|
||||
anchors.fill: photoMask
|
||||
source: generalImgItem
|
||||
anchors.fill: photoMaskEffect
|
||||
source: photoMaskEffect
|
||||
saturation: 0
|
||||
visible: root.dead || root.surrendered
|
||||
opacity: (root.dead || root.surrendered) ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 300 } }
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -266,9 +271,10 @@ Item {
|
|||
height: 222
|
||||
radius: 8
|
||||
|
||||
visible: root.drank > 0
|
||||
// visible: root.drank > 0
|
||||
color: "red"
|
||||
opacity: 0.4 + Math.log(root.drank) * 0.12
|
||||
opacity: (root.drank <= 0 ? 0 : 0.4) + Math.log(root.drank) * 0.12
|
||||
Behavior on opacity { NumberAnimation { duration: 300 } }
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
@ -279,7 +285,7 @@ Item {
|
|||
|
||||
GlowText {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
text: Backend.translate("resting...")
|
||||
text: luatr("resting...")
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 40
|
||||
font.bold: true
|
||||
|
@ -303,7 +309,7 @@ Item {
|
|||
GlowText {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
visible: root.rest > 0 && root.rest < 999
|
||||
text: Backend.translate("rest round num")
|
||||
text: luatr("rest round num")
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: 28
|
||||
color: "#F0E5D6"
|
||||
|
@ -333,11 +339,11 @@ Item {
|
|||
style: Text.Outline
|
||||
text: {
|
||||
if (totalGame === 0) {
|
||||
return Backend.translate("Newbie");
|
||||
return luatr("Newbie");
|
||||
}
|
||||
const winRate = (winGame / totalGame) * 100;
|
||||
const runRate = (runGame / totalGame) * 100;
|
||||
return Backend.translate("Win=%1\nRun=%2\nTotal=%3")
|
||||
return luatr("Win=%1\nRun=%2\nTotal=%3")
|
||||
.arg(winRate.toFixed(2))
|
||||
.arg(runRate.toFixed(2))
|
||||
.arg(totalGame);
|
||||
|
@ -350,7 +356,8 @@ Item {
|
|||
anchors.right: parent.right
|
||||
anchors.bottomMargin: -8
|
||||
anchors.rightMargin: 4
|
||||
source: SkinBank.PHOTO_DIR + (isOwner ? "owner" : (ready ? "ready" : "notready"))
|
||||
source: SkinBank.PHOTO_DIR +
|
||||
(isOwner ? "owner" : (ready ? "ready" : "notready"))
|
||||
visible: screenName != "" && !roomScene.isStarted
|
||||
}
|
||||
|
||||
|
@ -392,7 +399,8 @@ Item {
|
|||
}
|
||||
|
||||
function updatePileInfo(areaName) {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetPile", [root.playerid, areaName]));
|
||||
if (areaName.startsWith('#')) return;
|
||||
const data = lcall("GetPile", root.playerid, areaName);
|
||||
if (data.length === 0) {
|
||||
root.markArea.removeMark(areaName);
|
||||
} else {
|
||||
|
@ -434,10 +442,12 @@ Item {
|
|||
// id: saveme
|
||||
visible: (root.dead && !root.rest) || root.dying || root.surrendered
|
||||
source: {
|
||||
if (root.dead) {
|
||||
if (root.surrendered) {
|
||||
return SkinBank.DEATH_DIR + "surrender";
|
||||
} else if (root.dead) {
|
||||
return SkinBank.getRoleDeathPic(root.role);
|
||||
}
|
||||
return SkinBank.DEATH_DIR + (root.surrendered ? "surrender" : "saveme")
|
||||
return SkinBank.DEATH_DIR + "saveme";
|
||||
}
|
||||
anchors.centerIn: photoMask
|
||||
}
|
||||
|
@ -459,7 +469,14 @@ Item {
|
|||
x: -6
|
||||
|
||||
Text {
|
||||
text: (root.maxCard === root.hp || root.hp < 0 ) ? (root.handcards) : (root.handcards + "/" + (root.maxCard < 900 ? root.maxCard : "∞"))
|
||||
text: {
|
||||
if (root.maxCard === root.hp || root.hp < 0) {
|
||||
return root.handcards;
|
||||
} else {
|
||||
const maxCard = root.maxCard < 900 ? root.maxCard : "∞";
|
||||
return root.handcards + "/" + maxCard;
|
||||
}
|
||||
}
|
||||
font.family: fontLibian.name
|
||||
font.pixelSize: (root.maxCard === root.hp || root.hp < 0 ) ? 32 : 27
|
||||
//font.weight: 30
|
||||
|
@ -471,10 +488,11 @@ Item {
|
|||
}
|
||||
|
||||
TapHandler {
|
||||
enabled: (root.state != "candidate" || !root.selectable) && root.playerid !== Self.id
|
||||
enabled: (root.state != "candidate" || !root.selectable)
|
||||
&& root.playerid !== Self.id
|
||||
onTapped: {
|
||||
const params = { name: "hand_card" };
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetPlayerHandcards", [root.playerid]));
|
||||
let data = lcall("GetPlayerHandcards", root.playerid);
|
||||
data = data.filter((e) => e !== -1);
|
||||
if (data.length === 0)
|
||||
return;
|
||||
|
@ -531,7 +549,12 @@ Item {
|
|||
anchors.topMargin: 2
|
||||
|
||||
font.pixelSize: 16
|
||||
text: (config.blockedUsers && config.blockedUsers.includes(screenName) ? Backend.translate("<Blocked> ") : "") + screenName
|
||||
text: {
|
||||
let ret = screenName;
|
||||
if (config.blockedUsers?.includes(screenName))
|
||||
ret = luatr("<Blocked> ") + ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
glow.radius: 8
|
||||
}
|
||||
|
@ -548,7 +571,10 @@ Item {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: -32
|
||||
property var seatChr: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"]
|
||||
property var seatChr: [
|
||||
"一", "二", "三", "四", "五", "六",
|
||||
"七", "八", "九", "十", "十一", "十二",
|
||||
]
|
||||
font.family: fontLi2.name
|
||||
font.pixelSize: 32
|
||||
text: seatChr[seatNumber - 1]
|
||||
|
@ -704,7 +730,7 @@ Item {
|
|||
|
||||
onGeneralChanged: {
|
||||
if (!roomScene.isStarted) return;
|
||||
const text = Backend.translate(general);
|
||||
const text = luatr(general);
|
||||
if (text.length > 6) {
|
||||
generalName.text = "";
|
||||
longGeneralName.text = text;
|
||||
|
@ -712,8 +738,6 @@ Item {
|
|||
generalName.text = text;
|
||||
longGeneralName.text = "";
|
||||
}
|
||||
// let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [general]));
|
||||
// kingdom = data.kingdom;
|
||||
}
|
||||
|
||||
function chat(msg) {
|
||||
|
|
|
@ -2,13 +2,18 @@
|
|||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Fk
|
||||
import Fk.Pages
|
||||
|
||||
GraphicsBox {
|
||||
id: root
|
||||
property string prompt
|
||||
|
||||
title.text: prompt === "" ? (root.multiChoose ? Backend.translate("$ChooseCards").arg(root.min).arg(root.max) : Backend.translate("$ChooseCard")) : processPrompt(prompt)
|
||||
title.text: prompt === "" ?
|
||||
(root.multiChoose ?
|
||||
luatr("$ChooseCards").arg(root.min).arg(root.max)
|
||||
: luatr("$ChooseCard"))
|
||||
: Util.processPrompt(prompt)
|
||||
|
||||
// TODO: Adjust the UI design in case there are more than 7 cards
|
||||
width: 70 + 700
|
||||
|
@ -50,7 +55,7 @@ GraphicsBox {
|
|||
|
||||
Text {
|
||||
color: "#E4D5A0"
|
||||
text: Backend.translate(areaName)
|
||||
text: luatr(areaName)
|
||||
anchors.fill: parent
|
||||
wrapMode: Text.WrapAnywhere
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
@ -95,26 +100,15 @@ GraphicsBox {
|
|||
|
||||
MetroButton {
|
||||
anchors.bottom: parent.bottom
|
||||
text: Backend.translate("OK")
|
||||
text: luatr("OK")
|
||||
visible: root.multiChoose
|
||||
enabled: root.selected_ids.length <= root.max && root.selected_ids.length >= root.min
|
||||
enabled: root.selected_ids.length <= root.max
|
||||
&& root.selected_ids.length >= root.min
|
||||
onClicked: root.cardsSelected(root.selected_ids)
|
||||
}
|
||||
|
||||
onCardSelected: finished();
|
||||
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = Backend.translate(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src")) raw = raw.replace(/%src/g, Backend.translate(getPhoto(src).general));
|
||||
if (raw.match("%dest")) raw = raw.replace(/%dest/g, Backend.translate(getPhoto(dest).general));
|
||||
if (raw.match("%arg2")) raw = raw.replace(/%arg2/g, Backend.translate(data[4]));
|
||||
if (raw.match("%arg")) raw = raw.replace(/%arg/g, Backend.translate(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
function findAreaModel(name) {
|
||||
let ret;
|
||||
for (let i = 0; i < cardModel.count; i++) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import Fk.Pages
|
|||
GraphicsBox {
|
||||
id: root
|
||||
|
||||
title.text: Backend.callLuaFunction("PoxiPrompt", [poxi_type, card_data, extra_data])
|
||||
title.text: lcall("PoxiPrompt", poxi_type, card_data, extra_data)
|
||||
|
||||
// TODO: Adjust the UI design in case there are more than 7 cards
|
||||
width: 70 + 700
|
||||
|
@ -50,7 +50,7 @@ GraphicsBox {
|
|||
|
||||
Text {
|
||||
color: "#E4D5A0"
|
||||
text: Backend.translate(areaName)
|
||||
text: luatr(areaName)
|
||||
anchors.fill: parent
|
||||
wrapMode: Text.WrapAnywhere
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
@ -71,12 +71,10 @@ GraphicsBox {
|
|||
number: model.number || 0
|
||||
autoBack: false
|
||||
known: model.cid !== -1
|
||||
selectable: {
|
||||
return root.selected_ids.includes(model.cid) || JSON.parse(Backend.callLuaFunction(
|
||||
"PoxiFilter",
|
||||
[root.poxi_type, model.cid, root.selected_ids, root.card_data, root.extra_data]
|
||||
));
|
||||
}
|
||||
selectable: root.selected_ids.includes(model.cid) ||
|
||||
lcall("PoxiFilter", root.poxi_type, model.cid, root.selected_ids,
|
||||
root.card_data, root.extra_data);
|
||||
|
||||
onSelectedChanged: {
|
||||
if (selected) {
|
||||
chosenInBox = true;
|
||||
|
@ -102,20 +100,16 @@ GraphicsBox {
|
|||
MetroButton {
|
||||
width: 120
|
||||
height: 35
|
||||
text: Backend.translate("OK")
|
||||
enabled: {
|
||||
return JSON.parse(Backend.callLuaFunction(
|
||||
"PoxiFeasible",
|
||||
[root.poxi_type, root.selected_ids, root.card_data, root.extra_data]
|
||||
));
|
||||
}
|
||||
text: luatr("OK")
|
||||
enabled: lcall("PoxiFeasible", root.poxi_type, root.selected_ids,
|
||||
root.card_data, root.extra_data);
|
||||
onClicked: root.cardsSelected(root.selected_ids)
|
||||
}
|
||||
|
||||
MetroButton {
|
||||
width: 120
|
||||
height: 35
|
||||
text: Backend.translate("Cancel")
|
||||
text: luatr("Cancel")
|
||||
visible: root.cancelable
|
||||
onClicked: root.cardsSelected([])
|
||||
}
|
||||
|
|
|
@ -112,10 +112,7 @@ Flickable {
|
|||
return false;
|
||||
};
|
||||
|
||||
const data = JSON.parse(Backend.callLuaFunction(
|
||||
"GetSkillData",
|
||||
[skill_name]
|
||||
));
|
||||
const data = lcall("GetSkillData", skill_name);
|
||||
|
||||
if (prelight) {
|
||||
if (!modelContains(prelight_skills, data))
|
||||
|
|
|
@ -28,12 +28,12 @@ Item {
|
|||
Text {
|
||||
text: {
|
||||
let o = "$" + skillName + "_" + generalName + (index % 2 + 1);
|
||||
let p = Backend.translate(o);
|
||||
let p = luatr(o);
|
||||
if (o !== p) {
|
||||
return p;
|
||||
}
|
||||
o = "$" + skillName + (index % 2 + 1);
|
||||
p = Backend.translate(o);
|
||||
p = luatr(o);
|
||||
if (o === p) {
|
||||
return "Ultimate Skill Invoked!";
|
||||
}
|
||||
|
@ -59,12 +59,12 @@ Item {
|
|||
Text {
|
||||
text: {
|
||||
let o = "$" + skillName + "_" + generalName + ((index + 1) % 2 + 1);
|
||||
let p = Backend.translate(o);
|
||||
let p = luatr(o);
|
||||
if (o !== p) {
|
||||
return p;
|
||||
}
|
||||
o = "$" + skillName + ((index + 1) % 2 + 1);
|
||||
p = Backend.translate(o);
|
||||
p = luatr(o);
|
||||
if (o === p) {
|
||||
return "Ultimate Skill Invoked!";
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ Item {
|
|||
Text {
|
||||
topPadding: 5
|
||||
id: skill
|
||||
text: Backend.translate(skillName)
|
||||
text: luatr(skillName)
|
||||
font.family: fontLi2.name
|
||||
font.pixelSize: 40
|
||||
x: root.width / 2 + 100
|
||||
|
|
|
@ -13,7 +13,7 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: childrenRect.height + 4
|
||||
|
||||
text: Backend.translate(extra_data.name)
|
||||
text: luatr(extra_data.name)
|
||||
}
|
||||
|
||||
GridView {
|
||||
|
|
|
@ -13,7 +13,7 @@ ColumnLayout {
|
|||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: childrenRect.height + 4
|
||||
|
||||
text: Backend.translate(extra_data.name)
|
||||
text: luatr(extra_data.name)
|
||||
}
|
||||
|
||||
GridView {
|
||||
|
@ -32,7 +32,7 @@ ColumnLayout {
|
|||
Component.onCompleted: {
|
||||
let data = {}
|
||||
if (extra_data.ids) {
|
||||
data = JSON.parse(Backend.callLuaFunction("GetCardData", [modelData]));
|
||||
data = lcall("GetCardData", modelData);
|
||||
} else {
|
||||
data.cid = 0;
|
||||
data.name = modelData;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import Fk
|
||||
import Fk.Pages
|
||||
|
||||
MetroButton {
|
||||
|
@ -12,34 +13,21 @@ MetroButton {
|
|||
property string answer: default_choice
|
||||
property bool detailed: false
|
||||
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = Backend.translate(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src")) raw = raw.replace(/%src/g, Backend.translate(getPhoto(src).general));
|
||||
if (raw.match("%dest")) raw = raw.replace(/%dest/g, Backend.translate(getPhoto(dest).general));
|
||||
if (raw.match("%arg2")) raw = raw.replace(/%arg2/g, Backend.translate(data[4]));
|
||||
if (raw.match("%arg")) raw = raw.replace(/%arg/g, Backend.translate(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
text: processPrompt(answer)
|
||||
text: Util.processPrompt(answer)
|
||||
|
||||
onAnswerChanged: {
|
||||
if (!answer) return;
|
||||
Backend.callLuaFunction(
|
||||
"SetInteractionDataOfSkill",
|
||||
[skill, JSON.stringify(answer)]
|
||||
);
|
||||
lcall("SetInteractionDataOfSkill", skill, JSON.stringify(answer));
|
||||
roomScene.dashboard.startPending(skill);
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (detailed) {
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/DetailedChoiceBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/DetailedChoiceBox.qml");
|
||||
} else {
|
||||
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/ChoiceBox.qml");
|
||||
roomScene.popupBox.sourceComponent =
|
||||
Qt.createComponent("../RoomElement/ChoiceBox.qml");
|
||||
}
|
||||
const box = roomScene.popupBox.item;
|
||||
box.options = choices;
|
||||
|
|
|
@ -10,11 +10,7 @@ SpinBox {
|
|||
// from, to
|
||||
|
||||
onValueChanged: {
|
||||
Backend.callLuaFunction(
|
||||
"SetInteractionDataOfSkill",
|
||||
[skill, JSON.stringify(answer)]
|
||||
);
|
||||
lcall("SetInteractionDataOfSkill", skill, JSON.stringify(answer));
|
||||
roomScene.dashboard.startPending(skill);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,8 +89,14 @@ Rectangle {
|
|||
id: textAni
|
||||
running: false
|
||||
loops: Animation.Infinite
|
||||
NumberAnimation { from: 0; to: 1; duration: 1600; easing.type: Easing.InOutQuad; }
|
||||
NumberAnimation { from: 1; to: 0; duration: 1600; easing.type: Easing.InOutQuad; }
|
||||
NumberAnimation {
|
||||
from: 0; to: 1; duration: 1600
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
NumberAnimation {
|
||||
from: 1; to: 0; duration: 1600
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ Rectangle {
|
|||
property real time: defaultTime
|
||||
readonly property real fadeTime: 300
|
||||
|
||||
anchors.horizontalCenter: parent != null ? parent.horizontalCenter : undefined
|
||||
anchors.horizontalCenter: parent != null ? parent.horizontalCenter
|
||||
: undefined
|
||||
height: message.height + 20
|
||||
width: message.width + 40
|
||||
radius: 16
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
import QtQuick
|
||||
|
||||
// copy from https://gist.github.com/jonmcclung/bae669101d17b103e94790341301c129
|
||||
// and modified some code
|
||||
// https://gist.github.com/jonmcclung/bae669101d17b103e94790341301c129
|
||||
// modified some code
|
||||
ListView {
|
||||
function show(text, duration) {
|
||||
if (duration === undefined) {
|
||||
|
|
31
Fk/main.qml
31
Fk/main.qml
|
@ -45,7 +45,8 @@ Window {
|
|||
StackView {
|
||||
id: mainStack
|
||||
visible: !mainWindow.busy
|
||||
// If error occurs during loading initialItem, the program will fall into "polish()" loop
|
||||
// If error occurs during loading initialItem
|
||||
// the program will fall into "polish()" loop
|
||||
// initialItem: init
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
@ -159,7 +160,10 @@ Window {
|
|||
return;
|
||||
}
|
||||
if (mainWindow.is_pending && command !== "ChangeSelf") {
|
||||
mainWindow.pending_message.push({ command: command, jsonData: jsonData });
|
||||
mainWindow.pending_message.push({
|
||||
command: command,
|
||||
jsonData: jsonData,
|
||||
});
|
||||
} else {
|
||||
if (command === "StartChangeSelf") {
|
||||
mainWindow.is_pending = true;
|
||||
|
@ -254,4 +258,27 @@ Window {
|
|||
exitMessageDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
// fake global functions
|
||||
function lcall(funcName, ...params) {
|
||||
const ret = Backend.callLuaFunction(funcName, [...params]);
|
||||
try {
|
||||
return JSON.parse(ret);
|
||||
} catch (e) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
function leval(lua) {
|
||||
const ret = Backend.evalLuaExp(`return json.encode(${lua})`);
|
||||
try {
|
||||
return JSON.parse(ret);
|
||||
} catch (e) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
function luatr(src) {
|
||||
return Backend.translate(src);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module Fk
|
||||
SkinBank 1.0 skin-bank.js
|
||||
Utility 1.0 util.js
|
||||
Util 1.0 util.js
|
||||
|
|
|
@ -31,18 +31,20 @@ const searchPkgResource = function(path, name, suffix) {
|
|||
}
|
||||
|
||||
function getGeneralExtraPic(name, extra) {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
||||
const data = lcall("GetGeneralData", name);
|
||||
const extension = data.extension;
|
||||
const path = AppPath + "/packages/" + extension + "/image/generals/" + extra + name + ".jpg";
|
||||
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 data = lcall("GetGeneralData", name);
|
||||
const extension = data.extension;
|
||||
const path = AppPath + "/packages/" + extension + "/image/generals/" + name + ".jpg";
|
||||
const path = AppPath + "/packages/" + extension + "/image/generals/"
|
||||
+ name + ".jpg";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
}
|
||||
|
@ -54,14 +56,15 @@ function getCardPicture(cidOrName) {
|
|||
let name = "unknown";
|
||||
if (typeof cidOrName === 'string') {
|
||||
name = cidOrName;
|
||||
extension = Backend.callLuaFunction("GetCardExtensionByName", [cidOrName]);
|
||||
extension = lcall("GetCardExtensionByName", cidOrName);
|
||||
} else {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
const data = lcall("GetCardData", cid);
|
||||
extension = data.extension;
|
||||
name = data.name;
|
||||
}
|
||||
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/" + name + ".png";
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/"
|
||||
+ name + ".png";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
} else {
|
||||
|
@ -72,9 +75,10 @@ function getCardPicture(cidOrName) {
|
|||
}
|
||||
|
||||
function getDelayedTrickPicture(name) {
|
||||
const extension = Backend.callLuaFunction("GetCardExtensionByName", [name]);
|
||||
const extension = lcall("GetCardExtensionByName", name);
|
||||
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/delayedTrick/" + name + ".png";
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/delayedTrick/"
|
||||
+ name + ".png";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
} else {
|
||||
|
@ -86,10 +90,11 @@ function getDelayedTrickPicture(name) {
|
|||
|
||||
|
||||
function getEquipIcon(cid, icon) {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
||||
const data = lcall("GetCardData", cid);
|
||||
const extension = data.extension;
|
||||
const name = icon || data.name;
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/equipIcon/" + name + ".png";
|
||||
let path = AppPath + "/packages/" + extension + "/image/card/equipIcon/"
|
||||
+ name + ".png";
|
||||
if (Backend.exists(path)) {
|
||||
return path;
|
||||
} else {
|
||||
|
|
18
Fk/util.js
18
Fk/util.js
|
@ -1,7 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
.pragma library
|
||||
|
||||
function convertNumber(number) {
|
||||
if (number === 1)
|
||||
return "A";
|
||||
|
@ -14,8 +12,20 @@ function convertNumber(number) {
|
|||
return "";
|
||||
}
|
||||
|
||||
Array.prototype.contains = function(element) {
|
||||
return this.indexOf(element) != -1;
|
||||
function processPrompt(prompt) {
|
||||
const data = prompt.split(":");
|
||||
let raw = luatr(data[0]);
|
||||
const src = parseInt(data[1]);
|
||||
const dest = parseInt(data[2]);
|
||||
if (raw.match("%src"))
|
||||
raw = raw.replace(/%src/g, luatr(getPhoto(src).general));
|
||||
if (raw.match("%dest"))
|
||||
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
|
||||
if (raw.match("%arg2"))
|
||||
raw = raw.replace(/%arg2/g, luatr(data[4]));
|
||||
if (raw.match("%arg"))
|
||||
raw = raw.replace(/%arg/g, luatr(data[3]));
|
||||
return raw;
|
||||
}
|
||||
|
||||
Array.prototype.prepend = function() {
|
||||
|
|
18
README.md
18
README.md
|
@ -14,21 +14,11 @@ ___
|
|||
|
||||
新月杀(FreeKill)是一款开源的三国杀游戏,但其目的不在于补完官方所有武将,而是着力于提供一个最适合DIY的框架。
|
||||
|
||||
___
|
||||
|
||||
## 项目文档
|
||||
|
||||
[新月杀文档](https://qsgs-fans.github.io/FreeKill/usr/index.html)
|
||||
|
||||
### 依赖的库
|
||||
|
||||
以下是新月杀运行所必不可少的依赖库:
|
||||
|
||||
* [![](https://img.shields.io/badge/qt6-50D160?style=for-the-badge&logo=qt&logoColor=white)](https://www.qt.io)
|
||||
* [![](https://img.shields.io/badge/lua5.4-030380?style=for-the-badge&logo=lua)](https://www.lua.org)
|
||||
* [![](https://img.shields.io/badge/sqlite3-7ABEEA?style=for-the-badge&logo=sqlite)](https://www.sqlite.org)
|
||||
* [![](https://img.shields.io/badge/libgit2-FFFFFF?style=for-the-badge&logo=git)](https://www.libgit2.org)
|
||||
* [![](https://img.shields.io/badge/openssl-721412?style=for-the-badge&logo=openssl)](https://www.openssl.org)
|
||||
|
||||
新月杀在编译过程中,需要用到cmake, flex, bison, swig。
|
||||
https://fkbook-all-in-one.readthedocs.io/
|
||||
|
||||
___
|
||||
|
||||
|
@ -46,7 +36,7 @@ ___
|
|||
|
||||
## 如何构建
|
||||
|
||||
关于如何从头构建新月杀,详见[编译教程](https://qsgs-fans.github.io/FreeKill/inner/01-compile.html)。
|
||||
https://fkbook-all-in-one.readthedocs.io/zh-cn/latest/develop/02-env.html
|
||||
|
||||
___
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.notify.FreeKill"
|
||||
android:installLocation="preferExternal"
|
||||
android:versionCode="402"
|
||||
android:versionName="0.4.2">
|
||||
android:versionCode="409"
|
||||
android:versionName="0.4.9">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -107,6 +107,10 @@
|
|||
<source>[%1/%2] upgrading package '%3'</source>
|
||||
<translation>[%1/%2] 更新拓展包 '%3'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>packages/%1: some error occured.</source>
|
||||
<translation>拓展包 %1 出了点问题,尝试在管理拓展包中删除之再试试</translation>
|
||||
</message>
|
||||
</context>
|
||||
|
||||
<context>
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
-- SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
---@class Client
|
||||
---@class Client : AbstractRoom
|
||||
---@field public client fk.Client
|
||||
---@field public players ClientPlayer[] @ 所有参战玩家的数组
|
||||
---@field public alive_players ClientPlayer[] @ 所有存活玩家的数组
|
||||
---@field public observers ClientPlayer[] @ 观察者的数组
|
||||
---@field public current ClientPlayer @ 当前回合玩家
|
||||
---@field public discard_pile integer[] @ 弃牌堆
|
||||
---@field public status_skills Skill[] @ 状态技总和
|
||||
---@field public banners table<string, any> @ 左上角显示的东西
|
||||
---@field public observing boolean
|
||||
Client = class('Client')
|
||||
Client = AbstractRoom:subclass('Client')
|
||||
|
||||
-- load client classes
|
||||
ClientPlayer = require "client.clientplayer"
|
||||
|
@ -26,6 +24,7 @@ local pattern_refresh_commands = {
|
|||
}
|
||||
|
||||
function Client:initialize()
|
||||
AbstractRoom.initialize(self)
|
||||
self.client = fk.ClientInstance
|
||||
self.notifyUI = function(self, command, jsonData)
|
||||
fk.Backend:emitNotifyUI(command, jsonData)
|
||||
|
@ -49,21 +48,8 @@ function Client:initialize()
|
|||
end
|
||||
end
|
||||
|
||||
self.players = {} -- ClientPlayer[]
|
||||
self.alive_players = {}
|
||||
self.observers = {}
|
||||
self.discard_pile = {}
|
||||
self.status_skills = {}
|
||||
for class, skills in pairs(Fk.global_status_skill) do
|
||||
self.status_skills[class] = {table.unpack(skills)}
|
||||
end
|
||||
|
||||
self.banners = {}
|
||||
|
||||
self.skill_costs = {}
|
||||
self.card_marks = {}
|
||||
self.filtered_cards = {}
|
||||
self.printed_cards = {}
|
||||
self.disabled_packs = {}
|
||||
self.disabled_generals = {}
|
||||
|
||||
|
@ -71,7 +57,7 @@ function Client:initialize()
|
|||
end
|
||||
|
||||
---@param id integer
|
||||
---@return ClientPlayer
|
||||
---@return ClientPlayer?
|
||||
function Client:getPlayerById(id)
|
||||
if id == Self.id then return Self end
|
||||
for _, p in ipairs(self.players) do
|
||||
|
@ -225,7 +211,11 @@ end
|
|||
|
||||
---@param msg LogMessage
|
||||
function Client:appendLog(msg)
|
||||
self:notifyUI("GameLog", parseMsg(msg))
|
||||
local text = parseMsg(msg)
|
||||
self:notifyUI("GameLog", text)
|
||||
if msg.toast then
|
||||
self:notifyUI("ShowToast", text)
|
||||
end
|
||||
end
|
||||
|
||||
---@param msg LogMessage
|
||||
|
@ -237,15 +227,6 @@ function Client:setCardNote(ids, msg)
|
|||
end
|
||||
end
|
||||
|
||||
function Client:setBanner(name, value)
|
||||
if value == 0 then value = nil end
|
||||
self.banners[name] = value
|
||||
end
|
||||
|
||||
function Client:getBanner(name)
|
||||
return self.banners[name]
|
||||
end
|
||||
|
||||
fk.client_callback["SetCardFootnote"] = function(jsonData)
|
||||
local data = json.decode(jsonData)
|
||||
ClientInstance:setCardNote(data[1], data[2]);
|
||||
|
@ -401,6 +382,7 @@ fk.client_callback["AskForCardChosen"] = function(jsonData)
|
|||
judge = {}
|
||||
end
|
||||
ui_data = {
|
||||
_id = id,
|
||||
_reason = reason,
|
||||
card_data = {},
|
||||
_prompt = prompt,
|
||||
|
@ -409,6 +391,7 @@ fk.client_callback["AskForCardChosen"] = function(jsonData)
|
|||
if #equip ~= 0 then table.insert(ui_data.card_data, { "$Equip", equip }) end
|
||||
if #judge ~= 0 then table.insert(ui_data.card_data, { "$Judge", judge }) end
|
||||
else
|
||||
ui_data._id = id
|
||||
ui_data._reason = reason
|
||||
ui_data._prompt = prompt
|
||||
end
|
||||
|
@ -436,6 +419,7 @@ fk.client_callback["AskForCardsChosen"] = function(jsonData)
|
|||
judge = {}
|
||||
end
|
||||
ui_data = {
|
||||
_id = id,
|
||||
_min = min,
|
||||
_max = max,
|
||||
_reason = reason,
|
||||
|
@ -446,6 +430,7 @@ fk.client_callback["AskForCardsChosen"] = function(jsonData)
|
|||
if #equip ~= 0 then table.insert(ui_data.card_data, { "$Equip", equip }) end
|
||||
if #judge ~= 0 then table.insert(ui_data.card_data, { "$Judge", judge }) end
|
||||
else
|
||||
ui_data._id = id
|
||||
ui_data._min = min
|
||||
ui_data._max = max
|
||||
ui_data._reason = reason
|
||||
|
@ -469,6 +454,7 @@ local function separateMoves(moves)
|
|||
moveReason = move.moveReason,
|
||||
specialName = move.specialName,
|
||||
fromSpecialName = info.fromSpecialName,
|
||||
proposer = move.proposer,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -480,9 +466,9 @@ local function mergeMoves(moves)
|
|||
local ret = {}
|
||||
local temp = {}
|
||||
for _, move in ipairs(moves) do
|
||||
local info = string.format("%q,%q,%q,%q,%s,%s",
|
||||
local info = string.format("%q,%q,%q,%q,%s,%s,%q",
|
||||
move.from, move.to, move.fromArea, move.toArea,
|
||||
move.specialName, move.fromSpecialName)
|
||||
move.specialName, move.fromSpecialName, move.proposer)
|
||||
if temp[info] == nil then
|
||||
temp[info] = {
|
||||
ids = {},
|
||||
|
@ -493,6 +479,7 @@ local function mergeMoves(moves)
|
|||
moveReason = move.moveReason,
|
||||
specialName = move.specialName,
|
||||
fromSpecialName = move.fromSpecialName,
|
||||
proposer = move.proposer,
|
||||
}
|
||||
end
|
||||
table.insert(temp[info].ids, move.ids[1])
|
||||
|
@ -504,12 +491,96 @@ local function mergeMoves(moves)
|
|||
end
|
||||
|
||||
local function sendMoveCardLog(move)
|
||||
local client = ClientInstance
|
||||
local client = ClientInstance ---@class Client
|
||||
if #move.ids == 0 then return end
|
||||
local hidden = table.contains(move.ids, -1)
|
||||
local msgtype
|
||||
|
||||
if move.from and move.toArea == Card.DrawPile then
|
||||
if move.toArea == Card.PlayerHand then
|
||||
if move.fromArea == Card.PlayerSpecial then
|
||||
client:appendLog{
|
||||
type = "$GetCardsFromPile",
|
||||
from = move.to,
|
||||
arg = move.fromSpecialName,
|
||||
arg2 = #move.ids,
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.fromArea == Card.DrawPile then
|
||||
client:appendLog{
|
||||
type = "$DrawCards",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif move.fromArea == Card.Processing then
|
||||
client:appendLog{
|
||||
type = "$GotCardBack",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif move.fromArea == Card.DiscardPile then
|
||||
client:appendLog{
|
||||
type = "$RecycleCard",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif move.from then
|
||||
client:appendLog{
|
||||
type = "$MoveCards",
|
||||
from = move.from,
|
||||
to = { move.to },
|
||||
arg = #move.ids,
|
||||
card = move.ids,
|
||||
}
|
||||
else
|
||||
client:appendLog{
|
||||
type = "$PreyCardsFromPile",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
end
|
||||
elseif move.toArea == Card.PlayerEquip then
|
||||
client:appendLog{
|
||||
type = "$InstallEquip",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.toArea == Card.PlayerJudge then
|
||||
if move.from ~= move.to and move.fromArea == Card.PlayerJudge then
|
||||
client:appendLog{
|
||||
type = "$LightningMove",
|
||||
from = move.from,
|
||||
to = { move.to },
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.from then
|
||||
client:appendLog{
|
||||
type = "$PasteCard",
|
||||
from = move.from,
|
||||
to = { move.to },
|
||||
card = move.ids,
|
||||
}
|
||||
end
|
||||
elseif move.toArea == Card.PlayerSpecial then
|
||||
client:appendLog{
|
||||
type = "$AddToPile",
|
||||
arg = move.specialName,
|
||||
arg2 = #move.ids,
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.fromArea == Card.PlayerEquip then
|
||||
client:appendLog{
|
||||
type = "$UninstallEquip",
|
||||
from = move.from,
|
||||
card = move.ids,
|
||||
}
|
||||
-- elseif move.toArea == Card.Processing then
|
||||
-- nop
|
||||
elseif move.from and move.toArea == Card.DrawPile then
|
||||
msgtype = hidden and "$PutCard" or "$PutKnownCard"
|
||||
client:appendLog{
|
||||
type = msgtype,
|
||||
|
@ -521,85 +592,37 @@ local function sendMoveCardLog(move)
|
|||
type = "$$PutCard",
|
||||
from = move.from,
|
||||
})
|
||||
elseif move.toArea == Card.PlayerSpecial then
|
||||
msgtype = hidden and "$RemoveCardFromGame" or "$AddToPile"
|
||||
client:appendLog{
|
||||
type = msgtype,
|
||||
arg = move.specialName,
|
||||
arg2 = #move.ids,
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.fromArea == Card.PlayerSpecial and move.to then
|
||||
client:appendLog{
|
||||
type = "$GetCardsFromPile",
|
||||
from = move.to,
|
||||
arg = move.fromSpecialName,
|
||||
arg2 = #move.ids,
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.moveReason == fk.ReasonDraw then
|
||||
client:appendLog{
|
||||
type = "$DrawCards",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif (move.fromArea == Card.DrawPile or move.fromArea == Card.DiscardPile)
|
||||
and move.moveReason == fk.ReasonPrey then
|
||||
client:appendLog{
|
||||
type = "$PreyCardsFromPile",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif (move.fromArea == Card.Processing or move.fromArea == Card.PlayerJudge)
|
||||
and move.toArea == Card.PlayerHand then
|
||||
client:appendLog{
|
||||
type = "$GotCardBack",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif move.fromArea == Card.DiscardPile and move.toArea == Card.PlayerHand then
|
||||
client:appendLog{
|
||||
type = "$RecycleCard",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif move.from and move.fromArea ~= Card.PlayerJudge and
|
||||
move.toArea ~= Card.PlayerJudge and move.to and move.from ~= move.to then
|
||||
client:appendLog{
|
||||
type = "$MoveCards",
|
||||
from = move.from,
|
||||
to = { move.to },
|
||||
arg = #move.ids,
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.from and move.to and move.toArea == Card.PlayerJudge then
|
||||
if move.fromArea == Card.PlayerJudge and move.from ~= move.to then
|
||||
msgtype = "$LightningMove"
|
||||
elseif move.fromArea ~= Card.PlayerJudge then
|
||||
msgtype = "$PasteCard"
|
||||
end
|
||||
if msgtype then
|
||||
client:appendLog{
|
||||
type = msgtype,
|
||||
from = move.from,
|
||||
to = { move.to },
|
||||
card = move.ids,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO ...
|
||||
elseif move.toArea == Card.DiscardPile then
|
||||
if move.moveReason == fk.ReasonDiscard then
|
||||
if move.proposer and move.proposer ~= move.from then
|
||||
client:appendLog{
|
||||
type = "$DiscardOther",
|
||||
from = move.from,
|
||||
to = {move.proposer},
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
else
|
||||
client:appendLog{
|
||||
type = "$DiscardCards",
|
||||
from = move.from,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
end
|
||||
elseif move.moveReason == fk.ReasonPutIntoDiscardPile then
|
||||
client:appendLog{
|
||||
type = "$PutToDiscard",
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
end
|
||||
-- elseif move.toArea == Card.Void then
|
||||
-- nop
|
||||
end
|
||||
|
||||
-- TODO: footnote
|
||||
if move.moveReason == fk.ReasonDiscard then
|
||||
client:setCardNote(move.ids, {
|
||||
type = "$$DiscardCards",
|
||||
from = move.from
|
||||
|
@ -753,9 +776,7 @@ fk.client_callback["AskForUseActiveSkill"] = function(jsonData)
|
|||
local data = json.decode(jsonData)
|
||||
local skill = Fk.skills[data[1]]
|
||||
local extra_data = data[4]
|
||||
for k, v in pairs(extra_data) do
|
||||
skill[k] = v
|
||||
end
|
||||
skill._extra_data = extra_data
|
||||
|
||||
Fk.currentResponseReason = extra_data.skillName
|
||||
ClientInstance:notifyUI("AskForUseActiveSkill", jsonData)
|
||||
|
@ -775,9 +796,19 @@ fk.client_callback["SetPlayerMark"] = function(jsonData)
|
|||
-- jsonData: [ int id, string mark, int value ]
|
||||
local data = json.decode(jsonData)
|
||||
local player, mark, value = data[1], data[2], data[3]
|
||||
ClientInstance:getPlayerById(player):setMark(mark, value)
|
||||
local p = ClientInstance:getPlayerById(player)
|
||||
p:setMark(mark, value)
|
||||
|
||||
if string.sub(mark, 1, 1) == "@" then
|
||||
if mark:startsWith("@[") and mark:find(']') then
|
||||
local close = mark:find(']')
|
||||
local mtype = mark:sub(3, close - 1)
|
||||
local spec = Fk.qml_marks[mtype]
|
||||
if spec then
|
||||
local text = spec.how_to_show(mark, value, p)
|
||||
if text == "#hidden" then return end
|
||||
end
|
||||
end
|
||||
ClientInstance:notifyUI("SetPlayerMark", jsonData)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -127,6 +127,14 @@ function GetCardExtensionByName(cardName)
|
|||
return card and card.package.extensionName or ""
|
||||
end
|
||||
|
||||
function GetAllMods()
|
||||
return json.encode(Fk.extensions)
|
||||
end
|
||||
|
||||
function GetAllModNames()
|
||||
return json.encode(Fk.extension_names)
|
||||
end
|
||||
|
||||
function GetAllGeneralPack()
|
||||
local ret = {}
|
||||
for _, name in ipairs(Fk.package_names) do
|
||||
|
@ -138,6 +146,7 @@ function GetAllGeneralPack()
|
|||
end
|
||||
|
||||
function GetGenerals(pack_name)
|
||||
if not Fk.packages[pack_name] then return "{}" end
|
||||
local ret = {}
|
||||
for _, g in ipairs(Fk.packages[pack_name].generals) do
|
||||
if not g.total_hidden then
|
||||
|
@ -251,8 +260,10 @@ end
|
|||
|
||||
---@param card string | integer
|
||||
---@param player integer
|
||||
function CanUseCard(card, player)
|
||||
---@param extra_data_str string
|
||||
function CanUseCard(card, player, extra_data_str)
|
||||
local c ---@type Card
|
||||
local extra_data = extra_data_str == "" and nil or json.decode(extra_data_str)
|
||||
if type(card) == "number" then
|
||||
c = Fk:getCardById(card)
|
||||
else
|
||||
|
@ -271,13 +282,13 @@ function CanUseCard(card, player)
|
|||
end
|
||||
|
||||
player = ClientInstance:getPlayerById(player)
|
||||
local ret = c.skill:canUse(player, c)
|
||||
local ret = c.skill:canUse(player, c, extra_data)
|
||||
ret = ret and not player:prohibitUse(c)
|
||||
if ret then
|
||||
local min_target = c.skill:getMinTargetNum()
|
||||
if min_target > 0 then
|
||||
for _, p in ipairs(ClientInstance.players) do
|
||||
if c.skill:targetFilter(p.id, {}, {}, c) then
|
||||
if c.skill:targetFilter(p.id, {}, {}, c, extra_data) then
|
||||
return "true"
|
||||
end
|
||||
end
|
||||
|
@ -311,7 +322,9 @@ end
|
|||
---@param card string | integer
|
||||
---@param to_select integer @ id of the target
|
||||
---@param selected integer[] @ ids of selected targets
|
||||
function CanUseCardToTarget(card, to_select, selected)
|
||||
---@param extra_data_str string @ extra data
|
||||
function CanUseCardToTarget(card, to_select, selected, extra_data_str)
|
||||
local extra_data = extra_data_str == "" and nil or json.decode(extra_data_str)
|
||||
if ClientInstance:getPlayerById(to_select).dead then
|
||||
return "false"
|
||||
end
|
||||
|
@ -322,10 +335,10 @@ function CanUseCardToTarget(card, to_select, selected)
|
|||
selected_cards = {card}
|
||||
else
|
||||
local t = json.decode(card)
|
||||
return ActiveTargetFilter(t.skill, to_select, selected, t.subcards)
|
||||
return ActiveTargetFilter(t.skill, to_select, selected, t.subcards, extra_data)
|
||||
end
|
||||
|
||||
local ret = c.skill:targetFilter(to_select, selected, selected_cards, c)
|
||||
local ret = c.skill:targetFilter(to_select, selected, selected_cards, c, extra_data)
|
||||
ret = ret and not Self:isProhibited(Fk:currentRoom():getPlayerById(to_select), c)
|
||||
return json.encode(ret)
|
||||
end
|
||||
|
@ -392,12 +405,13 @@ function GetSkillData(skill_name)
|
|||
}
|
||||
end
|
||||
|
||||
function ActiveCanUse(skill_name)
|
||||
function ActiveCanUse(skill_name, extra_data_str)
|
||||
local extra_data = extra_data_str == "" and nil or json.decode(extra_data_str)
|
||||
local skill = Fk.skills[skill_name]
|
||||
local ret = false
|
||||
if skill then
|
||||
if skill:isInstanceOf(ActiveSkill) then
|
||||
ret = skill:canUse(Self)
|
||||
ret = skill:canUse(Self, extra_data)
|
||||
elseif skill:isInstanceOf(ViewAsSkill) then
|
||||
ret = skill:enabledAtPlay(Self)
|
||||
if ret then
|
||||
|
@ -414,7 +428,7 @@ function ActiveCanUse(skill_name)
|
|||
for _, n in ipairs(cnames) do
|
||||
local c = Fk:cloneCard(n)
|
||||
c.skillName = skill_name
|
||||
ret = c.skill:canUse(Self, c)
|
||||
ret = c.skill:canUse(Self, c, extra_data)
|
||||
if ret then break end
|
||||
end
|
||||
end
|
||||
|
@ -449,7 +463,7 @@ function ActiveCardFilter(skill_name, to_select, selected, selected_targets)
|
|||
return json.encode(ret)
|
||||
end
|
||||
|
||||
function ActiveTargetFilter(skill_name, to_select, selected, selected_cards)
|
||||
function ActiveTargetFilter(skill_name, to_select, selected, selected_cards, extra_data)
|
||||
local skill = Fk.skills[skill_name]
|
||||
local ret = false
|
||||
if skill then
|
||||
|
@ -458,7 +472,7 @@ function ActiveTargetFilter(skill_name, to_select, selected, selected_cards)
|
|||
elseif skill:isInstanceOf(ViewAsSkill) then
|
||||
local card = skill:viewAs(selected_cards)
|
||||
if card then
|
||||
ret = card.skill:targetFilter(to_select, selected, selected_cards, card)
|
||||
ret = card.skill:targetFilter(to_select, selected, selected_cards, card, extra_data)
|
||||
ret = ret and not Self:isProhibited(Fk:currentRoom():getPlayerById(to_select), card)
|
||||
end
|
||||
end
|
||||
|
@ -572,7 +586,17 @@ end
|
|||
|
||||
function GetExpandPileOfSkill(skillName)
|
||||
local skill = Fk.skills[skillName]
|
||||
return skill and (skill.expand_pile or "") or ""
|
||||
if not skill then return "" end
|
||||
local e = skill.expand_pile
|
||||
if type(e) == "function" then
|
||||
e = e(skill)
|
||||
end
|
||||
|
||||
if type(e) == "table" then
|
||||
return json.encode(e)
|
||||
else
|
||||
return e or ""
|
||||
end
|
||||
end
|
||||
|
||||
function GetGameModes()
|
||||
|
@ -722,7 +746,7 @@ function PoxiPrompt(poxi_type, data, extra_data)
|
|||
local poxi = Fk.poxi_methods[poxi_type]
|
||||
if not poxi or not poxi.prompt then return "" end
|
||||
if type(poxi.prompt) == "string" then return Fk:translate(poxi.prompt) end
|
||||
return poxi.prompt(data, extra_data)
|
||||
return Fk:translate(poxi.prompt(data, extra_data))
|
||||
end
|
||||
|
||||
function PoxiFilter(poxi_type, to_select, selected, data, extra_data)
|
||||
|
@ -748,6 +772,15 @@ function GetQmlMark(mtype, name, value, p)
|
|||
}
|
||||
end
|
||||
|
||||
function GetMiniGame(gtype, p, data)
|
||||
local spec = Fk.mini_games[gtype]
|
||||
p = ClientInstance:getPlayerById(p)
|
||||
data = json.decode(data)
|
||||
return json.encode {
|
||||
qml_path = type(spec.qml_path) == "function" and spec.qml_path(p, data) or spec.qml_path,
|
||||
}
|
||||
end
|
||||
|
||||
function YuqiPrompt(yuqi_type, data, extra_data)
|
||||
local yuqi = Fk.yuqi_methods[yuqi_type]
|
||||
if not yuqi or not yuqi.prompt then return "" end
|
||||
|
|
|
@ -134,8 +134,17 @@ Fk:loadTranslationTable({
|
|||
-- ["Quit"] = "退出",
|
||||
["BanGeneral"] = "Ban",
|
||||
["ResumeGeneral"] = "Unban",
|
||||
["BanPackage"] = "Ban packages",
|
||||
["$BanPkgHelp"] = "Banning packages",
|
||||
["$BanCharaHelp"] = "Banning characters",
|
||||
-- ["Companions"] = "珠联璧合",
|
||||
-- ["Death audio"] = "阵亡",
|
||||
-- ["Win audio"] = "胜利语音",
|
||||
-- ["Official"] = "官方",
|
||||
["Title"] = "Title: ",
|
||||
["Designer"] = "Designer: ",
|
||||
["Voice Actor"] = "Voice Actor: ",
|
||||
["Illustrator"] = "Illustrator: ",
|
||||
|
||||
["$WelcomeToLobby"] = "Welcome to FreeKill lobby!",
|
||||
["GameMode"] = "Game mode: ",
|
||||
|
@ -176,12 +185,13 @@ Fk:loadTranslationTable({
|
|||
["AskForKingdom"] = "Choosing kingdom",
|
||||
["AskForPindian"] = "Point fight",
|
||||
["AskForMoveCardInBoard"] = "Moving cards",
|
||||
["replaceEquip"] = "Replacing Equip",
|
||||
["PlayCard"] = "Playing card",
|
||||
|
||||
["AskForCardChosen"] = "Choosing card",
|
||||
["AskForCardsChosen"] = "Choosing card",
|
||||
["#AskForChooseCard"] = "%1: please choose a card",
|
||||
["#AskForChooseCards"] = "%1: please choose %2~%3 cards",
|
||||
["#AskForChooseCard"] = "%1: please choose a card from %src",
|
||||
["#AskForChooseCards"] = "%1: please choose %2~%3 cards from %src",
|
||||
["$ChooseCard"] = "Choose a card",
|
||||
["$ChooseCards"] = "Choose %1~%2 cards",
|
||||
["$Hand"] = "Hand",
|
||||
|
@ -196,8 +206,11 @@ Fk:loadTranslationTable({
|
|||
["#AskForPeaches"] = "%src is dying, please use %arg Peach(es) to save him",
|
||||
["#AskForPeachesSelf"] = "You are dying, please use %arg Peach(es)/Alcohol to save yourself",
|
||||
|
||||
["#AskForDiscard"] = "Please discard %arg cards (at least %arg2)",
|
||||
["#AskForCard"] = "Please choose %arg cards (at least %arg2)",
|
||||
["#AskForDiscard"] = "Please discard %arg cards (%arg2 at least)",
|
||||
["#AskForCard"] = "Please choose %arg cards (%arg2 at least)",
|
||||
["#AskForDistribution"] = "Please distribute cards (%arg at least , %arg2 total)",
|
||||
["@DistributionTo"] = "",
|
||||
["#replaceEquip"] = "Please Choose a Equip Card to be replaced",
|
||||
["#askForPindian"] = "%arg: please choose a hand card for point fight",
|
||||
["#StartPindianReason"] = "%from started point fight (%arg)",
|
||||
["#ShowPindianCard"] = "The point fight card of %from is %card",
|
||||
|
@ -268,6 +281,7 @@ Fk:loadTranslationTable({
|
|||
["thunder_damage"] = "Thunder",
|
||||
["ice_damage"] = "Ice",
|
||||
["hp_lost"] = "HP lost",
|
||||
["lose_hp"] = "lose HP",
|
||||
|
||||
["phase_start"] = "Prepare phase",
|
||||
["phase_judge"] = "Judge phase",
|
||||
|
@ -343,6 +357,7 @@ Fk:loadTranslationTable({
|
|||
["$LightningMove"] = "%card transfered from %from to %to",
|
||||
["$PasteCard"] = "%from used %card to %to",
|
||||
["$DiscardCards"] = "%from discarded %arg card(s) %card",
|
||||
["$DiscardOther"] = "%to discarded %arg card(s) %card from %from",
|
||||
["$InstallEquip"] = "%from equipped %card",
|
||||
["$UninstallEquip"] = "%from uninstalled %card",
|
||||
|
||||
|
|
|
@ -79,12 +79,16 @@ Fk:loadTranslationTable{
|
|||
["Clear"] = "清空",
|
||||
["Help_Ban_List"] = "导出键会将这个方案的内容复制到剪贴板中;" ..
|
||||
"导入键会自动读取剪贴板,若可以导入则导入,不能导入则报错。",
|
||||
["Ban_Generals"] = "已禁用武将",
|
||||
["Ban_Packages"] = "禁用拓展包",
|
||||
["Whitelist_Generals"] = "白名单武将",
|
||||
["Export"] = "导出",
|
||||
["Export Success"] = "禁将方案已经复制到剪贴板。",
|
||||
["Import"] = "导入",
|
||||
["Not Legal"] = "导入失败:不是合法的JSON字符串。",
|
||||
["Not JSON"] = "导入失败:数据格式不对。",
|
||||
["Import Success"] = "从剪贴板导入禁将方案成功。",
|
||||
["Rename"] = "重命名",
|
||||
|
||||
["$OnlineInfo"] = "大厅人数:%1,总在线人数:%2",
|
||||
|
||||
|
@ -184,8 +188,17 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
|||
-- ["Quit"] = "退出",
|
||||
["BanGeneral"] = "禁将",
|
||||
["ResumeGeneral"] = "解禁",
|
||||
["BanPackage"] = "禁拓展包",
|
||||
["$BanPkgHelp"] = "正在禁用拓展包",
|
||||
["$BanCharaHelp"] = "正在禁用武将",
|
||||
["Companions"] = "珠联璧合",
|
||||
["Death audio"] = "阵亡",
|
||||
["Win audio"] = "胜利语音",
|
||||
["Official"] = "官方",
|
||||
["Title"] = "称号:",
|
||||
["Designer"] = "设计:",
|
||||
["Voice Actor"] = "配音:",
|
||||
["Illustrator"] = "画师:",
|
||||
|
||||
["$WelcomeToLobby"] = "欢迎进入新月杀游戏大厅!",
|
||||
["GameMode"] = "游戏模式:",
|
||||
|
@ -226,12 +239,13 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
|||
["AskForKingdom"] = "选择势力",
|
||||
["AskForPindian"] = "拼点",
|
||||
["AskForMoveCardInBoard"] = "移动卡牌",
|
||||
["replaceEquip"] = "替换装备",
|
||||
["PlayCard"] = "出牌",
|
||||
|
||||
["AskForCardChosen"] = "选牌",
|
||||
["AskForCardsChosen"] = "选牌",
|
||||
["#AskForChooseCard"] = "%1:请选择其一张卡牌",
|
||||
["#AskForChooseCards"] = "%1:请选择其%2至%3张卡牌",
|
||||
["#AskForChooseCard"] = "%1:请选择%src的一张卡牌",
|
||||
["#AskForChooseCards"] = "%1:请选择%src的%2至%3张卡牌",
|
||||
["$ChooseCard"] = "请选择一张卡牌",
|
||||
["$ChooseCards"] = "请选择%1至%2张卡牌",
|
||||
["$Hand"] = "手牌区",
|
||||
|
@ -248,6 +262,9 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
|||
|
||||
["#AskForDiscard"] = "请弃置 %arg 张牌,最少 %arg2 张",
|
||||
["#AskForCard"] = "请选择 %arg 张牌,最少 %arg2 张",
|
||||
["#AskForDistribution"] = "请分配这些牌,至少 %arg 张,至多 %arg2 张",
|
||||
["@DistributionTo"] = "",
|
||||
["#replaceEquip"] = "选择一张装备牌替换之",
|
||||
["#askForPindian"] = "%arg:请选择一张手牌作为拼点牌",
|
||||
["#StartPindianReason"] = "%from 由于 %arg 而发起拼点",
|
||||
["#ShowPindianCard"] = "%from 的拼点牌是 %card",
|
||||
|
@ -304,9 +321,9 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
|||
["Resume"] = "继续",
|
||||
|
||||
["Bulletin Info"] = [==[
|
||||
## v0.4.2
|
||||
## v0.4.9
|
||||
|
||||
增加游玩计时和屏蔽提示。
|
||||
修复投降莫名奇妙把对面杀了的bug
|
||||
|
||||
]==],
|
||||
}
|
||||
|
@ -323,7 +340,8 @@ Fk:loadTranslationTable{
|
|||
["fire_damage"] = "火属性",
|
||||
["thunder_damage"] = "雷属性",
|
||||
["ice_damage"] = "冰属性",
|
||||
["hp_lost"] = "体力流失",
|
||||
["hp_lost"] = "失去体力",
|
||||
["lose_hp"] = "失去体力",
|
||||
|
||||
["phase_start"] = "准备阶段",
|
||||
["phase_judge"] = "判定阶段",
|
||||
|
@ -386,22 +404,27 @@ Fk:loadTranslationTable{
|
|||
["#LoseSkill"] = "%from 失去了技能 “%arg”",
|
||||
|
||||
-- moveCards (they are sent by notifyMoveCards)
|
||||
["$PutCard"] = "%from 的 %arg 张牌被置于牌堆",
|
||||
["$PutKnownCard"] = "%from 的牌 %card 被置于牌堆",
|
||||
["$RemoveCardFromGame"] = "%arg2 张牌被作为 %arg 移出游戏",
|
||||
["$AddToPile"] = "%card 被作为 %arg 移出游戏",
|
||||
["$GetCardsFromPile"] = "%from 从 %arg 中获得了 %arg2 张牌 %card",
|
||||
["$DrawCards"] = "%from 摸了 %arg 张牌 %card",
|
||||
["$MoveCards"] = "%to 从 %from 处获得了 %arg 张牌 %card",
|
||||
["$PreyCardsFromPile"] = "%from 获得了 %arg 张牌 %card",
|
||||
["$GotCardBack"] = "%from 收回了 %arg 张牌 %card",
|
||||
["$RecycleCard"] = "%from 从弃牌堆回收了 %arg 张牌 %card",
|
||||
["$MoveCards"] = "%to 从 %from 处获得了 %arg 张牌 %card",
|
||||
["$LightningMove"] = "%card 从 %from 转移到了 %to",
|
||||
["$PasteCard"] = "%from 给 %to 贴了张 %card",
|
||||
["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card",
|
||||
|
||||
["$InstallEquip"] = "%from 装备了 %card",
|
||||
["$UninstallEquip"] = "%from 卸载了 %card",
|
||||
|
||||
["$LightningMove"] = "%card 从 %from 转移到了 %to",
|
||||
["$PasteCard"] = "%from 给 %to 贴了张 %card",
|
||||
|
||||
["$AddToPile"] = "%arg2 张牌 %card 被作为 %from 的 %arg 移出游戏",
|
||||
|
||||
["$PutCard"] = "%from 的 %arg 张牌被置于牌堆",
|
||||
["$PutKnownCard"] = "%from 的牌 %card 被置于牌堆",
|
||||
["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card",
|
||||
["$DiscardOther"] = "%to 弃置了 %from 的 %arg 张牌 %card",
|
||||
["$PutToDiscard"] = "%arg 张牌 %card 被置入弃牌堆",
|
||||
|
||||
["#ShowCard"] = "%from 展示了牌 %card",
|
||||
["#Recast"] = "%from 重铸了 %card",
|
||||
["#RecastBySkill"] = "%from 发动了 “%arg” 重铸了 %card",
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
-- 作Room和Client的基类,这二者有不少共通之处
|
||||
---@class AbstractRoom : Object
|
||||
---@fiele public players Player[] @ 房内参战角色们
|
||||
---@field public alive_players Player[] @ 所有存活玩家的数组
|
||||
---@field public observers Player[] @ 看戏的
|
||||
---@field public current Player @ 当前行动者
|
||||
---@field public status_skills table<class, Skill[]> @ 这个房间中含有的状态技列表
|
||||
---@field public filtered_cards table<integer, Card> @ 见于Engine,其实在这
|
||||
---@field public printed_cards table<integer, Card> @ 同上
|
||||
---@field public skill_costs table<string, any> @ 用来存skill.cost_data
|
||||
---@field public card_marks table<integer, any> @ 用来存实体卡的card.mark
|
||||
---@field public banners table<string, any> @ 全局mark
|
||||
local AbstractRoom = class("AbstractRoom")
|
||||
|
||||
function AbstractRoom:initialize()
|
||||
self.players = {}
|
||||
self.alive_players = {}
|
||||
self.observers = {}
|
||||
self.current = nil
|
||||
|
||||
self.status_skills = {}
|
||||
for class, skills in pairs(Fk.global_status_skill) do
|
||||
self.status_skills[class] = {table.unpack(skills)}
|
||||
end
|
||||
|
||||
self.filtered_cards = {}
|
||||
self.printed_cards = {}
|
||||
self.skill_costs = {}
|
||||
self.card_marks = {}
|
||||
self.banners = {}
|
||||
end
|
||||
|
||||
-- 仅供注释,其余空函数一样
|
||||
---@param id integer
|
||||
---@return Player?
|
||||
function AbstractRoom:getPlayerById(id) end
|
||||
|
||||
--- 获取一张牌所处的区域。
|
||||
---@param cardId integer | Card @ 要获得区域的那张牌,可以是Card或者一个id
|
||||
---@return CardArea @ 这张牌的区域
|
||||
function AbstractRoom:getCardArea(cardId) end
|
||||
|
||||
function AbstractRoom:setBanner(name, value)
|
||||
if value == 0 then value = nil end
|
||||
self.banners[name] = value
|
||||
end
|
||||
|
||||
function AbstractRoom:getBanner(name)
|
||||
return self.banners[name]
|
||||
end
|
||||
|
||||
return AbstractRoom
|
|
@ -24,6 +24,7 @@
|
|||
---@field public special_skills? string[] @ 衍生技能,如重铸
|
||||
---@field public is_damage_card boolean @ 是否为会造成伤害的牌
|
||||
---@field public multiple_targets boolean @ 是否为指定多个目标的牌
|
||||
---@field public is_passive? boolean @ 是否只能在响应时使用或打出
|
||||
---@field public is_derived? boolean @ 判断是否为衍生牌
|
||||
local Card = class("Card")
|
||||
|
||||
|
@ -145,11 +146,12 @@ function Card:clone(suit, number)
|
|||
newCard.special_skills = self.special_skills
|
||||
newCard.is_damage_card = self.is_damage_card
|
||||
newCard.multiple_targets = self.multiple_targets
|
||||
newCard.is_passive = self.is_passive
|
||||
newCard.is_derived = self.is_derived
|
||||
return newCard
|
||||
end
|
||||
|
||||
--- 检测是否为虚拟卡牌,如果其ID为0及以下,则为虚拟卡牌。
|
||||
--- 检测是否为虚拟卡牌,如果其ID为0,则为虚拟卡牌。
|
||||
function Card:isVirtual()
|
||||
return self.id == 0
|
||||
end
|
||||
|
@ -171,7 +173,7 @@ local function updateColorAndNumber(card)
|
|||
local different_color = false
|
||||
for i, id in ipairs(card.subcards) do
|
||||
local c = Fk:getCardById(id)
|
||||
number = math.min(number + c.number, 13)
|
||||
number = #card.subcards == 1 and math.min(number + c.number, 13) or 0
|
||||
if i == 1 then
|
||||
card.suit = c.suit
|
||||
else
|
||||
|
@ -406,15 +408,10 @@ function Card:getMark(mark)
|
|||
if (not self:isVirtual()) and next(self.mark) == nil then
|
||||
self.mark = nil
|
||||
end
|
||||
return ret
|
||||
if type(ret) == "table" then
|
||||
ret = table.simpleClone(ret)
|
||||
end
|
||||
|
||||
--- 判定卡牌是否拥有对应的Mark。
|
||||
---@param mark string @ 标记
|
||||
---@return boolean
|
||||
function Card:hasMark(mark)
|
||||
fk.qWarning("hasMark will be deleted in future version!")
|
||||
return self:getMark(mark) ~= 0
|
||||
return ret
|
||||
end
|
||||
|
||||
--- 获取卡牌有哪些Mark。
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
--- 同时也提供了许多常用的函数。
|
||||
---
|
||||
---@class Engine : Object
|
||||
---@field public extensions table<string, string[]> @ 所有mod列表及其包含的拓展包
|
||||
---@field public extension_names string[] @ Mod名字的数组,为了方便排序
|
||||
---@field public packages table<string, Package> @ 所有拓展包的列表
|
||||
---@field public package_names string[] @ 含所有拓展包名字的数组,为了方便排序
|
||||
---@field public skills table<string, Skill> @ 所有的技能
|
||||
|
@ -28,6 +30,7 @@
|
|||
---@field private _custom_events any[] @ 自定义事件列表
|
||||
---@field public poxi_methods table<string, PoxiSpec> @ “魄袭”框操作方法表
|
||||
---@field public qml_marks table<string, QmlMarkSpec> @ 自定义Qml标记的表
|
||||
---@field public mini_games table<string, MiniGameSpec> @ 自定义多人交互表
|
||||
---@field public yuqi_methods table<string, YuqiSpec> @ “隅泣”框操作方法表
|
||||
local Engine = class("Engine")
|
||||
|
||||
|
@ -44,6 +47,12 @@ function Engine:initialize()
|
|||
|
||||
Fk = self
|
||||
|
||||
self.extensions = {
|
||||
["standard"] = { "standard" },
|
||||
["standard_cards"] = { "standard_cards" },
|
||||
["maneuvering"] = { "maneuvering" },
|
||||
}
|
||||
self.extension_names = { "standard", "standard_cards", "maneuvering" }
|
||||
self.packages = {} -- name --> Package
|
||||
self.package_names = {}
|
||||
self.skills = {} -- name --> Skill
|
||||
|
@ -62,6 +71,7 @@ function Engine:initialize()
|
|||
self._custom_events = {}
|
||||
self.poxi_methods = {}
|
||||
self.qml_marks = {}
|
||||
self.mini_games = {}
|
||||
|
||||
self:loadPackages()
|
||||
self:loadDisabled()
|
||||
|
@ -69,20 +79,20 @@ function Engine:initialize()
|
|||
end
|
||||
|
||||
local _foreign_keys = {
|
||||
"currentResponsePattern",
|
||||
"currentResponseReason",
|
||||
"filtered_cards",
|
||||
"printed_cards",
|
||||
["currentResponsePattern"] = true,
|
||||
["currentResponseReason"] = true,
|
||||
["filtered_cards"] = true,
|
||||
["printed_cards"] = true,
|
||||
}
|
||||
|
||||
function Engine:__index(k)
|
||||
if table.contains(_foreign_keys, k) then
|
||||
if _foreign_keys[k] then
|
||||
return self:currentRoom()[k]
|
||||
end
|
||||
end
|
||||
|
||||
function Engine:__newindex(k, v)
|
||||
if table.contains(_foreign_keys, k) then
|
||||
if _foreign_keys[k] then
|
||||
self:currentRoom()[k] = v
|
||||
else
|
||||
rawset(self, k, v)
|
||||
|
@ -140,11 +150,15 @@ function Engine:loadPackages()
|
|||
-- Note that instance of Package is a table too
|
||||
-- so dont use type(pack) == "table" here
|
||||
if type(pack) == "table" then
|
||||
table.insert(self.extension_names, dir)
|
||||
if pack[1] ~= nil then
|
||||
self.extensions[dir] = {}
|
||||
for _, p in ipairs(pack) do
|
||||
table.insert(self.extensions[dir], p.name)
|
||||
self:loadPackage(p)
|
||||
end
|
||||
else
|
||||
self.extensions[dir] = { pack.name }
|
||||
self:loadPackage(pack)
|
||||
end
|
||||
end
|
||||
|
@ -274,8 +288,8 @@ end
|
|||
---@param name string @ 要查询的武将名字
|
||||
---@return string[] @ 这个武将对应的同名武将列表
|
||||
function Engine:getSameGenerals(name)
|
||||
local tmp = name:split("__")
|
||||
local tName = tmp[#tmp]
|
||||
if not self.generals[name] then return {} end
|
||||
local tName = self.generals[name].trueName
|
||||
local ret = self.same_generals[tName] or {}
|
||||
return table.filter(ret, function(g)
|
||||
return g ~= name and self.generals[g] ~= nil and self:canUseGeneral(g)
|
||||
|
@ -358,7 +372,7 @@ function Engine:addPoxiMethod(spec)
|
|||
spec.post_select = spec.post_select or function(s) return s end
|
||||
end
|
||||
|
||||
--- 向Engine中添加一个隅泣用方法。
|
||||
--- 向Engine中添加一个QML标记方法。
|
||||
---@param spec QmlMarkSpec
|
||||
function Engine:addQmlMark(spec)
|
||||
assert(type(spec.name) == "string")
|
||||
|
@ -368,6 +382,16 @@ function Engine:addQmlMark(spec)
|
|||
self.qml_marks[spec.name] = spec
|
||||
end
|
||||
|
||||
--- 向Engine中添加一个多人交互用方法。
|
||||
---@param spec MiniGameSpec
|
||||
function Engine:addMiniGame(spec)
|
||||
assert(type(spec.name) == "string")
|
||||
if self.mini_games[spec.name] then
|
||||
fk.qCritical("Warning: duplicated mini game type " .. spec.name)
|
||||
end
|
||||
self.mini_games[spec.name] = spec
|
||||
end
|
||||
|
||||
--- 向Engine中添加一个隅泣用方法。
|
||||
---@param spec YuqiSpec
|
||||
function Engine:addYuqiMethod(spec)
|
||||
|
@ -538,7 +562,7 @@ function Engine:_addPrintedCard(card)
|
|||
end
|
||||
|
||||
--- 获知当前的Engine是跑在服务端还是客户端,并返回相应的实例。
|
||||
---@return Room | Client
|
||||
---@return AbstractRoom
|
||||
function Engine:currentRoom()
|
||||
if RoomInstance then
|
||||
return RoomInstance
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
2. 对于 Matcher 字符串,它是用 ('|') 分割的
|
||||
3. 然后在 Matcher 的每一个细分中,又可以用 ',' 来进行更进一步的分割
|
||||
|
||||
其中 Matcher 的格式为 牌名|花色|点数|位置|详细牌名|类型|牌的id
|
||||
其中 Matcher 的格式为 牌名|点数|花色|区域|完整牌名|牌类型|牌id
|
||||
更进一步,“点数” 可以用 '~' 符号表示数字的范围,并且可以用 AJQK 表示对应点数
|
||||
|
||||
例如:
|
||||
|
|
|
@ -27,7 +27,7 @@ end
|
|||
---@param victim ServerPlayer @ 死者
|
||||
---@return string @ 胜者阵营
|
||||
function GameMode:getWinner(victim)
|
||||
if victim.rest > 0 then
|
||||
if not victim.surrendered and victim.rest > 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ function General:__tostring()
|
|||
end
|
||||
|
||||
--- 为武将增加技能,需要注意增加其他武将技能时的处理方式。
|
||||
---@param skill Skill @ (单个)武将技能
|
||||
---@param skill Skill|string @ (单个)武将技能
|
||||
function General:addSkill(skill)
|
||||
if (type(skill) == "string") then
|
||||
table.insert(self.other_skills, skill)
|
||||
|
@ -82,7 +82,7 @@ function General:addSkill(skill)
|
|||
end
|
||||
|
||||
--- 为武将增加相关技能,需要注意增加其他武将技能时的处理方式。
|
||||
---@param skill Skill @ (单个)武将技能
|
||||
---@param skill Skill|string @ (单个)武将技能
|
||||
function General:addRelatedSkill(skill)
|
||||
if (type(skill) == "string") then
|
||||
table.insert(self.related_other_skills, skill)
|
||||
|
@ -94,12 +94,19 @@ function General:addRelatedSkill(skill)
|
|||
end
|
||||
|
||||
--- 获取武将所有技能。
|
||||
---@param include_lord? boolean
|
||||
---@return string[]
|
||||
function General:getSkillNameList(include_lord)
|
||||
local ret = table.map(self.skills, Util.NameMapper)
|
||||
table.insertTable(ret, self.other_skills)
|
||||
|
||||
if not include_lord then
|
||||
local ret = {}
|
||||
local other_skills = table.map(self.other_skills, Util.Name2SkillMapper)
|
||||
local skills = table.connect(self.skills, other_skills)
|
||||
for _, skill in ipairs(skills) do
|
||||
if include_lord or not skill.lordSkill then
|
||||
table.insert(ret, skill.name)
|
||||
end
|
||||
end
|
||||
|
||||
-- table.insertTable(ret, self.other_skills)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
|
|
@ -215,15 +215,10 @@ end
|
|||
---@param mark string @ 标记
|
||||
---@return any
|
||||
function Player:getMark(mark)
|
||||
return (self.mark[mark] or 0)
|
||||
end
|
||||
|
||||
--- 判定角色是否拥有对应的Mark。
|
||||
---@param mark string @ 标记
|
||||
---@return boolean
|
||||
function Player:hasMark(mark)
|
||||
fk.qWarning("hasMark will be deleted in future version!")
|
||||
return self:getMark(mark) ~= 0
|
||||
local mark = self.mark[mark]
|
||||
if not mark then return 0 end
|
||||
if type(mark) == "table" then return table.simpleClone(mark) end
|
||||
return mark
|
||||
end
|
||||
|
||||
--- 获取角色有哪些Mark。
|
||||
|
@ -363,13 +358,13 @@ function Player:getCardIds(playerAreas, specialName)
|
|||
return cardIds
|
||||
end
|
||||
|
||||
--- 通过名字检索获取玩家是否存在对应私人牌堆。
|
||||
--- 通过名字检索获取玩家对应的私人牌堆。
|
||||
---@param name string @ 私人牌堆名
|
||||
function Player:getPile(name)
|
||||
return self.special_cards[name] or {}
|
||||
return table.simpleClone(self.special_cards[name] or {})
|
||||
end
|
||||
|
||||
--- 通过ID检索获取玩家是否存在对应私人牌堆。
|
||||
--- 通过ID检索获取玩家对应的私人牌堆。
|
||||
---@param id integer @ 私人牌堆ID
|
||||
---@return string?
|
||||
function Player:getPileNameOfId(id)
|
||||
|
@ -454,23 +449,43 @@ end
|
|||
|
||||
--- 获取玩家攻击范围。
|
||||
function Player:getAttackRange()
|
||||
local weapon = Fk:getCardById(self:getEquipment(Card.SubtypeWeapon))
|
||||
local baseAttackRange = math.max(weapon and weapon.attack_range or 1, 0)
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local correct = skill:getCorrect(self)
|
||||
baseAttackRange = baseAttackRange + (correct or 0)
|
||||
local baseValue = 1
|
||||
local weapons = self:getEquipments(Card.SubtypeWeapon)
|
||||
if #weapons > 0 then
|
||||
baseValue = 0
|
||||
for _, id in ipairs(weapons) do
|
||||
local weapon = Fk:getCardById(id)
|
||||
baseValue = math.max(baseValue, weapon.attack_range or 1)
|
||||
end
|
||||
end
|
||||
|
||||
return math.max(baseAttackRange, 0)
|
||||
local status_skills = Fk:currentRoom().status_skills[AttackRangeSkill] or Util.DummyTable
|
||||
local max_fixed, correct = nil, 0
|
||||
for _, skill in ipairs(status_skills) do
|
||||
local f = skill:getFixed(self)
|
||||
if f ~= nil then
|
||||
max_fixed = max_fixed and math.max(max_fixed, f) or f
|
||||
end
|
||||
local c = skill:getCorrect(self)
|
||||
correct = correct + (c or 0)
|
||||
end
|
||||
|
||||
return math.max(math.max(baseValue, (max_fixed or 0)) + correct, 0)
|
||||
end
|
||||
|
||||
--- 获取角色是否被移除。
|
||||
function Player:isRemoved()
|
||||
return self:getMark(MarkEnum.PlayerRemoved) ~= 0 or table.find(MarkEnum.TempMarkSuffix, function(s)
|
||||
return self:getMark(MarkEnum.PlayerRemoved .. s) ~= 0
|
||||
end)
|
||||
for mark, _ in pairs(self.mark) do
|
||||
if mark == MarkEnum.PlayerRemoved then return true end
|
||||
if mark:startsWith(MarkEnum.PlayerRemoved .. "-") then
|
||||
for _, suffix in ipairs(MarkEnum.TempMarkSuffix) do
|
||||
if mark:find(suffix, 1, true) then return true end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- return self:getMark(MarkEnum.PlayerRemoved) ~= 0 or table.find(MarkEnum.TempMarkSuffix, function(s)
|
||||
-- return self:getMark(MarkEnum.PlayerRemoved .. s) ~= 0
|
||||
-- end)
|
||||
end
|
||||
|
||||
--- 修改玩家与其他角色的固定距离。
|
||||
|
@ -857,9 +872,20 @@ end
|
|||
|
||||
--- 确认玩家是否可以使用特定牌。
|
||||
---@param card Card @ 特定牌
|
||||
function Player:canUse(card)
|
||||
assert(card, "Error: No Card")
|
||||
return card.skill:canUse(self, card)
|
||||
---@param extra_data? UseExtraData @ 额外数据
|
||||
function Player:canUse(card, extra_data)
|
||||
return card.skill:canUse(self, card, extra_data)
|
||||
end
|
||||
|
||||
--- 确认玩家是否可以对特定玩家使用特定牌。
|
||||
---@param card Card @ 特定牌
|
||||
---@param to Player @ 特定玩家
|
||||
---@param extra_data? UseExtraData @ 额外数据
|
||||
function Player:canUseTo(card, to, extra_data)
|
||||
if self:prohibitUse(card) or self:isProhibited(to, card) then return false end
|
||||
local distance_limited = not (extra_data and extra_data.bypass_distances)
|
||||
local can_use = self:canUse(card, extra_data)
|
||||
return can_use and card.skill:modTargetFilter(to.id, {}, self.id, card, distance_limited)
|
||||
end
|
||||
|
||||
--- 确认玩家是否被禁止对特定玩家使用特定牌。
|
||||
|
@ -911,8 +937,12 @@ function Player:prohibitResponse(card)
|
|||
end
|
||||
|
||||
--- 确认玩家是否被禁止弃置特定牌。
|
||||
---@param card Card @ 特定的牌
|
||||
---@param card Card|integer @ 特定的牌
|
||||
function Player:prohibitDiscard(card)
|
||||
if type(card) == "number" then
|
||||
card = Fk:getCardById(card)
|
||||
end
|
||||
|
||||
local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
|
||||
for _, skill in ipairs(status_skills) do
|
||||
if skill:prohibitDiscard(self, card) then
|
||||
|
@ -928,13 +958,21 @@ function Player:prohibitReveal(isDeputy)
|
|||
if type(self:getMark(MarkEnum.RevealProhibited)) == "table" and table.contains(self:getMark(MarkEnum.RevealProhibited), place) then
|
||||
return true
|
||||
end
|
||||
for _, m in ipairs(table.map(MarkEnum.TempMarkSuffix, function(s)
|
||||
return self:getMark(MarkEnum.RevealProhibited .. s)
|
||||
end)) do
|
||||
if type(m) == "table" and table.contains(m, place) then
|
||||
return true
|
||||
|
||||
for mark, value in pairs(self.mark) do
|
||||
if mark:startsWith(MarkEnum.RevealProhibited .. "-") and type(value) == "table" then
|
||||
for _, suffix in ipairs(MarkEnum.TempMarkSuffix) do
|
||||
if mark:find(suffix, 1, true) then return true end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- for _, m in ipairs(table.map(MarkEnum.TempMarkSuffix, function(s)
|
||||
-- return self:getMark(MarkEnum.RevealProhibited .. s)
|
||||
-- end)) do
|
||||
-- if type(m) == "table" and table.contains(m, place) then
|
||||
-- return true
|
||||
-- end
|
||||
-- end
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -959,6 +997,21 @@ function Player:canPindian(to, ignoreFromKong, ignoreToKong)
|
|||
return true
|
||||
end
|
||||
|
||||
--- 判断一张牌能否移动至某角色的装备区
|
||||
---@param cardId integer @ 移动的牌
|
||||
---@param convert? boolean @ 是否可以替换装备(默认可以)
|
||||
---@return boolean
|
||||
function Player:canMoveCardIntoEquip(cardId, convert)
|
||||
convert = (convert == nil) and true or convert
|
||||
local card = Fk:getCardById(cardId)
|
||||
if not (card.sub_type >= 3 and card.sub_type <= 7) then return false end
|
||||
if self.dead or table.contains(self:getCardIds("e"), cardId) then return false end
|
||||
if self:hasEmptyEquipSlot(card.sub_type) or (#self:getEquipments(card.sub_type) > 0 and convert) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--转换技状态阳
|
||||
fk.SwitchYang = 0
|
||||
--转换技状态阴
|
||||
|
@ -991,7 +1044,7 @@ function Player:canMoveCardInBoardTo(to, id)
|
|||
return
|
||||
not (
|
||||
table.find(to:getCardIds(Player.Judge), function(cardId)
|
||||
return Fk:getCardById(cardId).name == card.name
|
||||
return (to:getVirualEquip(cardId) or Fk:getCardById(cardId)).name == card.name
|
||||
end) or
|
||||
table.contains(to.sealedSlots, Player.JudgeSlot)
|
||||
)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue