5 protected string m_sTypeTag;
6 protected string m_sTypeName;
8 protected string m_sCategoryTag;
9 protected string m_sCategoryName;
12 protected string m_sContent;
15 protected string m_sUserName;
19 protected string m_sBuildTime;
21 protected string m_sBuildVersion;
25 protected string m_sWorldFile;
28 protected string m_sSubmitTime;
31 protected vector m_vWorldPosition;
33 protected vector m_vWorldRotation;
36 protected string m_sMessage;
39 string FormatMessage()
41 const string altsep =
"-----------------------------\n";
44 res +=
string.Format(
"Type: %1\n", GetFeedbackType());
45 res +=
string.Format(
"Category: %1\n", GetFeedbackCategory());
46 res +=
string.Format(
"User: %1\n", GetUserName());
49 res +=
string.Format(
"<enfusion://WorldEditor/%1;%2,%3,%4;%5,%6,%7|Enfusion Link>\n",
51 m_vWorldPosition[0].ToString(),
52 m_vWorldPosition[1].ToString(),
53 m_vWorldPosition[2].ToString(),
54 m_vWorldRotation[1].ToString(),
55 m_vWorldRotation[2].ToString(),
56 m_vWorldRotation[0].ToString());
58 res +=
string.Format(
"Build Version: %1\n", GetBuildVersion());
59 res +=
string.Format(
"Submit Time: %1\n", GetFeedbackSubmitTime());
60 res +=
string.Format(
"Build Time: %1\n", GetBuildTime());
61 res +=
string.Format(
"World File: %1\n", GetWorldFile());
64 res +=
string.Format(
"Position: %1\n", m_vWorldPosition.ToString());
65 res +=
string.Format(
"Rotation: %1\n", m_vWorldRotation.ToString());
68 res +=
"FEEDBACK USER DATA:\n";
96 string GetBuildVersion()
98 return m_sBuildVersion;
102 string GetFeedbackSubmitTime()
104 return m_sSubmitTime;
108 string GetFeedbackType()
114 string GetFeedbackCategory()
116 return m_sCategoryName;
120 string GetFeedbackContent()
126 protected string GetCurrentTimestamp()
128 int year, month, day, hour, minute, sec;
129 System.GetYearMonthDay(year, month, day);
130 System.GetHourMinuteSecond(hour, minute, sec);
131 string smonth, sday, shour, sminute, ssec;
133 smonth =
string.Format(
"0%1", month);
135 smonth =
string.Format(
"%1", month);
138 sday =
string.Format(
"0%1", day);
140 sday =
string.Format(
"%1", day);
143 shour =
string.Format(
"0%1", hour);
145 shour =
string.Format(
"%1", hour);
148 sminute =
string.Format(
"0%1", minute);
150 sminute =
string.Format(
"%1", minute);
153 ssec =
string.Format(
"0%1", sec);
155 ssec =
string.Format(
"%1", sec);
157 return string.Format(
"%1-%2-%3 %4:%5:%6", year, smonth, sday, shour, sminute, ssec);
161 protected bool FetchCoords()
163 ArmaReforgerScripted game =
GetGame();
166 BaseWorld world = game.GetWorld();
169 int cameraId = world.GetCurrentCameraId();
172 world.GetCamera(cameraId, mat);
173 vector yawPitchRoll = Math3D.MatrixToAngles(mat);
174 m_vWorldPosition = mat[3];
177 m_vWorldRotation[0] = yawPitchRoll[1];
178 m_vWorldRotation[1] = yawPitchRoll[0];
179 m_vWorldRotation[2] = yawPitchRoll[2];
185 m_vWorldPosition = Vector(0,0,0);
186 m_vWorldRotation = Vector(0,0,0);
192 void FeedbackData(
string typeTag,
string typeName,
string catTag,
string catName,
string content)
197 RegV(
"m_sCategoryName");
201 RegV(
"m_sBuildTime");
202 RegV(
"m_sBuildVersion");
204 RegV(
"m_sWorldFile");
205 RegV(
"m_sSubmitTime");
207 RegV(
"m_vWorldPosition");
208 RegV(
"m_vWorldRotation");
212 m_sTypeTag = typeTag;
213 m_sCategoryTag = catTag;
215 m_sTypeName = typeName;
216 m_sCategoryName = catName;
218 m_sContent = content;
220 ArmaReforgerScripted game =
GetGame();
226 m_sBuildTime = game.GetBuildTime();
227 m_sBuildVersion = game.GetBuildVersion();
229 m_sWorldFile = game.GetWorldFile();
230 m_sSubmitTime = GetCurrentTimestamp();
242 static const int TYPE_NAMES_COUNT = 2;
243 static const string TYPE_TAGS[TYPE_NAMES_COUNT] =
250 "#AR-MainMenu_Feedback_Name",
255 static const int CATEGORY_NAMES_COUNT = 8;
256 static const string CATEGORY_TAGS[CATEGORY_NAMES_COUNT] =
269 "#AR-Feedback_General",
271 "#AR-MainMenu_Editor_Name",
272 "#AR-Feedback_Character",
273 "#AR-Feedback_Vehicles",
274 "#AR-Feedback_Weapons",
275 "#AR-MainMenu_Multiplayer_Name",
276 "#AR-MainMenu_Conflict_Name"
283 protected static ref FeedbackData m_LastFeedback;
284 protected static float m_fLastFeedbackTime = -
float.MAX;
285 protected static const float FEEDBACK_SEND_TIMEOUT = 5000;
288 protected bool m_bShouldEnableConfirmButton;
291 override protected void OnConfirm()
293 if (!
m_Type || !m_Category || !m_EditBox)
298 int category = m_Category.GetCurrentIndex();
299 string content = m_EditBox.GetValue();
306 override void OnMenuShow()
309 GetGame().GetWorkspace().SetFocusedWidget(
m_Type.GetRootWidget());
313 override void OnMenuUpdate(
float tDelta)
315 super.OnMenuUpdate(tDelta);
317 GetGame().GetInputManager().ActivateContext(
"InteractableDialogContext");
323 ArmaReforgerScripted game =
GetGame();
327 MenuManager menuManager = game.GetMenuManager();
331 MenuBase dialog = menuManager.FindMenuByPreset(
ChimeraMenuPreset.FeedbackDialog);
333 dialog = menuManager.OpenDialog(
ChimeraMenuPreset.FeedbackDialog, DialogPriority.INFORMATIVE, 0,
true);
339 static bool CanSendFeedback()
341 BaseWorld world =
GetGame().GetWorld();
345 float timeSinceLast = world.GetWorldTime() - m_fLastFeedbackTime;
346 return timeSinceLast > FEEDBACK_SEND_TIMEOUT;
350 static void SendFeedback(
string content,
int type,
int category)
353 m_LastFeedback =
NULL;
354 m_LastFeedback =
new FeedbackData(TYPE_TAGS[
type], TYPE_NAMES[
type], CATEGORY_TAGS[
category], CATEGORY_NAMES[
category], content);
355 string summary = m_LastFeedback.FormatMessage();
357 GetGame().GetBackendApi().FeedbackMessage(
null,m_LastFeedback,summary);
358 m_fLastFeedbackTime =
GetGame().GetWorld().GetWorldTime();
362 static void ClearFeedback()
364 m_LastFeedback =
null;
368 private void OnCreateAccount()
370 GetGame().GetPlatformService().OpenBrowser(
GetGame().GetBackendApi().GetLinkItem(
"Link_PrivacyPolicy"));
374 override void OnMenuOpen()
377 m_Confirm.SetEnabled(
false,
false);
384 for (
int i = 0; i < TYPE_NAMES_COUNT; i++)
386 m_Type.AddItem(TYPE_NAMES[i]);
394 for (
int i = 0; i < CATEGORY_NAMES_COUNT; i++)
396 m_Category.AddItem(CATEGORY_NAMES[i]);
398 m_Category.SetCurrentItem(0);
403 m_CreateAccount.m_OnActivated.Insert(OnCreateAccount);
407 m_EditBox.m_OnWriteModeLeave.Insert(OnWriteModeLeave);
408 m_EditBox.m_OnTextChange.Insert(OnTextChange);
413 protected void OnWriteModeLeave(
string text)
419 protected void OnTextChange(
string text)
424 m_bShouldEnableConfirmButton = m_EditBox.GetValue() !=
string.Empty &&
FeedbackDialogUI.CanSendFeedback();
426 m_Confirm.SetEnabled(m_bShouldEnableConfirmButton);