From 1590948b92372d5648fd55cd5fbb44cf0302456a Mon Sep 17 00:00:00 2001 From: jonpas Date: Fri, 24 Feb 2017 14:08:18 +0100 Subject: [PATCH] Fix multiple slideshows sub-actions, Add set name setting (#4904) * Fix all slides being in multiple slideshows setup, Use private keyword * Add setting for slides main interaction name * Update Slideshow documentation * Add not about new argument added in version --- addons/slideshow/CfgVehicles.hpp | 6 ++++ .../functions/fnc_createSlideshow.sqf | 29 ++++++++++++++----- addons/slideshow/functions/fnc_moduleInit.sqf | 14 ++++----- addons/slideshow/stringtable.xml | 26 ++++++++++------- docs/wiki/feature/slideshow.md | 3 ++ docs/wiki/framework/slideshow-framework.md | 6 +++- 6 files changed, 59 insertions(+), 25 deletions(-) diff --git a/addons/slideshow/CfgVehicles.hpp b/addons/slideshow/CfgVehicles.hpp index af3108eb59..6c11ba866c 100644 --- a/addons/slideshow/CfgVehicles.hpp +++ b/addons/slideshow/CfgVehicles.hpp @@ -35,6 +35,12 @@ class CfgVehicles { typeName = "STRING"; defaultValue = ""; }; + class SetName { + displayName = CSTRING(SetName_DisplayName); + description = CSTRING(SetName_Description); + typeName = "STRING"; + defaultValue = ""; + }; class Duration { displayName = CSTRING(Duration_DisplayName); description = CSTRING(Duration_Description); diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index 883ce2fa7d..5eefbd39bc 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -8,24 +8,25 @@ * 2: Image Paths * 3: Action Names * 4: Slide Duration (0 disables automatic transitions) + * 5: Set Name (default: localized "Slides") * * Return Value: * None * * Example: - * [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5] call ace_slideshow_fnc_createSlideshow + * [[object1, object2, object3], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides"] call ace_slideshow_fnc_createSlideshow * * Public: Yes */ #include "script_component.hpp" -private ["_currentSlideshow", "_slidesAction", "_varString"]; params [ ["_objects", [], [[]] ], ["_controllers", [], [[]] ], ["_images", [], [[]] ], ["_names", [], [[]] ], - ["_duration", 0, [0]] + ["_duration", 0, [0]], + ["_setName", localize LSTRING(Interaction), [""]] ]; // Verify data @@ -41,7 +42,7 @@ if (_controllers isEqualTo []) then { _controllers = _objects; }; -TRACE_4("Information",_objects,_controllers,_images,_names); +TRACE_5("Information",_objects,_controllers,_images,_names,_setName); if (isServer) then { // Default images on whiteboards (first image) @@ -53,7 +54,7 @@ if (isServer) then { GVAR(slideshows) = GVAR(slideshows) + 1; }; -_currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets changed during execution of below code +private _currentSlideshow = GVAR(slideshows); // Local variable in case GVAR gets changed during execution of below code // If interaction menu module is not present, set default duration value if !(["ace_interact_menu"] call EFUNC(common,isModLoaded)) then { @@ -64,8 +65,22 @@ if !(["ace_interact_menu"] call EFUNC(common,isModLoaded)) then { // Add interactions if automatic transitions are disabled, else setup automatic transitions if (_duration == 0) then { { + if (_setName == "") then { + _setName = localize LSTRING(Interaction); + }; + // Add Slides sub-action and populate with images - _slidesAction = [QGVAR(Slides), localize LSTRING(Interaction), "", {}, {true}, {(_this select 2) call FUNC(addSlideActions)}, [_objects, _images, _names, _x, _currentSlideshow], [0, 0, 0], 2] call EFUNC(interact_menu,createAction); + private _slidesAction = [ + format [QGVAR(slideshow%1), _currentSlideshow], + _setName, + "", + {}, + {true}, + {(_this select 2) call FUNC(addSlideActions)}, + [_objects, _images, _names, _x, _currentSlideshow], + [0, 0, 0], + 2 + ] call EFUNC(interact_menu,createAction); [_x, 0, ["ACE_MainActions"], _slidesAction] call EFUNC(interact_menu,addActionToObject); nil } count _controllers; @@ -73,7 +88,7 @@ if (_duration == 0) then { if !(isServer) exitWith {}; // Formatted GVAR string (multiple modules support) - _varString = format [QGVAR(slideshow%1), _currentSlideshow]; + private _varString = format [QGVAR(slideshow%1), _currentSlideshow]; TRACE_1("Current Slide",_varString); // Set formatted GVAR to first slide diff --git a/addons/slideshow/functions/fnc_moduleInit.sqf b/addons/slideshow/functions/fnc_moduleInit.sqf index bf27bae56b..c54aec7d2f 100644 --- a/addons/slideshow/functions/fnc_moduleInit.sqf +++ b/addons/slideshow/functions/fnc_moduleInit.sqf @@ -17,18 +17,18 @@ // Exit on Headless Client if (!hasInterface && !isDedicated) exitWith {}; -private ["_objects", "_controllers", "_images", "_names", "_duration"]; params [["_logic", objNull, [objNull]], "_units", "_activated"]; if !(_activated) exitWith {}; if (isNull _logic) exitWith {}; // Extract variables from logic -_objects = [_logic getVariable ["Objects", ""], true, true] call EFUNC(common,parseList); -_controllers = [_logic getVariable ["Controllers", ""], true, true] call EFUNC(common,parseList); -_images = [_logic getVariable ["Images", ""], false, false] call EFUNC(common,parseList); -_names = [_logic getVariable ["Names", ""], false, false] call EFUNC(common,parseList); -_duration = _logic getVariable ["Duration", 0]; +private _objects = [_logic getVariable ["Objects", ""], true, true] call EFUNC(common,parseList); +private _controllers = [_logic getVariable ["Controllers", ""], true, true] 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 _setName = _logic getVariable ["SetName", ""]; +private _duration = _logic getVariable ["Duration", 0]; // Objects synced to the module { @@ -37,6 +37,6 @@ _duration = _logic getVariable ["Duration", 0]; } count (synchronizedObjects _logic); // Prepare with actions -[_objects, _controllers, _images, _names, _duration] call FUNC(createSlideshow); +[_objects, _controllers, _images, _names, _duration, _setName] 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 47ed8f5a3d..58f23a2a5c 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -44,18 +44,18 @@ 물체 - Object names (can also be synchronized objects) slide-show will be displayed on, separated by commas if multiple. Reference INFO for object support. - Objektnamen (können auch synchronisierte Objekte sein) auf denen die Diavorführung abgepielt wird. Werden ggf. durch Kommata getrennt. Weiteres in der INFO für unterstützte Objekte. + Object names (can also be synchronized objects) slide-show will be displayed on, separated by commas if multiple. + Objektnamen (können auch synchronisierte Objekte sein) auf denen die Diavorführung abgepielt wird. Werden ggf. durch Kommata getrennt. Nom d'objets (peuvent aussi être des objets synchronisés) sur lesquels les diaporamas vont être affichées, séparation par virgule si plusieurs. - Nazwy obiektów (mogą to też być zsynchronizowane obiekty) na których pokaz slajdów zostanie pokazany, oddzielony przecinkiem jeżeli jest ich więcej niż 1. Sprawdź opis modułu aby dowiedzieć się jakie obiekty są wspierane przez moduł. - Objektum nevek (szinkronizált is lehet) amik a vetítésen megjelennek, több darab esetén vesszővel elválasztva. Objektumtámogatásért az INFO-t tekintsd meg. - Nomes dos objetos (também podem ser objetos sincronizados) em que a apresentação de slides será mostrada, separado por vírgulas se for mais de um. Referência INFO para suporte do objeto. - Имена объектов (так же могут использоваться синхронизированные объекты), на которых будет отображаться слайд-шоу, разделенные запятыми. Посмотрите описание, чтобы понять, какие объекты поддерживаются. - Los nombres de objetos (también pueden ser objetos sincronizados) de diapositivas se mostrarán en, separados por comas. Referencia INFO para el soporte del objeto. - Jména objektů (lze také použít synchronizované objekty) které se budou zobrazovat v prezentaci, oddělit čárkou pokud jich je více. Zkontrolujte POPIS abyste zjistili, zda je objekt podporován modulem. - Nomi di oggetti (possono anche essere oggetti sincronizzati) che verranno usati per la presentazione di diapositive, separato da virgole se più di uno. Fai riferimento ad INFO per gli oggetti supportati. + Nazwy obiektów (mogą to też być zsynchronizowane obiekty) na których pokaz slajdów zostanie pokazany, oddzielony przecinkiem jeżeli jest ich więcej niż 1. + Objektum nevek (szinkronizált is lehet) amik a vetítésen megjelennek, több darab esetén vesszővel elválasztva. + Nomes dos objetos (também podem ser objetos sincronizados) em que a apresentação de slides será mostrada, separado por vírgulas se for mais de um. + Имена объектов (так же могут использоваться синхронизированные объекты), на которых будет отображаться слайд-шоу, разделенные запятыми. + Los nombres de objetos (también pueden ser objetos sincronizados) de diapositivas se mostrarán en, separados por comas. + Jména objektů (lze také použít synchronizované objekty) které se budou zobrazovat v prezentaci, oddělit čárkou pokud jich je více. + Nomi di oggetti (possono anche essere oggetti sincronizzati) che verranno usati per la presentazione di diapositive, separato da virgole se più di uno. スライドショーを表示するオブジェクト名 (オブジェクトとの同期も可)。複数ある場合はコンマで区切れます - 슬라이드 쇼가 보여질 물체(동기화 되는 물체도 가능합니다) 명칭, 다수의 경우 쉼표로 구분합니다. 자세한 물체목록은 INFO에서 확인하십시요. + 슬라이드 쇼가 보여질 물체(동기화 되는 물체도 가능합니다) 명칭, 다수의 경우 쉼표로 구분합니다. Controllers @@ -139,6 +139,12 @@ 画像を操作できるインタラクション エントリ名の一覧を入力してください。コンマで区切り複数を指定できます。 상호작용 메세지에 쓰일 명칭입니다, 쉼표로 구분합니다, 이미지의 순서입니다. + + Set Name + + + Name that will be used for main interaction entry (to distinguish multiple slideshows). Default: "Slides" + Slide Duration Durée d'une diapositive diff --git a/docs/wiki/feature/slideshow.md b/docs/wiki/feature/slideshow.md index 81770a1783..d99a8f2940 100644 --- a/docs/wiki/feature/slideshow.md +++ b/docs/wiki/feature/slideshow.md @@ -13,14 +13,17 @@ version: --- ## 1. Overview + This adds the ability to have images shown on some objects and have other objects being used as remotes. Please note that only objects with hiddenSelection 0 can be used to render images (whiteboard, TV, PC Screen being the most notable examples). ## 2. Usage + Note that this sections is for users, for mission makers refer to [the entry in mission-tools](../missionmaker/mission-tools.html) Also if no remotes are defined the "screen" object itself becomes the remote. ### 2.1 Switching between images + - Look at the object used as a remote and use the interaction menu ⊞ Win (ACE3 default). - Select the action that correspond to the image you want (the name of the action depends on the mission maker). diff --git a/docs/wiki/framework/slideshow-framework.md b/docs/wiki/framework/slideshow-framework.md index a9aeae3935..2859252670 100644 --- a/docs/wiki/framework/slideshow-framework.md +++ b/docs/wiki/framework/slideshow-framework.md @@ -44,11 +44,14 @@ Important notes: 2 | Image Paths | Array | Required (paths must use backslash `\`) 3 | Action Names | Array | Required 4 | Slide Duration | Number | Optional (default: `0`, `0` disables automatic transitions) +5 | Set Name | String | Optional (default: localized `"Slides"`) **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] call ace_slideshow_fnc_createSlideshow;` +`[[object1, object2], [controller1], ["images\image1.paa", "images\image2.paa"], ["Action1", "Action2"], 5, "My Slides"] call ace_slideshow_fnc_createSlideshow;` | Arguments | Explanation ---| --------- | ----------- @@ -57,3 +60,4 @@ Important notes: 2 | `["images\image1.paa", "images\image2.paa"]` | Paths to images projected on screen objects 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