Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CompositionInfoDisplay.c
Go to the documentation of this file.
1class SCR_CompositionInfoDisplay : SCR_InfoDisplayExtended
2{
3 protected const string TIME_FORMAT_SINGULAR = "_LC";
4 protected const string TIME_FORMAT_HOUR = "#AR-Time_HourAgo_LC";
5 protected const string TIME_FORMAT_MINUTE = "#AR-Time_MinuteAgo_LC";
6 protected const string TIME_FORMAT_SECOND = "#AR-Time_SecondAgo_LC";
7 protected const string TIME_FORMAT_HOURS = "#AR-Time_HoursAgo_LC";
8 protected const string TIME_FORMAT_MINUTES = "#AR-Time_MinutesAgo_LC";
9 protected const string TIME_FORMAT_SECONDS = "#AR-Time_SecondsAgo_LC";
10
11 [Attribute("1.0")]
12 protected float m_fReportedCooldown;
13
16
17 protected float m_fReportedTimer;
18
19 //------------------------------------------------------------------------------------------------
20 override void DisplayStartDraw(IEntity owner)
21 {
22 if (!m_wRoot)
23 return;
24
27 }
28
29 //------------------------------------------------------------------------------------------------
30 override void DisplayUpdate(IEntity owner, float timeSlice)
31 {
32 if (!m_InfoWidgets)
33 return;
34
35 if (m_fReportedTimer > 0)
36 m_fReportedTimer -= timeSlice;
37
38 if (IsShown() && m_Details && !m_Details.m_sAuthorUID.IsEmpty())
40 }
41
42 //------------------------------------------------------------------------------------------------
43 protected void UpdateLine(SCR_CompositionDetails details)
44 {
45 WorkspaceWidget workspace = GetGame().GetWorkspace();
46 if (!workspace || !m_InfoWidgets.m_wLinePoint)
47 return;
48
49 float lineX, lineY;
51 m_InfoWidgets.m_wLinePoint.GetScreenPos(lineX, lineY);
52 vector line[2];
53 line[0] = workspace.ProjScreenToWorld(workspace.DPIUnscale(lineX), workspace.DPIUnscale(lineY), direction, GetGame().GetWorld());
54 line[0] = line[0] + direction * 100;
55
56 line[1] = details.m_vPosition;
57 Shape.CreateLines(UIColors.CONTRAST_COLOR.PackToInt(), ShapeFlags.ONCE | ShapeFlags.NOZBUFFER, line, 2);
58
59 vector projectedPos = workspace.ProjWorldToScreen(details.m_vPosition, GetGame().GetWorld());
60
61 FrameSlot.SetPos(m_InfoWidgets.m_wEntityPivot, projectedPos[0], projectedPos[1]);
62 }
63
64 //------------------------------------------------------------------------------------------------
66 {
67 m_InfoWidgets.m_wReportedInfo.SetVisible(true);
68 m_InfoWidgets.m_wAuthorDetails.SetVisible(false);
69 m_InfoWidgets.m_wDetailsInfo.SetVisible(false);
70
72 }
73
74 //------------------------------------------------------------------------------------------------
76 {
77 m_InfoWidgets.m_wReportedInfo.SetVisible(false);
78 }
79
80 //------------------------------------------------------------------------------------------------
82 {
83 bool shouldShow = details != null && !details.m_sAuthorUID.IsEmpty();
84
85 if (!m_InfoWidgets || !IsShown() || m_fReportedTimer > 0)
86 return;
87
88 m_Details = details;
89
91 m_InfoWidgets.m_wDetailsInfo.SetVisible(!shouldShow);
92 m_InfoWidgets.m_wAuthorDetails.SetVisible(shouldShow);
93 m_InfoWidgets.m_wEntityPivot.SetVisible(shouldShow);
94
95 // Disabled Reporting -> Rewrite due to ID
96 //if (shouldShow)
97 // m_InfoWidgets.m_wReportButton.SetVisible((details.m_iAuthorUID > -1 && m_PlayerController.GetPlayerId() != details.m_iAuthorUID));
98 //else
99 // m_InfoWidgets.m_wReportButton.SetVisible(false);
100
101 if (!shouldShow)
102 return;
103
104 int currentUnixTime = System.GetUnixTime();
105 int hours, minutes, seconds;
106 int deltaTime = currentUnixTime - details.m_iLastUpdated;
107
108 seconds = deltaTime % 60;
109 minutes = ((deltaTime - seconds) / 60) % 60;
110 hours = ((deltaTime - ((minutes * 60) + seconds)) / (60 * 60));
111
112 string format;
113 if (hours > 0)
114 {
115 format = TIME_FORMAT_HOURS;
116 if (hours == 1)
117 format = TIME_FORMAT_HOUR;
118 m_InfoWidgets.m_wAuthorTime.SetTextFormat(format, hours);
119 }
120 else if (minutes > 0)
121 {
122 format = TIME_FORMAT_MINUTES;
123 if (minutes == 1)
124 format = TIME_FORMAT_MINUTE;
125 m_InfoWidgets.m_wAuthorTime.SetTextFormat(format, minutes);
126 }
127 else if (seconds > 0)
128 {
129 format = TIME_FORMAT_SECONDS;
130 if (seconds == 1)
131 format = TIME_FORMAT_SECOND;
132 m_InfoWidgets.m_wAuthorTime.SetTextFormat(format, seconds);
133 }
134
136 if (playerController)
137 playerController.SetPlatformImageToKind(details.m_ePlatform, m_InfoWidgets.m_wAuthorPlatformIcon, showOnPC: true, showOnXbox: true);
138
139 m_InfoWidgets.m_wEntityName.SetText(details.m_sEntityName);
140 }
141
142 //------------------------------------------------------------------------------------------------
143 void UpdateName(string name)
144 {
145 m_InfoWidgets.m_wAuthorName.SetText(name);
146 }
147}
ArmaReforgerScripted GetGame()
Definition game.c:1398
vector direction
Widget m_wRoot
bool IsShown()
void UpdateCompositionDetails(SCR_CompositionDetails details)
ref SCR_CompositionInfoWidgets m_InfoWidgets
ref SCR_CompositionDetails m_Details
override void DisplayStartDraw(IEntity owner)
void UpdateLine(SCR_CompositionDetails details)
override void DisplayUpdate(IEntity owner, float timeSlice)
Instance of created debug visualizer.
Definition Shape.c:14
ShapeFlags
Definition ShapeFlags.c:13
SCR_FieldOfViewSettings Attribute
proto external PlayerController GetPlayerController()