快速短句 (#213)
- 添加了快速短句及其对应的i18n,可以疯狂“兵贵神速啊”( --------- Co-authored-by: notify <notify-ctrl@qq.com>
This commit is contained in:
parent
f24ea5dead
commit
2e8adf1918
|
@ -38,7 +38,7 @@ Flickable {
|
|||
skillDesc.text = "";
|
||||
|
||||
extra_data.generals.forEach((g) => {
|
||||
let data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [g]));
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [g]));
|
||||
skillDesc.append(Backend.translate(data.kingdom) + " " + Backend.translate(g) + " " + data.hp + "/" + data.maxHp);
|
||||
data.skill.forEach(t => {
|
||||
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
||||
|
|
|
@ -12,6 +12,64 @@ Rectangle {
|
|||
chatLogBox.append(chatter)
|
||||
}
|
||||
|
||||
/*
|
||||
function loadSkills(pid) {
|
||||
if (isLobby) return;
|
||||
let gender = 0;
|
||||
// let g = false;
|
||||
// if (g) {
|
||||
// const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [g]));
|
||||
// const extension = data.extension;
|
||||
// gender = data.gender;
|
||||
// data.skill.forEach(t => {
|
||||
// for (let i = 0; i < 999; i++) {
|
||||
// const fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
// t.name + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
// if (Backend.exists(fname)) {
|
||||
// skills.append({ name: t.name, idx: i });
|
||||
// } else {
|
||||
// if (i > 0) break;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// data.related_skill.forEach(t => {
|
||||
// for (let i = 0; i < 999; i++) {
|
||||
// const fname = AppPath + "/packages/" + extension + "/audio/skill/" +
|
||||
// t.name + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
// if (Backend.exists(fname)) {
|
||||
// skills.append({ name: t.name, idx: i });
|
||||
// } else {
|
||||
// if (i > 0) break;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
for (let i = 0; i < 999; i++) {
|
||||
const name = "fastchat_" + (gender == 1 ? "f" : "m")
|
||||
const fname = AppPath + "/packages/standard/audio/skill/" +
|
||||
name + (i !== 0 ? i.toString() : "") + ".mp3";
|
||||
|
||||
if (Backend.exists(fname)) {
|
||||
skills.append({ name: name, idx: i });
|
||||
} else {
|
||||
if (i > 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
function loadSkills() {
|
||||
for (let i = 1; i <= 16; i++) {
|
||||
skills.append({ name: "fastchat_m", idx: i });
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: opTimer
|
||||
interval: 1500
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
@ -47,6 +105,46 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: soundSelector
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 180
|
||||
visible: false
|
||||
clip: true
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
model: ListModel {
|
||||
id: skills
|
||||
}
|
||||
// onVisibleChanged: {skills.clear(); loadSkills();}
|
||||
|
||||
delegate: ItemDelegate {
|
||||
width: soundSelector.width
|
||||
height: 30
|
||||
text: Backend.translate("$" + name + (idx ? idx.toString() : ""))
|
||||
|
||||
onClicked: {
|
||||
opTimer.start();
|
||||
const general = roomScene.getPhoto(Self.id).general;
|
||||
let skill = "fastchat_m";
|
||||
if (general !== "") {
|
||||
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
|
||||
const gender = data.gender;
|
||||
if (gender !== 1) {
|
||||
skill = "fastchat_f";
|
||||
}
|
||||
}
|
||||
ClientInstance.notifyServer(
|
||||
"Chat",
|
||||
JSON.stringify({
|
||||
type: isLobby ? 1 : 2,
|
||||
msg: "$" + skill + ":" + idx
|
||||
})
|
||||
);
|
||||
soundSelector.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
|
@ -79,16 +177,38 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
MetroButton {
|
||||
id: soundBtn
|
||||
text: "🗨️"
|
||||
visible: !isLobby
|
||||
enabled: !opTimer.running;
|
||||
onClicked: {
|
||||
emojiSelector.visible = false;
|
||||
soundSelector.visible = !soundSelector.visible;
|
||||
}
|
||||
}
|
||||
|
||||
MetroButton {
|
||||
id: emojiBtn
|
||||
text: "😃"
|
||||
onClicked: emojiSelector.visible = !emojiSelector.visible;
|
||||
onClicked: {
|
||||
soundSelector.visible = false;
|
||||
emojiSelector.visible = !emojiSelector.visible;
|
||||
}
|
||||
}
|
||||
|
||||
MetroButton {
|
||||
text: "✔️"
|
||||
onClicked: chatEdit.accepted();
|
||||
enabled: !opTimer.running;
|
||||
onClicked: {
|
||||
opTimer.start();
|
||||
chatEdit.accepted();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
loadSkills();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ Item {
|
|||
property string password
|
||||
|
||||
Rectangle {
|
||||
width: parent.width / 2 - roomListLayout.width / 2
|
||||
width: parent.width / 2 - roomListLayout.width / 2 - 50
|
||||
height: parent.height * 0.7
|
||||
anchors.top: exitButton.bottom
|
||||
anchors.bottom: createRoomButton.top
|
||||
|
@ -106,17 +106,32 @@ Item {
|
|||
PersonalSettings {
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Timer {
|
||||
id: opTimer
|
||||
interval: 1000
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: roomListLayout
|
||||
anchors.centerIn: parent
|
||||
width: childrenRect.width
|
||||
height: parent.height
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 10
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: root.width * 0.48
|
||||
height: root.height - 80
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: Backend.translate("Refresh Room List")
|
||||
enabled: !opTimer.running
|
||||
onClicked: {
|
||||
opTimer.start();
|
||||
ClientInstance.notifyServer("RefreshRoomList", "");
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.preferredWidth: root.width * 0.6
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Rectangle {
|
||||
width: parent.width * 0.8
|
||||
height: parent.height * 0.8
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
color: "#88EEEEEE"
|
||||
radius: 16
|
||||
|
|
|
@ -956,6 +956,10 @@ Item {
|
|||
});
|
||||
}
|
||||
|
||||
function getPhoto(id) {
|
||||
return Logic.getPhoto(id);
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toast.show(Backend.translate("$EnterRoom"));
|
||||
playerNum = config.roomCapacity;
|
||||
|
|
|
@ -322,6 +322,14 @@
|
|||
<source>you have been temporarily banned!</source>
|
||||
<translation>由于逃跑或者其他不正当行为,你已经被暂时封禁!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can only observe running room.</source>
|
||||
<translation>只能旁观已开战的房间。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Room is full or already started!</source>
|
||||
<translation>房间已满!</translation>
|
||||
</message>
|
||||
</context>
|
||||
|
||||
<context>
|
||||
|
|
|
@ -31,6 +31,7 @@ function GetGeneralDetail(name)
|
|||
kingdom = general.kingdom,
|
||||
hp = general.hp,
|
||||
maxHp = general.maxHp,
|
||||
gender = general.gender,
|
||||
skill = {},
|
||||
related_skill = {}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ Fk:loadTranslationTable{
|
|||
["Hide unselectable cards"] = "下移不可选卡牌",
|
||||
["Back"] = "返回",
|
||||
|
||||
["Refresh Room List"] = "刷新房间列表",
|
||||
|
||||
["Create Room"] = "创建房间",
|
||||
["Room Name"] = "房间名字",
|
||||
["$RoomName"] = "%1的房间",
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -130,3 +130,8 @@ GameRule = fk.CreateTriggerSkill{
|
|||
end,
|
||||
|
||||
}
|
||||
|
||||
local fastchat_m = fk.CreateActiveSkill{ name = "fastchat_m" }
|
||||
local fastchat_f = fk.CreateActiveSkill{ name = "fastchat_f" }
|
||||
Fk:addSkill(fastchat_m)
|
||||
Fk:addSkill(fastchat_f)
|
||||
|
|
|
@ -245,6 +245,42 @@ Fk:loadTranslationTable{
|
|||
["biyue"] = "闭月",
|
||||
[":biyue"] = "结束阶段开始时,你可以摸一张牌。",
|
||||
|
||||
["fastchat_m"] = "快捷短语",
|
||||
["fastchat_f"] = "快捷短语",
|
||||
|
||||
["$fastchat_m1"] = "能不能快一点啊,兵贵神速啊。",
|
||||
["$fastchat_m2"] = "主公,别开枪,自己人!",
|
||||
["$fastchat_m3"] = "小内再不跳,后面还怎么玩啊?",
|
||||
["$fastchat_m4"] = "你们忍心,就这么让我酱油了?",
|
||||
["$fastchat_m5"] = "我……我惹你们了吗!?",
|
||||
["$fastchat_m6"] = "姑娘,你真是条汉子。",
|
||||
["$fastchat_m7"] = "三十六计走为上,容我去去便回。",
|
||||
["$fastchat_m8"] = "人心散了,队伍不好带啊。",
|
||||
["$fastchat_m9"] = "昏君,昏君呐!",
|
||||
["$fastchat_m10"] = "风吹鸡蛋壳,牌去人安乐。",
|
||||
["$fastchat_m11"] = "小内啊,你老悠着点。",
|
||||
["$fastchat_m12"] = "啊,不好意思,刚才卡了。",
|
||||
["$fastchat_m13"] = "你可以打的再烂一点吗?",
|
||||
["$fastchat_m14"] = "哥们,给力点行吗?",
|
||||
["$fastchat_m15"] = "哥哥,交个朋友吧。",
|
||||
["$fastchat_m16"] = "妹子,交个朋友吧。",
|
||||
["$fastchat_f1"] = "能不能快一点啊,兵贵神速啊。",
|
||||
["$fastchat_f2"] = "主公,别开枪,自己人!",
|
||||
["$fastchat_f3"] = "小内再不跳,后面还怎么玩啊?",
|
||||
["$fastchat_f4"] = "嗯嘛~你们忍心,就这么让我酱油了?",
|
||||
["$fastchat_f5"] = "我……我惹你们了吗?",
|
||||
["$fastchat_f6"] = "姑娘,你真是条汉子。",
|
||||
["$fastchat_f7"] = "三十六计走为上,容我去去便回。",
|
||||
["$fastchat_f8"] = "人心散了,队伍不好带啊。",
|
||||
["$fastchat_f9"] = "昏君,昏君呐!",
|
||||
["$fastchat_f10"] = "风吹鸡蛋壳,牌去人安乐。",
|
||||
["$fastchat_f11"] = "小内啊,你老悠着点儿。",
|
||||
["$fastchat_f12"] = "不好意思,刚才卡了。",
|
||||
["$fastchat_f13"] = "你可以打的再烂一点吗?",
|
||||
["$fastchat_f14"] = "哥们,给力点行吗?",
|
||||
["$fastchat_f15"] = "哥,交个朋友吧。",
|
||||
["$fastchat_f16"] = "妹子,交个朋友吧。",
|
||||
|
||||
["aaa_role_mode"] = "身份模式",
|
||||
[":aaa_role_mode"] = [========================================[
|
||||
# 身份模式简介
|
||||
|
|
|
@ -243,6 +243,10 @@ void Router::handlePacket(const QByteArray &rawPacket) {
|
|||
lobby_actions["Chat"] = [](ServerPlayer *sender, const QString &jsonData) {
|
||||
sender->getRoom()->chat(sender, jsonData);
|
||||
};
|
||||
lobby_actions["RefreshRoomList"] = [](ServerPlayer *sender,
|
||||
const QString &jsonData) {
|
||||
ServerInstance->updateRoomList(sender);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -177,11 +177,13 @@ void Room::addPlayer(ServerPlayer *player) {
|
|||
player->doNotify("UpdateGameData", JsonArray2Bytes(jsonData));
|
||||
}
|
||||
|
||||
/*
|
||||
if (this->owner != nullptr) {
|
||||
jsonData = QJsonArray();
|
||||
jsonData << this->owner->getId();
|
||||
player->doNotify("RoomOwner", JsonArray2Bytes(jsonData));
|
||||
}
|
||||
*/
|
||||
|
||||
if (player->getLastGameMode() != mode) {
|
||||
player->setLastGameMode(mode);
|
||||
|
|
|
@ -46,8 +46,8 @@ Server::Server(QObject *parent) : QObject(parent) {
|
|||
nextRoomId = 0;
|
||||
createRoom(nullptr, "Lobby", INT32_MAX);
|
||||
// 大厅只要发生人员变动,就向所有人广播一下房间列表
|
||||
connect(lobby(), &Room::playerAdded, this, &Server::updateRoomList);
|
||||
connect(lobby(), &Room::playerRemoved, this, &Server::updateRoomList);
|
||||
connect(lobby(), &Room::playerAdded, this, &Server::updateOnlineInfo);
|
||||
connect(lobby(), &Room::playerRemoved, this, &Server::updateOnlineInfo);
|
||||
|
||||
// 启动心跳包线程
|
||||
auto heartbeatThread = QThread::create([=]() {
|
||||
|
@ -166,7 +166,7 @@ void Server::removePlayer(int id) {
|
|||
}
|
||||
}
|
||||
|
||||
void Server::updateRoomList() {
|
||||
void Server::updateRoomList(ServerPlayer *teller) {
|
||||
QJsonArray arr;
|
||||
QJsonArray avail_arr;
|
||||
foreach (Room *room, rooms) {
|
||||
|
@ -192,9 +192,10 @@ void Server::updateRoomList() {
|
|||
arr.prepend(v);
|
||||
}
|
||||
auto jsonData = JsonArray2Bytes(arr);
|
||||
lobby()->doBroadcastNotify(lobby()->getPlayers(), "UpdateRoomList",
|
||||
QString(jsonData));
|
||||
teller->doNotify("UpdateRoomList", QString(jsonData));
|
||||
}
|
||||
|
||||
void Server::updateOnlineInfo() {
|
||||
lobby()->doBroadcastNotify(lobby()->getPlayers(), "UpdatePlayerNum",
|
||||
QString(JsonArray2Bytes(QJsonArray({
|
||||
lobby()->getPlayers().length(),
|
||||
|
@ -499,7 +500,7 @@ void Server::onRoomAbandoned() {
|
|||
Room *room = qobject_cast<Room *>(sender());
|
||||
room->gameOver();
|
||||
rooms.remove(room->getId());
|
||||
updateRoomList();
|
||||
updateOnlineInfo();
|
||||
// 按理说这时候就可以删除了,但是这里肯定比Lua先检测到。
|
||||
// 倘若在Lua的Room:gameOver时C++的Room被删除了问题就大了。
|
||||
// FIXME: 但是这终归是内存泄漏!以后啥时候再改吧。
|
||||
|
|
|
@ -35,7 +35,8 @@ public:
|
|||
void addPlayer(ServerPlayer *player);
|
||||
void removePlayer(int id);
|
||||
|
||||
void updateRoomList();
|
||||
void updateRoomList(ServerPlayer *teller);
|
||||
void updateOnlineInfo();
|
||||
|
||||
sqlite3 *getDatabase();
|
||||
|
||||
|
|
Loading…
Reference in New Issue