DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ScriptConsoleUniversalInfoDialog.c
См. документацию.
1class ScriptConsoleUniversalInfoDialog extends UIScriptedMenu
2{
3 private const int EDITBOX_TEXT_SIZE = 16;
4
5 private TextWidget m_Label;
6 private ScrollWidget m_ContentScroll;
7 private MultilineEditBoxWidget m_Content;
8 private ButtonWidget m_OKButton;
9
12
13 override Widget Init()
14 {
15 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/script_console_universal_info_dialog.layout");
16 m_Label = TextWidget.Cast(layoutRoot.FindAnyWidget("Label"));
17 m_ContentScroll = ScrollWidget.Cast(layoutRoot.FindAnyWidget("ContentScroll"));
18 m_ContentScroll.VScrollToPos(0);
19 m_Content = MultilineEditBoxWidget.Cast(layoutRoot.FindAnyWidget("Content"));
20 m_OKButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("MessageText"));
21
22 return layoutRoot;
23 }
24
25 override bool OnClick(Widget w, int x, int y, int button)
26 {
27 super.OnClick(w, x, y, button);
28
29 if (w.GetUserID() == IDC_OK)
30 {
32 if (consoleMenu != null)
33 {
34 ScriptConsole scriptedConsole = ScriptConsole.Cast(consoleMenu);
35 ScriptConsoleItemsTab tab = ScriptConsoleItemsTab.Cast(scriptedConsole.GetTabHandler(ScriptConsoleItemsTab));
36 if (tab)
37 {
38 Close();
39 return true;
40 }
41 }
42 }
43
44 return false;
45 }
46
47 void SetLabel(string label)
48 {
49 m_Label.SetText(label);
50 }
51
52 void SetContent(string content)
53 {
54 m_Content.SetText(content);
55 m_Content.Update();
56 float contentSizeX, contentSizeY = 0;
57 m_Content.GetSize(contentSizeX, contentSizeY);
58 m_Content.SetSize(contentSizeX, EDITBOX_TEXT_SIZE * m_Content.GetLinesCount());
59 float y_c = m_ContentScroll.GetContentHeight();
60 float x, y;
61 m_Content.GetScreenSize(x, y);
62 if (y > y_c)
63 {
64 m_ContentScroll.SetAlpha(1);
65 }
66 }
67}
Icon x
Icon y
void Close()
proto native UIManager GetUIManager()
proto native WorkspaceWidget GetWorkspace()
Определения EnWidgets.c:220
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
void ScriptConsole()
Определения ScriptConsole.c:37
void SetLabel(string label)
void SetContent(string content)
TextWidget m_Label
Определения ScriptConsoleAddPosition.c:65
ScrollWidget m_ContentScroll
const int EDITBOX_TEXT_SIZE
void ~ScriptConsoleUniversalInfoDialog()
ButtonWidget m_OKButton
override Widget Init()
override bool OnClick(Widget w, int x, int y, int button)
WrapSpacerWidget m_Content
Определения CreditsMenu.c:24
void ScriptConsoleUniversalInfoDialog()
Определения DayZGame.c:64
Определения EnWidgets.c:190
proto native CGame GetGame()
const int MENU_SCRIPTCONSOLE
Определения constants.c:185
const int IDC_OK
Определения constants.c:135
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.