diff --git a/Missionframework/KPGUI/KPGUI_classes.hpp b/Missionframework/KPGUI/KPGUI_classes.hpp index 5a44c0473..becaa4a1a 100644 --- a/Missionframework/KPGUI/KPGUI_classes.hpp +++ b/Missionframework/KPGUI/KPGUI_classes.hpp @@ -1112,6 +1112,44 @@ class KPGUI_PRE_DialogButton_LeftPanel: KPGUI_PRE_Button { w = KP_GETWPLAIN(KP_WIDTH_VAL_LP,1); }; +/* + --- Right panel sized classes --- +*/ + +// Title bar +class KPGUI_PRE_DialogTitle_RightPanel: KPGUI_PRE_Title { + x = KP_GETX(KP_X_VAL_RP,KP_WIDTH_VAL_RP,0,1); + y = safeZoneY + safeZoneH * KP_Y_VAL_RP; + w = KP_GETWPLAIN(KP_WIDTH_VAL_RP,1); +}; + +// Cross symbol +class KPGUI_PRE_DialogCross_RightPanel: KPGUI_PRE_CloseCross { + x = safeZoneX + safeZoneW * (KP_X_VAL_RP + KP_WIDTH_VAL_RP - 0.02); + y = KP_GETY_CROSS(KP_Y_VAL_RP); +}; + +// Version info +class KPGUI_PRE_DialogVersionIcon_RightPanel: KPGUI_PRE_VersionIcon { + x = safeZoneX + safeZoneW * (KP_X_VAL_RP + KP_WIDTH_VAL_RP - 0.04); + y = KP_GETY_CROSS(KP_Y_VAL_RP); +}; + +// Background +class KPGUI_PRE_DialogBackground_RightPanel: KPGUI_PRE_Background { + x = KP_GETX(KP_X_VAL_RP,KP_WIDTH_VAL_RP,0,1); + y = KP_GETY_AREA(KP_Y_VAL_RP); + w = KP_GETWPLAIN(KP_WIDTH_VAL_RP,1); + h = safeZoneH * KP_HEIGHT_VAL_RP; +}; + +// Button +class KPGUI_PRE_DialogButton_RightPanel: KPGUI_PRE_Button { + x = KP_GETX(KP_X_VAL_RP,KP_WIDTH_VAL_RP,0,1); + y = KP_GETY_BELOW(KP_Y_VAL_RP,KP_HEIGHT_VAL_RP); + w = KP_GETWPLAIN(KP_WIDTH_VAL_RP,1); +}; + /* --- Small sized classes --- */ diff --git a/Missionframework/KPGUI/KPGUI_defines.hpp b/Missionframework/KPGUI/KPGUI_defines.hpp index 9fb8f4de3..0ac508320 100644 --- a/Missionframework/KPGUI/KPGUI_defines.hpp +++ b/Missionframework/KPGUI/KPGUI_defines.hpp @@ -4,7 +4,7 @@ File: KPGUI_defines.hpp Author: Wyqer - https://github.com/KillahPotatoes Date: 2018-07-10 - Last Update: 2019-04-16 + Last Update: 2019-05-05 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Description: @@ -134,6 +134,7 @@ /* --- Left panel dialog components --- + (X from 0.0025 - 0.2025, Y from 0.0025 - 0.9975) */ #define KP_X_VAL_LP 0.0025 @@ -142,6 +143,17 @@ #define KP_WIDTH_VAL_LP 0.2 #define KP_HEIGHT_VAL_LP (1 - 2 * KP_Y_VAL_LP - KP_HEIGTH_TITLE - KP_HEIGTH_BUTTON - 2 * KP_SPACING_Y) +/* + --- Right panel dialog components --- + (X from 0.7975 - 0.9975, Y from 0.0025 - 0.9975) +*/ + +#define KP_X_VAL_RP 0.7975‬ +#define KP_Y_VAL_RP 0.0025 + +#define KP_WIDTH_VAL_RP 0.2 +#define KP_HEIGHT_VAL_RP (1 - 2 * KP_Y_VAL_RP - KP_HEIGTH_TITLE - KP_HEIGTH_BUTTON - 2 * KP_SPACING_Y) + /* --- Small dialog components --- (X from 0.3 - 0.7, Y from 0.15 - 0.85) diff --git a/Missionframework/description.ext b/Missionframework/description.ext index 673af504c..9f0914c4d 100644 --- a/Missionframework/description.ext +++ b/Missionframework/description.ext @@ -151,7 +151,7 @@ allowFunctionsLog = 0; // As a security measure, functions are by default protected against rewriting during mission. // This restriction does not apply in missions previewed from the editor. -allowFunctionsRecompile = 0; +allowFunctionsRecompile = __EVAL([0, 1] select (is3DENMultiplayer || is3DEN)); // Disable specific channels for voice and text communication. // MOTD and admin say have exception and will show in global. diff --git a/Missionframework/modules/15_build/README.md b/Missionframework/modules/15_build/README.md index 1ce08af85..fab408e10 100644 --- a/Missionframework/modules/15_build/README.md +++ b/Missionframework/modules/15_build/README.md @@ -37,14 +37,6 @@ Furthermore it handles the saving/loading of all objects which are buildable/spa *Place object in build queue.* -* KPLIB_fnc_build_displaySetMode - - *Set display build mode. (tab)* - -* KPLIB_fnc_build_displayTabClick - - *Handle tab click.* - * KPLIB_fnc_build_displayUnload *Handle build display unload.* diff --git a/Missionframework/modules/15_build/fnc/fn_build_addBuildables.sqf b/Missionframework/modules/15_build/fnc/fn_build_addBuildables.sqf index a0c6a8cf5..17730f8a7 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_addBuildables.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_addBuildables.sqf @@ -4,7 +4,7 @@ File: KPLIB_fnc_build_addBuildables.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-12-09 - Last Update: 2019-04-23 + Last Update: 2019-04-29 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -13,7 +13,7 @@ Parameter(s): _category - Display name of category [DATATYPE, defaults to DEFAULTVALUE] - _buildables - Buildable items [DATATYPE, defaults to DEFAULTVALUE] + _buildables - Buildable items [ARRAY or CODE, defaults to []] Returns: Index of items inside category [NUMBER] diff --git a/Missionframework/modules/15_build/fnc/fn_build_changeQueueMode.sqf b/Missionframework/modules/15_build/fnc/fn_build_changeQueueMode.sqf index 954aa749e..2c5288e71 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_changeQueueMode.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_changeQueueMode.sqf @@ -6,7 +6,7 @@ File: fn_build_changeQueueMode.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-11-29 - Last Update: 2019-04-23 + Last Update: 2019-05-04 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -25,25 +25,35 @@ params [ private _display = ctrlParent _control; private _confirmBtnControl = _display displayCtrl KPLIB_IDC_BUILD_CONFIRM; +private _buildList = _display displayCtrl KPLIB_IDC_BUILD_ITEM_LIST; // !TODO! preserve and restore current build queue switch (LGVAR_D(buildMode, 0)) do { case 0: { - _control ctrlSetText "Move mode"; + _control ctrlSetText localize "STR_KPLIB_DIALOG_BUILD_MODE_MOVE"; LSVAR("buildMode", 1); + LSVAR("buildItem", []); _confirmBtnControl ctrlEnable false; + _buildList ctrlEnable false; + + private _currentItems = LGVAR(buildQueue); private _playerFob = player getVariable "KPLIB_fob"; - private _currentItems = (KPLIB_persistence_objects select {(_x getVariable "KPLIB_fob") isEqualTo _playerFob}) select {!isNull _x}; - LSVAR("buildQueue", _currentItems); + private _movableItems = (KPLIB_persistence_objects select {(_x getVariable "KPLIB_fob") isEqualTo _playerFob}) select {!isNull _x}; + LSVAR("buildQueue_buy", _currentItems); + LSVAR("buildQueue", _movableItems); }; case 1: { - _control ctrlSetText "Build mode"; + _control ctrlSetText localize "STR_KPLIB_DIALOG_BUILD_MODE_BUILD"; LSVAR("buildMode", 0); _confirmBtnControl ctrlEnable true; + _buildList ctrlEnable true; + + private _buyableItems = LGVAR(buildQueue_buy); + LSVAR("buildQueue_buy", nil); - LSVAR("buildQueue", []); + LSVAR("buildQueue", _buyableItems); }; }; diff --git a/Missionframework/modules/15_build/fnc/fn_build_confirmAll.sqf b/Missionframework/modules/15_build/fnc/fn_build_confirmAll.sqf index e5cfc55f9..625119986 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_confirmAll.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_confirmAll.sqf @@ -5,7 +5,7 @@ File: fn_build_confirmAll.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-11-28 - Last Update: 2019-04-23 + Last Update: 2019-05-04 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -22,16 +22,16 @@ private _validItems = LGVAR(buildQueue) select {_x getVariable ["KPLIB_validPos", true]}; LSVAR("buildQueue", LGVAR(buildQueue) - _validItems); -// !TODO! implement build queue handling (resource check etc.) -systemChat "buildConfirm: Resource check not implemented yet!"; { private _dirAndUp = [vectorDir _x, vectorUp _x]; private _pos = getPosATL _x; private _class = typeOf _x; + private _price = _x getVariable "KPLIB_build_price"; + deleteVehicle _x; - [[_class, _pos, 0, true], _dirAndUp, player] remoteExecCall ["KPLIB_fnc_build_confirmSingle", 2]; + [[_class, _pos, 0, true], _dirAndUp, _price, player] remoteExecCall ["KPLIB_fnc_build_confirmSingle", 2]; } forEach _validItems; diff --git a/Missionframework/modules/15_build/fnc/fn_build_confirmSingle.sqf b/Missionframework/modules/15_build/fnc/fn_build_confirmSingle.sqf index ac136c217..447cee134 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_confirmSingle.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_confirmSingle.sqf @@ -4,7 +4,7 @@ File: fn_build_confirmSingle.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-11-29 - Last Update: 2019-04-23 + Last Update: 2019-05-04 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -14,6 +14,7 @@ Parameter(s): _createParams - Parameters for common_createVehicle [ARRAY, defaults to nil] _vectorDirAndUp - Vector dir and up for created object [ARRAY, defaults to nil] + _price - Supplies price [ARRAY, defaults to nil] _player - Player that initiated the building of object [OBJECT, defaults to objNull] Returns: @@ -22,13 +23,20 @@ params [ ["_createParams", nil, [[]]], ["_vectorDirAndUp", nil, [[]], 2], + ["_price", nil, [[]], 3], ["_player", objNull, [objNull]] ]; _createParams params ["_className", "_pos", "_dir", "_justBuild"]; +private _fob = _player getVariable ["KPLIB_fob", ""]; + +if !(([_fob] + _price) call KPLIB_fnc_resources_pay) exitWith { + [format ["Not enough resources to build: %1 at: %2", _className, _fob], "BUILD"] call KPLIB_fnc_common_log; + ["KPLIB_build_not_enough_resources", [_className], _player] call CBA_fnc_targetEvent; +}; + private ["_obj"]; -// !TODO! save only builings via Build module, units and vehicles should be moved to persistence module switch true do { case (_className isKindOf "Man"): { _obj = [createGroup KPLIB_preset_sideF, _className] call KPLIB_fnc_common_createUnit; @@ -51,7 +59,6 @@ switch true do { }; }; -private _fob = _player getVariable ["KPLIB_fob", ""]; ["KPLIB_build_item_built", [_obj, _fob]] call CBA_fnc_globalEvent; ["KPLIB_build_item_built_local", [_obj, _fob], _player] call CBA_fnc_targetEvent; diff --git a/Missionframework/modules/15_build/fnc/fn_build_displayFillList.sqf b/Missionframework/modules/15_build/fnc/fn_build_displayFillList.sqf index 913841809..464de4e9f 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_displayFillList.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_displayFillList.sqf @@ -6,36 +6,35 @@ File: fn_build_displayFillList.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-09-09 - Last Update: 2019-04-23 + Last Update: 2019-04-30 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No Description: - Sets display build mode + Fill list of buildable items Parameter(s): - _mode - Build mode index [NUMBER, defaults to 0] + NONE Returns: Mode was changed [BOOL] */ -params [ - ["_categoryIdx", 0, [0]], - ["_searchQuery", "", [""]] -]; // CfgVehicles config for shorter/faster access private _cfg = configFile >> "CfgVehicles"; -// Get category items -(LGVAR(buildables) select _categoryIdx) params ["", "_categoryItems"]; - +// Get categories list +private _categoriesList = LGVAR(display) displayCtrl KPLIB_IDC_BUILD_CATEGORY_LIST; +private _categoryIdx = lbCurSel _categoriesList; +// Get search query box +private _searchBox = LGVAR(display) displayCtrl KPLIB_IDC_BUILD_SEARCH; +private _searchQuery = toLower ctrlText _searchBox; +// Get list box with buildables private _listBox = LGVAR(display) displayCtrl KPLIB_IDC_BUILD_ITEM_LIST; _listBox lbSetCurSel -1; // Unselect current row as it sticks between clearing lnbClear _listBox; -private _fnc_addItems = { - -}; +// Get category items +(LGVAR(buildables) select _categoryIdx) params ["", "_categoryItems"]; // Fill the item list { @@ -49,15 +48,18 @@ private _fnc_addItems = { _x params ["_className", "_priceSupp", "_priceAmmo", "_priceFuel"]; private _name = getText (_cfg >> _className >> "displayName"); + // Filter list + if !((toLower _name find _searchQuery) isEqualTo -1) then { - _listBox lnbAddRow [_name, str _priceSupp, str _priceAmmo, str _priceFuel]; - private _currentIdx = ((lnbSize _listBox) select 0) - 1; + _listBox lnbAddRow [_name, str _priceSupp, str _priceAmmo, str _priceFuel]; + private _currentIdx = ((lnbSize _listBox) select 0) - 1; - // Serialize classname and price - _listBox lnbSetData [[_currentIdx, 0], str _x]; + // Serialize classname and price + _listBox lnbSetData [[_currentIdx, 0], str _x]; - private _icon = _className call KPLIB_fnc_common_getIcon; - _listBox lnbSetPicture [[_currentIdx, 0], _icon]; + private _icon = _className call KPLIB_fnc_common_getIcon; + _listBox lnbSetPicture [[_currentIdx, 0], _icon]; + }; } forEach _x; } foreach _categoryItems; diff --git a/Missionframework/modules/15_build/fnc/fn_build_displayLoad.sqf b/Missionframework/modules/15_build/fnc/fn_build_displayLoad.sqf index 090e8ba0b..ec9f8e96a 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_displayLoad.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_displayLoad.sqf @@ -6,7 +6,7 @@ File: fn_build_displayLoad.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-09-09 - Last Update: 2019-04-23 + Last Update: 2019-04-30 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -46,13 +46,10 @@ _itemsList ctrlAddEventHandler ["LBSelChanged", { private _categoriesList = _display displayCtrl KPLIB_IDC_BUILD_CATEGORY_LIST; _categoriesList ctrlAddEventHandler ["LBSelChanged", { - params ["_control", "_selectedIndex"]; - - // Clear the search on category change - LSVAR("search", ""); + params ["_control"]; - // Fill the items list - [_selectedIndex, ""] call KPLIB_fnc_build_displayFillList; + // Clear search and fill the items list + [] call KPLIB_fnc_build_searchClear; // Unfocus the listbox to prevent camera controls from changing the selection ctrlSetFocus ((ctrlParent _control) displayCtrl KPLIB_IDC_BUILD_CONFIRM); diff --git a/Missionframework/modules/15_build/fnc/fn_build_displayPlaceObject.sqf b/Missionframework/modules/15_build/fnc/fn_build_displayPlaceObject.sqf index 40bfe02bd..7b815e75e 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_displayPlaceObject.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_displayPlaceObject.sqf @@ -5,7 +5,7 @@ File: fn_build_displayPlaceObject.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-09-09 - Last Update: 2019-04-23 + Last Update: 2019-05-04 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -37,6 +37,8 @@ if !(_className isEqualTo "") exitWith { _obj setPosASL _cursorWorldPosASL; _obj setVectorUp _cursorSurfaceNormal; + _obj setVariable ["KPLIB_build_price", [_priceSupplies, _priceAmmo, _priceFuel]]; + LGVAR(buildQueue) pushBack _obj; // Clear current item upon placement diff --git a/Missionframework/modules/15_build/fnc/fn_build_displayTabClick.sqf b/Missionframework/modules/15_build/fnc/fn_build_displayTabClick.sqf deleted file mode 100644 index 3e1099e8b..000000000 --- a/Missionframework/modules/15_build/fnc/fn_build_displayTabClick.sqf +++ /dev/null @@ -1,50 +0,0 @@ -#include "..\ui\defines.hpp" -#include "script_components.hpp" -/* - KPLIB_fnc_build_displayTabClick - - File: fn_build_displayTabClick.sqf - Author: KP Liberation Dev Team - https://github.com/KillahPotatoes - Date: 2018-09-09 - Last Update: 2019-04-23 - License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html - Public: No - - Description: - Handle tab control click - - Parameter(s): - _tabCtrl - Tab control that was clicked [CONTROL, defaults to nil] - - Returns: - Tab was changed [BOOL] -*/ - -params [ - ["_tabCtrl", nil, [controlNull]] -]; - -private _display = ctrlParent _tabCtrl; - -_selectedMode = 0; -{ - private _ctrl = _display displayCtrl _x; - _ctrl ctrlSetTextColor [1,1,1,0.5]; - _color = [1,1,1,0.5]; - // Selected tab will be scaled up and highlighted - if (_ctrl isEqualTo _tabCtrl) then { - _color = [1,1,1,1]; - _selectedMode = _foreachindex; - }; - _ctrl ctrlSetTextColor _color; -} foreach KPLIB_BUILD_TABS_IDCS_ARRAY; - -// If clicked mode is different than current mode, fire change event -if(LGVAR_D(buildMode, -1) != _selectedMode) exitWith { - LSVAR("buildMode", _selectedMode); - LGVAR(buildMode) call KPLIB_fnc_build_displaySetMode; - - true -}; - -false diff --git a/Missionframework/modules/15_build/fnc/fn_build_drawBoundingBox.sqf b/Missionframework/modules/15_build/fnc/fn_build_drawBoundingBox.sqf index e22550e7d..253d3b258 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_drawBoundingBox.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_drawBoundingBox.sqf @@ -4,7 +4,7 @@ File: fn_build_drawBoundingBox.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-09-29 - Last Update: 2019-04-23 + Last Update: 2019-05-01 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -24,7 +24,7 @@ params [ ]; // Get left bottom and right top corners -(boundingBoxReal _object) params ["_c1", "_c2"]; +(0 boundingBoxReal _object) params ["_c1", "_c2"]; // Draw the bounding box { diff --git a/Missionframework/modules/15_build/fnc/fn_build_preInit.sqf b/Missionframework/modules/15_build/fnc/fn_build_preInit.sqf index 660d3b9fa..13e97f5b3 100644 --- a/Missionframework/modules/15_build/fnc/fn_build_preInit.sqf +++ b/Missionframework/modules/15_build/fnc/fn_build_preInit.sqf @@ -4,7 +4,7 @@ File: fn_build_preInit.sqf Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-10-18 - Last Update: 2019-04-23 + Last Update: 2019-05-01 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Public: No @@ -83,10 +83,23 @@ if (hasInterface) then { player addEventHandler ["Killed", KPLIB_fnc_build_stop]; + // Handle server notification about not enough resources + ["KPLIB_build_not_enough_resources", { + params ["_classname"]; + // TODO common func with caching + private _name = getText (configFile >> "CfgVehicles" >> _className >> "displayName"); + + [ + format[localize "STR_KPLIB_HINT_BUILD_NO_RESOURCES", _name] + ] call CBA_fnc_notify; + + }] call CBA_fnc_addEventHandler; + // Add default buildables from preset { [ localize (_x select 0), + // Add preset vars as code so if preset is changed during gameplay the lists will update dynamically compile format ["KPLIB_preset_%1F", _x select 1] ] call KPLIB_fnc_build_addBuildables; } forEach [ diff --git a/Missionframework/modules/15_build/fnc/fn_build_searchClear.sqf b/Missionframework/modules/15_build/fnc/fn_build_searchClear.sqf new file mode 100644 index 000000000..c14b36cee --- /dev/null +++ b/Missionframework/modules/15_build/fnc/fn_build_searchClear.sqf @@ -0,0 +1,29 @@ +#include "..\ui\defines.hpp" +#include "script_components.hpp" +/* + KPLIB_fnc_build_searchClear + + File: fn_build_searchClear.sqf + Author: KP Liberation Dev Team - https://github.com/KillahPotatoes + Date: 2019-04-29 + Last Update: 2019-04-30 + License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html + Public: No + + Description: + Clears build list search. + + Parameter(s): + NONE + + Returns: + Search was cleared [BOOL] +*/ + +// Clear search box +private _searchBox = LGVAR(display) displayCtrl KPLIB_IDC_BUILD_SEARCH; +_searchBox ctrlSetText ""; +// Update list +[] call KPLIB_fnc_build_displayFillList; + +true diff --git a/Missionframework/modules/15_build/functions.hpp b/Missionframework/modules/15_build/functions.hpp index ea6c4cada..8a3deca33 100644 --- a/Missionframework/modules/15_build/functions.hpp +++ b/Missionframework/modules/15_build/functions.hpp @@ -4,7 +4,7 @@ File: functions.hpp Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-07-01 - Last Update: 2018-12-11 + Last Update: 2019-05-05 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Description: @@ -47,9 +47,6 @@ class build { // Set display build mode (tab) class build_displayFillList {}; - // Handle tab click - class build_displayTabClick {}; - // Handle build display unload class build_displayUnload {}; @@ -102,6 +99,9 @@ class build { // Handle persistent data saving class build_saveData {}; + // Clear build list search + class build_searchClear {}; + // Add player actions class build_setupPlayerActions {}; diff --git a/Missionframework/modules/15_build/ui/KPLIB_buildDisplay.hpp b/Missionframework/modules/15_build/ui/KPLIB_buildDisplay.hpp index 97494eea8..4f4314d39 100644 --- a/Missionframework/modules/15_build/ui/KPLIB_buildDisplay.hpp +++ b/Missionframework/modules/15_build/ui/KPLIB_buildDisplay.hpp @@ -4,7 +4,7 @@ File: KPLIB_defines.hpp Author: KP Liberation Dev Team - https://github.com/KillahPotatoes Date: 2018-07-01 - Last Update: 2019-04-15 + Last Update: 2019-04-30 License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html Description: @@ -38,109 +38,15 @@ class KPLIB_build { onMouseHolding = "['onMouseHolding', _this] call KPLIB_fnc_build_handleMouse"; }; - class KPLIB_DialogTitle: KPGUI_PRE_DialogTitle_LeftPanel { - text = "$STR_KPLIB_DIALOG_BUILD_TITLE"; - }; - - class KP_DialogArea: KPGUI_PRE_DialogBackground_LeftPanel { - idc = KPLIB_IDC_BUILD_DIALOG_AREA; - }; + #include "buildDisplay_leftBg.hpp" + #include "buildDisplay_rightBg.hpp" }; class Controls { - class KPLIB_BuildCategoryList: KPGUI_PRE_Combo { - idc = KPLIB_IDC_BUILD_CATEGORY_LIST; - - x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,1); - y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,2,40); - w = KP_GETW(KP_WIDTH_VAL_LP,1); - h = KP_GETH(KP_HEIGHT_VAL_LP,40); - - onMouseZChanged = "['onMouseZChanged_BuildCategoryList', _this] call KPLIB_fnc_build_handleMouse"; - }; - - class KPLIB_BuildSearch: KPGUI_PRE_Combo { - idc = KPLIB_IDC_BUILD_SEARCH; - - x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,12); - y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,3,40); - w = KP_GETW(KP_WIDTH_VAL_LP,(12/11)); - h = KP_GETH(KP_HEIGHT_VAL_LP,40); - }; - - class KPLIB_BuildSearchButton: KPGUI_PRE_ActivePictureRatio { - idc = KPLIB_IDC_BUILD_SEARCH_BUTTON; - - x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,11,12); - y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,3,40); - w = KP_GETW(KP_WIDTH_VAL_LP,(12/1)); - h = KP_GETH(KP_HEIGHT_VAL_LP,40); - - text = "\a3\Ui_f\data\GUI\RscCommon\RscButtonSearch\search_start_ca.paa"; - }; - - class KPLIB_BuildList: KPGUI_PRE_ListNBox { - idc = KPLIB_IDC_BUILD_ITEM_LIST; - - x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,1); - y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,2,20); - w = KP_GETW(KP_WIDTH_VAL_LP,1); - h = KP_GETH(KP_HEIGHT_VAL_LP,(20/18)); - - columns[] = { 0, 0.65, 0.75, 0.85 }; - - onMouseZChanged = "['onMouseZChanged_BuildList', _this] call KPLIB_fnc_build_handleMouse"; - }; - - class KPLIB_ToolboxContainer: KPGUI_PRE_ControlsGroup { - class VScrollbar: KPGUI_PRE_ScrollBar { - width = 0; - }; - class HScrollbar: KPGUI_PRE_ScrollBar { - color[] = {1, 1, 1, 0.5}; - height = 0.02; - }; - - x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,1); - y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,0,20); - w = KP_GETW(KP_WIDTH_VAL_LP,1); - h = KP_GETH(KP_HEIGHT_VAL_LP,20); - - // Toolbox Controls - class Controls { - // !TODO! move toolbox items creation to script - class KPLIB_Toolbox_MoveItems: KPGUI_PRE_ActiveText { - text = "Build mode"; - idc = KPLIB_IDC_BUILD_TOOLBOX_MOVEITEMS; - - colorActive[] = {1, 1, 1, 1}; - colorText[] = {1, 1, 1, 0.75}; - colorDisabled[] = {1, 1, 1, 0.25}; - color[] = {1, 1, 1, 0.55}; - - x = 0; - y = 0; - w = KP_GETW(KP_WIDTH_VAL_LP,4); - h = KP_GETH(KP_HEIGHT_VAL_LP,20) - 0.02; - - onButtonClick = "_this call KPLIB_fnc_build_changeQueueMode"; - }; - }; - }; - - class KP_ApplyButton: KPGUI_PRE_DialogButton_LeftPanel { - idc = KPLIB_IDC_BUILD_CONFIRM; - text = "$STR_KPLIB_DIALOG_BUTTON_BUILD"; - - w = KP_GETWPLAIN(KP_WIDTH_VAL_LP,1); - onButtonClick = "_this call KPLIB_fnc_build_confirmAll"; - }; - - class KPLIB_DialogCross: KPGUI_PRE_DialogCross_LeftPanel { - action = "call KPLIB_fnc_build_stop"; - }; + #include "buildDisplay_left.hpp" + #include "buildDisplay_right.hpp" }; }; diff --git a/Missionframework/modules/15_build/ui/buildDisplay_left.hpp b/Missionframework/modules/15_build/ui/buildDisplay_left.hpp new file mode 100644 index 000000000..4d27976ce --- /dev/null +++ b/Missionframework/modules/15_build/ui/buildDisplay_left.hpp @@ -0,0 +1,96 @@ + +class KPLIB_BuildCategoryList: KPGUI_PRE_Combo { + idc = KPLIB_IDC_BUILD_CATEGORY_LIST; + + x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,1); + y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,2,40); + w = KP_GETW(KP_WIDTH_VAL_LP,1); + h = KP_GETH(KP_HEIGHT_VAL_LP,40); + + onMouseZChanged = "['onMouseZChanged_BuildCategoryList', _this] call KPLIB_fnc_build_handleMouse"; +}; + +class KPLIB_BuildSearch: KPGUI_PRE_EditBox { + idc = KPLIB_IDC_BUILD_SEARCH; + + x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,12); + y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,3,40); + w = KP_GETW(KP_WIDTH_VAL_LP,(12/11)); + h = KP_GETH(KP_HEIGHT_VAL_LP,40); + + onKeyUp = "[] call KPLIB_fnc_build_displayFillList"; +}; + +class KPLIB_BuildSearchClearButton: KPGUI_PRE_ActivePictureRatio { + idc = KPLIB_IDC_BUILD_SEARCH_BUTTON; + + x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,11,12); + y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,3,40); + w = KP_GETW(KP_WIDTH_VAL_LP,(12/1)); + h = KP_GETH(KP_HEIGHT_VAL_LP,40); + + text = "\a3\Ui_f\data\GUI\RscCommon\RscButtonSearch\search_end_ca.paa"; + action = "[] call KPLIB_fnc_build_searchClear"; +}; + +class KPLIB_BuildList: KPGUI_PRE_ListNBox { + idc = KPLIB_IDC_BUILD_ITEM_LIST; + + x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,1); + y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,2,20); + w = KP_GETW(KP_WIDTH_VAL_LP,1); + h = KP_GETH(KP_HEIGHT_VAL_LP,(20/18)); + + columns[] = {0, 0.65, 0.75, 0.85}; + + onMouseZChanged = "['onMouseZChanged_BuildList', _this] call KPLIB_fnc_build_handleMouse"; +}; + +class KPLIB_ToolboxContainer: KPGUI_PRE_ControlsGroup { + class VScrollbar: KPGUI_PRE_ScrollBar { + width = 0; + }; + class HScrollbar: KPGUI_PRE_ScrollBar { + color[] = {1, 1, 1, 0.5}; + height = 0.02; + }; + + x = KP_GETCX(KP_X_VAL_LP,KP_WIDTH_VAL_LP,0,1); + y = KP_GETCY(KP_Y_VAL_LP,KP_HEIGHT_VAL_LP,0,20); + w = KP_GETW(KP_WIDTH_VAL_LP,1); + h = KP_GETH(KP_HEIGHT_VAL_LP,20); + + // Toolbox Controls + class Controls { + // !TODO! move toolbox items creation to script + class KPLIB_Toolbox_MoveItems: KPGUI_PRE_ActiveText { + text = "$STR_KPLIB_DIALOG_BUILD_MODE_BUILD"; + tooltip = "$STR_KPLIB_DIALOG_BUILD_MODE_TT" + idc = KPLIB_IDC_BUILD_TOOLBOX_MOVEITEMS; + + colorActive[] = {1, 1, 1, 1}; + colorText[] = {1, 1, 1, 0.75}; + colorDisabled[] = {1, 1, 1, 0.25}; + color[] = {1, 1, 1, 0.55}; + + x = 0; + y = 0; + w = KP_GETW(KP_WIDTH_VAL_LP,4); + h = KP_GETH(KP_HEIGHT_VAL_LP,20) - 0.02; + + onButtonClick = "_this call KPLIB_fnc_build_changeQueueMode"; + }; + }; +}; + +class KP_ApplyButton: KPGUI_PRE_DialogButton_LeftPanel { + idc = KPLIB_IDC_BUILD_CONFIRM; + text = "$STR_KPLIB_DIALOG_BUTTON_BUILD"; + + w = KP_GETWPLAIN(KP_WIDTH_VAL_LP,1); + onButtonClick = "_this call KPLIB_fnc_build_confirmAll"; +}; + +class KPLIB_DialogCross: KPGUI_PRE_DialogCross_LeftPanel { + action = "[] call KPLIB_fnc_build_stop"; +}; diff --git a/Missionframework/modules/15_build/ui/buildDisplay_leftBg.hpp b/Missionframework/modules/15_build/ui/buildDisplay_leftBg.hpp new file mode 100644 index 000000000..04d83eec2 --- /dev/null +++ b/Missionframework/modules/15_build/ui/buildDisplay_leftBg.hpp @@ -0,0 +1,8 @@ + +class KPLIB_DialogTitle: KPGUI_PRE_DialogTitle_LeftPanel { + text = "$STR_KPLIB_DIALOG_BUILD_TITLE"; +}; + +class KP_DialogArea: KPGUI_PRE_DialogBackground_LeftPanel { + idc = KPLIB_IDC_BUILD_DIALOG_AREA; +}; diff --git a/Missionframework/modules/15_build/ui/buildDisplay_right.hpp b/Missionframework/modules/15_build/ui/buildDisplay_right.hpp new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/Missionframework/modules/15_build/ui/buildDisplay_right.hpp @@ -0,0 +1 @@ + diff --git a/Missionframework/modules/15_build/ui/buildDisplay_rightBg.hpp b/Missionframework/modules/15_build/ui/buildDisplay_rightBg.hpp new file mode 100644 index 000000000..2136e9055 --- /dev/null +++ b/Missionframework/modules/15_build/ui/buildDisplay_rightBg.hpp @@ -0,0 +1,9 @@ +/* +class KPLIB_QueueTitle: KPGUI_PRE_DialogTitle_RightPanel { + text = "$STR_KPLIB_DIALOG_BUILD_QUEUE_TITLE"; +}; + +class KP_QueueArea: KPGUI_PRE_DialogBackground_RightPanel { + idc = -1; +}; +*/ diff --git a/Missionframework/stringtable.xml b/Missionframework/stringtable.xml index b7af4a644..629ae1185 100644 --- a/Missionframework/stringtable.xml +++ b/Missionframework/stringtable.xml @@ -573,6 +573,22 @@ CONSTRUIR İnşa Et + + Build mode + Baumodus + + + Move mode + Bearbeitungsmodus + + + Click to toggle between building new items and moving existing items modes. + Wechsle zwischen dem Baumodus und dem Bearbeitungsmodus. + + + BUILD QUEUE + BAULISTE + @@ -1128,6 +1144,10 @@ Следующие элементы не разрешены: Şu eşyalar yasaklı: + + Not enough resources to build %1. + Nicht genug Ressourcen, um %1 zu bauen. + Selected storage is emptied. Ausgewählter Laderaum wurde geleert.