From f2771f338e1f56a8ced4ea6717fb4208e6796097 Mon Sep 17 00:00:00 2001 From: "DESKTOP-JN7AG79\\qweasdd" Date: Sun, 16 Sep 2018 13:49:41 +0300 Subject: [PATCH] Fixed mp connection. Exported mp classes to scripts. --- src/xrGame/ui/UIWindow_script.cpp | 96 ++++++++++++++++++++++- src/xrUICore/ListBox/UIListBox_script.cpp | 14 ---- 2 files changed, 93 insertions(+), 17 deletions(-) diff --git a/src/xrGame/ui/UIWindow_script.cpp b/src/xrGame/ui/UIWindow_script.cpp index 7c3d331fef3..20c3ed7f922 100644 --- a/src/xrGame/ui/UIWindow_script.cpp +++ b/src/xrGame/ui/UIWindow_script.cpp @@ -6,6 +6,10 @@ #include "UILabel.h" #include "UIMMShniaga.h" #include "UISleepStatic.h" +#include "ServerList.h" +#include "UIMapInfo.h" +#include "xrUICore/ComboBox/UIComboBox.h" +#include "UIMapList.h" #include "ScriptXMLInit.h" #include "xrScriptEngine/ScriptExporter.hpp" @@ -14,9 +18,12 @@ using namespace luabind::policy; // clang-format off SCRIPT_EXPORT(CDialogHolder, (), { - module(luaState)[class_("CDialogHolder") - .def("AddDialogToRender", &CDialogHolder::AddDialogToRender) - .def("RemoveDialogToRender", &CDialogHolder::RemoveDialogToRender)]; + module(luaState) + [ + class_("CDialogHolder") + .def("AddDialogToRender", &CDialogHolder::AddDialogToRender) + .def("RemoveDialogToRender", &CDialogHolder::RemoveDialogToRender) + ]; }); SCRIPT_EXPORT(CUIDialogWnd, (CUIWindow), { @@ -59,4 +66,87 @@ SCRIPT_EXPORT(CUIMMShniaga, (CUIWindow), { SCRIPT_EXPORT(CUISleepStatic, (CUIStatic), { module(luaState)[class_("CUISleepStatic").def(constructor<>())]; }); + +SCRIPT_EXPORT(SServerFilters, (), { + module(luaState) + [ + class_("SServerFilters") + .def(constructor<>()) + .def_readwrite("empty", &SServerFilters::empty) + .def_readwrite("full", &SServerFilters::full) + .def_readwrite("with_pass", &SServerFilters::with_pass) + .def_readwrite("without_pass", &SServerFilters::without_pass) + .def_readwrite("without_ff", &SServerFilters::without_ff) + .def_readwrite("listen_servers", &SServerFilters::listen_servers) + ]; +}); + +SCRIPT_EXPORT(connect_error_cb, (), { + module(luaState) + [ + class_("connect_error_cb") + .def(constructor<>()) + .def(constructor()) + .def("bind", &connect_error_cb::bind) + .def("clear", &connect_error_cb::clear) + ]; +}); + +SCRIPT_EXPORT(CServerList, (CUIWindow), { + module(luaState) + [ + class_("CServerList") + .def(constructor<>()) + .enum_("enum_connect_errcode") + [ + value("ece_unique_nick_not_registred", int(ece_unique_nick_not_registred)), + value("ece_unique_nick_expired", int(ece_unique_nick_expired)) + ] + .def("SetConnectionErrCb", &CServerList::SetConnectionErrCb) + .def("ConnectToSelected", &CServerList::ConnectToSelected) + .def("SetFilters", &CServerList::SetFilters) + .def("SetPlayerName", &CServerList::SetPlayerName) + .def("RefreshList", &CServerList::RefreshGameSpyList) + .def("RefreshQuick", &CServerList::RefreshQuick) + .def("ShowServerInfo", &CServerList::ShowServerInfo) + .def("NetRadioChanged", &CServerList::NetRadioChanged) + .def("SetSortFunc", &CServerList::SetSortFunc) + ]; +}); + +SCRIPT_EXPORT(CUIMapList, (CUIWindow), { + module(luaState)[class_("CUIMapList") + .def(constructor<>()) + .def("SetWeatherSelector", &CUIMapList::SetWeatherSelector) + .def("SetModeSelector", &CUIMapList::SetModeSelector) + .def("OnModeChange", &CUIMapList::OnModeChange) + .def("LoadMapList", &CUIMapList::LoadMapList) + .def("SaveMapList", &CUIMapList::SaveMapList) + .def("GetCommandLine", &CUIMapList::GetCommandLine) + .def("SetServerParams", &CUIMapList::SetServerParams) + .def("GetCurGameType", &CUIMapList::GetCurGameType) + .def("StartDedicatedServer", &CUIMapList::StartDedicatedServer) + .def("SetMapPic", &CUIMapList::SetMapPic) + .def("SetMapInfo", &CUIMapList::SetMapInfo) + .def("ClearList", &CUIMapList::ClearList) + .def("IsEmpty", &CUIMapList::IsEmpty)]; +}); + +SCRIPT_EXPORT(EnumGameIDs, (), { + class EnumGameIDs + { + }; + module(luaState) + [ + class_("GAME_TYPE") + .enum_("gametype") + [ + value("GAME_UNKNOWN", int(-1)), + value("eGameIDDeathmatch", int(eGameIDDeathmatch)), + value("eGameIDTeamDeathmatch", int(eGameIDTeamDeathmatch)), + value("eGameIDArtefactHunt", int(eGameIDArtefactHunt)), + value("eGameIDCaptureTheArtefact", int(eGameIDCaptureTheArtefact)) + ] + ]; +}); // clang-format on diff --git a/src/xrUICore/ListBox/UIListBox_script.cpp b/src/xrUICore/ListBox/UIListBox_script.cpp index 506b59d72b1..65a88552534 100644 --- a/src/xrUICore/ListBox/UIListBox_script.cpp +++ b/src/xrUICore/ListBox/UIListBox_script.cpp @@ -60,18 +60,4 @@ SCRIPT_EXPORT(CUIListBoxItemMsgChain, (CUIListBoxItem), { .def(constructor()) ]; }); - -SCRIPT_EXPORT(EnumGameIDs, (), { - class EnumGameIDs - { - }; - module(luaState) - [ - class_("GAME_TYPE") - .enum_("gametype") - [ - value("GAME_UNKNOWN", int(-1)) - ] - ]; -}); // clang-format on