Make slideshow add slides in proper order by going through the array backwards, add cover image filed for slideshows, fix wonky german translation

This commit is contained in:
bux 2019-08-12 13:23:32 +02:00
parent 187bd6f698
commit 2f0a5e0c84
5 changed files with 32 additions and 10 deletions

View File

@ -47,6 +47,12 @@ class CfgVehicles {
typeName = "NUMBER"; typeName = "NUMBER";
defaultValue = 0; defaultValue = 0;
}; };
class CoverImage {
displayName = CSTRING(CoverImage_DisplayName);
description = CSTRING(CoverImage_Description);
typeName = "STRING";
defaultValue = "";
};
}; };
class ModuleDescription { class ModuleDescription {
description = CSTRING(Description); description = CSTRING(Description);

View File

@ -22,12 +22,15 @@
params ["_objects", "_images", "_names", "_controller", "_currentSlideshow"]; params ["_objects", "_images", "_names", "_controller", "_currentSlideshow"];
private _actions = []; private _actions = [];
// fix action order by going through the array backwards
for "_i" from (count _images - 1) to 0 step -1 do
{ {
_actions pushBack _actions pushBack
[ [
[ [
format [QGVAR(slideshow%1_slide%2), _currentSlideshow, _forEachIndex + 1], format [QGVAR(slideshow%1_slide%2), _currentSlideshow, _i + 1],
_names select _forEachIndex, _names select _i,
"", "",
{ {
(_this select 2) params ["_objects", "_image"]; (_this select 2) params ["_objects", "_image"];
@ -42,7 +45,7 @@ private _actions = [];
[], [],
_controller _controller
]; ];
} forEach _images; };
TRACE_1("Children actions",_actions); TRACE_1("Children actions",_actions);

View File

@ -10,12 +10,13 @@
* 3: Action Names <ARRAY> * 3: Action Names <ARRAY>
* 4: Slide Duration <NUMBER> (0 disables automatic transitions) * 4: Slide Duration <NUMBER> (0 disables automatic transitions)
* 5: Set Name <STRING> (default: localized "Slides") * 5: Set Name <STRING> (default: localized "Slides")
* 6: Cover Image Path <STRING>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides"] call ace_slideshow_fnc_createSlideshow * [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides", "images\cover.paa"] call ace_slideshow_fnc_createSlideshow
* *
* Public: Yes * Public: Yes
*/ */
@ -26,7 +27,8 @@ params [
["_images", [], [[]] ], ["_images", [], [[]] ],
["_names", [], [[]] ], ["_names", [], [[]] ],
["_duration", 0, [0]], ["_duration", 0, [0]],
["_setName", localize LSTRING(Interaction), [""]] ["_setName", localize LSTRING(Interaction), [""]],
["_coverImage", "", [""]]
]; ];
// Verify data // Verify data
@ -47,8 +49,9 @@ TRACE_5("Information",_objects,_controllers,_images,_names,_setName);
if (isServer) then { if (isServer) then {
// Default images on whiteboards (first image) // Default images on whiteboards (first image)
{ {
_x setObjectTextureGlobal [0, _images select 0]; private _image = [_coverImage, _images select 0] select {_coverImage != ""};
} count _objects; _x setObjectTextureGlobal [0, _image];
} forEach _objects;
}; };
// Number of slideshows (multiple modules support) // Number of slideshows (multiple modules support)

View File

@ -31,6 +31,7 @@ private _controllers = [_logic getVariable ["Controllers", ""], true, true] call
private _images = [_logic getVariable ["Images", ""], false, false] call EFUNC(common,parseList); private _images = [_logic getVariable ["Images", ""], false, false] call EFUNC(common,parseList);
private _names = [_logic getVariable ["Names", ""], false, false] call EFUNC(common,parseList); private _names = [_logic getVariable ["Names", ""], false, false] call EFUNC(common,parseList);
private _setName = _logic getVariable ["SetName", ""]; private _setName = _logic getVariable ["SetName", ""];
private _coverImage = _logic getVariable ["CoverImage", ""];
private _duration = _logic getVariable ["Duration", 0]; private _duration = _logic getVariable ["Duration", 0];
// Objects synced to the module // Objects synced to the module
@ -40,6 +41,6 @@ private _duration = _logic getVariable ["Duration", 0];
} count (synchronizedObjects _logic); } count (synchronizedObjects _logic);
// Prepare with actions // Prepare with actions
[_objects, _controllers, _images, _names, _duration, _setName] call FUNC(createSlideshow); [_objects, _controllers, _images, _names, _duration, _setName, _coverImage] call FUNC(createSlideshow);
INFO_1("Slideshow Module Initialized on %1 Objects", count _objects); INFO_1("Slideshow Module Initialized on %1 Objects",(count _objects));

View File

@ -161,7 +161,7 @@
</Key> </Key>
<Key ID="STR_ACE_Slideshow_SetName_DisplayName"> <Key ID="STR_ACE_Slideshow_SetName_DisplayName">
<English>Set Name</English> <English>Set Name</English>
<German>Setze Namen</German> <German>Name der Diavorführung</German>
<Polish>Ustaw nazwę</Polish> <Polish>Ustaw nazwę</Polish>
<Japanese>名前設定</Japanese> <Japanese>名前設定</Japanese>
<French>Définir le nom</French> <French>Définir le nom</French>
@ -215,6 +215,15 @@
<Chinese>每張幻燈片顯示的時間。 預設:0 (自動換圖已禁用)</Chinese> <Chinese>每張幻燈片顯示的時間。 預設:0 (自動換圖已禁用)</Chinese>
<Chinesesimp>每张幻灯片显示的时间。 预设:0 (自动换图已禁用)</Chinesesimp> <Chinesesimp>每张幻灯片显示的时间。 预设:0 (自动换图已禁用)</Chinesesimp>
</Key> </Key>
<Key ID="STR_ACE_Slideshow_CoverImage_DisplayName">
<English>Slideshow Cover Image</English>
<German>Titelbild der Diavorführung</German>
</Key>
</Key>
<Key ID="STR_ACE_Slideshow_CoverImage_Description">
<English>The Cover Image will be used as the first image to be displayed on the slideshow objects. When using multiple sets only the last one will be used.</English>
<German>Das Titelbild wird als erstes Bild auf der Projektionsfläche dargestellt. Wenn mehrere Diavorführungen für eine Steuereinheit definiert sind, wird nur das Letzte verwendet.</German>
</Key>
<Key ID="STR_ACE_Slideshow_Interaction"> <Key ID="STR_ACE_Slideshow_Interaction">
<English>Slides</English> <English>Slides</English>
<French>Diapo</French> <French>Diapo</French>