From 0c3f9863a5b74ba2f9e912a11fe0a2dfcb64d24d Mon Sep 17 00:00:00 2001 From: notify Date: Fri, 26 Jan 2024 14:56:07 +0800 Subject: [PATCH] Changelog: v0.4.4 --- CHANGELOG.md | 8 +++++ CMakeLists.txt | 2 +- Fk/Pages/Room.qml | 52 ++------------------------- Fk/PhotoElement/LimitSkillItem.qml | 1 - Fk/RoomElement/AG.qml | 1 - Fk/RoomElement/CheckBox.qml | 4 +-- Fk/RoomElement/Dashboard.qml | 53 +++++++++++++++------------- android/AndroidManifest.xml | 4 +-- lua/client/client_util.lua | 12 ++++++- lua/client/i18n/zh_CN.lua | 4 +-- lua/core/skill_type/usable_skill.lua | 2 +- 11 files changed, 57 insertions(+), 86 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8564b19..f19b2ced 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # ChangeLog +## v0.4.4 + +禁将增强;修复bug + +UsableSkill的expand_pile功能加强 + +___ + ## v0.4.3 1. 事件栈和实际的函数调用栈分离 diff --git a/CMakeLists.txt b/CMakeLists.txt index f311507d..8a7e4122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) -project(FreeKill VERSION 0.4.3) +project(FreeKill VERSION 0.4.4) add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\") find_package(Qt6 REQUIRED COMPONENTS diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml index b83569fc..16264eb9 100644 --- a/Fk/Pages/Room.qml +++ b/Fk/Pages/Room.qml @@ -1006,53 +1006,6 @@ Item { } } - /* 这东西似乎一直不好使啊 - 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 @@ -1085,10 +1038,9 @@ Item { } Shortcut { - sequence: "Esc" + sequence: "T" onActivated: { - easyChat.visible = false; - easyChatEdit.enabled = false; + roomDrawer.open(); } } diff --git a/Fk/PhotoElement/LimitSkillItem.qml b/Fk/PhotoElement/LimitSkillItem.qml index ef81094d..41c7a62e 100644 --- a/Fk/PhotoElement/LimitSkillItem.qml +++ b/Fk/PhotoElement/LimitSkillItem.qml @@ -40,7 +40,6 @@ Item { onSkillnameChanged: { let data = lcall("GetSkillData", skillname); - data = JSON.parse(data); if (data.frequency || data.switchSkillName) { skilltype = data.switchSkillName ? 'switch' : data.frequency; visible = true; diff --git a/Fk/RoomElement/AG.qml b/Fk/RoomElement/AG.qml index b35c4f64..ce899e6a 100644 --- a/Fk/RoomElement/AG.qml +++ b/Fk/RoomElement/AG.qml @@ -47,7 +47,6 @@ GraphicsBox { function addIds(ids) { ids.forEach((id) => { let data = lcall("GetCardData", id); - data = JSON.parse(data); data.selectable = true; data.footnote = ""; cards.append(data); diff --git a/Fk/RoomElement/CheckBox.qml b/Fk/RoomElement/CheckBox.qml index 9839e46a..61059631 100644 --- a/Fk/RoomElement/CheckBox.qml +++ b/Fk/RoomElement/CheckBox.qml @@ -58,7 +58,7 @@ GraphicsBox { MetroButton { Layout.fillWidth: true - text: Util.processPrompt("OK") + text: luatr("OK") enabled: root.result.length >= min_num onClicked: { @@ -68,7 +68,7 @@ GraphicsBox { MetroButton { Layout.fillWidth: true - text: processPrompt("Cancel") + text: luatr("Cancel") visible: cancelable onClicked: { diff --git a/Fk/RoomElement/Dashboard.qml b/Fk/RoomElement/Dashboard.qml index 6c9718dc..8e601289 100644 --- a/Fk/RoomElement/Dashboard.qml +++ b/Fk/RoomElement/Dashboard.qml @@ -71,7 +71,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; @@ -80,30 +80,27 @@ 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 = luatr("$Equip"); - handcardAreaItem.add(card); - }) - handcardAreaItem.updateCardPosition(); + ids = self.equipArea.getAllCards(); + footnote = "$Equip"; + } else if (pile === "_extra") { + ids = extra_ids; + footnote = extra_footnote; } else { - const ids = lcall("GetPile", self.playerid, pile); - ids.forEach(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 = luatr(pile); - handcardAreaItem.add(card); - }); - handcardAreaItem.updateCardPosition(); + ids = lcall("GetPile", self.playerid, pile); + footnote = pile; } + ids.forEach(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 = luatr(footnote); + handcardAreaItem.add(card); + }); + handcardAreaItem.updateCardPosition(); } function retractPile(pile) { @@ -339,14 +336,20 @@ RowLayout { } }) - const pile = lcall("GetExpandPileOfSkill", pending_skill); - const pile_ids = lcall("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 (lcall("ActiveCardFilter", pending_skill, cid, pendings, targets)) { enabled_cards.push(cid); }; if (!expanded_piles[pile]) { - expandPile(pile); + expandPile(pile, pile_ids, pending_skill); } }); diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index c85c1750..d2fc268e 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -3,8 +3,8 @@ + android:versionCode="404" + android:versionName="0.4.4"> diff --git a/lua/client/client_util.lua b/lua/client/client_util.lua index bf6827e0..1bf67992 100644 --- a/lua/client/client_util.lua +++ b/lua/client/client_util.lua @@ -586,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() diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index e6b485f2..df4fb1a7 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -311,9 +311,9 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下 ["Resume"] = "继续", ["Bulletin Info"] = [==[ - ## v0.4.2 + ## v0.4.4 - 增加游玩计时和屏蔽提示。 + 禁将体验优化,然而烦请重新禁将。请善用禁用拓展包与白名单功能,旧方案已经不可导入。 ]==], } diff --git a/lua/core/skill_type/usable_skill.lua b/lua/core/skill_type/usable_skill.lua index 70e00244..7ef7bd87 100644 --- a/lua/core/skill_type/usable_skill.lua +++ b/lua/core/skill_type/usable_skill.lua @@ -3,7 +3,7 @@ ---@class UsableSkill : Skill ---@field public main_skill UsableSkill ---@field public max_use_time integer[] ----@field public expand_pile string +---@field public expand_pile? string | integer[] | fun(self: UsableSkill): integer[]|string? local UsableSkill = Skill:subclass("UsableSkill") function UsableSkill:initialize(name, frequency)