diff --git a/addons/slideshow/CfgVehicles.hpp b/addons/slideshow/CfgVehicles.hpp index 6c11ba866c..c7c0687913 100644 --- a/addons/slideshow/CfgVehicles.hpp +++ b/addons/slideshow/CfgVehicles.hpp @@ -47,6 +47,12 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 0; }; + class Selection { + displayName = CSTRING(Selection_DisplayName); + description = CSTRING(Selection_Description); + typeName = "NUMBER"; + defaultValue = 0; + }; }; class ModuleDescription { description = CSTRING(Description); diff --git a/addons/slideshow/functions/fnc_addSlideActions.sqf b/addons/slideshow/functions/fnc_addSlideActions.sqf index 6416c35748..29997861e5 100644 --- a/addons/slideshow/functions/fnc_addSlideActions.sqf +++ b/addons/slideshow/functions/fnc_addSlideActions.sqf @@ -9,6 +9,7 @@ * 2: Names * 3: Controller * 4: Current Slideshow + * 5: Texture Selection (default: 0) * * Return Value: * List of actions @@ -19,7 +20,7 @@ * Public: No */ -params ["_objects", "_images", "_names", "_controller", "_currentSlideshow"]; +params ["_objects", "_images", "_names", "_controller", "_currentSlideshow", ["_selection", 0]]; private _actions = []; { @@ -30,15 +31,15 @@ private _actions = []; _names select _forEachIndex, "", { - (_this select 2) params ["_objects", "_image", "_currentSlideshow"]; + (_this select 2) params ["_objects", "_image", "_currentSlideshow", "_selection"]; { - _x setObjectTextureGlobal [0, _image] + _x setObjectTextureGlobal [_selection, _image] } count _objects; [QGVAR(slideChanged), [_image, _currentSlideshow]] call CBA_fnc_localEvent; }, {true}, {}, - [_objects, _x, _currentSlideshow] + [_objects, _x, _currentSlideshow, _selection] ] call EFUNC(interact_menu,createAction), [], _controller diff --git a/addons/slideshow/functions/fnc_autoTransition.sqf b/addons/slideshow/functions/fnc_autoTransition.sqf index 87fe488754..f57abdd8df 100644 --- a/addons/slideshow/functions/fnc_autoTransition.sqf +++ b/addons/slideshow/functions/fnc_autoTransition.sqf @@ -9,17 +9,18 @@ * 2: State Variable Name * 3: Current Slideshow * 4: Duration (0 disables automatic transitions) + * 5: Texture Selection * * Return Value: * None * * Example: - * [objects, images, "ace_slideshow_slideshow1", duration] call ace_slideshow_fnc_autoTransition + * [objects, images, "ace_slideshow_slideshow1", duration, selection] call ace_slideshow_fnc_autoTransition * * Public: No */ -params ["_objects", "_images", "_varString", "_currentSlideshow", "_duration"]; +params ["_objects", "_images", "_varString", "_currentSlideshow", "_duration", "_selection"]; // Get current slide number of this slideshow private _currentSlide = missionNamespace getVariable [_varString, 0]; @@ -34,11 +35,11 @@ private _image = _images select _currentSlide; // Set slide { - _x setObjectTextureGlobal [0, _image]; + _x setObjectTextureGlobal [_selection, _image]; } count _objects; [QGVAR(slideChanged), [_image, _currentSlideshow]] call CBA_fnc_localEvent; // Log current slide and execute Next slide TRACE_4("Auto-transition",_image,_currentSlide,count _images,_duration); -[FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration], _duration] call CBA_fnc_waitAndExecute; +[FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration, _selection], _duration] call CBA_fnc_waitAndExecute; diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index 0d84fa969b..841365d4c4 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -10,6 +10,7 @@ * 3: Action Names * 4: Slide Duration (0 disables automatic transitions) * 5: Set Name (default: localized "Slides") + * 6: Texture Selection (default: 0) * * Return Value: * Slideshow ID @@ -26,7 +27,8 @@ params [ ["_images", [], [[]] ], ["_names", [], [[]] ], ["_duration", 0, [0]], - ["_setName", localize LSTRING(Interaction), [""]] + ["_setName", localize LSTRING(Interaction), [""]], + ["_selection", 0, [0]] ]; // Verify data @@ -47,7 +49,7 @@ TRACE_5("Information",_objects,_controllers,_images,_names,_setName); if (isServer) then { // Default images on whiteboards (first image) { - _x setObjectTextureGlobal [0, _images select 0]; + _x setObjectTextureGlobal [_selection, _images select 0]; } count _objects; }; @@ -82,7 +84,7 @@ if (_duration == 0) then { {}, {true}, {(_this select 2) call FUNC(addSlideActions)}, - [_objects, _images, _names, _x, _currentSlideshow], + [_objects, _images, _names, _x, _currentSlideshow, _selection], [0, 0, 0], 2 ] call EFUNC(interact_menu,createAction); @@ -100,7 +102,7 @@ if (_duration == 0) then { missionNamespace setVariable [_varString, 0]; // Automatic transitions handler - [FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration], _duration] call CBA_fnc_waitAndExecute; + [FUNC(autoTransition), [_objects, _images, _varString, _currentSlideshow, _duration, _selection], _duration] call CBA_fnc_waitAndExecute; }; _currentSlideshow diff --git a/addons/slideshow/functions/fnc_moduleInit.sqf b/addons/slideshow/functions/fnc_moduleInit.sqf index a8cf27ceec..783f1de720 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -32,6 +32,7 @@ private _images = [_logic getVariable ["Images", ""], false, false] call EFUNC(c private _names = [_logic getVariable ["Names", ""], false, false] call EFUNC(common,parseList); private _setName = _logic getVariable ["SetName", ""]; private _duration = _logic getVariable ["Duration", 0]; +private _selection = _logic getVariable ["Selection", 0]; // Objects synced to the module { @@ -40,6 +41,6 @@ private _duration = _logic getVariable ["Duration", 0]; } count (synchronizedObjects _logic); // Prepare with actions -[_objects, _controllers, _images, _names, _duration, _setName] call FUNC(createSlideshow); +[_objects, _controllers, _images, _names, _duration, _setName, _selection] call FUNC(createSlideshow); INFO_1("Slideshow Module Initialized on %1 Objects",(count _objects)); diff --git a/addons/slideshow/stringtable.xml b/addons/slideshow/stringtable.xml index 10adfc6457..937764d231 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -227,6 +227,12 @@ 每張幻燈片顯示的時間。 預設:0 (自動換圖已禁用) 每张幻灯片显示的时间。 预设:0 (自动换图已禁用) + + Texture Selection + + + Object texture selection. Default: 0 + Slides Diapositives diff --git a/docs/wiki/framework/slideshow-framework.md b/docs/wiki/framework/slideshow-framework.md index ef1d7062fd..5d27cbc697 100644 --- a/docs/wiki/framework/slideshow-framework.md +++ b/docs/wiki/framework/slideshow-framework.md @@ -40,13 +40,14 @@ Important notes: 3 | Action Names | Array | Required 4 | Slide Duration | Number | Optional (default: `0`, `0` disables automatic transitions) 5 | Set Name | String | Optional (default: localized `"Slides"`) +6 | Texture Selection | Number | Optional (default: `0`) **R** | None | None | Return value _Note: Set Name argument added in 3.9.1._ #### 2.1.1 Example -`[[object1, object2], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides"] call ace_slideshow_fnc_createSlideshow;` +`[[object1, object2], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides", 1] call ace_slideshow_fnc_createSlideshow;` | Arguments | Explanation ---| --------- | ----------- @@ -56,3 +57,4 @@ _Note: Set Name argument added in 3.9.1._ 3 | `["Action1", "Action2"]` | Action names for interaction menu if automatic transitions are not enabled 4 | `5` | 5s slide duration before change to next image 5 | `"My Slides"` | Main interaction point name, for easier distinguishing of multiple slideshow sets +6 | `1` | Uses texture selection 1 for objects with multiple options