From 0a57727b3945112c486c1101270ce646cbe30fcc Mon Sep 17 00:00:00 2001 From: notify Date: Sun, 13 Aug 2023 01:39:45 +0800 Subject: [PATCH] pic mark (#248) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 图片标记 --- CHANGELOG.md | 21 +++++++++++ CMakeLists.txt | 2 +- Fk/Config.qml | 8 +++- Fk/Pages/RoomLogic.js | 5 ++- Fk/PhotoElement/PicMarkArea.qml | 67 +++++++++++++++++++++++++++++++++ Fk/PhotoElement/qmldir | 1 + Fk/RoomElement/Photo.qml | 9 +++++ Fk/skin-bank.js | 9 +++++ android/AndroidManifest.xml | 4 +- lua/client/i18n/zh_CN.lua | 4 +- src/main.cpp | 4 ++ 11 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 Fk/PhotoElement/PicMarkArea.qml diff --git a/CHANGELOG.md b/CHANGELOG.md index aa495050..ecf4f9f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ ___ +## v0.3.2 + +本次更新的主要看点是废除装备栏和判定区。 + +1. 游戏结束时离线玩家增加逃率 +2. 退出房间时取消准备状态 +3. 副技能的 `main_skill` +4. 预亮相关优化 +5. 自定义身份,图从拓展包随便找一张 +6. 无懈可击使用时带1200毫秒延迟 +7. 未开始的房间显示开启的所有牌堆,衍生牌灰色字体化 +8. 可以随意打开fk.rep文件并播放录像 +9. 服务器Shell新增重置密码命令 +10. 虚空印卡 +11. 15秒踢出房主 +12. 各种修bug +13. 图片标记 +14. 废除区域 + +___ + ## v0.3.1 修复了0.3.0的bug,现在应该是稳定版。 diff --git a/CMakeLists.txt b/CMakeLists.txt index 625e268d..08d78fdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) -project(FreeKill VERSION 0.3.1) +project(FreeKill VERSION 0.3.2) add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\") find_package(Qt6 REQUIRED COMPONENTS diff --git a/Fk/Config.qml b/Fk/Config.qml index f869aaa3..068b145e 100644 --- a/Fk/Config.qml +++ b/Fk/Config.qml @@ -62,7 +62,13 @@ QtObject { lobbyBg = conf.lobbyBg ?? AppPath + "/image/background"; roomBg = conf.roomBg ?? AppPath + "/image/gamebg"; bgmFile = conf.bgmFile ?? AppPath + "/audio/system/bgm.mp3"; - language = conf.language ?? "zh_CN"; + language = conf.language ?? (() => { + let ret = SysLocale; + if (['zh_CN', 'en_US'].includes(ret)) { + return ret; + } + return 'zh_CN'; + })(); disabledPack = conf.disabledPack ?? [ "test_p_0" ]; preferedMode = conf.preferedMode ?? "aaa_role_mode"; preferedPlayerNum = conf.preferedPlayerNum ?? 2; diff --git a/Fk/Pages/RoomLogic.js b/Fk/Pages/RoomLogic.js index 8b3f15a3..e945afb3 100644 --- a/Fk/Pages/RoomLogic.js +++ b/Fk/Pages/RoomLogic.js @@ -1194,10 +1194,11 @@ callbacks["SetPlayerMark"] = (jsonData) => { const player = getPhoto(data[0]); const mark = data[1]; const value = data[2] instanceof Array ? data[2] : data[2].toString(); + let area = mark.startsWith("@!") ? player.picMarkArea : player.markArea; if (data[2] === 0) { - player.markArea.removeMark(mark); + area.removeMark(mark); } else { - player.markArea.setMark(mark, mark.startsWith("@@") ? "" : value); + area.setMark(mark, mark.startsWith("@@") ? "" : value); } } diff --git a/Fk/PhotoElement/PicMarkArea.qml b/Fk/PhotoElement/PicMarkArea.qml new file mode 100644 index 00000000..79553fbc --- /dev/null +++ b/Fk/PhotoElement/PicMarkArea.qml @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick +import QtQuick.Layouts +import Fk + +RowLayout { + id: root + spacing: 4 + + ListModel { + id: markList + } + + Repeater { + id: markRepeater + model: markList + + Item { + width: 28 + height: 28 + Image { + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + source: SkinBank.getMarkPic(mark_name) + } + + Text { + anchors.right: parent.right + anchors.bottom: parent.bottom + text: mark_extra + visible: mark_extra != 1 + font.family: fontLibian.name + font.pixelSize: 20 + font.bold: true + color: "white" + style: Text.Outline + } + } + } + + function setMark(mark, data) { + let i, modelItem; + for (i = 0; i < markList.count; i++) { + if (markList.get(i).mark_name === mark) { + modelItem = markList.get(i); + break; + } + } + + if (modelItem) { + modelItem.mark_extra = data; + } else { + markList.append({ mark_name: mark, mark_extra: data }); + } + } + + function removeMark(mark) { + let i, modelItem; + for (i = 0; i < markList.count; i++) { + if (markList.get(i).mark_name === mark) { + markList.remove(i, 1); + return; + } + } + } +} diff --git a/Fk/PhotoElement/qmldir b/Fk/PhotoElement/qmldir index 1421e3b7..364ae81a 100644 --- a/Fk/PhotoElement/qmldir +++ b/Fk/PhotoElement/qmldir @@ -7,6 +7,7 @@ LimitSkillArea 1.0 LimitSkillArea.qml LimitSkillItem 1.0 LimitSkillItem.qml Magatama 1.0 Magatama.qml MarkArea 1.0 MarkArea.qml +PicMarkArea 1.0 PicMarkArea.qml RoleComboBox 1.0 RoleComboBox.qml Shield 1.0 Shield.qml SpecialMarkArea 1.0 SpecialMarkArea.qml diff --git a/Fk/RoomElement/Photo.qml b/Fk/RoomElement/Photo.qml index 64de7f40..bf9cb8ed 100644 --- a/Fk/RoomElement/Photo.qml +++ b/Fk/RoomElement/Photo.qml @@ -42,6 +42,7 @@ Item { property alias handcardArea: handcardAreaItem property alias equipArea: equipAreaItem property alias markArea: markAreaItem + property alias picMarkArea: picMarkAreaItem property alias delayedTrickArea: delayedTrickAreaItem property alias specialArea: specialAreaItem @@ -588,6 +589,14 @@ Item { anchors.bottomMargin: 8 } + PicMarkArea { + id: picMarkAreaItem + + anchors.top: parent.bottom + anchors.right: parent.right + anchors.topMargin: -4 + } + InvisibleCardArea { id: defaultArea anchors.centerIn: parent diff --git a/Fk/skin-bank.js b/Fk/skin-bank.js index ab56bc06..398ffff6 100644 --- a/Fk/skin-bank.js +++ b/Fk/skin-bank.js @@ -138,3 +138,12 @@ function getRolePic(role) { } return ROLE_DIR + "unknown.png"; } + +function getMarkPic(mark) { + for (let dir of Backend.ls(AppPath + "/packages/")) { + if (dir.endsWith(".disabled")) continue; + let path = AppPath + "/packages/" + dir + "/image/mark/" + mark + ".png"; + if (Backend.exists(path)) return path; + } + return ""; +} diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 9d73646a..590eeee1 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -3,8 +3,8 @@ + android:versionCode="302" + android:versionName="0.3.2"> diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index 88898147..bdb8c2c3 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -282,9 +282,9 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下 ["Resume"] = "继续", ["Bulletin Info"] = [==[ - ## v0.3.0 + ## v0.3.3 - 0.3.0版本,新增录像和禁将方案切换功能,同时修复不少bug。 + 0.3.3版本,新增弹劾房主和房间开启牌堆显示,修复不少bug。 加强谋徐盛。 ]==], diff --git a/src/main.cpp b/src/main.cpp index 3103c46c..2966bd2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -191,6 +191,9 @@ int main(int argc, char *argv[]) { QCoreApplication::setApplicationName("FreeKill"); QCoreApplication::setApplicationVersion(FK_VERSION); + QLocale l = QLocale::system(); + auto localeName = l.name(); + #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) prepareForLinux(); #endif @@ -312,6 +315,7 @@ int main(int argc, char *argv[]) { engine->rootContext()->setContextProperty("Backend", &backend); engine->rootContext()->setContextProperty("ModBackend", nullptr); engine->rootContext()->setContextProperty("Pacman", Pacman); + engine->rootContext()->setContextProperty("SysLocale", localeName); #ifdef QT_DEBUG bool debugging = true;