-
Notifications
You must be signed in to change notification settings - Fork 159
UI - Add map preview to Create MP Mission dialog #1844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,19 +25,61 @@ private _fnc_findMissions = { | |
|
|
||
| _display setVariable [QGVAR(stockMissions), _stockMissions]; | ||
|
|
||
| // Show worldnames as tooltips on map list | ||
| private _worldNames = createHashMap; | ||
| private _worldFeatures = createHashMap; | ||
| private _defaultPicture = getText (configFile >> "display3DENNew" >> "defaultPicture"); | ||
| private _defaultAuthor = localize "STR_AUTHOR_UNKNOWN"; | ||
| private _authorFullLocalized = localize "STR_FORMAT_AUTHOR_SCRIPTED"; | ||
| { | ||
| private _worldName = configName _x; | ||
| private _description = getText (configFile >> "CfgWorlds" >> _worldName >> "description"); | ||
| private _worldConfig = configFile >> "CfgWorlds" >> _worldName; | ||
|
|
||
| private _description = getText (_worldConfig >> "description"); | ||
| _worldNames set [_description, _worldname]; | ||
|
|
||
| private _pictureMap = getText (_worldConfig >> "pictureMap"); | ||
| if (_pictureMap isEqualTo "") then {_pictureMap = _defaultPicture}; // can be empty | ||
| private _author = getText (_worldConfig >> "author"); | ||
| if (_author isEqualTo "") then {_author = _defaultAuthor}; | ||
| _author = format [_authorFullLocalized, _author]; | ||
|
|
||
| _worldFeatures set [_worldName, [_pictureMap, _author]]; | ||
| } forEach (configProperties [configFile >> "CfgWorldList", "isClass _x"]); | ||
|
|
||
| // Show worldnames as tooltips on map list | ||
| for "_index" from 0 to ((lbSize _ctrlMaps) - 1) do { | ||
| private _description = _ctrlMaps lbText _index; | ||
| private _worldName = _worldNames getOrDefault [_description, ""]; | ||
| _ctrlMaps lbSetTooltip [_index, _worldName]; | ||
| }; | ||
|
|
||
| _ctrlMaps setVariable [QGVAR(worldFeatures), _worldFeatures]; | ||
|
|
||
| ctrlPosition _ctrlMaps params ["_mapsLeft", "_mapsTop", "_mapsWidth", "_mapsHeight"]; | ||
| private _squareWidth = _mapsHeight * 3 / 4; | ||
| private _mapsWidthNew = _mapsWidth - _squareWidth; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On square-ish aspect ratios this could possibly start to get cut-off we could do something like to prevent the pic from taking too much of the horizontal, |
||
| _ctrlMaps ctrlSetPositionW _mapsWidthNew; | ||
| _ctrlMaps ctrlCommit 0; | ||
|
|
||
| private _ctrlIslandPanorama = _display ctrlCreate ["RscPicture", IDC_RSCDISPLAYSELECTISLAND_ISLANDPANORAMA]; | ||
| _ctrlIslandPanorama ctrlSetPosition [ | ||
| _mapsLeft + _mapsWidthNew, | ||
| _mapsTop, | ||
| _squareWidth, | ||
| _mapsHeight | ||
| ]; | ||
| _ctrlIslandPanorama ctrlCommit 0; | ||
|
|
||
| _ctrlMaps ctrlAddEventHandler ["LBSelChanged", { | ||
| params ["_ctrlMaps", "_lbCurSel"]; | ||
| private _worldFeatures = _ctrlMaps getVariable QGVAR(worldFeatures); | ||
| _worldFeatures getOrDefault [_ctrlMaps lbData _lbCurSel, []] params [["_picture", ""], ["_author", ""]]; | ||
| private _display = ctrlParent _ctrlMaps; | ||
| private _ctrlIslandPanorama = _display displayCtrl IDC_RSCDISPLAYSELECTISLAND_ISLANDPANORAMA; | ||
| _ctrlIslandPanorama ctrlSetText _picture; | ||
| _ctrlIslandPanorama ctrlSetTooltip _author; | ||
| }]; | ||
|
|
||
| lbSort _ctrlMaps; | ||
| _ctrlMaps lbSetCurSel 0; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check this expression, because I completely do not understand how to correctly calculate it,
3/4works for me, as well assafeZoneH / safeZoneW.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the
3/4refers to the 4:3 aspect ratio, which, as I understand it,safeZone{H,W}were designed to help abstract away.