parent
a7e3ad0f19
commit
0033cd6c07
|
@ -205,6 +205,7 @@ fk.client_callback["EnterRoom"] = function(jsonData)
|
||||||
|
|
||||||
local data = json.decode(jsonData)[3]
|
local data = json.decode(jsonData)[3]
|
||||||
Fk.disabled_packs = data.disabledPack
|
Fk.disabled_packs = data.disabledPack
|
||||||
|
Fk.disabled_generals = data.disabledGenerals
|
||||||
ClientInstance:notifyUI("EnterRoom", jsonData)
|
ClientInstance:notifyUI("EnterRoom", jsonData)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,8 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
||||||
["Cancel"] = "取消",
|
["Cancel"] = "取消",
|
||||||
["End"] = "结束",
|
["End"] = "结束",
|
||||||
["Quit"] = "退出",
|
["Quit"] = "退出",
|
||||||
|
["BanGeneral"] = "禁将",
|
||||||
|
["ResumeGeneral"] = "解禁",
|
||||||
|
|
||||||
["$WelcomeToLobby"] = "欢迎进入FreeKill游戏大厅!",
|
["$WelcomeToLobby"] = "欢迎进入FreeKill游戏大厅!",
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ function Engine:initialize()
|
||||||
self.translations = {} -- srcText --> translated
|
self.translations = {} -- srcText --> translated
|
||||||
self.game_modes = {}
|
self.game_modes = {}
|
||||||
self.disabled_packs = {}
|
self.disabled_packs = {}
|
||||||
|
self.disabled_generals = {}
|
||||||
self.kingdoms = {}
|
self.kingdoms = {}
|
||||||
|
|
||||||
self:loadPackages()
|
self:loadPackages()
|
||||||
|
@ -213,8 +214,9 @@ function Engine:getSameGenerals(name)
|
||||||
local tName = tmp[#tmp]
|
local tName = tmp[#tmp]
|
||||||
local ret = self.same_generals[tName] or {}
|
local ret = self.same_generals[tName] or {}
|
||||||
return table.filter(ret, function(g)
|
return table.filter(ret, function(g)
|
||||||
return g ~= name and self.generals[g] ~= nil and not
|
return g ~= name and self.generals[g] ~= nil and
|
||||||
table.contains(self.disabled_packs, self.generals[g].package.name)
|
not table.contains(self.disabled_packs, self.generals[g].package.name) and
|
||||||
|
not table.contains(self.disabled_generals, g)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -334,7 +336,7 @@ function Engine:getAllGenerals(except)
|
||||||
local result = {}
|
local result = {}
|
||||||
for _, general in pairs(self.generals) do
|
for _, general in pairs(self.generals) do
|
||||||
if not (except and table.contains(except, general)) then
|
if not (except and table.contains(except, general)) then
|
||||||
if not table.contains(self.disabled_packs, general.package.name) then
|
if not table.contains(self.disabled_packs, general.package.name) and not table.contains(self.disabled_generals, general.name) then
|
||||||
table.insert(result, general)
|
table.insert(result, general)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -67,6 +67,7 @@ function Room:initialize(_room)
|
||||||
Room.initialize(self, _room) -- clear old data
|
Room.initialize(self, _room) -- clear old data
|
||||||
self.settings = json.decode(_room:settings())
|
self.settings = json.decode(_room:settings())
|
||||||
Fk.disabled_packs = self.settings.disabledPack
|
Fk.disabled_packs = self.settings.disabledPack
|
||||||
|
Fk.disabled_generals = self.settings.disabledGenerals
|
||||||
local main_co = coroutine.create(function()
|
local main_co = coroutine.create(function()
|
||||||
self:run()
|
self:run()
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -22,6 +22,7 @@ QtObject {
|
||||||
property string ladyImg
|
property string ladyImg
|
||||||
property real bgmVolume
|
property real bgmVolume
|
||||||
property bool disableMsgAudio
|
property bool disableMsgAudio
|
||||||
|
property var disabledGenerals: []
|
||||||
|
|
||||||
property int preferredTimeout
|
property int preferredTimeout
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ QtObject {
|
||||||
bgmVolume = conf.bgmVolume ?? 50.;
|
bgmVolume = conf.bgmVolume ?? 50.;
|
||||||
disableMsgAudio = conf.disableMsgAudio ?? false;
|
disableMsgAudio = conf.disableMsgAudio ?? false;
|
||||||
preferredTimeout = conf.preferredTimeout ?? 15;
|
preferredTimeout = conf.preferredTimeout ?? 15;
|
||||||
|
disabledGenerals = conf.disabledGenerals ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveConf() {
|
function saveConf() {
|
||||||
|
@ -81,6 +83,7 @@ QtObject {
|
||||||
conf.bgmVolume = bgmVolume;
|
conf.bgmVolume = bgmVolume;
|
||||||
conf.disableMsgAudio = disableMsgAudio;
|
conf.disableMsgAudio = disableMsgAudio;
|
||||||
conf.preferredTimeout = preferredTimeout;
|
conf.preferredTimeout = preferredTimeout;
|
||||||
|
conf.disabledGenerals = disabledGenerals;
|
||||||
|
|
||||||
Backend.saveConf(JSON.stringify(conf, undefined, 2));
|
Backend.saveConf(JSON.stringify(conf, undefined, 2));
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,28 @@ Item {
|
||||||
generalDetail.updateGeneral();
|
generalDetail.updateGeneral();
|
||||||
// generalDetail.open();
|
// generalDetail.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "black"
|
||||||
|
opacity: config.disabledGenerals.includes(modelData) ? 0.7 : 0
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlowText {
|
||||||
|
visible: config.disabledGenerals.includes(modelData)
|
||||||
|
text: '禁'
|
||||||
|
anchors.centerIn: parent
|
||||||
|
font.family: fontLi2.name
|
||||||
|
color: "#E4D5A0"
|
||||||
|
font.pixelSize: 36
|
||||||
|
font.weight: Font.Medium
|
||||||
|
glow.color: "black"
|
||||||
|
glow.spread: 0.3
|
||||||
|
glow.radius: 5
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,11 +194,40 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.right: parent.right
|
||||||
Button {
|
Button {
|
||||||
text: Backend.translate("Quit")
|
text: Backend.translate("Quit")
|
||||||
anchors.right: parent.right
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
mainStack.pop();
|
mainStack.pop();
|
||||||
|
config.saveConf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: banButton
|
||||||
|
text: Backend.translate(config.disabledGenerals.includes(detailGeneralCard.name) ? 'ResumeGeneral' : 'BanGeneral')
|
||||||
|
visible: detailGeneralCard.name
|
||||||
|
onClicked: {
|
||||||
|
const { disabledGenerals } = config;
|
||||||
|
const { name } = detailGeneralCard;
|
||||||
|
|
||||||
|
if (banButton.text === Backend.translate('ResumeGeneral')) {
|
||||||
|
const deleteIndex = disabledGenerals.findIndex((general) => general === name);
|
||||||
|
if (deleteIndex === -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
disabledGenerals.splice(deleteIndex, 1);
|
||||||
|
} else {
|
||||||
|
if (disabledGenerals.includes(name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
disabledGenerals.push(name);
|
||||||
|
}
|
||||||
|
config.disabledGeneralsChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,38 @@ import "Logic.js" as Logic
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property alias roomModel: roomModel
|
property alias roomModel: roomModel
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width / 2 - roomListLayout.width / 2
|
||||||
|
height: parent.height * 0.7
|
||||||
|
anchors.top: exitButton.bottom
|
||||||
|
anchors.bottom: createRoomButton.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 20
|
||||||
|
color: "#88EEEEEE"
|
||||||
|
radius: 6
|
||||||
|
|
||||||
|
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
|
||||||
|
contentWidth: flickableContainer.width
|
||||||
|
contentHeight: flickableContainer.height
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.fill: parent
|
||||||
|
wrapMode: TextEdit.WrapAnywhere
|
||||||
|
text: '<h1>公告测试</h1><br>● 更新跳过觉醒(神郭嘉)、转换技概念(许攸)。<br>● 武将一览中增加禁将功能。'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: roomDelegate
|
id: roomDelegate
|
||||||
|
|
||||||
|
@ -81,6 +113,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
id: roomListLayout
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
@ -113,6 +146,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
id: createRoomButton
|
||||||
anchors.bottom: buttonRow.top
|
anchors.bottom: buttonRow.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
width: 120
|
width: 120
|
||||||
|
@ -162,6 +196,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
id: exitButton
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
text: Backend.translate("Exit Lobby")
|
text: Backend.translate("Exit Lobby")
|
||||||
display: AbstractButton.TextBesideIcon
|
display: AbstractButton.TextBesideIcon
|
||||||
|
|
|
@ -116,6 +116,18 @@ ColumnLayout {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.finished();
|
root.finished();
|
||||||
mainWindow.busy = true;
|
mainWindow.busy = true;
|
||||||
|
|
||||||
|
let disabledGenerals = config.disabledGenerals.slice();
|
||||||
|
if (disabledGenerals.length) {
|
||||||
|
const availablePack = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", [])).
|
||||||
|
filter((pack) => !config.disabledPack.includes(pack));
|
||||||
|
disabledGenerals = disabledGenerals.filter((general) => {
|
||||||
|
return availablePack.find((pack) => JSON.parse(Backend.callLuaFunction("GetGenerals", [pack])).includes(general));
|
||||||
|
});
|
||||||
|
|
||||||
|
disabledGenerals = Array.from(new Set(disabledGenerals));
|
||||||
|
}
|
||||||
|
|
||||||
ClientInstance.notifyServer(
|
ClientInstance.notifyServer(
|
||||||
"CreateRoom",
|
"CreateRoom",
|
||||||
JSON.stringify([roomName.text, playerNum.value, config.preferredTimeout, {
|
JSON.stringify([roomName.text, playerNum.value, config.preferredTimeout, {
|
||||||
|
@ -124,6 +136,7 @@ ColumnLayout {
|
||||||
gameMode: config.preferedMode,
|
gameMode: config.preferedMode,
|
||||||
disabledPack: config.disabledPack,
|
disabledPack: config.disabledPack,
|
||||||
generalNum: config.preferredGeneralNum,
|
generalNum: config.preferredGeneralNum,
|
||||||
|
disabledGenerals,
|
||||||
}])
|
}])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue