diff --git a/Fk/ChatAnim/Egg.qml b/Fk/ChatAnim/Egg.qml new file mode 100644 index 00000000..f9ef7260 --- /dev/null +++ b/Fk/ChatAnim/Egg.qml @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick +import Fk + +Item { + id: root + anchors.fill: parent + property point start: Qt.point(0, 0) + property point end: Qt.point(0, 0) + property alias running: pointToAnimation.running + + signal finished() + + Image { + id: egg + source: SkinBank.PIXANIM_DIR + "/egg/egg" + x: start.x - width / 2 + y: start.y - height / 2 + scale: 0.7 + opacity: 0 + } + + Image { + id: whip + x: end.x - width / 2 + y: end.y - height / 2 + property int idx: 1 + opacity: 0 + scale: 0.7 + source: SkinBank.PIXANIM_DIR + "/egg/egg" + idx + } + + SequentialAnimation { + id: pointToAnimation + running: false + PropertyAnimation { + target: egg + property: "opacity" + to: 1 + duration: 400 + } + + PauseAnimation { + duration: 350 + } + + ScriptAction { + script: Backend.playSound("./audio/system/fly" + (Math.floor(Math.random() * 2) + 1)); + } + + ParallelAnimation { + PropertyAnimation { + target: egg + property: "scale" + to: 0.4 + duration: 500 + } + + PropertyAnimation { + target: egg + property: "x" + to: end.x - egg.width / 2 + duration: 500 + } + + PropertyAnimation { + target: egg + property: "y" + to: end.y - egg.height / 2 + duration: 500 + } + + PropertyAnimation { + target: egg + property: "rotation" + to: 360 + duration: 250 + loops: 2 + } + + SequentialAnimation { + PauseAnimation { duration: 400 } + PropertyAnimation { + target: egg + property: "opacity" + to: 0 + duration: 100 + } + } + } + + ScriptAction { + script: Backend.playSound("./audio/system/egg" + (Math.floor(Math.random() * 2) + 1)); + } + + ParallelAnimation { + SequentialAnimation { + SequentialAnimation { + PauseAnimation { duration: 160 } + ScriptAction { script: whip.idx++; } + loops: 2 + } + + PauseAnimation { duration: 160 } + } + + SequentialAnimation { + PropertyAnimation { + target: whip + property: "opacity" + to: 1 + duration: 100 + } + + PauseAnimation { duration: 300 } + + PropertyAnimation { + target: whip + property: "opacity" + to: 0 + duration: 100 + } + } + } + + onStopped: { + root.visible = false; + root.finished(); + } + } +} diff --git a/Fk/ChatAnim/Flower.qml b/Fk/ChatAnim/Flower.qml new file mode 100644 index 00000000..179d744b --- /dev/null +++ b/Fk/ChatAnim/Flower.qml @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick +import Fk + +Item { + id: root + anchors.fill: parent + property point start: Qt.point(0, 0) + property point end: Qt.point(0, 0) + property alias running: pointToAnimation.running + + signal finished() + + Image { + id: egg + source: SkinBank.PIXANIM_DIR + "/flower/egg" + x: start.x - width / 2 + y: start.y - height / 2 + scale: 0.7 + 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) + } + + Image { + id: whip + x: end.x - width / 2 + y: end.y - height / 2 + property int idx: 1 + opacity: 0 + scale: 0.7 + source: SkinBank.PIXANIM_DIR + "/flower/egg" + idx + } + + Image { + id: star + opacity: 0 + source: SkinBank.PIXANIM_DIR + "/flower/star" + scale: 0.7 + } + + SequentialAnimation { + id: pointToAnimation + running: false + ScriptAction { + script: Backend.playSound("./audio/system/fly" + (Math.floor(Math.random() * 2) + 1)); + } + + ParallelAnimation { + PropertyAnimation { + target: egg + property: "scale" + to: 0.5 + duration: 360 + } + + PropertyAnimation { + target: egg + property: "x" + to: end.x - egg.width / 2 + duration: 360 + } + + PropertyAnimation { + target: egg + property: "y" + to: end.y - egg.height / 2 + duration: 360 + } + + SequentialAnimation { + PauseAnimation { duration: 300 } + PropertyAnimation { + target: egg + property: "opacity" + to: 0 + duration: 60 + } + } + } + + ScriptAction { + script: Backend.playSound("./audio/system/flower" + (Math.floor(Math.random() * 2) + 1)); + } + + ParallelAnimation { + SequentialAnimation { + SequentialAnimation { + PauseAnimation { duration: 180 } + ScriptAction { script: whip.idx++; } + loops: 2 + } + + ScriptAction { + script: { + star.x = end.x - 25; + star.y = end.y - 35; + } + } + + SequentialAnimation { + PropertyAnimation { + target: star + property: "opacity" + to: 1 + duration: 100 + } + + PauseAnimation { duration: 100 } + + PropertyAnimation { + target: star + property: "opacity" + to: 0 + duration: 100 + } + + ScriptAction { + script: { + star.x = end.x - 10; + star.y = end.y - 20; + } + } + } + + SequentialAnimation { + PropertyAnimation { + target: star + property: "opacity" + to: 1 + duration: 100 + } + + PauseAnimation { duration: 100 } + + PropertyAnimation { + target: star + property: "opacity" + to: 0 + duration: 100 + } + } + } + + SequentialAnimation { + PropertyAnimation { + target: whip + property: "opacity" + to: 1 + duration: 100 + } + + PauseAnimation { duration: 1100 } + + PropertyAnimation { + target: whip + property: "opacity" + to: 0 + duration: 100 + } + } + } + + onStopped: { + root.visible = false; + root.finished(); + } + } +} diff --git a/Fk/ChatAnim/qmldir b/Fk/ChatAnim/qmldir new file mode 100644 index 00000000..c4029473 --- /dev/null +++ b/Fk/ChatAnim/qmldir @@ -0,0 +1,2 @@ +module Fk.ChatAnim +Egg 1.0 Egg.qml diff --git a/Fk/Cheat/PlayerDetail.qml b/Fk/Cheat/PlayerDetail.qml index 510925c6..75cbc3e4 100644 --- a/Fk/Cheat/PlayerDetail.qml +++ b/Fk/Cheat/PlayerDetail.qml @@ -8,6 +8,7 @@ Flickable { id: root anchors.fill: parent property var extra_data: ({}) + property int pid signal finish() @@ -19,6 +20,24 @@ Flickable { width: parent.width - 40 x: 20 + RowLayout { + Button { + text: Backend.translate("Give Flower") + onClicked: { + root.givePresent("Flower"); + root.finish(); + } + } + + Button { + text: Backend.translate("Give Egg") + onClicked: { + root.givePresent("Egg"); + root.finish(); + } + } + } + // TODO: player details Text { id: screenName @@ -40,6 +59,16 @@ Flickable { } } + function givePresent(p) { + ClientInstance.notifyServer( + "Chat", + JSON.stringify({ + type: 2, + msg: "$!" + p + ":" + pid + }) + ); + } + onExtra_dataChanged: { if (!extra_data.photo) return; screenName.text = ""; @@ -47,6 +76,9 @@ Flickable { let id = extra_data.photo.playerid; if (id == 0) return; + root.pid = id; + + screenName.text = extra_data.photo.screenName; let data = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [id])); data.forEach(t => { diff --git a/Fk/Common/ChatBox.qml b/Fk/Common/ChatBox.qml index ea71d5cc..41c937c8 100644 --- a/Fk/Common/ChatBox.qml +++ b/Fk/Common/ChatBox.qml @@ -1,7 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later import QtQuick +import QtQuick.Controls import QtQuick.Layouts +import Fk.Pages Rectangle { property bool isLobby: false @@ -26,34 +28,66 @@ Rectangle { } } - Rectangle { + GridView { + id: emojiSelector Layout.fillWidth: true - Layout.preferredHeight: 28 - color: "#040403" - radius: 3 - border.width: 1 - border.color: "#A6967A" + Layout.preferredHeight: 120 + cellHeight: 48 + cellWidth: 48 + model: 49 + visible: false + delegate: ItemDelegate { + Image { + height: 32; width: 32 + anchors.centerIn: parent + source: "../../image/emoji/" + index + } + onClicked: chatEdit.insert(chatEdit.cursorPosition, "{emoji" + index + "}"); + } + } - TextInput { - anchors.fill: parent - anchors.margins: 6 - color: "white" - clip: true - font.pixelSize: 14 + RowLayout { + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 28 + color: "#040403" + radius: 3 + border.width: 1 + border.color: "#A6967A" - onAccepted: { - if (text != "") { - ClientInstance.notifyServer( - "Chat", - JSON.stringify({ - type: isLobby ? 1 : 2, - msg: text - }) - ); - text = ""; + TextInput { + id: chatEdit + anchors.fill: parent + anchors.margins: 6 + color: "white" + clip: true + font.pixelSize: 14 + + onAccepted: { + if (text != "") { + ClientInstance.notifyServer( + "Chat", + JSON.stringify({ + type: isLobby ? 1 : 2, + msg: text + }) + ); + text = ""; + } } } } + + MetroButton { + id: emojiBtn + text: "😃" + onClicked: emojiSelector.visible = !emojiSelector.visible; + } + + MetroButton { + text: "✔️" + onClicked: chatEdit.accepted(); + } } } } diff --git a/Fk/Pages/Lobby.qml b/Fk/Pages/Lobby.qml index f67b022c..56e2d988 100644 --- a/Fk/Pages/Lobby.qml +++ b/Fk/Pages/Lobby.qml @@ -277,6 +277,8 @@ Item { function addToChat(pid, raw, msg) { if (raw.type !== 1) return; + msg = msg.replace(/\{emoji([0-9]+)\}/g, ''); + raw.msg = raw.msg.replace(/\{emoji([0-9]+)\}/g, ''); lobbyChat.append(msg); danmaku.sendLog("" + raw.userName + ": " + raw.msg); } diff --git a/Fk/Pages/Room.qml b/Fk/Pages/Room.qml index 1835476b..b0ffe5e3 100644 --- a/Fk/Pages/Room.qml +++ b/Fk/Pages/Room.qml @@ -9,7 +9,6 @@ import Fk.Common import Fk.RoomElement import "RoomLogic.js" as Logic - Item { id: roomScene @@ -693,6 +692,9 @@ Item { function addToChat(pid, raw, msg) { if (raw.type === 1) return; + msg = msg.replace(/\{emoji([0-9]+)\}/g, ''); + raw.msg = raw.msg.replace(/\{emoji([0-9]+)\}/g, ''); + if (raw.msg.startsWith("$")) { if (specialChat(pid, raw, raw.msg.slice(1))) return; } @@ -710,20 +712,32 @@ Item { function specialChat(pid, data, msg) { // skill audio: %s%d // death audio: ~%s - // something special: .%s:... + // something special: !%s:... let time = data.time; let userName = data.userName; let general = Backend.translate(data.general); - if (msg.startsWith(".")) { + if (msg.startsWith("!")) { let splited = msg.split(":"); let type = splited[0].slice(1); switch (type) { - case "egg": { - return true; - } - case "flower": { + case "Egg": + case "Flower": { + const fromId = pid; + const toId = parseInt(splited[1]); + const component = Qt.createComponent("../ChatAnim/" + type + ".qml"); + //if (component.status !== Component.Ready) + // return false; + + const fromItem = Logic.getPhoto(fromId); + 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 }); + egg.finished.connect(() => egg.destroy()); + egg.running = true; + return true; } default: diff --git a/Fk/Pages/RoomLogic.js b/Fk/Pages/RoomLogic.js index 1b150ac4..c124570e 100644 --- a/Fk/Pages/RoomLogic.js +++ b/Fk/Pages/RoomLogic.js @@ -68,14 +68,15 @@ function arrangePhotos() { function doOkButton() { if (roomScene.state == "playing" || roomScene.state == "responding") { - replyToServer(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, } - )); + ); + replyToServer(reply); return; } if (roomScene.extra_data.luckCard) { @@ -823,6 +824,7 @@ callbacks["AskForUseActiveSkill"] = function(jsonData) { let skill_name = data[0]; let prompt = data[1]; let cancelable = data[2]; + let extra_data = data[3] ?? {}; if (prompt === "") { roomScene.promptText = Backend.translate("#AskForUseActiveSkill") .arg(Backend.translate(skill_name)); @@ -832,8 +834,11 @@ callbacks["AskForUseActiveSkill"] = function(jsonData) { roomScene.respond_play = false; roomScene.state = "responding"; + roomScene.responding_card = "."; roomScene.autoPending = true; - dashboard.startPending(skill_name); + roomScene.extra_data = extra_data; + // dashboard.startPending(skill_name); + roomScene.activateSkill(skill_name, true); cancelButton.enabled = cancelable; } diff --git a/Fk/main.qml b/Fk/main.qml index d1bde09c..8decf09c 100644 --- a/Fk/main.qml +++ b/Fk/main.qml @@ -220,6 +220,6 @@ Item { config.winWidth = width; config.winHeight = height; config.saveConf(); - Backend.quitLobby(); + Backend.quitLobby(false); } } diff --git a/audio/system/egg1.mp3 b/audio/system/egg1.mp3 new file mode 100644 index 00000000..c54296b7 Binary files /dev/null and b/audio/system/egg1.mp3 differ diff --git a/audio/system/egg2.mp3 b/audio/system/egg2.mp3 new file mode 100644 index 00000000..9c2aa308 Binary files /dev/null and b/audio/system/egg2.mp3 differ diff --git a/audio/system/flower1.mp3 b/audio/system/flower1.mp3 new file mode 100644 index 00000000..eac76b2d Binary files /dev/null and b/audio/system/flower1.mp3 differ diff --git a/audio/system/flower2.mp3 b/audio/system/flower2.mp3 new file mode 100644 index 00000000..cddbd45d Binary files /dev/null and b/audio/system/flower2.mp3 differ diff --git a/audio/system/fly1.mp3 b/audio/system/fly1.mp3 new file mode 100644 index 00000000..c1c737a1 Binary files /dev/null and b/audio/system/fly1.mp3 differ diff --git a/audio/system/fly2.mp3 b/audio/system/fly2.mp3 new file mode 100644 index 00000000..26204edf Binary files /dev/null and b/audio/system/fly2.mp3 differ diff --git a/image/anim/egg/egg.png b/image/anim/egg/egg.png new file mode 100644 index 00000000..2b33cdaa Binary files /dev/null and b/image/anim/egg/egg.png differ diff --git a/image/anim/egg/egg1.png b/image/anim/egg/egg1.png new file mode 100644 index 00000000..18017d2a Binary files /dev/null and b/image/anim/egg/egg1.png differ diff --git a/image/anim/egg/egg2.png b/image/anim/egg/egg2.png new file mode 100644 index 00000000..6477a5ec Binary files /dev/null and b/image/anim/egg/egg2.png differ diff --git a/image/anim/egg/egg3.png b/image/anim/egg/egg3.png new file mode 100644 index 00000000..caabec55 Binary files /dev/null and b/image/anim/egg/egg3.png differ diff --git a/image/anim/flower/egg.png b/image/anim/flower/egg.png new file mode 100644 index 00000000..d11cb876 Binary files /dev/null and b/image/anim/flower/egg.png differ diff --git a/image/anim/flower/egg1.png b/image/anim/flower/egg1.png new file mode 100644 index 00000000..69f2dfa3 Binary files /dev/null and b/image/anim/flower/egg1.png differ diff --git a/image/anim/flower/egg2.png b/image/anim/flower/egg2.png new file mode 100644 index 00000000..e0903738 Binary files /dev/null and b/image/anim/flower/egg2.png differ diff --git a/image/anim/flower/egg3.png b/image/anim/flower/egg3.png new file mode 100644 index 00000000..138d14da Binary files /dev/null and b/image/anim/flower/egg3.png differ diff --git a/image/anim/flower/star.png b/image/anim/flower/star.png new file mode 100644 index 00000000..0d8803fb Binary files /dev/null and b/image/anim/flower/star.png differ diff --git a/image/emoji/0.png b/image/emoji/0.png new file mode 100644 index 00000000..7c963786 Binary files /dev/null and b/image/emoji/0.png differ diff --git a/image/emoji/1.png b/image/emoji/1.png new file mode 100644 index 00000000..ae5aba55 Binary files /dev/null and b/image/emoji/1.png differ diff --git a/image/emoji/10.png b/image/emoji/10.png new file mode 100644 index 00000000..3b0fb352 Binary files /dev/null and b/image/emoji/10.png differ diff --git a/image/emoji/11.png b/image/emoji/11.png new file mode 100644 index 00000000..31a97f4b Binary files /dev/null and b/image/emoji/11.png differ diff --git a/image/emoji/12.png b/image/emoji/12.png new file mode 100644 index 00000000..bca85d5c Binary files /dev/null and b/image/emoji/12.png differ diff --git a/image/emoji/13.png b/image/emoji/13.png new file mode 100644 index 00000000..3213d5e1 Binary files /dev/null and b/image/emoji/13.png differ diff --git a/image/emoji/14.png b/image/emoji/14.png new file mode 100644 index 00000000..6fe7a602 Binary files /dev/null and b/image/emoji/14.png differ diff --git a/image/emoji/15.png b/image/emoji/15.png new file mode 100644 index 00000000..604c7758 Binary files /dev/null and b/image/emoji/15.png differ diff --git a/image/emoji/16.png b/image/emoji/16.png new file mode 100644 index 00000000..4a203bbb Binary files /dev/null and b/image/emoji/16.png differ diff --git a/image/emoji/17.png b/image/emoji/17.png new file mode 100644 index 00000000..3c4995a6 Binary files /dev/null and b/image/emoji/17.png differ diff --git a/image/emoji/18.png b/image/emoji/18.png new file mode 100644 index 00000000..b007e0c8 Binary files /dev/null and b/image/emoji/18.png differ diff --git a/image/emoji/19.png b/image/emoji/19.png new file mode 100644 index 00000000..3fa6e99c Binary files /dev/null and b/image/emoji/19.png differ diff --git a/image/emoji/2.png b/image/emoji/2.png new file mode 100644 index 00000000..b90d1c78 Binary files /dev/null and b/image/emoji/2.png differ diff --git a/image/emoji/20.png b/image/emoji/20.png new file mode 100644 index 00000000..90a86114 Binary files /dev/null and b/image/emoji/20.png differ diff --git a/image/emoji/21.png b/image/emoji/21.png new file mode 100644 index 00000000..378fce36 Binary files /dev/null and b/image/emoji/21.png differ diff --git a/image/emoji/22.png b/image/emoji/22.png new file mode 100644 index 00000000..e7961387 Binary files /dev/null and b/image/emoji/22.png differ diff --git a/image/emoji/23.png b/image/emoji/23.png new file mode 100644 index 00000000..0bd00f3e Binary files /dev/null and b/image/emoji/23.png differ diff --git a/image/emoji/24.png b/image/emoji/24.png new file mode 100644 index 00000000..12d9266f Binary files /dev/null and b/image/emoji/24.png differ diff --git a/image/emoji/25.png b/image/emoji/25.png new file mode 100644 index 00000000..e4cb3c6a Binary files /dev/null and b/image/emoji/25.png differ diff --git a/image/emoji/26.png b/image/emoji/26.png new file mode 100644 index 00000000..1e7d4829 Binary files /dev/null and b/image/emoji/26.png differ diff --git a/image/emoji/27.png b/image/emoji/27.png new file mode 100644 index 00000000..92ae2026 Binary files /dev/null and b/image/emoji/27.png differ diff --git a/image/emoji/28.png b/image/emoji/28.png new file mode 100644 index 00000000..ed607ff6 Binary files /dev/null and b/image/emoji/28.png differ diff --git a/image/emoji/29.png b/image/emoji/29.png new file mode 100644 index 00000000..1b005cdc Binary files /dev/null and b/image/emoji/29.png differ diff --git a/image/emoji/3.png b/image/emoji/3.png new file mode 100644 index 00000000..4f4c7650 Binary files /dev/null and b/image/emoji/3.png differ diff --git a/image/emoji/30.png b/image/emoji/30.png new file mode 100644 index 00000000..290c1539 Binary files /dev/null and b/image/emoji/30.png differ diff --git a/image/emoji/31.png b/image/emoji/31.png new file mode 100644 index 00000000..abe9271a Binary files /dev/null and b/image/emoji/31.png differ diff --git a/image/emoji/32.png b/image/emoji/32.png new file mode 100644 index 00000000..412bb28d Binary files /dev/null and b/image/emoji/32.png differ diff --git a/image/emoji/33.png b/image/emoji/33.png new file mode 100644 index 00000000..98034f1c Binary files /dev/null and b/image/emoji/33.png differ diff --git a/image/emoji/34.png b/image/emoji/34.png new file mode 100644 index 00000000..46304a8d Binary files /dev/null and b/image/emoji/34.png differ diff --git a/image/emoji/35.png b/image/emoji/35.png new file mode 100644 index 00000000..4c1f47b8 Binary files /dev/null and b/image/emoji/35.png differ diff --git a/image/emoji/36.png b/image/emoji/36.png new file mode 100644 index 00000000..2671f457 Binary files /dev/null and b/image/emoji/36.png differ diff --git a/image/emoji/37.png b/image/emoji/37.png new file mode 100644 index 00000000..ef1feb40 Binary files /dev/null and b/image/emoji/37.png differ diff --git a/image/emoji/38.png b/image/emoji/38.png new file mode 100644 index 00000000..6fb1d42d Binary files /dev/null and b/image/emoji/38.png differ diff --git a/image/emoji/39.png b/image/emoji/39.png new file mode 100644 index 00000000..7b73c7e3 Binary files /dev/null and b/image/emoji/39.png differ diff --git a/image/emoji/4.png b/image/emoji/4.png new file mode 100644 index 00000000..9934a07f Binary files /dev/null and b/image/emoji/4.png differ diff --git a/image/emoji/40.png b/image/emoji/40.png new file mode 100644 index 00000000..5d36bba8 Binary files /dev/null and b/image/emoji/40.png differ diff --git a/image/emoji/41.png b/image/emoji/41.png new file mode 100644 index 00000000..c01e31e6 Binary files /dev/null and b/image/emoji/41.png differ diff --git a/image/emoji/42.png b/image/emoji/42.png new file mode 100644 index 00000000..23106aed Binary files /dev/null and b/image/emoji/42.png differ diff --git a/image/emoji/43.png b/image/emoji/43.png new file mode 100644 index 00000000..92a6bd5d Binary files /dev/null and b/image/emoji/43.png differ diff --git a/image/emoji/44.png b/image/emoji/44.png new file mode 100644 index 00000000..2daef26e Binary files /dev/null and b/image/emoji/44.png differ diff --git a/image/emoji/45.png b/image/emoji/45.png new file mode 100644 index 00000000..7e1f6639 Binary files /dev/null and b/image/emoji/45.png differ diff --git a/image/emoji/46.png b/image/emoji/46.png new file mode 100644 index 00000000..6a0985ea Binary files /dev/null and b/image/emoji/46.png differ diff --git a/image/emoji/47.png b/image/emoji/47.png new file mode 100644 index 00000000..102f16ac Binary files /dev/null and b/image/emoji/47.png differ diff --git a/image/emoji/48.png b/image/emoji/48.png new file mode 100644 index 00000000..e26e491a Binary files /dev/null and b/image/emoji/48.png differ diff --git a/image/emoji/49.png b/image/emoji/49.png new file mode 100644 index 00000000..c5c14239 Binary files /dev/null and b/image/emoji/49.png differ diff --git a/image/emoji/5.png b/image/emoji/5.png new file mode 100644 index 00000000..13d8c69d Binary files /dev/null and b/image/emoji/5.png differ diff --git a/image/emoji/6.png b/image/emoji/6.png new file mode 100644 index 00000000..1ba986a3 Binary files /dev/null and b/image/emoji/6.png differ diff --git a/image/emoji/7.png b/image/emoji/7.png new file mode 100644 index 00000000..0aea3751 Binary files /dev/null and b/image/emoji/7.png differ diff --git a/image/emoji/8.png b/image/emoji/8.png new file mode 100644 index 00000000..fb049fc5 Binary files /dev/null and b/image/emoji/8.png differ diff --git a/image/emoji/9.png b/image/emoji/9.png new file mode 100644 index 00000000..b3fa6d8f Binary files /dev/null and b/image/emoji/9.png differ diff --git a/lua/client/i18n/zh_CN.lua b/lua/client/i18n/zh_CN.lua index 079e26b3..f7083a30 100644 --- a/lua/client/i18n/zh_CN.lua +++ b/lua/client/i18n/zh_CN.lua @@ -40,6 +40,9 @@ Fk:loadTranslationTable{ ["General Packages"] = "武将拓展包", ["Card Packages"] = "卡牌拓展包", + ["Give Flower"] = "送花", + ["Give Egg"] = "砸蛋", + ["$OnlineInfo"] = "大厅人数:%1,总在线人数:%2", ["Generals Overview"] = "武将一览", diff --git a/lua/server/room.lua b/lua/server/room.lua index 2759cbd7..28f81639 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -871,7 +871,7 @@ function Room:askForUseActiveSkill(player, skill_name, prompt, cancelable, extra cancelable = cancelable or false extra_data = extra_data or {} local skill = Fk.skills[skill_name] - if not (skill and skill:isInstanceOf(ActiveSkill)) then + if not (skill and (skill:isInstanceOf(ActiveSkill) or skill:isInstanceOf(ViewAsSkill))) then print("Attempt ask for use non-active skill: " .. skill_name) return false end @@ -894,11 +894,18 @@ function Room:askForUseActiveSkill(player, skill_name, prompt, cancelable, extra local card_data = json.decode(card) local selected_cards = card_data.subcards self:doIndicate(player.id, targets) - skill:onUse(self, { - from = player.id, - cards = selected_cards, - tos = targets, - }) + + if skill.interaction then + skill.interaction.data = data.interaction_data + end + + if skill:isInstanceOf(ActiveSkill) then + skill:onUse(self, { + from = player.id, + cards = selected_cards, + tos = targets, + }) + end return true, { cards = selected_cards, @@ -906,6 +913,8 @@ function Room:askForUseActiveSkill(player, skill_name, prompt, cancelable, extra } end +Room.askForUseViewAsSkill = Room.askForUseActiveSkill + --- 询问一名角色弃牌。 --- --- 在这个函数里面牌已经被弃掉了。 diff --git a/packages/test/init.lua b/packages/test/init.lua index 5b61ccec..3d96b548 100644 --- a/packages/test/init.lua +++ b/packages/test/init.lua @@ -78,9 +78,18 @@ local test_active = fk.CreateActiveSkill{ on_use = function(self, room, effect) --room:doSuperLightBox("packages/test/qml/Test.qml") local from = room:getPlayerById(effect.from) - local to = room:getPlayerById(effect.tos[1]) + --local to = room:getPlayerById(effect.tos[1]) -- room:swapSeat(from, to) - from:control(to) + --from:control(to) + local success, dat = room:askForUseViewAsSkill(from, "test_vs", nil, true) + if success then + local card = Fk.skills["test_vs"]:viewAs(dat.cards) + room:useCard{ + from = from.id, + tos = table.map(dat.targets, function(e) return {e} end), + card = card, + } + end -- from:pindian({to}) -- local result = room:askForCustomDialog(from, "simayi", "packages/test/qml/TestDialog.qml", "Hello, world. FROM LUA") -- print(result) diff --git a/src/ui/qmlbackend.cpp b/src/ui/qmlbackend.cpp index 00fbb356..3c5c41c6 100644 --- a/src/ui/qmlbackend.cpp +++ b/src/ui/qmlbackend.cpp @@ -106,10 +106,10 @@ void QmlBackend::joinServer(QString address) { client->connectToHost(addr, port); } -void QmlBackend::quitLobby() { +void QmlBackend::quitLobby(bool close) { if (ClientInstance) - ClientInstance->deleteLater(); - if (ServerInstance) + delete ClientInstance; + if (ServerInstance && close) ServerInstance->deleteLater(); } diff --git a/src/ui/qmlbackend.h b/src/ui/qmlbackend.h index ac9574e2..3c49dc5a 100644 --- a/src/ui/qmlbackend.h +++ b/src/ui/qmlbackend.h @@ -26,7 +26,7 @@ public: Q_INVOKABLE void joinServer(QString address); // Lobby - Q_INVOKABLE void quitLobby(); + Q_INVOKABLE void quitLobby(bool close = true); // lua --> qml void emitNotifyUI(const QString &command, const QString &jsonData);