Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LocalizationTools.c
Go to the documentation of this file.
2 {
3  static const string FORMAT_TAG = "##";
4 
5  protected static bool AppendParam(out string text, string p)
6  {
7  text += FORMAT_TAG + p;
8  return p != string.Empty;
9  }
16  static string EncodeFormat(string text, string p1 = string.Empty, string p2 = string.Empty, string p3 = string.Empty, string p4 = string.Empty, string p5 = string.Empty, string p6 = string.Empty, string p7 = string.Empty, string p8 = string.Empty, string p9 = string.Empty)
17  {
18  string params;
19  bool isParam = AppendParam(params, p1)
20  || AppendParam(params, p2)
21  || AppendParam(params, p3)
22  || AppendParam(params, p4)
23  || AppendParam(params, p5)
24  || AppendParam(params, p6)
25  || AppendParam(params, p7)
26  || AppendParam(params, p8)
27  || AppendParam(params, p9);
28 
29  if (isParam)
30  return FORMAT_TAG + text + params;
31  else
32  return text;
33  }
40  static string DecodeFormat(string text, out string p1, out string p2, out string p3, out string p4, out string p5, out string p6, out string p7, out string p8, out string p9)
41  {
42  if (!text.StartsWith(FORMAT_TAG))
43  return text;
44 
45  array<string> segments = {};
46  text.Split(FORMAT_TAG, segments, false);
47  segments.Resize(11);
48 
49  p1 = segments[2];
50  p2 = segments[3];
51  p3 = segments[4];
52  p4 = segments[5];
53  p5 = segments[6];
54  p6 = segments[7];
55  p7 = segments[8];
56  p8 = segments[9];
57  p9 = segments[10];
58 
59  return segments[1];
60  }
66  static void SetTextFormat(TextWidget w, string text)
67  {
68  if (text.StartsWith(FORMAT_TAG))
69  {
70  string p1, p2, p3, p4, p5, p6, p7, p8, p9;
71  text = DecodeFormat(text, p1, p2, p3, p4, p5, p6, p7, p8, p9);
72  w.SetTextFormat(text, p1, p2, p3, p4, p5, p6, p7, p8, p9);
73  }
74  else
75  {
76  w.SetText(text);
77  }
78  }
79 };
SCR_LocalizationTools
Definition: SCR_LocalizationTools.c:1
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24