diff --git a/gamedata/scripts/lua_help_ex.script b/gamedata/scripts/lua_help_ex.script index 97d020525..b604f14fe 100644 --- a/gamedata/scripts/lua_help_ex.script +++ b/gamedata/scripts/lua_help_ex.script @@ -185,12 +185,6 @@ bool dltx_is_override(string sec, string line) } - // UI hud - // get_hud():GetWindow() - get_hud() { - CUIWindow GetWindow() - } - // Player hud // get_player_hud():set_hands("actor_hud_cs_exo") get_player_hud() { @@ -213,6 +207,54 @@ property dest_position // Fvector } + class CUIWindow { + CUIWindow FindChild() + + CUI3tButton cast_3tButton() + CUIActorMenu cast_ActorMenu() + CUIButton cast_Button() + CUICheckButton cast_CheckButton() + CUIComboBox cast_ComboBox() + CUICustomEdit cast_CustomEdit() + CUICustomSpin cast_CustomSpin() + CUIDialogWnd cast_DialogWnd() + CUIEditBox cast_EditBox() + CUIFrameLineWnd cast_FrameLineWnd() + CUIFrameWindow cast_FrameWindow() + UIHint cast_Hint() + CUIHudStatesWnd cast_HudStatesWnd() + CUIListBox cast_ListBox() + CUIListBoxItem cast_ListBoxItem() + CUIListBoxItemMsgChain cast_ListBoxItemMsgChain() + CUIMMShniaga cast_MMShniaga() + CUIMainIngameWnd cast_MainIngameWnd() + CUIMapInfo cast_MapInfo() + CUIMapList cast_MapList() + CUIMessageBox cast_MessageBox() + CUIMessageBoxEx cast_MessageBoxEx() + CUIMessagesWindow cast_MessagesWindow() + CUIMotionIcon cast_MotionIcon() + CUIPdaWnd cast_PdaWnd() + CUIProgressBar cast_ProgressBar() + CUIPropertiesBox cast_PropertiesBox() + CUIDialogWndEx cast_ScriptWnd() + CUIScrollView cast_ScrollView() + CServerList cast_ServerList() + CUISleepStatic cast_SleepStatic() + CUISpinFlt cast_SpinFlt() + CUISpinNum cast_SpinNum() + CUISpinText cast_SpinText() + CUIStatic cast_Static() + CUITabButton cast_TabButton() + CUITabControl cast_TabControl() + CUITextWnd cast_TextWnd() + CUITrackBar cast_TrackBar() + } + + class CUIGameCustom { + CUIWindow GetWindow() // get_hud():GetWindow() + } + class CUIProgressBar { CUIStatic GetProgressStatic() bool GetSnapNoDelay() Get the status of "SnapNoDelay" diff --git a/src/xrGame/ui/UIMainIngameWnd.cpp b/src/xrGame/ui/UIMainIngameWnd.cpp index a29cd8a5f..f4b368918 100644 --- a/src/xrGame/ui/UIMainIngameWnd.cpp +++ b/src/xrGame/ui/UIMainIngameWnd.cpp @@ -315,7 +315,6 @@ void CUIMainIngameWnd::Draw() RenderQuickInfos(); } - void CUIMainIngameWnd::SetMPChatLog(CUIWindow* pChat, CUIWindow* pLog) { m_pMPChatWnd = pChat; diff --git a/src/xrGame/ui/UIMainIngameWnd.h b/src/xrGame/ui/UIMainIngameWnd.h index 456fbb0cd..6551b277f 100644 --- a/src/xrGame/ui/UIMainIngameWnd.h +++ b/src/xrGame/ui/UIMainIngameWnd.h @@ -67,7 +67,6 @@ class CUIMainIngameWnd : public CUIWindow CUITextWnd* m_QuickSlotText2; CUITextWnd* m_QuickSlotText3; CUITextWnd* m_QuickSlotText4; - protected: // 5 статиков для отображения иконок: // - сломанного оружия(only mp) diff --git a/src/xrGame/ui/UIWindow.cpp b/src/xrGame/ui/UIWindow.cpp index 5840c89f6..7ec1b46f3 100644 --- a/src/xrGame/ui/UIWindow.cpp +++ b/src/xrGame/ui/UIWindow.cpp @@ -612,7 +612,7 @@ bool CUIWindow::IsChild(CUIWindow* pPossibleChild) const } -CUIWindow* CUIWindow::FindChild(const shared_str name) +CUIWindow* CUIWindow::FindChild(const LPCSTR name) { if (WindowName() == name) return this; diff --git a/src/xrGame/ui/UIWindow.h b/src/xrGame/ui/UIWindow.h index 881f3763b..2a5d8800c 100644 --- a/src/xrGame/ui/UIWindow.h +++ b/src/xrGame/ui/UIWindow.h @@ -240,7 +240,7 @@ class CUIWindow : public CUISimpleWindow const shared_str WindowName() const { return m_windowName; } void SetWindowName(LPCSTR wn) { m_windowName = wn; } LPCSTR WindowName_script() { return m_windowName.c_str(); } - CUIWindow* FindChild(const shared_str name); + CUIWindow* FindChild(const LPCSTR name); IC bool CursorOverWindow() const { return m_bCursorOverWindow; } IC u32 FocusReceiveTime() const { return m_dwFocusReceiveTime; } diff --git a/src/xrGame/ui/UIWindow_script.cpp b/src/xrGame/ui/UIWindow_script.cpp index 82d4650a1..2d99d6627 100644 --- a/src/xrGame/ui/UIWindow_script.cpp +++ b/src/xrGame/ui/UIWindow_script.cpp @@ -1,17 +1,47 @@ #include "pch_script.h" #include "UIWindow.h" -#include "UIFrameWindow.h" -#include "UIFrameLineWnd.h" -#include "UIDialogWnd.h" #include "UIDialogHolder.h" -#include "../GamePersistent.h" -//#include "UILabel.h" -#include "UIMMShniaga.h" #include "UITextureMaster.h" -#include "UIScrollView.h" -#include "UIHint.h" +#include "../GamePersistent.h" #include "../ScriptXMLInit.h" #include "../UICursor.h" +#include "ServerList.h" +#include "UI3tButton.h" +#include "UIActorMenu.h" +#include "UIAnimatedStatic.h" +#include "UIButton.h" +#include "UICheckButton.h" +#include "UIComboBox.h" +#include "UICustomEdit.h" +#include "UICustomSpin.h" +#include "UIDialogWnd.h" +#include "UIEditBox.h" +#include "UIFrameLineWnd.h" +#include "UIFrameWindow.h" +#include "UIHint.h" +#include "UIHudStatesWnd.h" +#include "UIListBox.h" +#include "UIListBoxItem.h" +#include "UIListBoxItemMsgChain.h" +#include "UIMainIngameWnd.h" +#include "UIMapInfo.h" +#include "UIMapList.h" +#include "UIMessageBox.h" +#include "UIMessageBoxEx.h" +#include "UIMessagesWindow.h" +#include "UIMMShniaga.h" +#include "UIMotionIcon.h" +#include "UIPdaWnd.h" +#include "UIProgressBar.h" +#include "UIPropertiesBox.h" +#include "UIScriptWnd.h" +#include "UIScrollView.h" +#include "UISpinNum.h" +#include "UISpinText.h" +#include "UIStatic.h" +#include "UITabButton.h" +#include "UITabControl.h" +#include "UITrackBar.h" CFontManager& mngr() { @@ -131,6 +161,14 @@ void SetCursorPosition_script(Fvector2& pos) GetUICursor().SetUICursorPosition(pos); } +template +T* ui_window_cast(CUIWindow* window) +{ + return smart_cast(window); +} + +#define UI_WINDOW_CAST(class_name) &ui_window_cast + using namespace luabind; #pragma optimize("s",on) void CUIWindow::script_register(lua_State* L) @@ -166,6 +204,7 @@ void CUIWindow::script_register(lua_State* L) .def("AttachChild", &CUIWindow::AttachChild, adopt<2>()) .def("AttachChildKeepOwner", &CUIWindow::AttachChild) .def("DetachChild", &CUIWindow::DetachChild) + .def("FindChild", &CUIWindow::FindChild) .def("SetAutoDelete", &CUIWindow::SetAutoDelete) .def("IsAutoDelete", &CUIWindow::IsAutoDelete) @@ -173,18 +212,6 @@ void CUIWindow::script_register(lua_State* L) .def("FocusReceiveTime", &CUIWindow::FocusReceiveTime) .def("GetAbsoluteRect", &CUIWindow::GetAbsoluteRect) - /* - .def("DisableHint", &CUIWindow::DisableHint) - .def("EnableHint", &CUIWindow::EnableHint) - .def("SetHintDelay", &CUIWindow::SetHintDelay) - .def("GetHintDelay", &CUIWindow::GetHintDelay) - .def("RemoveHint", &CUIWindow::RemoveHint) - .def("SetHintWnd", &CUIWindow::SetHintWnd) - .def("GetHintWnd", &CUIWindow::GetHintWnd) - .def("SetHintText", &CUIWindow::SetHintText) - .def("GetHintText", &CUIWindow::GetHintText) - */ - .def("SetWndRect", (void (CUIWindow::*)(Frect))&CUIWindow::SetWndRect_script) .def("SetWndPos", (void (CUIWindow::*)(Fvector2))&CUIWindow::SetWndPos_script) .def("SetWndSize", (void (CUIWindow::*)(Fvector2))&CUIWindow::SetWndSize_script) @@ -201,6 +228,46 @@ void CUIWindow::script_register(lua_State* L) .def("SetWindowName", &CUIWindow::SetWindowName) .def("SetPPMode", &CUIWindow::SetPPMode) .def("ResetPPMode", &CUIWindow::ResetPPMode) + + .def("cast_3tButton", UI_WINDOW_CAST(CUI3tButton)) + .def("cast_ActorMenu", UI_WINDOW_CAST(CUIActorMenu)) + .def("cast_Button", UI_WINDOW_CAST(CUIButton)) + .def("cast_CheckButton", UI_WINDOW_CAST(CUICheckButton)) + .def("cast_ComboBox", UI_WINDOW_CAST(CUIComboBox)) + .def("cast_CustomEdit", UI_WINDOW_CAST(CUICustomEdit)) + .def("cast_CustomSpin", UI_WINDOW_CAST(CUICustomSpin)) + .def("cast_DialogWnd", UI_WINDOW_CAST(CUIDialogWnd)) + .def("cast_EditBox", UI_WINDOW_CAST(CUIEditBox)) + .def("cast_FrameLineWnd", UI_WINDOW_CAST(CUIFrameLineWnd)) + .def("cast_FrameWindow", UI_WINDOW_CAST(CUIFrameWindow)) + .def("cast_Hint", UI_WINDOW_CAST(UIHint)) + .def("cast_HudStatesWnd", UI_WINDOW_CAST(CUIHudStatesWnd)) + .def("cast_ListBox", UI_WINDOW_CAST(CUIListBox)) + .def("cast_ListBoxItem", UI_WINDOW_CAST(CUIListBoxItem)) + .def("cast_ListBoxItemMsgChain", UI_WINDOW_CAST(CUIListBoxItemMsgChain)) + .def("cast_MMShniaga", UI_WINDOW_CAST(CUIMMShniaga)) + .def("cast_MainIngameWnd", UI_WINDOW_CAST(CUIMainIngameWnd)) + .def("cast_MapInfo", UI_WINDOW_CAST(CUIMapInfo)) + .def("cast_MapList", UI_WINDOW_CAST(CUIMapList)) + .def("cast_MessageBox", UI_WINDOW_CAST(CUIMessageBox)) + .def("cast_MessageBoxEx", UI_WINDOW_CAST(CUIMessageBoxEx)) + .def("cast_MessagesWindow", UI_WINDOW_CAST(CUIMessagesWindow)) + .def("cast_MotionIcon", UI_WINDOW_CAST(CUIMotionIcon)) + .def("cast_PdaWnd", UI_WINDOW_CAST(CUIPdaWnd)) + .def("cast_ProgressBar", UI_WINDOW_CAST(CUIProgressBar)) + .def("cast_PropertiesBox", UI_WINDOW_CAST(CUIPropertiesBox)) + .def("cast_ScriptWnd", UI_WINDOW_CAST(CUIDialogWndEx)) + .def("cast_ScrollView", UI_WINDOW_CAST(CUIScrollView)) + .def("cast_ServerList", UI_WINDOW_CAST(CServerList)) + .def("cast_SleepStatic", UI_WINDOW_CAST(CUISleepStatic)) + .def("cast_SpinFlt", UI_WINDOW_CAST(CUISpinFlt)) + .def("cast_SpinNum", UI_WINDOW_CAST(CUISpinNum)) + .def("cast_SpinText", UI_WINDOW_CAST(CUISpinText)) + .def("cast_Static", UI_WINDOW_CAST(CUIStatic)) + .def("cast_TabButton", UI_WINDOW_CAST(CUITabButton)) + .def("cast_TabControl", UI_WINDOW_CAST(CUITabControl)) + .def("cast_TextWnd", UI_WINDOW_CAST(CUITextWnd)) + .def("cast_TrackBar", UI_WINDOW_CAST(CUITrackBar)) ]; module(L) @@ -322,3 +389,5 @@ void CUIWindow::script_register(lua_State* L) ] ]; } + +#undef UI_WINDOW_CAST