修一大堆bug
This commit is contained in:
notify 2023-03-18 15:34:42 +08:00 committed by GitHub
parent 37839a8289
commit fd1a1ce5fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 143 additions and 124 deletions

View File

@ -1,52 +1,52 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.notify.FreeKill" package="org.notify.FreeKill"
android:installLocation="preferExternal" android:installLocation="preferExternal"
android:versionCode="4" android:versionCode="4"
android:versionName="0.0.4"> android:versionName="0.0.4">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<supports-screens <supports-screens
android:anyDensity="true" android:anyDensity="true"
android:largeScreens="true" android:largeScreens="true"
android:normalScreens="true" android:normalScreens="true"
android:smallScreens="true" /> android:smallScreens="true" />
<application <application
android:name="org.qtproject.qt.android.bindings.QtApplication" android:name="org.qtproject.qt.android.bindings.QtApplication"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:label="FreeKill" android:label="FreeKill"
android:icon="@mipmap/icon" android:icon="@mipmap/icon"
android:requestLegacyExternalStorage="true" android:requestLegacyExternalStorage="true"
android:allowNativeHeapPointerTagging="false" android:allowNativeHeapPointerTagging="false"
android:allowBackup="true" android:allowBackup="true"
android:fullBackupOnly="false"> android:fullBackupOnly="false">
<activity <activity
android:name="org.qtproject.qt.android.bindings.QtActivity" android:name="org.qtproject.qt.android.bindings.QtActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:label="FreeKill" android:label="FreeKill"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorLandscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:theme="@style/FkTheme"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.app.lib_name" android:name="android.app.lib_name"
android:value="FreeKill" /> android:value="FreeKill" />
<meta-data <meta-data
android:name="android.app.arguments" android:name="android.app.arguments"
android:value="" /> android:value="" />
<meta-data <meta-data
android:name="android.app.extract_android_style" android:name="android.app.extract_android_style"
android:value="minimal" /> android:value="minimal" />
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,6 @@
<resources>
<style name="FkTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:windowEnableSplitTouch">false</item>
<item name="android:splitMotionEvents">false</item>
</style>
</resources>

View File

@ -513,8 +513,8 @@ function Player:addSkill(skill, source_skill)
room.logic:addTriggerSkill(s) room.logic:addTriggerSkill(s)
end end
if s:isInstanceOf(StatusSkill) then if s:isInstanceOf(StatusSkill) then
room.status_skills[skill.class] = room.status_skills[skill.class] or {} room.status_skills[s.class] = room.status_skills[s.class] or {}
table.insertIfNeed(room.status_skills[skill.class], s) table.insertIfNeed(room.status_skills[s.class], s)
end end
end end
end end

View File

@ -1649,7 +1649,7 @@ function Room:moveCards(...)
return execGameEvent(GameEvent.MoveCards, ...) return execGameEvent(GameEvent.MoveCards, ...)
end end
---@param player integer ---@param player integer|Player
---@param cid integer|Card ---@param cid integer|Card
---@param unhide boolean ---@param unhide boolean
---@param reason CardMoveReason ---@param reason CardMoveReason
@ -1661,6 +1661,11 @@ function Room:obtainCard(player, cid, unhide, reason)
cid = {cid} cid = {cid}
end end
if #cid == 0 then return end if #cid == 0 then return end
if type(player) == "table" then
player = player.id
end
self:moveCards({ self:moveCards({
ids = cid, ids = cid,
from = self.owner_map[cid[1]], from = self.owner_map[cid[1]],

View File

@ -29,6 +29,7 @@ Item {
onClicked: { onClicked: {
generalText.clear(); generalText.clear();
generalText.general = modelData; generalText.general = modelData;
generalText.updateGeneral();
generalDetail.open(); generalDetail.open();
} }
} }
@ -78,7 +79,7 @@ Item {
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
font.pixelSize: 16 font.pixelSize: 16
onGeneralChanged: { function updateGeneral() {
let data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general])); let data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
this.append(Backend.translate(data.kingdom) + " " + Backend.translate(general) + " " + data.hp + "/" + data.maxHp); this.append(Backend.translate(data.kingdom) + " " + Backend.translate(general) + " " + data.hp + "/" + data.maxHp);
data.skill.forEach(t => { data.skill.forEach(t => {

View File

@ -39,9 +39,8 @@ Item {
Text { Text {
text: Backend.translate("Enter") text: Backend.translate("Enter")
font.pixelSize: 24 font.pixelSize: 24
MouseArea { TapHandler {
anchors.fill: parent onTapped: {
onClicked: {
config.observing = false; config.observing = false;
mainWindow.busy = true; mainWindow.busy = true;
ClientInstance.notifyServer( ClientInstance.notifyServer(
@ -55,9 +54,8 @@ Item {
Text { Text {
text: Backend.translate("Observe") text: Backend.translate("Observe")
font.pixelSize: 24 font.pixelSize: 24
MouseArea { TapHandler {
anchors.fill: parent onTapped: {
onClicked: {
config.observing = true; config.observing = true;
mainWindow.busy = true; mainWindow.busy = true;
ClientInstance.notifyServer( ClientInstance.notifyServer(

View File

@ -27,7 +27,7 @@ Item {
states: [ states: [
State { State {
name: "hovered"; when: mouse.containsMouse name: "hovered"; when: hover.hovered
PropertyChanges { target: bg; color: "white" } PropertyChanges { target: bg; color: "white" }
PropertyChanges { target: title; color: "black" } PropertyChanges { target: title; color: "black" }
}, },
@ -37,11 +37,14 @@ Item {
} }
] ]
MouseArea { TapHandler {
id: mouse id: mouse
anchors.fill: parent onTapped: if (parent.enabled) parent.clicked()
hoverEnabled: parent.enabled }
onReleased: if (parent.enabled) parent.clicked()
HoverHandler {
id: hover
cursorShape: Qt.PointingHandCursor
} }
Row { Row {

View File

@ -46,9 +46,8 @@ Item {
} }
} }
MouseArea { TapHandler {
anchors.fill: parent onTapped: {
onClicked: {
if (packageList.currentIndex === index) { if (packageList.currentIndex === index) {
packageList.currentIndex = -1; packageList.currentIndex = -1;
} else { } else {

View File

@ -47,7 +47,7 @@ Item {
property int origX: 0 property int origX: 0
property int origY: 0 property int origY: 0
property real origOpacity: 1 property real origOpacity: 1
property bool isClicked: false // property bool isClicked: false
property bool moveAborted: false property bool moveAborted: false
property alias goBackAnim: goBackAnimation property alias goBackAnim: goBackAnimation
property int goBackDuration: 500 property int goBackDuration: 500
@ -147,50 +147,50 @@ Item {
opacity: 0.7 opacity: 0.7
} }
MouseArea { TapHandler {
anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.NoButton
acceptedButtons: Qt.LeftButton | Qt.RightButton
drag.target: draggable ? parent : undefined
drag.axis: Drag.XAndYAxis
hoverEnabled: true
onReleased: function(mouse) { onTapped: (p, btn) => {
root.isClicked = mouse.isClick; if (btn === Qt.LeftButton || btn === Qt.NoButton) {
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) {
selected = selectable ? !selected : false; selected = selectable ? !selected : false;
parent.clicked(); parent.clicked();
} else if (mouse.button === Qt.RightButton) { } else if (btn === Qt.RightButton) {
parent.rightClicked(); parent.rightClicked();
} }
} }
onPressAndHold: { onLongPressed: {
parent.rightClicked(); 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 { ParallelAnimation {
id: goBackAnimation id: goBackAnimation

View File

@ -122,8 +122,7 @@ GraphicsBox {
} }
onReleased: { onReleased: {
if (!isClicked) arrangeCards();
arrangeCards();
} }
} }
} }

View File

@ -27,10 +27,9 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
MouseArea { DragHandler {
anchors.fill: parent xAxis.enabled: true
drag.target: parent yAxis.enabled: true
drag.axis: Drag.XAndYAxis
} }
function close() function close()

View File

@ -249,7 +249,7 @@ Item {
if (data.length === 0) { if (data.length === 0) {
root.markArea.removeMark(areaName); root.markArea.removeMark(areaName);
} else { } else {
root.markArea.setMark(areaName, data.length); root.markArea.setMark(areaName, data.length.toString());
} }
} }
@ -318,12 +318,9 @@ Item {
} }
} }
MouseArea { TapHandler {
anchors.fill: parent onTapped: {
propagateComposedEvents: true
onClicked: (mouse) => {
if (parent.state != "candidate" || !parent.selectable) { if (parent.state != "candidate" || !parent.selectable) {
mouse.accepted = false;
return; return;
} }
parent.selected = !parent.selected; parent.selected = !parent.selected;
@ -339,6 +336,18 @@ Item {
anchors.rightMargin: -4 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 { Image {
visible: root.state === "candidate" && !selectable && !selected visible: root.state === "candidate" && !selectable && !selected
source: SkinBank.PHOTO_DIR + "disable" source: SkinBank.PHOTO_DIR + "disable"

View File

@ -39,9 +39,9 @@ Item {
textFormat: Text.RichText textFormat: Text.RichText
} }
MouseArea { TapHandler {
anchors.fill: parent enabled: root.parent.state != "candidate" || !root.parent.selectable
onClicked: { onTapped: {
let data = JSON.parse(Backend.callLuaFunction("GetPile", [root.parent.playerid, mark_name])); let data = JSON.parse(Backend.callLuaFunction("GetPile", [root.parent.playerid, mark_name]));
data = data.filter((e) => e !== -1); data = data.filter((e) => e !== -1);
if (data.length === 0) if (data.length === 0)

View File

@ -16,9 +16,8 @@ Image {
source: SkinBank.ROLE_DIR + value source: SkinBank.ROLE_DIR + value
visible: root.value == "unknown" visible: root.value == "unknown"
MouseArea { TapHandler {
anchors.fill: parent onTapped: optionPopupBox.visible = true;
onClicked: optionPopupBox.visible = true;
} }
} }
@ -33,9 +32,8 @@ Image {
Image { Image {
source: SkinBank.ROLE_DIR + modelData source: SkinBank.ROLE_DIR + modelData
MouseArea { TapHandler {
anchors.fill: parent onTapped: {
onClicked: {
optionPopupBox.visible = false; optionPopupBox.visible = false;
assumptionBox.value = modelData; assumptionBox.value = modelData;
} }

View File

@ -0,0 +1,5 @@
import QtQuick
Item {
id: root
}

View File

@ -51,10 +51,8 @@ Item {
} }
} }
MouseArea { TapHandler {
id: mouseArea
anchors.fill: parent
enabled: root.type === "active" && root.enabled enabled: root.type === "active" && root.enabled
onClicked: parent.pressed = !parent.pressed; onTapped: parent.pressed = !parent.pressed;
} }
} }

View File

@ -160,9 +160,8 @@ Item {
text: errDialog.txt text: errDialog.txt
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
MouseArea { TapHandler {
anchors.fill: parent onTapped: errDialog.close();
onClicked: errDialog.close();
} }
} }
} }