Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
Constants.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3//------------------------------------------------------------------------------------------------
4
6const float KILOMETERS_PER_HOUR_TO_METERS_PER_SEC = 0.277778; // 1 / 3.6
7
8const float METERS_TO_KNOTS = 1.943844;
9const float KNOTS_TO_METERS = 0.514444;
10
11const float COLOR_255_TO_1 = 0.003921568; // 1 / 255
12const float COLOR_1_TO_255 = 255;
13
14const int TRACE_LAYER_CAMERA = EPhysicsLayerDefs.Camera;
15
17{
18 static const ref Color DARK_SAGE = Color.FromSRGBA(86, 92, 84, 255);
19 static const ref Color DARK_GREY = Color.FromSRGBA(85, 85, 85, 255);
20 static const ref Color TRANSPARENT = Color.FromSRGBA(0, 0, 0, 0);
21
22 // Refined UI colors
23 static const ref Color CONTRAST_DISABLED = Color.FromSRGBA(0, 0, 0, 38);
24 static const ref Color CONTRAST_DEFAULT = Color.FromSRGBA(226, 167, 79, 76);
25 static const ref Color CONTRAST_HOVERED = Color.FromSRGBA(239, 199, 139, 102);
26 static const ref Color CONTRAST_CLICKED = Color.FromSRGBA(226, 167, 79, 255);
27 static const ref Color CONTRAST_CLICKED_HOVERED = Color.FromSRGBA(226, 167, 79, 255);
28
29 static const ref Color WHITE_DISABLED = Color.FromSRGBA(255, 255, 255, 38);
30 static const ref Color WHITE_DEFAULT = Color.FromSRGBA(255, 255, 255, 25);
31 static const ref Color WHITE_HOVERED = Color.FromSRGBA(255, 255, 255, 102);
32
33 static const ref Color BACKGROUND_DISABLED = Color.FromSRGBA(0, 0, 0, 38);
34 static const ref Color BACKGROUND_DEFAULT = Color.FromSRGBA(0, 0, 0, 102);
35 static const ref Color BACKGROUND_HOVERED = Color.FromSRGBA(0, 0, 0, 153);
36
37 static const ref Color INFO = Color.FromSRGBA(0, 128, 255, 255);
38
39 // From Manual
40 static const ref Color HIGHLIGHTED = Color.FromSRGBA(255, 203, 123, 255); //#FFCB7B
41 static const ref Color NEUTRAL_INFORMATION = Color.FromSRGBA(255, 255, 255, 255); //#FFFFFF
42 static const ref Color NEUTRAL_ACTIVE_STANDBY = Color.FromSRGBA(189, 189, 188, 255); //#BDBDBC
43 static const ref Color IDLE_ACTIVE = Color.FromSRGBA(255, 255, 255, 179); //#FFFFFF at 70% Alpha
44 static const ref Color IDLE_DISABLED = Color.FromSRGBA(77, 77, 77, 255); //#4D4D4D
45 static const ref Color IDLE_DISABLED_TRANSPARENT = Color.FromSRGBA(77, 77, 77, 153); //60% #4D4D4D
46 static const ref Color WARNING = Color.FromSRGBA(249, 67, 67, 255); //#f94343 red
47 static const ref Color WARNING_DISABLED = Color.FromSRGBA(146, 72, 72, 255); //#924848 dark red
48 static const ref Color WARNING_DISABLED_FOCUSED = Color.FromSRGBA(173, 71, 71, 255); //#ad4747
49 static const ref Color SLIGHT_WARNING = Color.FromSRGBA(234, 203, 131, 255); //#EACB83 light yellow
50 static const ref Color CONFIRM = Color.FromSRGBA(67, 194, 93, 255); //#43C25D green, Manual calls it POSITIVE
51 static const ref Color CONTRAST_COLOR = Color.FromSRGBA(226, 167, 79, 255); //#e2a74f REFORGER ORANGE
52 static const ref Color ONLINE = Color.FromSRGBA(0, 128, 255, 255); //#0080FF blue
53 static const ref Color EDIT_WIDGET_BACKGROUND = Color.FromSRGBA(42, 42, 42, 255); //#2a2a2a
54 static const ref Color SUB_HEADER = Color.FromSRGBA(255, 220, 105, 255); //#ffdc69 yellow
55
56 //~ editor
57 static const ref Color EDITOR_ICON_COLOR_NEUTRAL = Color.FromSRGBA(255, 255, 255, 255);
58 static const ref Color EDITOR_ICON_COLOR_DESTROYED = Color(0.25, 0.25, 0.25, 1);
59 static const ref Color EDITOR_MODE_GM_MODE = Color.FromRGBA(235, 46, 9, 255); // Color for GM mode and LOGISTICS
60 static const ref Color EDITOR_MODE_ADMIN_MODE = Color.FromRGBA(0, 55, 255, 255); // Color for ADMIN mode and COMBAT SUPPORT
61 static const ref Color EDITOR_MODE_ARMAVISION = Color.FromRGBA(1, 50, 12, 255); // Color for ARMAVISION and OPERATIONS
62
63 // Nearby Interactions
64 static const ref Color INTERACT_GENERIC_PRIMARY = Color.FromSRGBA(120, 120, 120, 180);
65 static const ref Color INTERACT_GENERIC_SECONDARY = Color.FromSRGBA(120, 120, 120, 70);
66
67 //------------------------------------------------------------------------------------------------
71 static string GetColorAttribute(Color color)
72 {
73 if (color)
74 return string.Format("%1 %2 %3 %4", color.R(), color.G(), color.B(), color.A());
75
76 return "1 1 1 1";
77 }
78
79 //------------------------------------------------------------------------------------------------
83 static string FormatColor(Color color)
84 {
85 if (!color)
86 return "255, 255, 255, 255";
87
88 Color returnColor = new Color(color.R(), color.G(), color.B(), color.A());
89
90 //--- Convert to sRGBA format for rich text
91 returnColor.LinearToSRGB();
92
93 //--- Convert to ints, no fractions allowed in rich text
94 int colorR = returnColor.R() * 255;
95 int colorG = returnColor.G() * 255;
96 int colorB = returnColor.B() * 255;
97 int colorA = returnColor.A() * 255;
98
99 return string.Format("%1, %2, %3, %4", colorR, colorG, colorB, colorA);
100 }
101
102 //------------------------------------------------------------------------------------------------
104 static Color CopyColor(Color uiConstColor)
105 {
106 return Color.FromInt(uiConstColor.PackToInt());
107 }
108}
109
110class GUIColors
111{
112 static const ref Color DISABLED_GRAY = Color.FromSRGBA(128, 128, 128, 255); //Dark Gray
113 static const ref Color DISABLED = Color.FromSRGBA(200, 200, 200, 100); //WHITE with 30% alpha converted to GREY with 100% alpha
114 static const ref Color DISABLED_GLOW = Color.FromSRGBA(0, 0, 0, 100);
115
116 static const ref Color ENABLED = Color.FromSRGBA(255, 255, 255, 255); //WHITE
117 static const ref Color ENABLED_GLOW = Color.FromSRGBA(162, 162, 162, 255); //GREY
118
119 static const ref Color DEFAULT = Color.FromSRGBA(255, 255, 255, 255); //WHITE
120 static const ref Color DEFAULT_GLOW = Color.FromSRGBA(0, 0, 0, 255); //BLACK
121
122 static const ref Color WHITE_GLOW = Color.FromSRGBA(225, 225, 225, 178); //WHITE with 70% alpha
123 //---
124
125 static const ref Color ORANGE = Color.FromSRGBA(226, 167, 80, 255); //ORANGE, standard UI orange, warnings
126 static const ref Color ORANGE_BRIGHT = Color.FromSRGBA(255, 207, 136, 255); //ORANGE (bright)
127 static const ref Color ORANGE_BRIGHT2 = Color.FromSRGBA(255, 233, 200, 255); //ORANGE (bright++)
128 static const ref Color ORANGE_DARK = Color.FromSRGBA(162, 97, 0, 255); //DARK ORANGE
129
130 static const ref Color RED = Color.FromSRGBA(236, 80, 80, 255); //RED, error states
131 static const ref Color RED_BRIGHT = Color.FromSRGBA(255, 134, 134, 255); //RED (bright)
132 static const ref Color RED_BRIGHT2 = Color.FromSRGBA(255, 150, 150, 255); //RED (bright++)
133 static const ref Color RED_DARK = Color.FromSRGBA(162, 0, 0, 255); //DARK RED
134
135 static const ref Color BLUE = Color.FromSRGBA(41, 127, 240, 255); //BLUE
136 static const ref Color BLUE_BRIGHT = Color.FromSRGBA(122, 175, 255, 255); //BLUE (bright)
137 static const ref Color BLUE_BRIGHT2 = Color.FromSRGBA(184, 212, 255, 255); //BLUE (bright++)
138 static const ref Color BLUE_DARK = Color.FromSRGBA(27, 92, 189, 255); //DARK BLUE
139
140 static const ref Color GREEN = Color.FromSRGBA(37, 209, 29, 255); //GREEN
141 static const ref Color GREEN_BRIGHT = Color.FromSRGBA(157, 250, 153, 255); //GREEN (bright)
142 static const ref Color GREEN_BRIGHT2 = Color.FromSRGBA(216, 255, 214, 255); //GREEN (bright++)
143 static const ref Color GREEN_DARK = Color.FromSRGBA(28, 157, 22, 255); //DARK GREEN
144
145 static const ref Color LIGHT_GRAY = Color.FromSRGBA(189, 189, 188, 255); //LIGHT GRAY
146 static const ref Color DARK_GRAY = Color.FromSRGBA(128, 128, 128, 255); //Dark Gray
147 static const ref Color DARKER_GRAY = Color.FromSRGBA(98, 98, 98, 200); //Darker Gray
148}
149
151{
152 // Animation
153 static const float FADE_RATE_INSTANT = 0;
154 static const float FADE_RATE_SUPER_FAST = 20;
155 static const float FADE_RATE_FAST = 10;
156 static const float FADE_RATE_DEFAULT = 5; // Used for near instant actions
157 static const float FADE_RATE_SLOW = 1; // Used for fading out elements that should be visible for some time
158 static const float FADE_RATE_SUPER_SLOW = 0.2; // Very slow fade out
159
160 // Spinners
161 static const float PROCESSING_SPINNER_ANIMATION_SPEED = 0.75;
162
163 // Common labels
164 static const LocalizedString FAVORITE_LABEL_ADD = "#AR-Workshop_ButtonAddToFavourites";
165 static const LocalizedString FAVORITE_LABEL_REMOVE = "#AR-Workshop_ButtonRemoveFavourites";
166 static const LocalizedString BOHEMIA_INTERACTIVE_LOC = "#AR-Author_BI";
167 static const string BOHEMIA_INTERACTIVE = "Bohemia Interactive";
168
169 static const LocalizedString VALUE_UNIT_PERCENTAGE = "#AR-ValueUnit_Percentage";
170 static const LocalizedString VALUE_UNIT_SHORT_PLUS = "#AR-ValueUnit_Short_Plus";
171 static const LocalizedString VALUE_UNIT_MILS = "#AR-ValueUnit_Mils";
172 static const LocalizedString VALUE_UNIT_DEGREES = "#AR-ValueUnit_Degrees";
173 static const LocalizedString VALUE_UNIT_METERS = "#AR-ValueUnit_Short_Meters";
174 static const LocalizedString VALUE_UNIT_SECONDS = "#AR-ValueUnit_Short_Seconds";
175 static const LocalizedString VALUE_MUTLIPLIER_SHORT = "#AR-ValueUnit_Short_Times";
176
177 static const LocalizedString VALUE_OUT_OF = "#AR-SupportStation_ActionFormat_ItemAmount";
178 static const LocalizedString VALUE_OUT_OF_SPACED = "#AR-Filters_EntriesFound_Condensed";
179
180 static const LocalizedString TIME_DISPLAY_DAYS_HOURS_MINUTES_SECONDS = "#AR-TimeDisplay_Days_Hours_Minutes_Seconds";
181 static const LocalizedString TIME_DISPLAY_HOURS_MINUTES_SECONDS = "#AR-TimeDisplay_Hours_Minutes_Seconds";
182 static const LocalizedString TIME_DISPLAY_MINUTES_SECONDS = "#AR-TimeDisplay_Minutes_Seconds";
183 static const LocalizedString TIME_DISPLAY_SECONDS = "#AR-TimeDisplay_Seconds";
184
185 // Common icons
186 static const ResourceName ICONS_IMAGE_SET = "{3262679C50EF4F01}UI/Textures/Icons/icons_wrapperUI.imageset";
187 static const ResourceName ICONS_GLOW_IMAGE_SET = "{00FE3DBDFD15227B}UI/Textures/Icons/icons_wrapperUI-glow.imageset";
188
190 static const string NAME_WITH_PLATFORM_ICON_FORMAT = "<color rgba=%1><image set='%2' name='%3' scale='%4'/></color>%5";
191 static const string RICH_TEXT_LINE_BREAK = "<br/>";
192 static const string RICH_TEXT_LIST_POINT = "<ucs codepoints=\"u2022\"/>";
193
194 // Platform Icons
195 static const string PLATFROM_PC_ICON_NAME = "platform-windows";
196 static const string PLATFROM_XBOX_ICON_NAME = "platform-xbox";
197 static const string PLATFROM_PLAYSTATION_ICON_NAME = "platform-playstation";
198 static const string PLATFROM_GENERIC_ICON_NAME = "generic-platform";
199
200 static const string ICON_INTERACT_DEFAULT = "ingameInteraction";
201 static const string ICON_INTERACT_DISABLED = "disable";
202 static const string ICON_WARNING = "warning";
203 static const string ICON_OK = "okCircle";
204 static const string ICON_CANCEL = "cancelCircle";
205 static const string ICON_CHECK = "check";
206 static const string ICON_NOT_AVAILABLE = "not-available";
207
208 // Action rich text
209 static const string ACTION_DISPLAY_ICON_SCALE_BIG = "1.25";
210 static const string ACTION_DISPLAY_ICON_SCALE_VERY_BIG = "1.5";
211 static const string ACTION_DISPLAY_ICON_SCALE_HUGE = "1.75";
212
213 // Default Color Enum for nearby interaction
214 static const int NEARBY_INTERACTION_DEFAULT_STATE = SCR_ENearbyInteractionContextColors.DEFAULT;
215
216 // Values
217 static const float DISABLED_WIDGET_OPACITY = 0.3;
218 static const float ENABLED_WIDGET_OPACITY = 1;
219 static const float DISABLED_WIDGET_SATURATION = 0.5;
220 static const float ENABLED_WIDGET_SATURATION = 1;
221
222 // Menu base actions
223 static const string MENU_ACTION_LEFT = "MenuLeft";
224 static const string MENU_ACTION_RIGHT = "MenuRight";
225 static const string MENU_ACTION_UP = "MenuUp";
226 static const string MENU_ACTION_DOWN = "MenuDown";
227 static const string MENU_ACTION_BACK = "MenuBack";
228
229 static const string MENU_ACTION_MOUSE_WHEEL = "MouseWheel";
230
231 static const string MENU_ACTION_SELECT = "MenuSelect";
232 static const string MENU_ACTION_SELECT_HOLD = "MenuSelectHold";
233 static const string MENU_ACTION_ENABLE = "MenuEnable";
234 static const string MENU_ACTION_ENABLE_ALL = "MenuEnableAll";
235 static const string MENU_ACTION_DOUBLE_CLICK = "MenuSelectDouble";
236 static const string MENU_ACTION_FAVORITE = "MenuFavourite";
237 static const string MENU_ACTION_OPEN = "MenuOpen";
238
239 static const string MENU_ACTION_OPEN_WB = "MenuOpenWB";
240 static const string MENU_ACTION_BACK_WB = "MenuBackWB";
241
242 // Input devices
243 static const string DEVICE_KEYBOARD = "keyboard";
244 static const string DEVICE_GAMEPAD = "gamepad";
245
246 // Mouse buttons
247 static const int MOUSE_LEFT_CLICK = 0;
248 static const int MOUSE_RIGHT_CLICK = 1;
249
250 // Footer buttons
251 static const string BUTTON_BACK = "Back";
252
253 //------------------------------------------------------------------------------------------------
255 static string GetActionDisplayStateAttribute(SCR_EActionDisplayState state)
256 {
257 return typename.EnumToString(SCR_EActionDisplayState, state);
258 }
259
260 //------------------------------------------------------------------------------------------------
262 static string FormatUnitPercentage(float percentage)
263 {
264 return WidgetManager.Translate(VALUE_UNIT_PERCENTAGE, percentage);
265 }
266
267 //------------------------------------------------------------------------------------------------
269 static string FormatUnitShortPlus(float value)
270 {
271 return WidgetManager.Translate(VALUE_UNIT_SHORT_PLUS, value);
272 }
273
274 //------------------------------------------------------------------------------------------------
276 static string FormatValueOutOf(float value, float max, bool condensed = true)
277 {
278 string text = VALUE_OUT_OF;
279 if (!condensed)
280 text = VALUE_OUT_OF_SPACED;
281
282 return WidgetManager.Translate(text, value, max);
283 }
284
285 //------------------------------------------------------------------------------------------------
286 //TODO: LOCALIZED STRING!
287 static string FormatVersion(string version)
288 {
289 return string.Format("v. %1", version);
290 }
291
292 //------------------------------------------------------------------------------------------------
293 static string GetFavoriteLabel(bool isFavorite)
294 {
295 if (isFavorite)
296 return FAVORITE_LABEL_REMOVE;
297 else
298 return FAVORITE_LABEL_ADD;
299 }
300
301 //------------------------------------------------------------------------------------------------
302 // Depending on seconds given, returns formatted time display strings
303 static string FormatSeconds(int totalSeconds)
304 {
305 int days;
306 int hours;
307 int minutes;
308 int seconds;
309
310 SCR_DateTimeHelper.GetDayHourMinuteSecondFromSeconds(totalSeconds, days, hours, minutes, seconds);
311
312 if (days >= 1)
313 return WidgetManager.Translate(TIME_DISPLAY_DAYS_HOURS_MINUTES_SECONDS, days, hours, minutes, seconds);
314
315 if (hours >= 1)
316 return WidgetManager.Translate(TIME_DISPLAY_HOURS_MINUTES_SECONDS, hours, minutes, seconds);
317
318 if (minutes >= 1)
319 return WidgetManager.Translate(TIME_DISPLAY_MINUTES_SECONDS, minutes, seconds);
320
321 return WidgetManager.Translate(TIME_DISPLAY_SECONDS, seconds);
322 }
323}
324
325// Input action display state for Rich text widgets
326// States allow overriding icon colors in {2F14B8749FE911B4}Configs/WidgetLibrary/SCR_InputButton/SCR_InputButtonLayout.conf
327enum SCR_EActionDisplayState
328{
329 DEFAULT,
330 DISABLED,
332 WARNING
333}
334
335enum SCR_EMouseButtons
336{
337 LEFT, //Keyboard Enter and Gamepad A are hardcoded to also return 0
339 MIDDLE
340}
class UIConstants NON_INTERACTABLE_HINT
const float COLOR_1_TO_255
Definition Constants.c:12
const float KNOTS_TO_METERS
Definition Constants.c:9
const float METERS_TO_KNOTS
Definition Constants.c:8
const float KILOMETERS_PER_HOUR_TO_METERS_PER_SEC
Definition Constants.c:6
class UIColors DISABLED_GRAY
const float COLOR_255_TO_1
Definition Constants.c:11
const float METERS_PER_SEC_TO_KILOMETERS_PER_HOUR
Contains various global constants.
Definition Constants.c:5
const int TRACE_LAYER_CAMERA
Definition Constants.c:14
Definition Color.c:13
@ DEFAULT
Use currently set main RT format (based on game options).
@ WARNING
Definition LogLevel.c:19
@ DISABLED
General event switch.
Definition EntityEvent.c:35
@ MIDDLE
Definition MouseState.c:16
@ LEFT
navigation
@ RIGHT