From 0657894282196fca879a32eaa37ad1ac37f31a1c Mon Sep 17 00:00:00 2001 From: notify Date: Fri, 25 Aug 2023 21:08:03 +0800 Subject: [PATCH] Changelog: v0.3.5 --- CHANGELOG.md | 6 +++++ CMakeLists.txt | 2 +- Fk/Pages/GeneralsOverview.qml | 50 +++++++++++++++++++++++++++++++---- Fk/Pages/Room.qml | 19 +++++++------ android/AndroidManifest.xml | 4 +-- 5 files changed, 65 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab3ca17a..d853ce48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ___ +## v0.3.5 + +小测一下,修了bug推个稳定版 + +___ + ## v0.3.4 多少也鸽了半个月了,来点体验版 diff --git a/CMakeLists.txt b/CMakeLists.txt index 795c861c..753aec16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) -project(FreeKill VERSION 0.3.4) +project(FreeKill VERSION 0.3.5) add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\") find_package(Qt6 REQUIRED COMPONENTS diff --git a/Fk/Pages/GeneralsOverview.qml b/Fk/Pages/GeneralsOverview.qml index 576c1119..3cf2ab37 100644 --- a/Fk/Pages/GeneralsOverview.qml +++ b/Fk/Pages/GeneralsOverview.qml @@ -4,6 +4,7 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Fk.RoomElement +import "RoomLogic.js" as RoomLogic Item { id: root @@ -157,7 +158,27 @@ Item { 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; + console.log(skill, 'normal add') const skilldata = JSON.parse(Backend.callLuaFunction("GetSkillData", [skill])); if (!skilldata) return; const extension = skilldata.extension; @@ -261,16 +282,35 @@ Item { } Text { Layout.fillWidth: true - text: (Backend.translate("$" + name + (idx ? idx.toString() : "")) == "$" + name + (idx ? idx.toString() : "") ? "" : Backend.translate("$" + name + (idx ? idx.toString() : ""))) + text: { + const orig = '$' + name + (idx ? idx.toString() : ""); + const orig_trans = Backend.translate(orig); + + // try general specific + const orig_g = '$' + name + '_' + detailGeneralCard.name + (idx ? idx.toString() : ""); + const orig_g_trans = Backend.translate(orig_g); + + if (orig_g_trans !== orig_g) { + return orig_g_trans; + } + + if (orig_trans !== orig) { + return orig_trans; + } + + return ""; + } wrapMode: Text.WordWrap } } onClicked: { - const skilldata = JSON.parse(Backend.callLuaFunction("GetSkillData", [name])); - const extension = skilldata.extension; - Backend.playSound("./packages/" + extension + - "/audio/skill/" + name, idx); + callbacks["LogEvent"](JSON.stringify({ + type: "PlaySkillSound", + name: name, + general: detailGeneralCard.name, + i: idx, + })); } } } diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml index a24c6b11..6f1de120 100644 --- a/Fk/Pages/Room.qml +++ b/Fk/Pages/Room.qml @@ -1035,7 +1035,7 @@ Item { } function specialChat(pid, data, msg) { - // skill audio: %s%d + // skill audio: %s%d[%s] // death audio: ~%s // something special: !%s:... @@ -1096,14 +1096,17 @@ Item { if (splited.length < 2) return false; const skill = splited[0]; const idx = parseInt(splited[1]); + const gene = splited[2]; - const data2 = JSON.parse(Backend.callLuaFunction("GetSkillData", [skill])); - if (!data2) return false; - const extension = data2.extension; - if (!config.disableMsgAudio) - Backend.playSound("./packages/" + extension + "/audio/skill/" + skill, idx); - - const m = Backend.translate("$" + skill + idx.toString()); + try { + callbacks["LogEvent"](JSON.stringify({ + type: "PlaySkillSound", + name: skill, + general: gene, + i: idx, + })); + } catch (e) {} + const m = Backend.translate("$" + skill + (gene ? "_" + gene : "") + idx.toString()); if (general === "") chat.append(`[${time}] ${userName}: ${m}`); else diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index b1bcaa33..2fbe4e86 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -3,8 +3,8 @@ + android:versionCode="305" + android:versionName="0.3.5">