Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/xxyheaven/FreeKill
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyheaven committed Apr 20, 2024
2 parents e703b26 + b343433 commit 1a0d773
Show file tree
Hide file tree
Showing 50 changed files with 1,023 additions and 969 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ChangeLog

## v0.4.13 & v0.4.14

- 优化重连逻辑
- 客户端代码大量删除JSON。可能影响部分拓展

___

## v0.4.12

- 修前个版本poxi框bug
Expand Down
63 changes: 3 additions & 60 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

cmake_minimum_required(VERSION 3.16)

project(FreeKill VERSION 0.4.12)
project(FreeKill VERSION 0.4.14)
add_definitions(-DFK_VERSION=\"${CMAKE_PROJECT_VERSION}\")

find_package(Qt6 REQUIRED COMPONENTS
Expand All @@ -31,7 +31,7 @@ find_package(Lua)
find_package(SQLite3)

set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(REQUIRED_QT_VERSION "6.4")

Expand All @@ -45,15 +45,8 @@ include_directories(src/network)
include_directories(src/server)
include_directories(src/ui)

if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
# Fix include problem
include_directories("/usr/include/openssl-1.1/")
endif()

file(GLOB SWIG_FILES "${PROJECT_SOURCE_DIR}/src/swig/*.i")
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(SWIG_SOURCE ${PROJECT_SOURCE_DIR}/src/swig/freekill-wasm.i)
elseif (DEFINED FK_SERVER_ONLY)
if (DEFINED FK_SERVER_ONLY)
set(SWIG_SOURCE ${PROJECT_SOURCE_DIR}/src/swig/freekill-nogui.i)
else ()
set(SWIG_SOURCE ${PROJECT_SOURCE_DIR}/src/swig/freekill.i)
Expand Down Expand Up @@ -87,54 +80,4 @@ add_custom_command(
COMMAND echo ${CMAKE_PROJECT_VERSION} > ${PROJECT_SOURCE_DIR}/fk_ver
)

if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")

set(CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS}
"-s INITIAL_MEMORY=64MB"
)

file(GLOB_RECURSE FK_SCRIPT_FILES
RELATIVE ${PROJECT_SOURCE_DIR}
*.lua *.qml *.js *.fkp *.sql zh_CN.qm
)
qt_add_resources(FreeKill "scripts_qrc"
PREFIX "/"
FILES ${FK_SCRIPT_FILES}
)

qt_add_resources(FreeKill "font_qrc"
PREFIX "/"
FILES "fonts/FZLBGBK.ttf"
)

file(GLOB_RECURSE FK_IMG_FILES
RELATIVE ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/image/*.jpg
${PROJECT_SOURCE_DIR}/image/*.png
)
qt_add_resources(FreeKill "img_qrc"
PREFIX "/"
FILES ${FK_IMG_FILES}
)
file(GLOB_RECURSE FK_AUDIO_FILES
RELATIVE ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/audio/*.mp3
)
qt_add_resources(FreeKill "audio_qrc"
PREFIX "/"
FILES ${FK_AUDIO_FILES}
)
file(GLOB_RECURSE FK_PKG_FILES
RELATIVE ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/packages/*.mp3
${PROJECT_SOURCE_DIR}/packages/*.jpg
${PROJECT_SOURCE_DIR}/packages/*.png
)
qt_add_resources(FreeKill "pkg_qrc"
PREFIX "/"
FILES ${FK_PKG_FILES}
)

endif()

add_subdirectory(src)
18 changes: 7 additions & 11 deletions Fk/Logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ callbacks["ErrorMsg"] = (jsonData) => {
mainWindow.busy = false;
if (sheduled_download !== "") {
mainWindow.busy = true;
Pacman.loadSummary(sheduled_download, true);
Pacman.loadSummary(JSON.stringify(sheduled_download), true);
sheduled_download = "";
}
}
Expand All @@ -98,8 +98,7 @@ callbacks["BackToStart"] = (jsonData) => {
}
}

callbacks["SetServerSettings"] = (j) => {
const data = JSON.parse(j);
callbacks["SetServerSettings"] = (data) => {
const [ motd, hiddenPacks, enableBots ] = data;
config.serverMotd = motd;
config.serverHiddenPacks = hiddenPacks;
Expand Down Expand Up @@ -127,9 +126,8 @@ callbacks["EnterLobby"] = (jsonData) => {
config.saveConf();
}

callbacks["EnterRoom"] = (jsonData) => {
callbacks["EnterRoom"] = (data) => {
// jsonData: int capacity, int timeout
const data = JSON.parse(jsonData);
config.roomCapacity = data[0];
config.roomTimeout = data[1] - 1;
const roomSettings = data[2];
Expand All @@ -139,11 +137,11 @@ callbacks["EnterRoom"] = (jsonData) => {
mainWindow.busy = false;
}

callbacks["UpdateRoomList"] = (jsonData) => {
callbacks["UpdateRoomList"] = (data) => {
const current = mainStack.currentItem; // should be lobby
if (mainStack.depth === 2) {
current.roomModel.clear();
JSON.parse(jsonData).forEach(room => {
data.forEach(room => {
const [roomId, roomName, gameMode, playerNum, capacity, hasPassword,
outdated] = room;
current.roomModel.append({
Expand All @@ -154,21 +152,19 @@ callbacks["UpdateRoomList"] = (jsonData) => {
}
}

callbacks["UpdatePlayerNum"] = (j) => {
callbacks["UpdatePlayerNum"] = (data) => {
const current = mainStack.currentItem; // should be lobby
if (mainStack.depth === 2) {
const data = JSON.parse(j);
const l = data[0];
const s = data[1];
current.lobbyPlayerNum = l;
current.serverPlayerNum = s;
}
}

callbacks["Chat"] = (jsonData) => {
callbacks["Chat"] = (data) => {
// jsonData: { string userName, string general, string time, string msg }
const current = mainStack.currentItem; // lobby or room
const data = JSON.parse(jsonData);
const pid = data.sender;
const userName = data.userName;
const general = luatr(data.general);
Expand Down
5 changes: 2 additions & 3 deletions Fk/Pages/GeneralsOverview.qml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ Item {
delete s.normalPkg[name];
s.banPkg[name] = [];
}
console.log(JSON.stringify(config.curScheme))
config.curSchemeChanged();
} else {
pkgList.currentIndex = index;
Expand Down Expand Up @@ -394,12 +393,12 @@ Item {
}

onClicked: {
callbacks["LogEvent"](JSON.stringify({
callbacks["LogEvent"]({
type: "PlaySkillSound",
name: name,
general: detailGeneralCard.name,
i: idx,
}));
});
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Fk/Pages/Lobby.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Item {
wrapMode: TextEdit.WordWrap
textFormat: Text.MarkdownText
text: config.serverMotd + "\n___\n" + luatr('Bulletin Info')
onLinkActivated: Qt.openUrlExternally(link);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Fk/Pages/Room.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1176,12 +1176,12 @@ Item {

if (!config.disableMsgAudio)
try {
callbacks["LogEvent"](JSON.stringify({
callbacks["LogEvent"]({
type: "PlaySkillSound",
name: skill,
general: gene,
i: idx,
}));
});
} catch (e) {}
const m = luatr("$" + skill + (gene ? "_" + gene : "")
+ (idx ? idx.toString() : ""));
Expand Down Expand Up @@ -1278,7 +1278,7 @@ Item {
roomScene.isOwner = d.isOwner;
} else {
lcall("ResetAddPlayer",
JSON.stringify([d.id, d.name, d.avatar, d.ready, d.gameData[3]]));
[d.id, d.name, d.avatar, d.ready, d.gameData[3]]);
}
lcall("SetPlayerGameData", d.id, d.gameData);
Logic.getPhotoModel(d.id).isOwner = d.isOwner;
Expand Down
Loading

0 comments on commit 1a0d773

Please sign in to comment.