Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
notemenu.c
Go to the documentation of this file.
1
class
NoteMenu
extends
UIScriptedMenu
2
{
3
protected
MultilineEditBoxWidget
m_edit
;
4
protected
HtmlWidget
m_html
;
5
protected
ButtonWidget
m_confirm_button
;
6
protected
ItemBase
m_Paper
;
7
protected
EntityAI
m_Pen
;
8
protected
bool
m_IsWriting
;
9
//protected int m_Handwriting;
10
protected
int
m_SymbolCount
;
11
protected
string
m_PenColor
;
//color in hex-code format, transferred as string. Could be transferred as int or array<int, bool>?
12
13
void
NoteMenu
()
14
{
15
MissionGameplay
mission
= MissionGameplay.Cast(
g_Game
.GetMission());
16
if
(
mission
)
17
{
18
IngameHud hud = IngameHud.Cast(
mission
.GetHud());
19
if
(hud)
20
{
21
hud.ShowHudUI(
false
);
22
}
23
}
24
}
25
26
void
~NoteMenu
()
27
{
28
MissionGameplay
mission
= MissionGameplay.Cast(
g_Game
.GetMission());
29
if
(
mission
)
30
{
31
IngameHud hud = IngameHud.Cast(
mission
.GetHud());
32
if
(hud)
33
{
34
hud.ShowHudUI(
true
);
35
}
36
}
37
}
38
39
override
void
InitNoteRead
(
string
text =
""
)
40
{
41
m_IsWriting
=
false
;
42
43
if
(
m_edit
)
44
{
45
m_edit
.Show(
false
);
46
}
47
48
if
(
m_html
)
49
{
50
//TODO add text formating here. Just text string for now
51
if
(text)
52
{
53
m_html
.Show(
true
);
54
m_html
.SetText(text);
55
m_SymbolCount
= text.Length();
//string.LengthUtf8() ?
56
//m_html.SetText("<html><body><p>" + text + "</p></body></html>");
57
}
58
}
59
m_confirm_button
.Show(
false
);
60
}
61
62
override
void
InitNoteWrite
(
EntityAI
paper,
EntityAI
pen,
string
text =
""
)
63
{
64
m_IsWriting
=
true
;
65
66
if
(
m_edit
)
67
{
68
m_Paper
=
ItemBase
.Cast(paper);
69
m_Pen
= pen;
70
m_PenColor
=
m_Pen
.ConfigGetString(
"writingColor"
);
71
if
(
m_PenColor
==
""
)
72
{
73
m_PenColor
=
"#000000"
;
74
}
75
//m_Handwriting = handwriting;
76
77
m_edit
.Show(
true
);
78
m_edit
.SetText(text);
79
}
80
81
if
(
m_html
)
82
{
83
m_html
.Show(
false
);
84
}
85
m_confirm_button
.Show(
true
);
86
}
87
88
override
Widget
Init
()
89
{
90
layoutRoot =
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/day_z_inventory_note.layout"
);
91
m_edit
= MultilineEditBoxWidget.Cast(layoutRoot.FindAnyWidget(
"EditWidget"
));
92
m_html
= HtmlWidget.Cast(layoutRoot.FindAnyWidget(
"HtmlWidget"
));
93
m_confirm_button
= ButtonWidget.Cast(layoutRoot.FindAnyWidgetById(
IDC_OK
));
94
95
return
layoutRoot;
96
}
97
98
override
bool
OnClick
(
Widget
w,
int
x
,
int
y
,
int
button)
99
{
100
super.OnClick(w,
x
,
y
, button);
101
102
/* string txt;
103
m_edit.GetText(txt);
104
Print(m_edit.GetLinesCount());
105
Print(txt);
106
Print(txt.Length());*/
107
108
switch
(w.GetUserID())
109
{
110
case
IDC_CANCEL
:
111
Close
();
112
return
true
;
113
case
IDC_OK
:
114
if
(
m_Paper
&&
m_Pen
&&
m_IsWriting
)
115
{
116
string
edit_text;
117
m_edit
.GetText(edit_text);
118
edit_text = MiscGameplayFunctions.SanitizeString(edit_text);
119
// Print("edit_text: " + edit_text);
120
Param1<string> text =
new
Param1<string>(edit_text);
121
m_Paper
.RPCSingleParam(
ERPCs
.RPC_WRITE_NOTE_CLIENT, text,
true
);
122
}
123
Close
();
124
return
true
;
125
}
126
127
return
false
;
128
}
129
130
override
void
Update
(
float
timeslice)
131
{
132
super.Update(timeslice);
133
134
if
(
g_Game
&&
GetUApi
().GetInputByID(UAUIBack).LocalPress())
135
{
136
Close
();
137
}
138
}
139
}
EntityAI
Definition
inventoryitem.c:2
ItemBase
Definition
inventoryitem.c:742
UIScriptedMenu
Xbox menu.
Definition
dayzgame.c:64
UIScriptedMenu::m_Pen
EntityAI m_Pen
Definition
notemenu.c:7
UIScriptedMenu::m_edit
MultilineEditBoxWidget m_edit
Definition
notemenu.c:3
UIScriptedMenu::Update
override void Update(float timeslice)
Definition
notemenu.c:130
UIScriptedMenu::m_confirm_button
ButtonWidget m_confirm_button
Definition
notemenu.c:5
UIScriptedMenu::InitNoteWrite
override void InitNoteWrite(EntityAI paper, EntityAI pen, string text="")
Definition
notemenu.c:62
UIScriptedMenu::NoteMenu
void NoteMenu()
Definition
notemenu.c:13
UIScriptedMenu::m_html
HtmlWidget m_html
Definition
notemenu.c:4
UIScriptedMenu::m_PenColor
string m_PenColor
Definition
notemenu.c:11
UIScriptedMenu::m_Paper
ItemBase m_Paper
Definition
notemenu.c:6
UIScriptedMenu::m_SymbolCount
int m_SymbolCount
Definition
notemenu.c:10
UIScriptedMenu::InitNoteRead
override void InitNoteRead(string text="")
Definition
notemenu.c:39
UIScriptedMenu::Init
override Widget Init()
Definition
notemenu.c:88
UIScriptedMenu::m_IsWriting
bool m_IsWriting
Definition
notemenu.c:8
UIScriptedMenu::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
notemenu.c:98
UIScriptedMenu::~NoteMenu
void ~NoteMenu()
Definition
notemenu.c:26
Widget
Definition
enwidgets.c:190
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
mission
Mission mission
Definition
displaystatus.c:28
ERPCs
ERPCs
Definition
erpcs.c:2
IDC_CANCEL
const int IDC_CANCEL
Definition
constants.c:136
IDC_OK
const int IDC_OK
Definition
constants.c:135
x
Icon x
y
Icon y
Close
void Close()
GetUApi
proto native UAInputAPI GetUApi()
Games
Dayz
scripts
5_mission
gui
notemenu.c
Generated by
1.17.0