ACE3/addons/optionsmenu/init_loadMainMenuBox.sqf

63 lines
2.5 KiB
Plaintext
Raw Normal View History

2015-05-13 19:05:13 +00:00
/*
* 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
*/
2017-04-11 00:37:53 +00:00
#include "\a3\ui_f\hpp\defineResinclDesign.inc"
2015-05-13 19:05:13 +00:00
#include "script_component.hpp"
2017-04-11 00:37:53 +00:00
params ["_display"];
private _controlsGroup = _display displayCtrl IDC_MAIN_INFO;
2015-06-05 22:23:51 +00:00
//Need to load from profileNamespace because ace_settings might not be init if world = empty
if (profileNamespace getVariable [QGVAR(showNewsOnMainMenu), true]) then {
2017-04-11 00:37:53 +00:00
_controlsGroup ctrlShow true;
private _fnc_onSetFocus = {
params ["_control"];
private _controlsGroup = ctrlParentControlsGroup _control;
2017-04-11 14:41:32 +00:00
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BACKGROUND) ctrlSetTextColor [1,1,1,1];
(_controlsGroup controlsGroupCtrl IDC_MAIN_INFO_BACKGROUND_ICON) ctrlSetTextColor [1,1,1,1];
2017-04-11 00:37:53 +00:00
(_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 ".";
2015-05-13 19:05:13 +00:00
2017-04-11 00:37:53 +00:00
(_display displayCtrl IDC_MAIN_INFO_CURRENT_VERSION_INFO) ctrlSetText format ["Version: %1", _versionStr];
2017-04-11 10:00:34 +00:00
(_display displayCtrl IDC_MAIN_INFO_NEWEST_VERSION_INFO) htmlLoad "https://ace3mod.com/version.html";
2015-06-05 22:23:51 +00:00
} else {
2017-04-11 00:37:53 +00:00
_controlsGroup ctrlShow false;
2015-06-05 22:23:51 +00:00
};
2016-07-04 20:31:25 +00:00
/*
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>
*/