DayZ 1.24
Loading...
Searching...
No Matches
CTEvent.c
Go to the documentation of this file.
1class CTEvent extends ScriptedWidgetEventHandler
2{
3 protected int m_Index;
4 protected int m_ActorIndex;
5 protected int m_EventType;
6 protected float m_EventTime;
7
8 protected CameraToolsMenu m_Menu;
9
10 protected Widget m_Root;
16
18
19 void CTEvent(int index, int actor, Widget root, bool walk, CameraToolsMenu parent)
20 {
21 m_Menu = parent;
22 m_Index = index;
23 m_ActorIndex = actor;
24
25 m_Root = GetGame().GetWorkspace().CreateWidgets("gui/layouts/camera_tools/event_entry.layout", root);
26 m_IndexWidget = TextWidget.Cast(m_Root.FindAnyWidget("event_id"));
27 m_EventActorWidget = EditBoxWidget.Cast(m_Root.FindAnyWidget("event_actor_edit"));
28 m_EventTimeWidget = EditBoxWidget.Cast(m_Root.FindAnyWidget("event_time_edit"));
29 m_EventTypeWidget = EditBoxWidget.Cast(m_Root.FindAnyWidget("event_type_edit"));
30 m_EventWalkWidget = CheckBoxWidget.Cast(m_Root.FindAnyWidget("auto_walk"));
31
32 m_EventWalkWidget.SetChecked(walk);
33 m_IndexWidget.SetText(m_Index.ToString());
34 m_EventActorWidget.SetText(m_ActorIndex.ToString());
35 m_Root.SetHandler(this);
36 }
37
38 void ~CTEvent()
39 {
40 delete m_Root;
41 }
42
43 void Play()
44 {
46 if (player)
47 {
48 if (m_EventWalkWidget.IsChecked())
49 {
50 player.GetInputController().OverrideMovementAngle(true, 1);
51 player.GetInputController().OverrideMovementSpeed(true, 1);
52 }
53 else
54 {
55 if (player.GetCommand_Action())
56 {
57 //player.GetCommand_Action().Cancel();
58 }
59 m_Callback = player.StartCommand_Action(GetEventType(), EmoteCB, DayZPlayerConstants.STANCEMASK_ALL);
60 m_Callback.EnableCancelCondition(true);
61 }
62 }
63 }
64
65 void Stop()
66 {
67 if (m_Callback)
68 {
69 m_Callback.Cancel();
71 }
73 if (player)
74 player.GetInputController().OverrideMovementSpeed(true, 0);
75 }
76
77 bool IsTime(float start_time, float end_time)
78 {
79 if (m_EventTime >= start_time)
80 {
81 if (m_EventTime <= end_time)
82 return true;
83 }
84 return false;
85 }
86
87 void SetEventTime(float time)
88 {
89 m_EventTime = time;
90 m_EventTimeWidget.SetText(time.ToString());
91 }
92
93 void SetEventType(int type)
94 {
95 m_EventTypeWidget.SetText(type.ToString());
96 }
97
99 {
100 m_EventTime = m_EventTimeWidget.GetText().ToFloat();
101 return m_EventTime;
102 }
103
105 {
106 return m_EventTypeWidget.GetText().ToInt();
107 }
108
110 {
111 return m_EventActorWidget.GetText().ToInt();
112 }
113
115 {
116 return m_EventWalkWidget.IsChecked();
117 }
118
119 void Select()
120 {
121 m_Root.FindAnyWidget("spacer").SetAlpha(1);
122 m_IndexWidget.SetColor(ARGBF(1, 1, 0, 0));
123 m_EventTypeWidget.SetColor(ARGBF(1, 1, 0, 0));
124 m_EventTypeWidget.SetColor(ARGBF(1, 1, 0, 0));
125 }
126
127 void Unselect()
128 {
129 m_Root.FindAnyWidget("spacer").SetAlpha(0.625);
130 m_IndexWidget.SetColor(ARGBF(1, 1, 1, 1));
131 m_EventTypeWidget.SetColor(ARGBF(1, 1, 1, 1));
132 m_EventTypeWidget.SetColor(ARGBF(1, 1, 1, 1));
133 }
134}
EmoteCB m_Callback
ServerBrowserMenuNew m_Menu
Widget m_Root
Definition SizeToChild.c:85
map: item x vector(index, width, height)
Definition EnWidgets.c:651
HumanCommandActionCallback m_Callback
Definition CTEvent.c:17
EditBoxWidget m_EventActorWidget
Definition CTEvent.c:12
CameraToolsMenu m_Menu
Definition CTEvent.c:8
CheckBoxWidget m_EventWalkWidget
Definition CTEvent.c:15
void SetEventTime(float time)
Definition CTEvent.c:87
void SetEventType(int type)
Definition CTEvent.c:93
bool IsTime(float start_time, float end_time)
Definition CTEvent.c:77
EditBoxWidget m_EventTypeWidget
Definition CTEvent.c:14
void CTEvent(int index, int actor, Widget root, bool walk, CameraToolsMenu parent)
Definition CTEvent.c:19
EditBoxWidget m_EventTimeWidget
Definition CTEvent.c:13
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition proto.c:332