-
Notifications
You must be signed in to change notification settings - Fork 739
/
init_loadMainMenuBox.sqf
62 lines (52 loc) · 2.53 KB
/
init_loadMainMenuBox.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "\a3\ui_f\hpp\defineResinclDesign.inc"
#include "script_component.hpp"
/*
* Author: PabstMirror
* Loads the version info HTML box from main menu
*
* Arguments:
* 0: Display (from onMouseMoving) <DISPLAY>
*
* Return Value:
* None
*
* Example:
* onMouseMovingEvent execVM "script_loadMainMenuBox.sqf";
*
* Public: No
*/
params ["_display"];
private _controlsGroup = _display displayCtrl IDC_MAIN_INFO;
//Need to load from profileNamespace because ace_settings might not be init if world = empty
if (profileNamespace getVariable [QGVAR(showNewsOnMainMenu), true]) then {
_controlsGroup ctrlShow true;
private _fnc_onSetFocus = {
params ["_control"];
private _controlsGroup = ctrlParentControlsGroup _control;
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BACKGROUND) ctrlSetTextColor [1,1,1,1];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BACKGROUND_ICON) ctrlSetTextColor [1,1,1,1];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_ICON) ctrlSetTextColor [0,0,0,1];
};
private _fnc_onKillFocus = {
params ["_control"];
private _controlsGroup = ctrlParentControlsGroup _control;
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BACKGROUND) ctrlSetTextColor [0,0,0,0.75];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BACKGROUND_ICON) ctrlSetTextColor [0,0,0,0.75];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_ICON) ctrlSetTextColor [1,1,1,0.5];
};
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BUTTON) ctrlAddEventHandler ["MouseEnter", _fnc_onSetFocus];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BUTTON) ctrlAddEventHandler ["SetFocus", _fnc_onSetFocus];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BUTTON) ctrlAddEventHandler ["MouseExit", _fnc_onKillFocus];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BUTTON) ctrlAddEventHandler ["KillFocus", _fnc_onKillFocus];
private _versionStr = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr") splitString ".";
_versionStr resize 3; // MAJOR, MINOR, PATCH
_versionStr = _versionStr joinString ".";
(_display displayCtrl IDC_MAIN_INFO_CURRENT_VERSION_INFO) ctrlSetText format ["Version: %1", _versionStr];
(_display displayCtrl IDC_MAIN_INFO_NEWEST_VERSION_INFO) htmlLoad "https://ace3.acemod.org/version.html";
} else {
_controlsGroup ctrlShow false;
};
/*
Note: switch version.html to simpler format and right align
<h1 align="right">Latest: {{site.ace.version.major}}.{{site.ace.version.minor}}.{{site.ace.version.patch}}</h1>
*/