修一大堆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

@ -29,7 +29,7 @@
android:label="FreeKill"
android:launchMode="singleTop"
android:screenOrientation="sensorLandscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:theme="@style/FkTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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)
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

View File

@ -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]],

View File

@ -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 => {

View File

@ -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(

View File

@ -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 {

View File

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

View File

@ -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,48 +147,48 @@ 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;
onTapped: (p, btn) => {
if (btn === Qt.LeftButton || btn === Qt.NoButton) {
selected = selectable ? !selected : false;
parent.clicked();
} else if (btn === Qt.RightButton) {
parent.rightClicked();
}
}
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();
}
}
onEntered: {
parent.entered();
if (draggable) {
HoverHandler {
id: hover
onHoveredChanged: {
if (!draggable) return;
if (hovered) {
glow.visible = true;
root.z++;
}
}
onExited: {
parent.exited();
if (draggable) {
} else {
glow.visible = false;
root.z--;
}
}
onClicked: (mouse) => {
if (mouse.button == Qt.LeftButton) {
selected = selectable ? !selected : false;
parent.clicked();
} else if (mouse.button === Qt.RightButton) {
parent.rightClicked();
}
}
onPressAndHold: {
parent.rightClicked();
}
}
ParallelAnimation {

View File

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

View File

@ -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()

View File

@ -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"

View File

@ -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)

View File

@ -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;
}

View File

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

View File

@ -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;
}
}

View File

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