This commit is contained in:
2025-08-20 12:00:25 +06:00
parent 2cf37f4e0a
commit e8e3667fa9
6 changed files with 51 additions and 31 deletions

View File

@@ -131,6 +131,9 @@ struct DefItemInfo {
};
struct DefVoxel_t {};
struct DefNode_t {};
/* Интерфейс обработчика сессии с сервером */
class IServerSession {
struct ArrayHasher {

View File

@@ -622,24 +622,24 @@ coro<> ServerSession::rP_Definition(Net::AsyncSocket &sock) {
}
case ToClient::L2Definition::Node:
{
DefNodeId id;
DefNode_t def;
id = co_await sock.read<DefNodeId>();
def.DrawType = (DefNode_t::EnumDrawType) co_await sock.read<uint8_t>();
for(int iter = 0; iter < 6; iter++) {
auto &pl = def.Texs[iter].Pipeline;
pl.resize(co_await sock.read<uint16_t>());
co_await sock.read((std::byte*) pl.data(), pl.size());
}
// DefNodeId id;
// DefNode_t def;
// id = co_await sock.read<DefNodeId>();
// def.DrawType = (DefNode_t::EnumDrawType) co_await sock.read<uint8_t>();
// for(int iter = 0; iter < 6; iter++) {
// auto &pl = def.Texs[iter].Pipeline;
// pl.resize(co_await sock.read<uint16_t>());
// co_await sock.read((std::byte*) pl.data(), pl.size());
// }
PP_Definition_Node *packet = new PP_Definition_Node(
id,
def
);
// PP_Definition_Node *packet = new PP_Definition_Node(
// id,
// def
// );
while(!NetInputPackets.push(packet));
// while(!NetInputPackets.push(packet));
co_return;
// co_return;
}
case ToClient::L2Definition::FreeNode:
{

View File

@@ -2231,12 +2231,24 @@ void Vulkan::gui_ConnectedToServer() {
std::string text = std::to_string(ImGui::GetIO().Framerate);
ImGui::Text(text.c_str());
if(ImGui::Button("Выйти")) {
Game.RSession->pushStage(EnumRenderStage::Shutdown);
Game.Session->shutdown(EnumDisconnect::ByInterface);
try {
if(Game.Session)
Game.Session->shutdown(EnumDisconnect::ByInterface);
} catch(const std::exception &exc) {
LOG.error() << "Game.Session->shutdown: " << exc.what();
}
Game.RSession = nullptr;
Game.Session = nullptr;
Game.ImGuiInterfaces.pop_back();
int mode = glfwGetInputMode(Graphics.Window, GLFW_CURSOR);
if(mode != GLFW_CURSOR_NORMAL)
glfwSetInputMode(Graphics.Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}
ImGui::End();
if(!Game.RSession)
return;
}
if(Game.Session->isConnected())