diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 06ae6618..89caa5ef 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,52 +1,52 @@ - - - + package="org.notify.FreeKill" + android:installLocation="preferExternal" + android:versionCode="4" + android:versionName="0.0.4"> + + + - - + - - - - - + android:requestLegacyExternalStorage="true" + android:allowNativeHeapPointerTagging="false" + android:allowBackup="true" + android:fullBackupOnly="false"> + + + + + - + - + - - - + + + diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml new file mode 100644 index 00000000..74d20974 --- /dev/null +++ b/android/res/values/styles.xml @@ -0,0 +1,6 @@ + + + diff --git a/lua/core/player.lua b/lua/core/player.lua index 98f1a887..63347f3f 100644 --- a/lua/core/player.lua +++ b/lua/core/player.lua @@ -513,8 +513,8 @@ function Player:addSkill(skill, source_skill) room.logic:addTriggerSkill(s) end if s:isInstanceOf(StatusSkill) then - room.status_skills[skill.class] = room.status_skills[skill.class] or {} - table.insertIfNeed(room.status_skills[skill.class], s) + room.status_skills[s.class] = room.status_skills[s.class] or {} + table.insertIfNeed(room.status_skills[s.class], s) end end end diff --git a/lua/server/room.lua b/lua/server/room.lua index f8f844d7..0a552956 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -1649,7 +1649,7 @@ function Room:moveCards(...) return execGameEvent(GameEvent.MoveCards, ...) end ----@param player integer +---@param player integer|Player ---@param cid integer|Card ---@param unhide boolean ---@param reason CardMoveReason @@ -1661,6 +1661,11 @@ function Room:obtainCard(player, cid, unhide, reason) cid = {cid} end if #cid == 0 then return end + + if type(player) == "table" then + player = player.id + end + self:moveCards({ ids = cid, from = self.owner_map[cid[1]], diff --git a/qml/Pages/GeneralsOverview.qml b/qml/Pages/GeneralsOverview.qml index a7da789c..5ed95486 100644 --- a/qml/Pages/GeneralsOverview.qml +++ b/qml/Pages/GeneralsOverview.qml @@ -29,6 +29,7 @@ Item { onClicked: { generalText.clear(); generalText.general = modelData; + generalText.updateGeneral(); generalDetail.open(); } } @@ -78,7 +79,7 @@ Item { textFormat: TextEdit.RichText font.pixelSize: 16 - onGeneralChanged: { + function updateGeneral() { let data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general])); this.append(Backend.translate(data.kingdom) + " " + Backend.translate(general) + " " + data.hp + "/" + data.maxHp); data.skill.forEach(t => { diff --git a/qml/Pages/Lobby.qml b/qml/Pages/Lobby.qml index 36919748..e996c763 100644 --- a/qml/Pages/Lobby.qml +++ b/qml/Pages/Lobby.qml @@ -39,9 +39,8 @@ Item { Text { text: Backend.translate("Enter") font.pixelSize: 24 - MouseArea { - anchors.fill: parent - onClicked: { + TapHandler { + onTapped: { config.observing = false; mainWindow.busy = true; ClientInstance.notifyServer( @@ -55,9 +54,8 @@ Item { Text { text: Backend.translate("Observe") font.pixelSize: 24 - MouseArea { - anchors.fill: parent - onClicked: { + TapHandler { + onTapped: { config.observing = true; mainWindow.busy = true; ClientInstance.notifyServer( diff --git a/qml/Pages/MetroButton.qml b/qml/Pages/MetroButton.qml index 6a9f3127..3b84be05 100644 --- a/qml/Pages/MetroButton.qml +++ b/qml/Pages/MetroButton.qml @@ -27,7 +27,7 @@ Item { states: [ State { - name: "hovered"; when: mouse.containsMouse + name: "hovered"; when: hover.hovered PropertyChanges { target: bg; color: "white" } PropertyChanges { target: title; color: "black" } }, @@ -37,11 +37,14 @@ Item { } ] - MouseArea { + TapHandler { id: mouse - anchors.fill: parent - hoverEnabled: parent.enabled - onReleased: if (parent.enabled) parent.clicked() + onTapped: if (parent.enabled) parent.clicked() + } + + HoverHandler { + id: hover + cursorShape: Qt.PointingHandCursor } Row { diff --git a/qml/Pages/PackageManage.qml b/qml/Pages/PackageManage.qml index d251f1a3..3b8a5bc0 100644 --- a/qml/Pages/PackageManage.qml +++ b/qml/Pages/PackageManage.qml @@ -46,9 +46,8 @@ Item { } } - MouseArea { - anchors.fill: parent - onClicked: { + TapHandler { + onTapped: { if (packageList.currentIndex === index) { packageList.currentIndex = -1; } else { diff --git a/qml/Pages/RoomElement/CardItem.qml b/qml/Pages/RoomElement/CardItem.qml index 970c029b..5b7033f6 100644 --- a/qml/Pages/RoomElement/CardItem.qml +++ b/qml/Pages/RoomElement/CardItem.qml @@ -47,7 +47,7 @@ Item { property int origX: 0 property int origY: 0 property real origOpacity: 1 - property bool isClicked: false + // property bool isClicked: false property bool moveAborted: false property alias goBackAnim: goBackAnimation property int goBackDuration: 500 @@ -147,50 +147,50 @@ Item { opacity: 0.7 } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - drag.target: draggable ? parent : undefined - drag.axis: Drag.XAndYAxis - hoverEnabled: true + TapHandler { + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.NoButton - onReleased: function(mouse) { - root.isClicked = mouse.isClick; - parent.released(); - if (autoBack) - goBackAnimation.start(); - } - - onEntered: { - parent.entered(); - if (draggable) { - glow.visible = true; - root.z++; - } - } - - onExited: { - parent.exited(); - if (draggable) { - glow.visible = false; - root.z--; - } - } - - onClicked: (mouse) => { - if (mouse.button == Qt.LeftButton) { + onTapped: (p, btn) => { + if (btn === Qt.LeftButton || btn === Qt.NoButton) { selected = selectable ? !selected : false; parent.clicked(); - } else if (mouse.button === Qt.RightButton) { + } else if (btn === Qt.RightButton) { parent.rightClicked(); } } - onPressAndHold: { + onLongPressed: { parent.rightClicked(); } } + DragHandler { + enabled: draggable + xAxis.enabled: true + yAxis.enabled: true + + onGrabChanged: (transtition, point) => { + if (transtition !== PointerDevice.UngrabExclusive) return; + parent.released(); + if (autoBack) + goBackAnimation.start(); + } + } + + HoverHandler { + id: hover + onHoveredChanged: { + if (!draggable) return; + if (hovered) { + glow.visible = true; + root.z++; + } else { + glow.visible = false; + root.z--; + } + } + } + ParallelAnimation { id: goBackAnimation diff --git a/qml/Pages/RoomElement/ChooseGeneralBox.qml b/qml/Pages/RoomElement/ChooseGeneralBox.qml index 0887aeb8..594eb657 100644 --- a/qml/Pages/RoomElement/ChooseGeneralBox.qml +++ b/qml/Pages/RoomElement/ChooseGeneralBox.qml @@ -122,8 +122,7 @@ GraphicsBox { } onReleased: { - if (!isClicked) - arrangeCards(); + arrangeCards(); } } } diff --git a/qml/Pages/RoomElement/GraphicsBox.qml b/qml/Pages/RoomElement/GraphicsBox.qml index 70f6a94e..bf7f72b9 100644 --- a/qml/Pages/RoomElement/GraphicsBox.qml +++ b/qml/Pages/RoomElement/GraphicsBox.qml @@ -27,10 +27,9 @@ Item { anchors.horizontalCenter: parent.horizontalCenter } - MouseArea { - anchors.fill: parent - drag.target: parent - drag.axis: Drag.XAndYAxis + DragHandler { + xAxis.enabled: true + yAxis.enabled: true } function close() diff --git a/qml/Pages/RoomElement/Photo.qml b/qml/Pages/RoomElement/Photo.qml index 29471abe..598a4d54 100644 --- a/qml/Pages/RoomElement/Photo.qml +++ b/qml/Pages/RoomElement/Photo.qml @@ -249,7 +249,7 @@ Item { if (data.length === 0) { root.markArea.removeMark(areaName); } else { - root.markArea.setMark(areaName, data.length); + root.markArea.setMark(areaName, data.length.toString()); } } @@ -318,12 +318,9 @@ Item { } } - MouseArea { - anchors.fill: parent - propagateComposedEvents: true - onClicked: (mouse) => { + TapHandler { + onTapped: { if (parent.state != "candidate" || !parent.selectable) { - mouse.accepted = false; return; } parent.selected = !parent.selected; @@ -339,6 +336,18 @@ Item { anchors.rightMargin: -4 } + GlowText { + id: playerName + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 2 + + font.pixelSize: 16 + text: screenName + + glow.radius: 8 + } + Image { visible: root.state === "candidate" && !selectable && !selected source: SkinBank.PHOTO_DIR + "disable" diff --git a/qml/Pages/RoomElement/PhotoElement/MarkArea.qml b/qml/Pages/RoomElement/PhotoElement/MarkArea.qml index e15a1c94..a6786bbd 100644 --- a/qml/Pages/RoomElement/PhotoElement/MarkArea.qml +++ b/qml/Pages/RoomElement/PhotoElement/MarkArea.qml @@ -39,9 +39,9 @@ Item { textFormat: Text.RichText } - MouseArea { - anchors.fill: parent - onClicked: { + TapHandler { + enabled: root.parent.state != "candidate" || !root.parent.selectable + onTapped: { let data = JSON.parse(Backend.callLuaFunction("GetPile", [root.parent.playerid, mark_name])); data = data.filter((e) => e !== -1); if (data.length === 0) diff --git a/qml/Pages/RoomElement/PhotoElement/RoleComboBox.qml b/qml/Pages/RoomElement/PhotoElement/RoleComboBox.qml index 119e16ed..924710bf 100644 --- a/qml/Pages/RoomElement/PhotoElement/RoleComboBox.qml +++ b/qml/Pages/RoomElement/PhotoElement/RoleComboBox.qml @@ -16,9 +16,8 @@ Image { source: SkinBank.ROLE_DIR + value visible: root.value == "unknown" - MouseArea { - anchors.fill: parent - onClicked: optionPopupBox.visible = true; + TapHandler { + onTapped: optionPopupBox.visible = true; } } @@ -33,9 +32,8 @@ Image { Image { source: SkinBank.ROLE_DIR + modelData - MouseArea { - anchors.fill: parent - onClicked: { + TapHandler { + onTapped: { optionPopupBox.visible = false; assumptionBox.value = modelData; } diff --git a/qml/Pages/RoomElement/PhotoElement/SpecialMarkArea.qml b/qml/Pages/RoomElement/PhotoElement/SpecialMarkArea.qml new file mode 100644 index 00000000..202c2394 --- /dev/null +++ b/qml/Pages/RoomElement/PhotoElement/SpecialMarkArea.qml @@ -0,0 +1,5 @@ +import QtQuick + +Item { + id: root +} diff --git a/qml/Pages/RoomElement/SkillButton.qml b/qml/Pages/RoomElement/SkillButton.qml index 0696542c..eb5d3ec6 100644 --- a/qml/Pages/RoomElement/SkillButton.qml +++ b/qml/Pages/RoomElement/SkillButton.qml @@ -51,10 +51,8 @@ Item { } } - MouseArea { - id: mouseArea - anchors.fill: parent + TapHandler { enabled: root.type === "active" && root.enabled - onClicked: parent.pressed = !parent.pressed; + onTapped: parent.pressed = !parent.pressed; } } diff --git a/qml/main.qml b/qml/main.qml index c3b9b9a2..980f712b 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -160,9 +160,8 @@ Item { text: errDialog.txt wrapMode: Text.WordWrap - MouseArea { - anchors.fill: parent - onClicked: errDialog.close(); + TapHandler { + onTapped: errDialog.close(); } } }