Skip to content

Commit

Permalink
Merge pull request #48 from pwnsky/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
i0gan authored Apr 27, 2024
2 parents 5b2f774 + a6814e4 commit dd488fb
Show file tree
Hide file tree
Showing 167 changed files with 1,195 additions and 2,021 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

**Unreal SDK**: [squick-unreal-sdk](https://github.com/pwnsky/squick-unreal-sdk)

**Web Admin**: [squick-web](https://github.com/pwnsky/squick-web)

**QQ Group:739065686**

**Version:** 1.1.1
Expand Down
18 changes: 9 additions & 9 deletions config/plugin/db_proxy.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<XML>
<DbProxy>
<Plugin Name="core/net" />
<Plugin Name="core/log" />
<Plugin Name="node/db_proxy/node" />
<Plugin Name="node/db_proxy/mysql" />
<Plugin Name="node/db_proxy/mongo" />
<Plugin Name="node/db_proxy/redis" />
<Plugin Name="node/db_proxy/clickhouse" />
<DbProxy>
<Plugin Name="core/net" />
<Plugin Name="core/log" />
<Plugin Name="core/node" />
<Plugin Name="node/db_proxy/mysql" />
<Plugin Name="node/db_proxy/mongo" />
<Plugin Name="node/db_proxy/redis" />
<Plugin Name="node/db_proxy/clickhouse" />
<Plugin Name="node/db_proxy/logic" />
</DbProxy>
</XML>
9 changes: 4 additions & 5 deletions config/plugin/ds_mgr.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<XML>
<GameMgr>
<Plugin Name="core/net" />
<Plugin Name="core/log" />

<Plugin Name="node/ds_mgr/node" />
<Plugin Name="node/ds_mgr/logic" />
<Plugin Name="core/net" />
<Plugin Name="core/log" />
<Plugin Name="core/node" />
<Plugin Name="node/ds_mgr/logic" />
</GameMgr>
</XML>
11 changes: 5 additions & 6 deletions config/plugin/game.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<XML>
<Game>
<Plugin Name="core/net" />
<Plugin Name="core/log" />

<Plugin Name="node/game/node" />
<Game>
<Plugin Name="core/net" />
<Plugin Name="core/log" />
<Plugin Name="core/node" />
<Plugin Name="node/game/logic" />
</Game>
</Game>
</XML>
3 changes: 1 addition & 2 deletions config/plugin/login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<Login>
<Plugin Name="core/net" />
<Plugin Name="core/log" />

<Plugin Name="node/login/node" />
<Plugin Name="core/node" />
<Plugin Name="node/login/logic" />
</Login>

Expand Down
11 changes: 4 additions & 7 deletions config/plugin/master.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<XML>
<Master>
<Plugin Name="core/net" />
<Plugin Name="core/log" />

<Plugin Name="node/master/logic" />
<Plugin Name="node/master/node" />
<Plugin Name="node/master/http" />

<Plugin Name="core/net" />
<Plugin Name="core/log" />
<Plugin Name="core/node" />
<Plugin Name="node/master/logic" />
</Master>
</XML>
24 changes: 12 additions & 12 deletions config/plugin/player.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<XML>
<Player>
<!-- The order is priority for destroy -->
<Plugin Name="core/log"/>
<Plugin Name="core/net"/>
<Plugin Name="core/config"/>
<Plugin Name="core/world" />
<Plugin Name="core/utils" />
<Plugin Name="core/thread" />
<Plugin Name="core/lua" />

<Plugin Name="node/player/node" />
</Player>
<Player>
<!-- The order is priority for destroy -->
<Plugin Name="core/log"/>
<Plugin Name="core/net"/>
<Plugin Name="core/config"/>
<Plugin Name="core/world" />
<Plugin Name="core/utils" />
<Plugin Name="core/thread" />
<Plugin Name="core/lua" />
<Plugin Name="core/node" />
<Plugin Name="node/player/logic" />
</Player>
</XML>
2 changes: 1 addition & 1 deletion config/plugin/proxy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<Plugin Name="core/config" />
<Plugin Name="core/log" />
<Plugin Name="core/utils" />
<Plugin Name="core/node" />

<Plugin Name="node/proxy/logic" />
<Plugin Name="node/proxy/node" />
</Proxy>
</XML>
13 changes: 6 additions & 7 deletions config/plugin/sqkcli.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<XML>
<Tester>
<Plugin Name="core/net" />
<Plugin Name="core/config" />
<Plugin Name="core/log" />

<Plugin Name="sqkcli/core" />
</Tester>
<Tester>
<Plugin Name="core/net" />
<Plugin Name="core/config" />
<Plugin Name="core/log" />
<Plugin Name="sqkcli/core" />
</Tester>
</XML>
6 changes: 3 additions & 3 deletions config/plugin/tutorial/t1_plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<XML>
<Tutorial>
<Plugin Name="tutorial/t1_plugin" />
</Tutorial>
<Tutorial>
<Plugin Name="tutorial/t1_plugin" />
</Tutorial>
</XML>
6 changes: 3 additions & 3 deletions config/plugin/tutorial/t2_property.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<XML>
<Tutorial>
<Plugin Name="tutorial/t1_Property" />
</Tutorial>
<Tutorial>
<Plugin Name="tutorial/t1_Property" />
</Tutorial>
</XML>
1 change: 0 additions & 1 deletion config/plugin/tutorial/t5_http.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<Tutorial>
<Plugin Name="core/net" />
<Plugin Name="core/log" />

<Plugin Name="tutorial/t5_http" />
</Tutorial>
</XML>
1 change: 0 additions & 1 deletion config/plugin/tutorial/t6_rpc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<Tutorial>
<Plugin Name="core/net" />
<Plugin Name="core/log" />

<Plugin Name="tutorial/t6_rpc" />
</Tutorial>
</XML>
12 changes: 5 additions & 7 deletions config/plugin/web.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<XML>
<Login>
<Plugin Name="core/net" />
<Plugin Name="core/log" />

<Plugin Name="node/web/node" />
<Plugin Name="node/web/logic" />
</Login>

<Plugin Name="core/net" />
<Plugin Name="core/log" />
<Plugin Name="core/node" />
<Plugin Name="node/web/logic" />
</Login>
</XML>
17 changes: 8 additions & 9 deletions config/plugin/world.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<XML>
<World>
<Plugin Name="core/net" />
<Plugin Name="core/log" />
<World>
<Plugin Name="core/net" />
<Plugin Name="core/log" />
<Plugin Name="core/config" />
<Plugin Name="core/world" />
<Plugin Name="core/world" />
<Plugin Name="core/utils" />
<Plugin Name="core/thread" />
<Plugin Name="core/lua" />

<Plugin Name="node/world/node" />
<Plugin Name="node/world/logic" />
</World>
<Plugin Name="core/lua" />
<Plugin Name="core/node" />
<Plugin Name="node/world/logic" />
</World>
</XML>
16 changes: 0 additions & 16 deletions src/lua/common/base.lua
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
ServerType =
{
ST_NONE = 0,
ST_MASTER = 1,
ST_LOGIN = 2,
ST_WORLD = 3,
ST_DB_PROXY = 4,
ST_PROXY = 5,
ST_PLAYER = 6,
ST_GAME_MGR = 7,
ST_GAME = 8,
ST_MICRO = 9,
ST_CDN = 10,
ST_ROBOT = 11,
ST_MAX = 12,
};
1 change: 1 addition & 0 deletions src/lua/common/net.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Net = {}
-- function Table:func(uid, msg_data, msg_id, fd)
function Net:Register(msg_id, this, func)
Squick:LogInfo("Lua Register msg: " .. tostring(msg_id))
Squick:AddMsgCallBackAsServer(msg_id, this, func)
end

Expand Down
6 changes: 3 additions & 3 deletions src/lua/lib/db/clickhouse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ local DbClickhouseID = 0;
Clickhouse = Clickhouse and Clickhouse or Object(QueryAsync).new()

function Clickhouse:Bind()
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckClickhouseExecute, self, self.AckExecute)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckClickhouseSelect, self, self.AckSelect)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckClickhouseInsert, self, self.AckInsert)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckClickhouseExecute, self, self.AckExecute)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckClickhouseSelect, self, self.AckSelect)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckClickhouseInsert, self, self.AckInsert)
DbClickhouseID = GetDbProxyID()
end

Expand Down
10 changes: 5 additions & 5 deletions src/lua/lib/db/mongo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ local DbProxyID = 0;
Mongo = Mongo and Mongo or Object(QueryAsync).new()

function Mongo:Bind()
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMongoInsert, self, self.AckInsert)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMongoFind, self, self.AckFind)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMongoUpdate, self, self.AckUpdate)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMongoDelete, self, self.AckDelete)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMongoCreateIndex, self, self.AckCreateIndex)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMongoInsert, self, self.AckInsert)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMongoFind, self, self.AckFind)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMongoUpdate, self, self.AckUpdate)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMongoDelete, self, self.AckDelete)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMongoCreateIndex, self, self.AckCreateIndex)
DbProxyID = GetDbProxyID()
end

Expand Down
8 changes: 4 additions & 4 deletions src/lua/lib/db/mysql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ local DbMysqlID = 0;
Mysql = Mysql and Mysql or Object(QueryAsync).new()

function Mysql:Bind()
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMysqlExecute, self, self.AckExecute)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMysqlSelect, self, self.AckSelect)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMysqlInsert, self, self.AckInsert)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckMysqlUpdate, self, self.AckUpdate)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMysqlExecute, self, self.AckExecute)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMysqlSelect, self, self.AckSelect)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMysqlInsert, self, self.AckInsert)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckMysqlUpdate, self, self.AckUpdate)
DbMysqlID = GetDbProxyID()
end

Expand Down
4 changes: 2 additions & 2 deletions src/lua/lib/db/redis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ local DbProxyID = 0;
Redis = Redis and Redis or Object(QueryAsync).new()

function Redis:Bind()
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckRedisGet, self, self.AckGetString)
Net:ClientRegister(ServerType.ST_DB_PROXY, NMsgId.IdNAckRedisSet, self, self.AckSetString)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckRedisGet, self, self.AckGetString)
Net:ClientRegister(NodeType.ST_DB_PROXY, NMsgId.IdNAckRedisSet, self, self.AckSetString)
DbProxyID = GetDbProxyID()
end

Expand Down
8 changes: 4 additions & 4 deletions src/lua/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function ReadyUpdate()
ModuleMgr:Start()
end

-- Update for per second
-- Update 10 fps
function Update()
ModuleMgr:Update()
end
Expand All @@ -74,12 +74,12 @@ function Load()
Require("lib.init")

local node_init = {
[ServerType.ST_GAME ] = function()
[NodeType.ST_GAME ] = function()
Require("node.game.init")
end,
[ServerType.ST_PLAYER] = function ()
[NodeType.ST_PLAYER] = function ()
Require("node.player.init")
--Require("test.init")
-- Require("test.init")
end
}
if(node_init[Env.app_type]) then
Expand Down
4 changes: 2 additions & 2 deletions src/node/db_proxy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_subdirectory(node)
add_subdirectory(mysql)
add_subdirectory(mongo)
add_subdirectory(redis)
add_subdirectory(clickhouse)
add_subdirectory(clickhouse)
add_subdirectory(logic)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(ProjectName "db_proxy_node")
set(ProjectName "db_proxy_logic")
file(GLOB soruces *.cc)
file(GLOB headers *.h)
add_library(${ProjectName} SHARED ${soruces} ${headers})
LinkSquick(${ProjectName})
SquickOut(${ProjectName} "node/db_proxy" ${SQUICK_BUILD_PLUGIN_SERVER_PATH}/db_proxy "node")
SquickOut(${ProjectName} "node/db_proxy" ${SQUICK_BUILD_PLUGIN_SERVER_PATH}/db_proxy "logic")
7 changes: 7 additions & 0 deletions src/node/db_proxy/logic/i_logic_module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <squick/core/i_module.h>
namespace db_proxy::logic {
class ILogicModule : public IModule {};

} // namespace db_proxy::logic
10 changes: 10 additions & 0 deletions src/node/db_proxy/logic/logic_module.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "logic_module.h"

namespace db_proxy::logic {
bool LogicModule::Start() {
m_node_ = pm_->FindModule<INodeModule>();
vector<int> node_types = {};
m_node_->AddSubscribeNode(node_types);
return true;
}
} // namespace db_proxy::logic
19 changes: 19 additions & 0 deletions src/node/db_proxy/logic/logic_module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once
#include "i_logic_module.h"
#include <squick/plugin/net/export.h>
#include <squick/plugin/node/export.h>

namespace db_proxy::logic {
class LogicModule : public ILogicModule {
public:
LogicModule(IPluginManager *p) {
pm_ = p;
is_update_ = true; // Update
}
virtual bool Start() override;

private:
INodeModule *m_node_;
};

} // namespace db_proxy::logic
Loading

0 comments on commit dd488fb

Please sign in to comment.