2023-04-09 13:35:35 +08:00
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
2023-07-02 20:39:42 +08:00
|
|
|
|
import QtQuick.Dialogs
|
2022-09-14 13:01:10 +08:00
|
|
|
|
import QtQuick.Layouts
|
2023-01-29 18:11:41 +08:00
|
|
|
|
import QtMultimedia
|
2023-05-19 10:08:36 +08:00
|
|
|
|
import Fk
|
|
|
|
|
import Fk.Common
|
|
|
|
|
import Fk.RoomElement
|
2023-12-06 21:07:35 +08:00
|
|
|
|
import Fk.PhotoElement as PhotoElement
|
2022-03-23 19:40:28 +08:00
|
|
|
|
import "RoomLogic.js" as Logic
|
2022-12-20 12:51:54 +08:00
|
|
|
|
|
2022-03-01 13:18:00 +08:00
|
|
|
|
Item {
|
2022-04-30 15:27:56 +08:00
|
|
|
|
id: roomScene
|
|
|
|
|
|
|
|
|
|
property int playerNum: 0
|
2023-04-27 14:15:08 +08:00
|
|
|
|
// property var dashboardModel
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
property bool isOwner: false
|
|
|
|
|
property bool isStarted: false
|
2023-06-04 19:31:44 +08:00
|
|
|
|
property bool isFull: false
|
|
|
|
|
property bool isAllReady: false
|
|
|
|
|
property bool isReady: false
|
2023-08-11 03:19:59 +08:00
|
|
|
|
property bool canKickOwner: false
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
property alias popupBox: popupBox
|
2023-03-01 21:41:16 +08:00
|
|
|
|
property alias manualBox: manualBox
|
2023-02-21 13:44:24 +08:00
|
|
|
|
property alias bigAnim: bigAnim
|
2022-04-30 15:27:56 +08:00
|
|
|
|
property alias promptText: prompt.text
|
2023-06-16 10:58:28 +08:00
|
|
|
|
property var currentPrompt
|
2022-12-18 12:52:52 +08:00
|
|
|
|
property alias okCancel: okCancel
|
|
|
|
|
property alias okButton: okButton
|
|
|
|
|
property alias cancelButton: cancelButton
|
|
|
|
|
property alias dynamicCardArea: dynamicCardArea
|
2023-01-29 18:11:41 +08:00
|
|
|
|
property alias tableCards: tablePile.cards
|
2023-04-05 00:49:54 +08:00
|
|
|
|
property alias dashboard: dashboard
|
2023-04-27 14:15:08 +08:00
|
|
|
|
property alias drawPile: drawPile
|
2023-04-08 20:45:55 +08:00
|
|
|
|
property alias skillInteraction: skillInteraction
|
2023-04-20 00:19:48 +08:00
|
|
|
|
property alias miscStatus: miscStatus
|
2023-12-06 21:07:35 +08:00
|
|
|
|
property alias banner: banner
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
property var selected_targets: []
|
2022-12-18 21:19:35 +08:00
|
|
|
|
property string responding_card
|
|
|
|
|
property bool respond_play: false
|
2023-04-20 00:19:48 +08:00
|
|
|
|
property bool autoPending: false
|
2023-01-16 19:13:07 +08:00
|
|
|
|
property var extra_data: ({})
|
2023-07-16 19:18:43 +08:00
|
|
|
|
property var skippedUseEventId: []
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
2023-08-01 21:01:01 +08:00
|
|
|
|
property real replayerSpeed
|
|
|
|
|
property int replayerElapsed
|
|
|
|
|
property int replayerDuration
|
|
|
|
|
|
2022-05-01 18:37:13 +08:00
|
|
|
|
Image {
|
2023-02-15 19:54:35 +08:00
|
|
|
|
source: config.roomBg
|
2022-05-01 18:37:13 +08:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
2022-05-01 18:37:13 +08:00
|
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
|
MediaPlayer {
|
|
|
|
|
id: bgm
|
2023-02-15 19:54:35 +08:00
|
|
|
|
source: config.bgmFile
|
2023-02-26 16:51:29 +08:00
|
|
|
|
|
2023-09-19 14:27:54 +08:00
|
|
|
|
loops: MediaPlayer.Infinite
|
2023-01-29 18:11:41 +08:00
|
|
|
|
onPlaybackStateChanged: {
|
|
|
|
|
if (playbackState == MediaPlayer.StoppedState && roomScene.isStarted)
|
|
|
|
|
play();
|
|
|
|
|
}
|
2023-04-28 18:24:31 +08:00
|
|
|
|
audioOutput: AudioOutput {
|
|
|
|
|
volume: config.bgmVolume / 100
|
|
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onIsStartedChanged: {
|
|
|
|
|
if (isStarted) {
|
2023-12-06 21:07:35 +08:00
|
|
|
|
bgm.play();
|
2023-08-11 03:19:59 +08:00
|
|
|
|
canKickOwner = false;
|
|
|
|
|
kickOwnerTimer.stop();
|
2023-01-29 18:11:41 +08:00
|
|
|
|
} else {
|
2023-12-06 21:07:35 +08:00
|
|
|
|
bgm.stop();
|
2023-01-29 18:11:41 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
Button {
|
2023-07-02 20:39:42 +08:00
|
|
|
|
id: menuButton
|
2022-04-30 15:27:56 +08:00
|
|
|
|
anchors.top: parent.top
|
2023-12-09 21:57:47 +08:00
|
|
|
|
anchors.topMargin: 12
|
2022-04-30 15:27:56 +08:00
|
|
|
|
anchors.right: parent.right
|
2023-12-09 23:25:26 +08:00
|
|
|
|
anchors.rightMargin: 12
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Menu")
|
2023-07-02 20:39:42 +08:00
|
|
|
|
onClicked: {
|
2023-12-09 21:57:47 +08:00
|
|
|
|
if (menuContainer.visible){
|
|
|
|
|
menuContainer.close();
|
|
|
|
|
} else {
|
|
|
|
|
menuContainer.open();
|
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
}
|
2023-07-02 20:47:10 +08:00
|
|
|
|
|
2023-12-09 21:57:47 +08:00
|
|
|
|
Menu {
|
|
|
|
|
id: menuContainer
|
|
|
|
|
y: menuButton.height - 12
|
2023-12-09 23:25:26 +08:00
|
|
|
|
width: 100
|
2023-07-02 20:47:10 +08:00
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
MenuItem {
|
|
|
|
|
id: quitButton
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Quit")
|
2023-12-09 23:25:26 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
if (config.replaying) {
|
|
|
|
|
Backend.controlReplayer("shutdown");
|
|
|
|
|
mainStack.pop();
|
|
|
|
|
} else if (config.observing) {
|
|
|
|
|
ClientInstance.notifyServer("QuitRoom", "[]");
|
|
|
|
|
} else {
|
|
|
|
|
quitDialog.open();
|
2023-07-02 22:43:56 +08:00
|
|
|
|
}
|
2023-07-02 20:47:10 +08:00
|
|
|
|
}
|
2023-12-09 23:25:26 +08:00
|
|
|
|
}
|
2023-07-02 20:47:10 +08:00
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
MenuItem {
|
|
|
|
|
id: surrenderButton
|
|
|
|
|
enabled: !config.observing && !config.replaying
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Surrender")
|
2023-12-09 23:25:26 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
if (isStarted && !getPhoto(Self.id).dead) {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const surrenderCheck =
|
|
|
|
|
lcall('CheckSurrenderAvailable', miscStatus.playedTime);
|
2023-12-09 23:25:26 +08:00
|
|
|
|
if (!surrenderCheck.length) {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
surrenderDialog.informativeText =
|
|
|
|
|
luatr('Surrender is disabled in this mode');
|
2023-12-09 23:25:26 +08:00
|
|
|
|
} else {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
surrenderDialog.informativeText = surrenderCheck
|
|
|
|
|
.map(str => `${luatr(str.text)}(${str.passed ? '√' : '×'})`)
|
|
|
|
|
.join('<br>');
|
2023-07-02 20:47:10 +08:00
|
|
|
|
}
|
2023-12-09 23:25:26 +08:00
|
|
|
|
surrenderDialog.open();
|
2023-07-02 20:47:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-09 23:25:26 +08:00
|
|
|
|
}
|
2023-12-09 21:57:47 +08:00
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
MenuItem {
|
|
|
|
|
id: volumeButton
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Audio Settings")
|
2023-12-09 23:25:26 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
volumeDialog.open();
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
2023-07-02 20:47:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Button {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Add Robot")
|
2023-06-04 19:31:44 +08:00
|
|
|
|
visible: isOwner && !isStarted && !isFull
|
2022-04-30 15:27:56 +08:00
|
|
|
|
anchors.centerIn: parent
|
2023-08-27 20:21:37 +08:00
|
|
|
|
enabled: config.serverEnableBot
|
2022-04-30 15:27:56 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
ClientInstance.notifyServer("AddRobot", "[]");
|
2022-03-01 13:18:00 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
2023-06-04 19:31:44 +08:00
|
|
|
|
Button {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Start Game")
|
2023-06-04 19:31:44 +08:00
|
|
|
|
visible: isOwner && !isStarted && isFull
|
|
|
|
|
enabled: isAllReady
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
onClicked: {
|
|
|
|
|
ClientInstance.notifyServer("StartGame", "[]");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Timer {
|
|
|
|
|
id: opTimer
|
|
|
|
|
interval: 1000
|
|
|
|
|
}
|
|
|
|
|
Button {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: isReady ? luatr("Cancel Ready") : luatr("Ready")
|
2023-06-04 19:31:44 +08:00
|
|
|
|
visible: !isOwner && !isStarted
|
|
|
|
|
enabled: !opTimer.running
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
onClicked: {
|
|
|
|
|
opTimer.start();
|
|
|
|
|
ClientInstance.notifyServer("Ready", "");
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-11 03:19:59 +08:00
|
|
|
|
|
|
|
|
|
Button {
|
|
|
|
|
id: kickOwner
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
y: parent.height / 2 + 30
|
|
|
|
|
text: "踢出房主"
|
|
|
|
|
visible: canKickOwner && !isStarted && isFull && !isOwner
|
|
|
|
|
onClicked: {
|
|
|
|
|
for (let i = 0; i < photoModel.count; i++) {
|
|
|
|
|
let item = photoModel.get(i);
|
|
|
|
|
if (item.isOwner) {
|
|
|
|
|
ClientInstance.notifyServer("KickPlayer", item.id.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
|
id: kickOwnerTimer
|
|
|
|
|
interval: 15000
|
|
|
|
|
onTriggered: {
|
|
|
|
|
canKickOwner = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onIsAllReadyChanged: {
|
|
|
|
|
if (!isAllReady) {
|
|
|
|
|
canKickOwner = false;
|
|
|
|
|
kickOwnerTimer.stop();
|
|
|
|
|
} else {
|
|
|
|
|
kickOwnerTimer.start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-04 20:00:35 +08:00
|
|
|
|
Rectangle {
|
2023-08-09 22:25:15 +08:00
|
|
|
|
x: parent.width / 2 + 60
|
|
|
|
|
y: parent.height / 2 - 30
|
2023-06-04 20:00:35 +08:00
|
|
|
|
color: "snow"
|
|
|
|
|
opacity: 0.8
|
|
|
|
|
radius: 6
|
|
|
|
|
visible: !isStarted
|
2023-08-09 22:25:15 +08:00
|
|
|
|
width: 280
|
|
|
|
|
height: 280
|
2023-06-04 20:00:35 +08:00
|
|
|
|
|
2023-08-09 22:25:15 +08:00
|
|
|
|
Flickable {
|
|
|
|
|
id: flickableContainer
|
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: 10
|
|
|
|
|
flickableDirection: Flickable.VerticalFlick
|
|
|
|
|
width: parent.width - 10
|
|
|
|
|
height: parent.height - 10
|
|
|
|
|
contentHeight: roominfo.height
|
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
id: roominfo
|
|
|
|
|
font.pixelSize: 16
|
|
|
|
|
width: parent.width
|
|
|
|
|
wrapMode: TextEdit.WordWrap
|
|
|
|
|
Component.onCompleted: {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const data = lcall("GetRoomConfig");
|
|
|
|
|
let cardpack = lcall("GetAllCardPack");
|
2023-08-09 22:25:15 +08:00
|
|
|
|
cardpack = cardpack.filter(p => !data.disabledPack.includes(p));
|
|
|
|
|
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text = luatr("GameMode") + luatr(data.gameMode) + "<br />"
|
|
|
|
|
+ luatr("LuckCardNum") + "<b>" + data.luckTime + "</b><br />"
|
|
|
|
|
+ luatr("ResponseTime") + "<b>" + config.roomTimeout + "</b><br />"
|
|
|
|
|
+ luatr("GeneralBoxNum") + "<b>" + data.generalNum + "</b>"
|
|
|
|
|
+ (data.enableFreeAssign ? "<br />" + luatr("IncludeFreeAssign")
|
|
|
|
|
: "")
|
|
|
|
|
+ (data.enableDeputy ? " " + luatr("IncludeDeputy") : "")
|
|
|
|
|
+ '<br />' + luatr('CardPackages') + cardpack.map(e => {
|
|
|
|
|
let ret = luatr(e);
|
|
|
|
|
// TODO: 这种东西最好还是变量名规范化= =
|
|
|
|
|
if (ret.search(/特殊牌|衍生牌/) === -1) {
|
2023-08-09 22:25:15 +08:00
|
|
|
|
ret = "<b>" + ret + "</b>";
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
2024-01-25 03:23:29 +08:00
|
|
|
|
}).join(',');
|
2023-08-09 22:25:15 +08:00
|
|
|
|
}
|
2023-06-04 20:00:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
states: [
|
|
|
|
|
State { name: "notactive" }, // Normal status
|
|
|
|
|
State { name: "playing" }, // Playing cards in playing phase
|
|
|
|
|
State { name: "responding" }, // all requests need to operate dashboard
|
|
|
|
|
State { name: "replying" } // requests only operate a popup window
|
|
|
|
|
]
|
|
|
|
|
state: "notactive"
|
|
|
|
|
transitions: [
|
|
|
|
|
Transition {
|
|
|
|
|
from: "*"; to: "notactive"
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
2023-05-19 10:08:36 +08:00
|
|
|
|
skillInteraction.sourceComponent = undefined;
|
2022-04-30 15:27:56 +08:00
|
|
|
|
promptText = "";
|
2023-06-16 10:58:28 +08:00
|
|
|
|
currentPrompt = "";
|
2022-04-30 15:27:56 +08:00
|
|
|
|
progress.visible = false;
|
|
|
|
|
okCancel.visible = false;
|
|
|
|
|
endPhaseButton.visible = false;
|
2022-12-20 21:15:49 +08:00
|
|
|
|
respond_play = false;
|
2023-01-29 18:11:41 +08:00
|
|
|
|
extra_data = {};
|
2023-04-27 14:15:08 +08:00
|
|
|
|
mainWindow.pending_message = [];
|
|
|
|
|
mainWindow.is_pending = false;
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
if (dashboard.pending_skill !== "")
|
|
|
|
|
dashboard.stopPending();
|
2023-06-23 22:18:11 +08:00
|
|
|
|
dashboard.updateHandcards();
|
2022-09-15 11:17:13 +08:00
|
|
|
|
dashboard.disableAllCards();
|
|
|
|
|
dashboard.disableSkills();
|
2023-01-29 18:11:41 +08:00
|
|
|
|
dashboard.retractAllPiles();
|
2022-04-30 15:27:56 +08:00
|
|
|
|
selected_targets = [];
|
2023-08-13 15:05:45 +08:00
|
|
|
|
autoPending = false;
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
if (popupBox.item != null) {
|
|
|
|
|
popupBox.item.finished();
|
2023-02-26 16:51:29 +08:00
|
|
|
|
}
|
2022-04-03 06:41:55 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Transition {
|
|
|
|
|
from: "*"; to: "playing"
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
2023-05-19 10:08:36 +08:00
|
|
|
|
skillInteraction.sourceComponent = undefined;
|
2023-06-23 22:18:11 +08:00
|
|
|
|
dashboard.updateHandcards();
|
2022-04-30 15:27:56 +08:00
|
|
|
|
dashboard.enableCards();
|
2022-09-14 13:01:10 +08:00
|
|
|
|
dashboard.enableSkills();
|
2022-04-30 15:27:56 +08:00
|
|
|
|
progress.visible = true;
|
|
|
|
|
okCancel.visible = true;
|
2023-08-13 15:05:45 +08:00
|
|
|
|
autoPending = false;
|
2022-04-30 15:27:56 +08:00
|
|
|
|
endPhaseButton.visible = true;
|
2022-12-20 21:15:49 +08:00
|
|
|
|
respond_play = false;
|
2022-03-23 19:40:28 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Transition {
|
|
|
|
|
from: "*"; to: "responding"
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
2023-05-19 10:08:36 +08:00
|
|
|
|
skillInteraction.sourceComponent = undefined;
|
2023-06-23 22:18:11 +08:00
|
|
|
|
dashboard.updateHandcards();
|
2022-12-18 21:19:35 +08:00
|
|
|
|
dashboard.enableCards(responding_card);
|
2023-04-30 18:55:59 +08:00
|
|
|
|
dashboard.enableSkills(responding_card, respond_play);
|
2023-04-20 00:19:48 +08:00
|
|
|
|
autoPending = false;
|
2022-04-30 15:27:56 +08:00
|
|
|
|
progress.visible = true;
|
|
|
|
|
okCancel.visible = true;
|
2022-03-23 19:40:28 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
Transition {
|
|
|
|
|
from: "*"; to: "replying"
|
|
|
|
|
ScriptAction {
|
|
|
|
|
script: {
|
2023-05-19 10:08:36 +08:00
|
|
|
|
skillInteraction.sourceComponent = undefined;
|
2023-06-23 22:18:11 +08:00
|
|
|
|
dashboard.updateHandcards();
|
2022-09-14 13:01:10 +08:00
|
|
|
|
dashboard.disableAllCards();
|
|
|
|
|
dashboard.disableSkills();
|
2022-04-30 15:27:56 +08:00
|
|
|
|
progress.visible = true;
|
2022-12-20 21:15:49 +08:00
|
|
|
|
respond_play = false;
|
2023-08-13 15:05:45 +08:00
|
|
|
|
autoPending = false;
|
2023-01-29 18:11:41 +08:00
|
|
|
|
roomScene.okCancel.visible = false;
|
|
|
|
|
roomScene.okButton.enabled = false;
|
|
|
|
|
roomScene.cancelButton.enabled = false;
|
2022-03-23 19:40:28 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
/* Layout:
|
|
|
|
|
* +---------------------+
|
|
|
|
|
* | Photos, get more |
|
|
|
|
|
* | in arrangePhotos() |
|
|
|
|
|
* | tablePile |
|
|
|
|
|
* | progress,prompt,btn |
|
|
|
|
|
* +---------------------+
|
|
|
|
|
* | dashboard |
|
|
|
|
|
* +---------------------+
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
|
id: photoModel
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: roomArea
|
|
|
|
|
width: roomScene.width
|
2022-09-14 13:01:10 +08:00
|
|
|
|
height: roomScene.height - dashboard.height + 20
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
|
id: photos
|
|
|
|
|
model: photoModel
|
|
|
|
|
Photo {
|
|
|
|
|
playerid: model.id
|
|
|
|
|
general: model.general
|
2023-06-04 19:31:44 +08:00
|
|
|
|
avatar: model.avatar
|
2023-04-19 14:07:16 +08:00
|
|
|
|
deputyGeneral: model.deputyGeneral
|
2022-04-30 15:27:56 +08:00
|
|
|
|
screenName: model.screenName
|
|
|
|
|
role: model.role
|
|
|
|
|
kingdom: model.kingdom
|
|
|
|
|
netstate: model.netstate
|
|
|
|
|
maxHp: model.maxHp
|
|
|
|
|
hp: model.hp
|
2023-04-13 20:17:39 +08:00
|
|
|
|
shield: model.shield
|
2022-04-30 15:27:56 +08:00
|
|
|
|
seatNumber: model.seatNumber
|
2022-12-20 12:51:54 +08:00
|
|
|
|
dead: model.dead
|
2022-04-30 15:27:56 +08:00
|
|
|
|
dying: model.dying
|
|
|
|
|
faceup: model.faceup
|
|
|
|
|
chained: model.chained
|
|
|
|
|
drank: model.drank
|
2023-12-10 18:55:16 +08:00
|
|
|
|
rest: model.rest
|
2022-04-30 15:27:56 +08:00
|
|
|
|
isOwner: model.isOwner
|
2023-06-04 19:31:44 +08:00
|
|
|
|
ready: model.ready
|
2023-07-02 20:39:42 +08:00
|
|
|
|
surrendered: model.surrendered
|
2023-08-13 02:25:04 +08:00
|
|
|
|
sealedSlots: JSON.parse(model.sealedSlots)
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
onSelectedChanged: {
|
|
|
|
|
Logic.updateSelectedTargets(playerid, selected);
|
|
|
|
|
}
|
2023-04-27 14:15:08 +08:00
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
if (index === 0) dashboard.self = this;
|
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
onWidthChanged: Logic.arrangePhotos();
|
|
|
|
|
onHeightChanged: Logic.arrangePhotos();
|
2022-04-02 15:11:13 +08:00
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
InvisibleCardArea {
|
|
|
|
|
id: drawPile
|
|
|
|
|
x: parent.width / 2
|
|
|
|
|
y: roomScene.height / 2
|
|
|
|
|
}
|
2022-04-02 15:11:13 +08:00
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
TablePile {
|
|
|
|
|
id: tablePile
|
|
|
|
|
width: parent.width * 0.6
|
|
|
|
|
height: 150
|
|
|
|
|
x: parent.width * 0.2
|
2023-01-29 18:11:41 +08:00
|
|
|
|
y: parent.height * 0.6 + 10
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-18 12:52:52 +08:00
|
|
|
|
Item {
|
|
|
|
|
id: dashboardBtn
|
|
|
|
|
width: childrenRect.width
|
|
|
|
|
height: childrenRect.height
|
|
|
|
|
anchors.bottom: parent.bottom
|
2023-07-01 04:12:19 +08:00
|
|
|
|
anchors.bottomMargin: 8
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.leftMargin: 8
|
2022-12-18 12:52:52 +08:00
|
|
|
|
ColumnLayout {
|
2023-10-03 00:19:12 +08:00
|
|
|
|
MetroButton {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Choose one handcard")
|
2023-10-03 00:19:12 +08:00
|
|
|
|
textFont.pixelSize: 28
|
|
|
|
|
visible: {
|
|
|
|
|
if (dashboard.handcardArea.length <= 15) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-01-25 03:23:29 +08:00
|
|
|
|
if (roomScene.state === "notactive"
|
|
|
|
|
|| roomScene.state === "replying") {
|
2023-10-03 00:19:12 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
onClicked: roomScene.startCheat("../RoomElement/ChooseHandcard");
|
|
|
|
|
}
|
2022-12-18 12:52:52 +08:00
|
|
|
|
MetroButton {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Revert Selection")
|
2023-07-01 04:12:19 +08:00
|
|
|
|
textFont.pixelSize: 28
|
2023-06-24 14:48:49 +08:00
|
|
|
|
enabled: dashboard.pending_skill !== ""
|
|
|
|
|
onClicked: dashboard.revertSelection();
|
2022-12-18 12:52:52 +08:00
|
|
|
|
}
|
2023-06-24 14:48:49 +08:00
|
|
|
|
// MetroButton {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
// text: luatr("Trust")
|
2023-06-24 14:48:49 +08:00
|
|
|
|
// }
|
2022-12-18 12:52:52 +08:00
|
|
|
|
MetroButton {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Sort Cards")
|
2023-07-01 04:12:19 +08:00
|
|
|
|
textFont.pixelSize: 28
|
2023-07-02 20:39:42 +08:00
|
|
|
|
onClicked: Logic.resortHandcards();
|
2022-12-18 12:52:52 +08:00
|
|
|
|
}
|
|
|
|
|
MetroButton {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Chat")
|
2023-07-01 04:12:19 +08:00
|
|
|
|
textFont.pixelSize: 28
|
2022-12-18 12:52:52 +08:00
|
|
|
|
onClicked: roomDrawer.open();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Dashboard {
|
|
|
|
|
id: dashboard
|
2022-12-18 12:52:52 +08:00
|
|
|
|
width: roomScene.width - dashboardBtn.width
|
2022-04-30 15:27:56 +08:00
|
|
|
|
anchors.top: roomArea.bottom
|
2022-12-18 12:52:52 +08:00
|
|
|
|
anchors.left: dashboardBtn.right
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
|
onCardSelected: function(card) {
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Logic.enableTargets(card);
|
2024-01-25 03:23:29 +08:00
|
|
|
|
if (typeof card === "number" && card !== -1
|
|
|
|
|
&& roomScene.state === "playing"
|
|
|
|
|
&& lcall("GetPlayerHandcards", Self.id).includes(card)) {
|
2023-11-07 21:31:07 +08:00
|
|
|
|
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const skills = lcall("GetCardSpecialSkills", card);
|
|
|
|
|
if (lcall("CanUseCard", card, Self.id,
|
|
|
|
|
JSON.stringify(roomScene.extra_data))) {
|
2023-05-28 12:22:43 +08:00
|
|
|
|
skills.unshift("_normal_use");
|
|
|
|
|
}
|
2023-03-20 20:15:24 +08:00
|
|
|
|
specialCardSkills.model = skills;
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const skillName = lcall("GetCardSkill", card);
|
|
|
|
|
const prompt = lcall("ActiveSkillPrompt", skillName, card,
|
|
|
|
|
selected_targets);
|
2023-12-09 21:57:47 +08:00
|
|
|
|
if (prompt !== "") {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
roomScene.setPrompt(Util.processPrompt(prompt));
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
2023-03-20 20:15:24 +08:00
|
|
|
|
} else {
|
|
|
|
|
specialCardSkills.model = [];
|
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-01 21:01:01 +08:00
|
|
|
|
Rectangle {
|
|
|
|
|
id: replayControls
|
|
|
|
|
visible: config.replaying
|
|
|
|
|
anchors.bottom: dashboard.top
|
|
|
|
|
anchors.bottomMargin: -60
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
width: childrenRect.width + 8
|
|
|
|
|
height: childrenRect.height + 8
|
|
|
|
|
|
|
|
|
|
color: "#88EEEEEE"
|
|
|
|
|
radius: 4
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
x: 4; y: 4
|
|
|
|
|
Text {
|
|
|
|
|
font.pixelSize: 20
|
|
|
|
|
font.bold: true
|
|
|
|
|
text: {
|
|
|
|
|
const elapsedMin = Math.floor(replayerElapsed / 60);
|
|
|
|
|
const elapsedSec = replayerElapsed % 60;
|
|
|
|
|
const totalMin = Math.floor(replayerDuration / 60);
|
|
|
|
|
const totalSec = replayerDuration % 60;
|
|
|
|
|
|
2024-01-25 03:23:29 +08:00
|
|
|
|
return elapsedMin.toString() + ":" + elapsedSec + "/" + totalMin
|
|
|
|
|
+ ":" + totalSec;
|
2023-08-01 21:01:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Switch {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Speed Resume")
|
2023-08-01 21:01:01 +08:00
|
|
|
|
checked: false
|
|
|
|
|
onCheckedChanged: Backend.controlReplayer("uniform");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Button {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Speed Down")
|
2023-08-01 21:01:01 +08:00
|
|
|
|
onClicked: Backend.controlReplayer("slowdown");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
font.pixelSize: 20
|
|
|
|
|
font.bold: true
|
|
|
|
|
text: "x" + replayerSpeed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Button {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Speed Up")
|
2023-08-01 21:01:01 +08:00
|
|
|
|
onClicked: Backend.controlReplayer("speedup");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Button {
|
|
|
|
|
property bool running: true
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr(running ? "Pause" : "Resume")
|
2023-08-01 21:01:01 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
running = !running;
|
|
|
|
|
Backend.controlReplayer("toggle");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Item {
|
|
|
|
|
id: controls
|
|
|
|
|
anchors.bottom: dashboard.top
|
2022-09-14 13:01:10 +08:00
|
|
|
|
anchors.bottomMargin: -60
|
2022-04-30 15:27:56 +08:00
|
|
|
|
width: roomScene.width
|
|
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
id: prompt
|
|
|
|
|
visible: progress.visible
|
2023-04-04 15:59:21 +08:00
|
|
|
|
anchors.bottom: progress.bottom
|
2022-12-18 12:52:52 +08:00
|
|
|
|
z: 1
|
2023-04-04 15:59:21 +08:00
|
|
|
|
color: "#F0E5DA"
|
|
|
|
|
font.pixelSize: 16
|
|
|
|
|
font.family: fontLibian.name
|
|
|
|
|
style: Text.Outline
|
|
|
|
|
styleColor: "#3D2D1C"
|
|
|
|
|
textFormat: TextEdit.RichText
|
2022-04-30 15:27:56 +08:00
|
|
|
|
anchors.horizontalCenter: progress.horizontalCenter
|
2022-04-02 15:11:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
ProgressBar {
|
|
|
|
|
id: progress
|
|
|
|
|
width: parent.width * 0.6
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
anchors.bottom: okCancel.top
|
2022-12-18 12:52:52 +08:00
|
|
|
|
anchors.bottomMargin: 4
|
2022-04-30 15:27:56 +08:00
|
|
|
|
from: 0.0
|
|
|
|
|
to: 100.0
|
|
|
|
|
|
|
|
|
|
visible: false
|
2022-12-18 12:52:52 +08:00
|
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
implicitWidth: 200
|
2023-04-04 15:59:21 +08:00
|
|
|
|
implicitHeight: 12
|
2022-12-18 12:52:52 +08:00
|
|
|
|
color: "black"
|
2023-04-04 15:59:21 +08:00
|
|
|
|
radius: 6
|
2022-12-18 12:52:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contentItem: Item {
|
2023-04-04 15:59:21 +08:00
|
|
|
|
implicitWidth: 196
|
|
|
|
|
implicitHeight: 10
|
2022-12-18 12:52:52 +08:00
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
width: progress.visualPosition * parent.width
|
|
|
|
|
height: parent.height
|
2023-04-04 15:59:21 +08:00
|
|
|
|
radius: 6
|
|
|
|
|
gradient: Gradient {
|
|
|
|
|
GradientStop { position: 0.0; color: "orange" }
|
|
|
|
|
GradientStop { position: 0.3; color: "red" }
|
|
|
|
|
GradientStop { position: 0.7; color: "red" }
|
|
|
|
|
GradientStop { position: 1.0; color: "orange" }
|
|
|
|
|
}
|
2022-12-18 12:52:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
NumberAnimation on value {
|
|
|
|
|
running: progress.visible
|
|
|
|
|
from: 100.0
|
|
|
|
|
to: 0.0
|
|
|
|
|
duration: config.roomTimeout * 1000
|
|
|
|
|
|
|
|
|
|
onFinished: {
|
|
|
|
|
roomScene.state = "notactive"
|
2022-03-30 14:14:40 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-30 14:14:40 +08:00
|
|
|
|
|
2023-03-20 20:15:24 +08:00
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: 8
|
|
|
|
|
anchors.right: okCancel.left
|
|
|
|
|
anchors.rightMargin: 20
|
|
|
|
|
color: "#88EEEEEE"
|
|
|
|
|
radius: 8
|
2023-06-16 13:26:02 +08:00
|
|
|
|
visible: {
|
|
|
|
|
if (roomScene.state !== "playing") {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!specialCardSkills) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (specialCardSkills.count > 1) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return (specialCardSkills.model ?? false)
|
|
|
|
|
&& specialCardSkills.model[0] !== "_normal_use"
|
|
|
|
|
}
|
2023-03-20 20:15:24 +08:00
|
|
|
|
width: childrenRect.width
|
|
|
|
|
height: childrenRect.height - 20
|
|
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
|
y: -10
|
|
|
|
|
Repeater {
|
|
|
|
|
id: specialCardSkills
|
|
|
|
|
RadioButton {
|
|
|
|
|
property string orig_text: modelData
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr(modelData)
|
2023-03-20 20:15:24 +08:00
|
|
|
|
checked: index === 0
|
|
|
|
|
onCheckedChanged: {
|
2023-12-09 21:57:47 +08:00
|
|
|
|
roomScene.resetPrompt();
|
|
|
|
|
const card = dashboard.selected_card;
|
|
|
|
|
let prompt = ""
|
2023-03-20 20:15:24 +08:00
|
|
|
|
if (modelData === "_normal_use") {
|
2023-12-09 21:57:47 +08:00
|
|
|
|
Logic.enableTargets(card);
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const skillName = lcall("GetCardSkill", card);
|
|
|
|
|
prompt = lcall("ActiveSkillPrompt", skillName, card,
|
|
|
|
|
selected_targets);
|
2023-03-20 20:15:24 +08:00
|
|
|
|
} else {
|
|
|
|
|
Logic.enableTargets(JSON.stringify({
|
|
|
|
|
skill: modelData,
|
2023-12-09 21:57:47 +08:00
|
|
|
|
subcards: [card],
|
2023-03-20 20:15:24 +08:00
|
|
|
|
}));
|
2024-01-25 03:23:29 +08:00
|
|
|
|
prompt = lcall("ActiveSkillPrompt", modelData, card,
|
|
|
|
|
selected_targets);
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
|
|
|
|
if (prompt !== "") {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
roomScene.setPrompt(Util.processPrompt(prompt));
|
2023-03-20 20:15:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-05 00:49:54 +08:00
|
|
|
|
Loader {
|
|
|
|
|
id: skillInteraction
|
|
|
|
|
visible: dashboard.pending_skill !== ""
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: 8
|
|
|
|
|
anchors.right: okCancel.left
|
|
|
|
|
anchors.rightMargin: 20
|
|
|
|
|
}
|
2023-03-20 20:15:24 +08:00
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Row {
|
|
|
|
|
id: okCancel
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.horizontalCenter: progress.horizontalCenter
|
|
|
|
|
spacing: 20
|
|
|
|
|
visible: false
|
|
|
|
|
|
2023-07-16 19:18:43 +08:00
|
|
|
|
Button {
|
|
|
|
|
id: skipNullificationButton
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("SkipNullification")
|
|
|
|
|
visible: !!extra_data.useEventId
|
|
|
|
|
&& !skippedUseEventId.find(id => id === extra_data.useEventId)
|
2023-07-16 19:18:43 +08:00
|
|
|
|
onClicked: {
|
|
|
|
|
skippedUseEventId.push(extra_data.useEventId);
|
|
|
|
|
Logic.doCancelButton();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Button {
|
|
|
|
|
id: okButton
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("OK")
|
2022-04-30 15:27:56 +08:00
|
|
|
|
onClicked: Logic.doOkButton();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Button {
|
|
|
|
|
id: cancelButton
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Cancel")
|
2022-04-30 15:27:56 +08:00
|
|
|
|
onClicked: Logic.doCancelButton();
|
|
|
|
|
}
|
2022-03-30 14:14:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Button {
|
|
|
|
|
id: endPhaseButton
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("End")
|
2022-04-30 15:27:56 +08:00
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: 40
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 30
|
|
|
|
|
visible: false;
|
2022-09-15 11:17:13 +08:00
|
|
|
|
onClicked: Logic.replyToServer("");
|
2022-04-30 15:27:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-21 23:21:28 +08:00
|
|
|
|
// manualBox: same as popupBox, but must be closed manually
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Loader {
|
2023-09-21 23:21:28 +08:00
|
|
|
|
id: manualBox
|
2022-09-14 13:01:10 +08:00
|
|
|
|
z: 999
|
2022-04-30 15:27:56 +08:00
|
|
|
|
onSourceChanged: {
|
|
|
|
|
if (item === null)
|
|
|
|
|
return;
|
2023-09-21 23:21:28 +08:00
|
|
|
|
item.finished.connect(() => sourceComponent = undefined);
|
|
|
|
|
item.widthChanged.connect(() => manualBox.moveToCenter());
|
|
|
|
|
item.heightChanged.connect(() => manualBox.moveToCenter());
|
2022-04-30 15:27:56 +08:00
|
|
|
|
moveToCenter();
|
|
|
|
|
}
|
2023-05-19 10:08:36 +08:00
|
|
|
|
onSourceComponentChanged: sourceChanged();
|
2022-03-24 21:23:42 +08:00
|
|
|
|
|
2023-06-16 13:26:02 +08:00
|
|
|
|
function moveToCenter() {
|
2022-04-30 15:27:56 +08:00
|
|
|
|
item.x = Math.round((roomArea.width - item.width) / 2);
|
|
|
|
|
item.y = Math.round(roomArea.height * 0.67 - item.height / 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-01 21:41:16 +08:00
|
|
|
|
Loader {
|
2023-09-21 23:21:28 +08:00
|
|
|
|
id: popupBox
|
2023-03-01 21:41:16 +08:00
|
|
|
|
z: 999
|
|
|
|
|
onSourceChanged: {
|
|
|
|
|
if (item === null)
|
|
|
|
|
return;
|
2023-09-21 23:21:28 +08:00
|
|
|
|
item.finished.connect(() => {
|
|
|
|
|
sourceComponent = undefined;
|
|
|
|
|
});
|
|
|
|
|
item.widthChanged.connect(() => {
|
|
|
|
|
popupBox.moveToCenter();
|
|
|
|
|
});
|
|
|
|
|
item.heightChanged.connect(() => {
|
|
|
|
|
popupBox.moveToCenter();
|
|
|
|
|
});
|
2023-03-01 21:41:16 +08:00
|
|
|
|
moveToCenter();
|
|
|
|
|
}
|
2023-05-19 10:08:36 +08:00
|
|
|
|
onSourceComponentChanged: sourceChanged();
|
2023-03-01 21:41:16 +08:00
|
|
|
|
|
2023-09-21 23:21:28 +08:00
|
|
|
|
function moveToCenter() {
|
2023-03-01 21:41:16 +08:00
|
|
|
|
item.x = Math.round((roomArea.width - item.width) / 2);
|
|
|
|
|
item.y = Math.round(roomArea.height * 0.67 - item.height / 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-21 13:44:24 +08:00
|
|
|
|
Loader {
|
|
|
|
|
id: bigAnim
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
z: 999
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
|
function activateSkill(skill_name, pressed) {
|
|
|
|
|
if (pressed) {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const data = lcall("GetInteractionOfSkill", skill_name);
|
2023-04-05 00:49:54 +08:00
|
|
|
|
if (data) {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
lcall("SetInteractionDataOfSkill", skill_name, "null");
|
2023-04-05 00:49:54 +08:00
|
|
|
|
switch (data.type) {
|
|
|
|
|
case "combo":
|
2024-01-25 03:23:29 +08:00
|
|
|
|
skillInteraction.sourceComponent =
|
|
|
|
|
Qt.createComponent("../SkillInteraction/SkillCombo.qml");
|
2023-04-05 00:49:54 +08:00
|
|
|
|
skillInteraction.item.skill = skill_name;
|
|
|
|
|
skillInteraction.item.default_choice = data["default"];
|
|
|
|
|
skillInteraction.item.choices = data.choices;
|
2023-06-15 21:19:57 +08:00
|
|
|
|
skillInteraction.item.detailed = data.detailed;
|
2023-07-16 15:29:20 +08:00
|
|
|
|
skillInteraction.item.all_choices = data.all_choices;
|
2023-05-19 10:08:36 +08:00
|
|
|
|
// skillInteraction.item.clicked();
|
2023-04-30 00:52:39 +08:00
|
|
|
|
break;
|
|
|
|
|
case "spin":
|
2024-01-25 03:23:29 +08:00
|
|
|
|
skillInteraction.sourceComponent =
|
|
|
|
|
Qt.createComponent("../SkillInteraction/SkillSpin.qml");
|
2023-04-30 00:52:39 +08:00
|
|
|
|
skillInteraction.item.skill = skill_name;
|
|
|
|
|
skillInteraction.item.from = data.from;
|
|
|
|
|
skillInteraction.item.to = data.to;
|
2023-04-05 00:49:54 +08:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2023-05-19 10:08:36 +08:00
|
|
|
|
skillInteraction.sourceComponent = undefined;
|
2023-04-05 00:49:54 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2023-05-19 10:08:36 +08:00
|
|
|
|
skillInteraction.sourceComponent = undefined;
|
2023-04-05 00:49:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
|
dashboard.startPending(skill_name);
|
|
|
|
|
cancelButton.enabled = true;
|
|
|
|
|
} else {
|
2023-05-19 10:08:36 +08:00
|
|
|
|
skillInteraction.sourceComponent = undefined;
|
2022-09-14 13:01:10 +08:00
|
|
|
|
Logic.doCancelButton();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-18 12:52:52 +08:00
|
|
|
|
Drawer {
|
|
|
|
|
id: roomDrawer
|
2023-12-06 21:07:35 +08:00
|
|
|
|
width: parent.width * 0.36 / mainWindow.scale
|
2023-02-15 19:54:35 +08:00
|
|
|
|
height: parent.height / mainWindow.scale
|
2022-12-18 12:52:52 +08:00
|
|
|
|
dim: false
|
|
|
|
|
clip: true
|
|
|
|
|
dragMargin: 0
|
2023-02-15 19:54:35 +08:00
|
|
|
|
scale: mainWindow.scale
|
|
|
|
|
transformOrigin: Item.TopLeft
|
2023-02-26 16:51:29 +08:00
|
|
|
|
|
2022-12-18 12:52:52 +08:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
SwipeView {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
interactive: false
|
|
|
|
|
currentIndex: drawerBar.currentIndex
|
|
|
|
|
Item {
|
|
|
|
|
LogEdit {
|
|
|
|
|
id: log
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Item {
|
2023-08-01 21:01:01 +08:00
|
|
|
|
visible: !config.replaying
|
2023-12-10 18:55:16 +08:00
|
|
|
|
AvatarChatBox {
|
2022-12-18 12:52:52 +08:00
|
|
|
|
id: chat
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TabBar {
|
|
|
|
|
id: drawerBar
|
|
|
|
|
width: roomDrawer.width
|
|
|
|
|
TabButton {
|
|
|
|
|
width: roomDrawer.width / 2
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Log")
|
2022-12-18 12:52:52 +08:00
|
|
|
|
}
|
|
|
|
|
TabButton {
|
|
|
|
|
width: roomDrawer.width / 2
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Chat")
|
2022-12-18 12:52:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-06 21:07:35 +08:00
|
|
|
|
Popup {
|
2023-02-15 19:54:35 +08:00
|
|
|
|
id: cheatDrawer
|
2023-12-06 21:07:35 +08:00
|
|
|
|
width: realMainWin.width * 0.60
|
|
|
|
|
height: realMainWin.height * 0.8
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
color: "#CC2E2C27"
|
|
|
|
|
radius: 5
|
|
|
|
|
border.color: "#A6967A"
|
|
|
|
|
border.width: 1
|
|
|
|
|
}
|
2023-02-15 19:54:35 +08:00
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: cheatLoader
|
2023-12-06 21:07:35 +08:00
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
width: parent.width / mainWindow.scale
|
|
|
|
|
height: parent.height / mainWindow.scale
|
|
|
|
|
scale: mainWindow.scale
|
|
|
|
|
clip: true
|
2023-02-15 19:54:35 +08:00
|
|
|
|
onSourceChanged: {
|
|
|
|
|
if (item === null)
|
|
|
|
|
return;
|
|
|
|
|
item.finish.connect(() => {
|
|
|
|
|
cheatDrawer.close();
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-05-19 10:08:36 +08:00
|
|
|
|
onSourceComponentChanged: sourceChanged();
|
2023-02-15 19:54:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-18 12:52:52 +08:00
|
|
|
|
Item {
|
|
|
|
|
id: dynamicCardArea
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
MessageDialog {
|
|
|
|
|
id: quitDialog
|
2024-01-25 03:23:29 +08:00
|
|
|
|
title: luatr("Quit")
|
|
|
|
|
informativeText: luatr("Are you sure to quit?")
|
2023-12-09 23:25:26 +08:00
|
|
|
|
buttons: MessageDialog.Ok | MessageDialog.Cancel
|
|
|
|
|
onButtonClicked: function (button) {
|
|
|
|
|
switch (button) {
|
|
|
|
|
case MessageDialog.Ok: {
|
|
|
|
|
ClientInstance.notifyServer("QuitRoom", "[]");
|
|
|
|
|
break;
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
2023-12-09 23:25:26 +08:00
|
|
|
|
case MessageDialog.Cancel: {
|
|
|
|
|
quitDialog.close();
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-09 23:25:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-09 21:57:47 +08:00
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
MessageDialog {
|
|
|
|
|
id: surrenderDialog
|
2024-01-25 03:23:29 +08:00
|
|
|
|
title: luatr("Surrender")
|
2023-12-09 23:25:26 +08:00
|
|
|
|
informativeText: ''
|
|
|
|
|
buttons: MessageDialog.Ok | MessageDialog.Cancel
|
|
|
|
|
onButtonClicked: function (button, role) {
|
|
|
|
|
switch (button) {
|
|
|
|
|
case MessageDialog.Ok: {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const surrenderCheck =
|
|
|
|
|
lcall('CheckSurrenderAvailable', miscStatus.playedTime);
|
|
|
|
|
if (surrenderCheck.length &&
|
|
|
|
|
!surrenderCheck.find(check => !check.passed)) {
|
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
ClientInstance.notifyServer("PushRequest", [
|
|
|
|
|
"surrender", true
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
surrenderDialog.close();
|
|
|
|
|
break;
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
2023-12-09 23:25:26 +08:00
|
|
|
|
case MessageDialog.Cancel: {
|
|
|
|
|
surrenderDialog.close();
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-09 23:25:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-09 21:57:47 +08:00
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
Popup {
|
|
|
|
|
id: volumeDialog
|
|
|
|
|
width: realMainWin.width * 0.5
|
|
|
|
|
height: realMainWin.height * 0.5
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
color: "#EEEEEEEE"
|
|
|
|
|
radius: 5
|
|
|
|
|
border.color: "#A6967A"
|
|
|
|
|
border.width: 1
|
|
|
|
|
}
|
2023-12-09 21:57:47 +08:00
|
|
|
|
|
2023-12-09 23:25:26 +08:00
|
|
|
|
Loader {
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
width: parent.width / mainWindow.scale
|
|
|
|
|
height: parent.height / mainWindow.scale
|
|
|
|
|
scale: mainWindow.scale
|
|
|
|
|
source: AppPath + "/Fk/LobbyElement/AudioSetting.qml"
|
2023-12-09 21:57:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-12 20:06:07 +08:00
|
|
|
|
GlowText {
|
|
|
|
|
anchors.centerIn: dashboard
|
|
|
|
|
visible: Logic.getPhoto(Self.id).rest > 0 && !config.observing
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Resting, don't leave!")
|
2023-12-12 20:06:07 +08:00
|
|
|
|
color: "#DBCC69"
|
|
|
|
|
font.family: fontLibian.name
|
|
|
|
|
font.pixelSize: 28
|
|
|
|
|
glow.color: "#2E200F"
|
|
|
|
|
glow.spread: 0.6
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-06 21:07:35 +08:00
|
|
|
|
Rectangle {
|
|
|
|
|
anchors.fill: dashboard
|
|
|
|
|
visible: config.observing && !config.replaying
|
|
|
|
|
color: "transparent"
|
|
|
|
|
GlowText {
|
|
|
|
|
anchors.centerIn: parent
|
2024-01-25 03:23:29 +08:00
|
|
|
|
text: luatr("Observing ...")
|
2023-12-06 21:07:35 +08:00
|
|
|
|
color: "#4B83CD"
|
|
|
|
|
font.family: fontLi2.name
|
|
|
|
|
font.pixelSize: 48
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 这东西似乎一直不好使啊
|
2022-12-18 12:52:52 +08:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-06 21:07:35 +08:00
|
|
|
|
Shortcut {
|
|
|
|
|
sequence: "T"
|
|
|
|
|
onActivated: {
|
|
|
|
|
easyChat.visible = true;
|
|
|
|
|
easyChatEdit.enabled = true;
|
|
|
|
|
easyChatEdit.forceActiveFocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
2023-04-20 00:19:48 +08:00
|
|
|
|
MiscStatus {
|
|
|
|
|
id: miscStatus
|
2023-07-02 20:39:42 +08:00
|
|
|
|
anchors.right: menuButton.left
|
2023-04-20 00:19:48 +08:00
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
|
anchors.topMargin: 8
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-06 21:07:35 +08:00
|
|
|
|
PhotoElement.MarkArea {
|
|
|
|
|
id: banner
|
|
|
|
|
x: 12; y: 12
|
|
|
|
|
width: (roomScene.width - 175 * 0.75 * 7) / 4 + 175 - 16
|
|
|
|
|
transformOrigin: Item.TopLeft
|
|
|
|
|
scale: 0.75
|
|
|
|
|
bgColor: "#BB838AEA"
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-18 23:26:15 +08:00
|
|
|
|
Danmaku {
|
|
|
|
|
id: danmaku
|
|
|
|
|
width: parent.width
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-20 12:51:54 +08:00
|
|
|
|
Shortcut {
|
|
|
|
|
sequence: "D"
|
|
|
|
|
property bool show_distance: false
|
|
|
|
|
onActivated: {
|
|
|
|
|
show_distance = !show_distance;
|
|
|
|
|
showDistance(show_distance);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-18 12:52:52 +08:00
|
|
|
|
Shortcut {
|
|
|
|
|
sequence: "Esc"
|
|
|
|
|
onActivated: {
|
|
|
|
|
easyChat.visible = false;
|
|
|
|
|
easyChatEdit.enabled = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
|
sequence: "Return"
|
|
|
|
|
enabled: okButton.enabled
|
|
|
|
|
onActivated: Logic.doOkButton();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Shortcut {
|
|
|
|
|
sequence: "Space"
|
|
|
|
|
enabled: cancelButton.enabled
|
|
|
|
|
onActivated: Logic.doCancelButton();
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-20 20:15:24 +08:00
|
|
|
|
function getCurrentCardUseMethod() {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
if (specialCardSkills.count === 1
|
|
|
|
|
&& specialCardSkills.model[0] !== "_normal_use") {
|
2023-05-28 12:22:43 +08:00
|
|
|
|
return specialCardSkills.model[0];
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-20 20:15:24 +08:00
|
|
|
|
for (let i = 1; i < specialCardSkills.count; i++) {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const item = specialCardSkills.itemAt(i);
|
2023-03-20 20:15:24 +08:00
|
|
|
|
if (item.checked) {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const ret = item.orig_text;
|
2023-03-20 20:15:24 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-18 12:52:52 +08:00
|
|
|
|
function addToChat(pid, raw, msg) {
|
2023-04-05 15:13:58 +08:00
|
|
|
|
if (raw.type === 1) return;
|
2023-04-10 21:34:23 +08:00
|
|
|
|
|
2024-01-25 03:23:29 +08:00
|
|
|
|
msg = msg.replace(/\{emoji([0-9]+)\}/g,
|
|
|
|
|
'<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
|
|
|
|
raw.msg = raw.msg.replace(/\{emoji([0-9]+)\}/g,
|
|
|
|
|
'<img src="../../image/emoji/$1.png" height="24" width="24" />');
|
2023-05-19 23:03:39 +08:00
|
|
|
|
|
2023-04-10 21:34:23 +08:00
|
|
|
|
if (raw.msg.startsWith("$")) {
|
2023-04-18 23:26:15 +08:00
|
|
|
|
if (specialChat(pid, raw, raw.msg.slice(1))) return;
|
2023-04-10 21:34:23 +08:00
|
|
|
|
}
|
2023-12-10 18:55:16 +08:00
|
|
|
|
chat.append(msg, raw);
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const photo = Logic.getPhoto(pid);
|
2023-04-18 23:26:15 +08:00
|
|
|
|
if (photo === undefined) {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const user = raw.userName;
|
|
|
|
|
const m = raw.msg;
|
2023-04-18 23:26:15 +08:00
|
|
|
|
danmaku.sendLog(`${user}: ${m}`);
|
2023-02-15 19:54:35 +08:00
|
|
|
|
return;
|
2023-04-18 23:26:15 +08:00
|
|
|
|
}
|
2022-12-18 12:52:52 +08:00
|
|
|
|
photo.chat(raw.msg);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-10 21:34:23 +08:00
|
|
|
|
function specialChat(pid, data, msg) {
|
2023-08-25 21:08:03 +08:00
|
|
|
|
// skill audio: %s%d[%s]
|
2023-04-10 21:34:23 +08:00
|
|
|
|
// death audio: ~%s
|
2023-05-19 23:03:39 +08:00
|
|
|
|
// something special: !%s:...
|
2023-04-10 21:34:23 +08:00
|
|
|
|
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const time = data.time;
|
|
|
|
|
const userName = data.userName;
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const general = luatr(data.general);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
|
2023-05-19 23:03:39 +08:00
|
|
|
|
if (msg.startsWith("!")) {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const splited = msg.split(":");
|
|
|
|
|
const type = splited[0].slice(1);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
switch (type) {
|
2023-05-19 23:03:39 +08:00
|
|
|
|
case "Egg":
|
2023-05-26 20:53:45 +08:00
|
|
|
|
case "GiantEgg":
|
|
|
|
|
case "Shoe":
|
2023-06-24 12:29:08 +08:00
|
|
|
|
case "Wine":
|
2023-05-19 23:03:39 +08:00
|
|
|
|
case "Flower": {
|
|
|
|
|
const fromId = pid;
|
|
|
|
|
const toId = parseInt(splited[1]);
|
|
|
|
|
const component = Qt.createComponent("../ChatAnim/" + type + ".qml");
|
|
|
|
|
//if (component.status !== Component.Ready)
|
|
|
|
|
// return false;
|
|
|
|
|
|
2023-05-26 20:53:45 +08:00
|
|
|
|
const fromItem = Logic.getPhotoOrDashboard(fromId);
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const fromPos = mapFromItem(fromItem, fromItem.width / 2,
|
|
|
|
|
fromItem.height / 2);
|
2023-05-19 23:03:39 +08:00
|
|
|
|
const toItem = Logic.getPhoto(toId);
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const toPos = mapFromItem(toItem, toItem.width / 2,
|
|
|
|
|
toItem.height / 2);
|
|
|
|
|
const egg = component.createObject(roomScene, {
|
|
|
|
|
start: fromPos,
|
|
|
|
|
end: toPos
|
|
|
|
|
});
|
2023-05-19 23:03:39 +08:00
|
|
|
|
egg.finished.connect(() => egg.destroy());
|
|
|
|
|
egg.running = true;
|
|
|
|
|
|
2023-04-10 21:34:23 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else if (msg.startsWith("~")) {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const g = msg.slice(1);
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const extension = lcall("GetGeneralData", g).extension;
|
2023-04-28 18:24:31 +08:00
|
|
|
|
if (!config.disableMsgAudio)
|
|
|
|
|
Backend.playSound("./packages/" + extension + "/audio/death/" + g);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const m = luatr("~" + g);
|
2023-12-10 18:55:16 +08:00
|
|
|
|
data.msg = m;
|
2023-04-10 21:34:23 +08:00
|
|
|
|
if (general === "")
|
2023-12-10 18:55:16 +08:00
|
|
|
|
chat.append(`[${time}] ${userName}: ${m}`, data);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
else
|
2023-12-10 18:55:16 +08:00
|
|
|
|
chat.append(`[${time}] ${userName}(${general}): ${m}`, data);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const photo = Logic.getPhoto(pid);
|
2023-04-18 23:26:15 +08:00
|
|
|
|
if (photo === undefined) {
|
|
|
|
|
danmaku.sendLog(`${userName}: ${m}`);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
return true;
|
2023-04-18 23:26:15 +08:00
|
|
|
|
}
|
2023-04-10 21:34:23 +08:00
|
|
|
|
photo.chat(m);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const splited = msg.split(":");
|
2023-04-10 21:34:23 +08:00
|
|
|
|
if (splited.length < 2) return false;
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const skill = splited[0];
|
|
|
|
|
const idx = parseInt(splited[1]);
|
2023-08-25 21:08:03 +08:00
|
|
|
|
const gene = splited[2];
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
callbacks["LogEvent"](JSON.stringify({
|
|
|
|
|
type: "PlaySkillSound",
|
|
|
|
|
name: skill,
|
|
|
|
|
general: gene,
|
|
|
|
|
i: idx,
|
|
|
|
|
}));
|
|
|
|
|
} catch (e) {}
|
2024-01-25 03:23:29 +08:00
|
|
|
|
const m = luatr("$" + skill + (gene ? "_" + gene : "")
|
|
|
|
|
+ (idx ? idx.toString() : ""));
|
2023-12-10 18:55:16 +08:00
|
|
|
|
data.msg = m;
|
2023-04-10 21:34:23 +08:00
|
|
|
|
if (general === "")
|
2023-12-10 18:55:16 +08:00
|
|
|
|
chat.append(`[${time}] ${userName}: ${m}`, data);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
else
|
2023-12-10 18:55:16 +08:00
|
|
|
|
chat.append(`[${time}] ${userName}(${general}): ${m}`, data)
|
2023-04-10 21:34:23 +08:00
|
|
|
|
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const photo = Logic.getPhoto(pid);
|
2023-04-18 23:26:15 +08:00
|
|
|
|
if (photo === undefined) {
|
|
|
|
|
danmaku.sendLog(`${userName}: ${m}`);
|
2023-04-10 21:34:23 +08:00
|
|
|
|
return true;
|
2023-04-18 23:26:15 +08:00
|
|
|
|
}
|
2023-04-10 21:34:23 +08:00
|
|
|
|
photo.chat(m);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-18 12:52:52 +08:00
|
|
|
|
function addToLog(msg) {
|
2023-12-10 18:55:16 +08:00
|
|
|
|
log.append({ logText: msg });
|
2022-12-18 12:52:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-18 23:26:15 +08:00
|
|
|
|
function sendDanmaku(msg) {
|
|
|
|
|
danmaku.sendLog(msg);
|
2023-12-10 18:55:16 +08:00
|
|
|
|
chat.append(null, {
|
|
|
|
|
msg: msg,
|
|
|
|
|
general: "__server", // FIXME: 基于默认读取貂蝉的数据
|
|
|
|
|
userName: "",
|
|
|
|
|
time: "Server",
|
|
|
|
|
});
|
2023-04-18 23:26:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-20 12:51:54 +08:00
|
|
|
|
function showDistance(show) {
|
|
|
|
|
for (let i = 0; i < photoModel.count; i++) {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const item = photos.itemAt(i);
|
2022-12-20 12:51:54 +08:00
|
|
|
|
if (show) {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
item.distance = lcall("DistanceTo", Self.id, item.playerid);
|
2022-12-20 12:51:54 +08:00
|
|
|
|
} else {
|
2023-06-10 23:51:09 +08:00
|
|
|
|
item.distance = -1;
|
2022-12-20 12:51:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-19 10:08:36 +08:00
|
|
|
|
function startCheat(type, data) {
|
2023-05-20 16:00:03 +08:00
|
|
|
|
cheatLoader.sourceComponent = Qt.createComponent(`../Cheat/${type}.qml`);
|
2023-02-15 19:54:35 +08:00
|
|
|
|
cheatLoader.item.extra_data = data;
|
|
|
|
|
cheatDrawer.open();
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-04 19:31:44 +08:00
|
|
|
|
function resetToInit() {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const datalist = [];
|
2023-06-04 19:31:44 +08:00
|
|
|
|
for (let i = 0; i < photoModel.count; i++) {
|
2023-06-09 17:23:02 +08:00
|
|
|
|
const item = photoModel.get(i);
|
2023-06-19 21:56:06 +08:00
|
|
|
|
let gameData;
|
|
|
|
|
try {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
gameData = lcall("GetPlayerGameData", item.id);
|
2023-06-19 21:56:06 +08:00
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
2023-12-28 12:11:24 +08:00
|
|
|
|
gameData = [0, 0, 0, 0];
|
2023-06-19 21:56:06 +08:00
|
|
|
|
}
|
2023-06-04 19:31:44 +08:00
|
|
|
|
if (item.id > 0) {
|
|
|
|
|
datalist.push({
|
|
|
|
|
id: item.id,
|
|
|
|
|
avatar: item.avatar,
|
|
|
|
|
name: item.screenName,
|
|
|
|
|
isOwner: item.isOwner,
|
|
|
|
|
ready: item.ready,
|
2023-06-19 21:56:06 +08:00
|
|
|
|
gameData: gameData,
|
2023-06-04 19:31:44 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mainStack.pop();
|
2024-01-25 03:23:29 +08:00
|
|
|
|
lcall("ResetClientLua");
|
2023-06-04 19:31:44 +08:00
|
|
|
|
mainStack.push(room);
|
|
|
|
|
mainStack.currentItem.loadPlayerData(datalist);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-16 10:58:28 +08:00
|
|
|
|
function setPrompt(text, iscur) {
|
|
|
|
|
promptText = text;
|
|
|
|
|
if (iscur) currentPrompt = text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function resetPrompt() {
|
|
|
|
|
promptText = currentPrompt;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-04 19:31:44 +08:00
|
|
|
|
function loadPlayerData(datalist) {
|
|
|
|
|
datalist.forEach(d => {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
if (d.id === Self.id) {
|
2023-06-04 19:31:44 +08:00
|
|
|
|
roomScene.isOwner = d.isOwner;
|
|
|
|
|
} else {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
lcall("ResetAddPlayer",
|
|
|
|
|
JSON.stringify([d.id, d.name, d.avatar, d.ready, d.gameData[3]]));
|
2023-06-04 19:31:44 +08:00
|
|
|
|
}
|
2024-01-25 03:23:29 +08:00
|
|
|
|
lcall("SetPlayerGameData", d.id, d.gameData);
|
2023-06-04 19:31:44 +08:00
|
|
|
|
Logic.getPhotoModel(d.id).isOwner = d.isOwner;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-02 13:21:13 +08:00
|
|
|
|
function getPhoto(id) {
|
|
|
|
|
return Logic.getPhoto(id);
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
|
Component.onCompleted: {
|
2024-01-25 03:23:29 +08:00
|
|
|
|
toast.show(luatr("$EnterRoom"));
|
2022-04-30 15:27:56 +08:00
|
|
|
|
playerNum = config.roomCapacity;
|
|
|
|
|
|
2023-04-27 14:15:08 +08:00
|
|
|
|
for (let i = 0; i < playerNum; i++) {
|
2022-04-30 15:27:56 +08:00
|
|
|
|
photoModel.append({
|
2023-04-27 14:15:08 +08:00
|
|
|
|
id: i ? -1 : Self.id,
|
|
|
|
|
index: i, // For animating seat swap
|
|
|
|
|
general: i ? "" : Self.avatar,
|
2023-06-04 19:31:44 +08:00
|
|
|
|
avatar: i ? "" : Self.avatar,
|
2023-04-19 14:07:16 +08:00
|
|
|
|
deputyGeneral: "",
|
2023-04-27 14:15:08 +08:00
|
|
|
|
screenName: i ? "" : Self.screenName,
|
2022-04-30 15:27:56 +08:00
|
|
|
|
role: "unknown",
|
2023-04-23 21:10:07 +08:00
|
|
|
|
kingdom: "unknown",
|
2022-04-30 15:27:56 +08:00
|
|
|
|
netstate: "online",
|
|
|
|
|
maxHp: 0,
|
|
|
|
|
hp: 0,
|
2023-04-13 20:17:39 +08:00
|
|
|
|
shield: 0,
|
2022-04-30 15:27:56 +08:00
|
|
|
|
seatNumber: i + 1,
|
2022-12-20 12:51:54 +08:00
|
|
|
|
dead: false,
|
2022-04-30 15:27:56 +08:00
|
|
|
|
dying: false,
|
|
|
|
|
faceup: true,
|
|
|
|
|
chained: false,
|
2023-03-14 20:48:08 +08:00
|
|
|
|
drank: 0,
|
2023-12-10 18:55:16 +08:00
|
|
|
|
rest: 0,
|
2023-06-04 19:31:44 +08:00
|
|
|
|
isOwner: false,
|
|
|
|
|
ready: false,
|
2023-07-02 20:39:42 +08:00
|
|
|
|
surrendered: false,
|
2023-08-13 02:25:04 +08:00
|
|
|
|
sealedSlots: "[]",
|
2022-04-30 15:27:56 +08:00
|
|
|
|
});
|
2022-03-23 19:40:28 +08:00
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
|
|
|
|
|
|
Logic.arrangePhotos();
|
|
|
|
|
}
|
2022-03-01 13:18:00 +08:00
|
|
|
|
}
|