2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-04-09 03:44:19 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
|
|
|
property var extra_data: ({})
|
2023-05-19 15:03:39 +00:00
|
|
|
property int pid
|
2023-04-09 03:44:19 +00:00
|
|
|
|
|
|
|
signal finish()
|
|
|
|
|
|
|
|
contentHeight: details.height
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: details
|
2023-05-18 23:45:21 +00:00
|
|
|
width: parent.width - 40
|
|
|
|
x: 20
|
2023-04-09 03:44:19 +00:00
|
|
|
|
2023-05-19 15:03:39 +00:00
|
|
|
RowLayout {
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Give Flower")
|
|
|
|
onClicked: {
|
|
|
|
root.givePresent("Flower");
|
|
|
|
root.finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Give Egg")
|
|
|
|
onClicked: {
|
2023-05-26 12:53:45 +00:00
|
|
|
if (Math.random() < 0.03) {
|
|
|
|
root.givePresent("GiantEgg");
|
|
|
|
} else {
|
|
|
|
root.givePresent("Egg");
|
|
|
|
}
|
|
|
|
root.finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Give Shoe")
|
2023-06-04 11:31:44 +00:00
|
|
|
enabled: Math.random() < 0.3
|
2023-05-26 12:53:45 +00:00
|
|
|
onClicked: {
|
|
|
|
root.givePresent("Shoe");
|
2023-05-19 15:03:39 +00:00
|
|
|
root.finish();
|
2023-06-04 11:31:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: Backend.translate("Kick From Room")
|
|
|
|
visible: !roomScene.isStarted && roomScene.isOwner
|
|
|
|
enabled: pid !== Self.id
|
|
|
|
onClicked: {
|
|
|
|
ClientInstance.notifyServer("KickPlayer", pid.toString());
|
|
|
|
root.finish();
|
2023-05-19 15:03:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-09 03:44:19 +00:00
|
|
|
// TODO: player details
|
|
|
|
Text {
|
|
|
|
id: screenName
|
|
|
|
Layout.fillWidth: true
|
|
|
|
font.pixelSize: 18
|
|
|
|
}
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
id: skillDesc
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
font.pixelSize: 18
|
|
|
|
|
|
|
|
readOnly: true
|
|
|
|
selectByKeyboard: true
|
|
|
|
selectByMouse: false
|
|
|
|
wrapMode: TextEdit.WordWrap
|
|
|
|
textFormat: TextEdit.RichText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-19 15:03:39 +00:00
|
|
|
function givePresent(p) {
|
|
|
|
ClientInstance.notifyServer(
|
|
|
|
"Chat",
|
|
|
|
JSON.stringify({
|
|
|
|
type: 2,
|
|
|
|
msg: "$!" + p + ":" + pid
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-04-09 03:44:19 +00:00
|
|
|
onExtra_dataChanged: {
|
|
|
|
if (!extra_data.photo) return;
|
|
|
|
screenName.text = "";
|
|
|
|
skillDesc.text = "";
|
|
|
|
|
2023-06-09 09:23:02 +00:00
|
|
|
const id = extra_data.photo.playerid;
|
2023-04-09 03:44:19 +00:00
|
|
|
if (id == 0) return;
|
2023-05-19 15:03:39 +00:00
|
|
|
root.pid = id;
|
|
|
|
|
|
|
|
screenName.text = extra_data.photo.screenName;
|
2023-04-09 03:44:19 +00:00
|
|
|
|
2023-06-09 09:23:02 +00:00
|
|
|
const data = JSON.parse(Backend.callLuaFunction("GetPlayerSkills", [id]));
|
2023-04-09 03:44:19 +00:00
|
|
|
data.forEach(t => {
|
|
|
|
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|