Add categories view to Advanced Trading buy mode

This commit is contained in:
ebaydayz
2016-05-12 14:09:05 -04:00
parent e60175b30c
commit bd85693af7
9 changed files with 97 additions and 13 deletions

View File

@@ -92,7 +92,7 @@ class AdvancedTrading
x = 0.51 * safezoneW + safezoneX;
y = 0.26 * safezoneH + safezoneY;
w = 0.08 * safezoneW;
onButtonClick = "call Z_ChangeBuySell;";
onButtonClick = "Z_CategoryView = true; call Z_ChangeBuySell;";
colorBackground[] = {1,1,1,1};
color[] = {0,0,0,1};
};
@@ -116,6 +116,17 @@ class AdvancedTrading
h = 0.03 * safezoneH;
colorText[] = {1,1,1,1};
};
class ZSC_RscButtonMenu_BACK: AT_Zupa_BlueButton
{
idc = 7449;
text = $STR_EPOCH_BACK;
x = 0.21 * safezoneW + safezoneX;
y = 0.33 * safezoneH + safezoneY;
w = 0.08 * safezoneW;
onButtonClick = "Z_Selling = !Z_Selling; Z_CategoryView = true; call Z_ChangeBuySell;";
colorBackground[] = {1,1,1,1};
color[] = {0,0,0,1};
};
class RscText_AT8: ZSC_RscText
{
idc = -1;
@@ -221,7 +232,7 @@ class AdvancedTrading
soundSelect[] = {"",0.1,1};
colorBackground[] = {0.1,0.1,0.1,0.8};
onload = "ctrlShow [_this,false]";
onLBSelChanged = "['buyable',(lbCurSel 7421)] call Z_getItemInfo";
onLBSelChanged = "if (Z_CategoryView) then {(lbCurSel 7421) call Z_fillCategoryList} else {['buyable',(lbCurSel 7421)] call Z_getItemInfo};";
class ListScrollBar: ZSC_RscScrollBar{};
class ScrollBar
{
@@ -280,12 +291,12 @@ class AdvancedTrading
};
class ZSC_RscButtonMenu_ATTFilter: AT_Zupa_BlueButton
{
idc = -1;
idc = 7498;
text = $STR_UI_FILTER;
x = 0.21 * safezoneW + safezoneX;
y = 0.77 * safezoneH + safezoneY;
w = 0.13 * safezoneW;
onButtonClick = "[(ctrlText 7444)] call Z_filterList;";
onButtonClick = "if (Z_CategoryView) then {(lbCurSel 7421) call Z_fillCategoryList} else {[(ctrlText 7444)] call Z_filterList};";
colorBackground[] = {1,1,1,1};
color[] = {0,0,0,1};
};

View File

@@ -76,4 +76,12 @@
// #define Z_AT_PRICEINFO 7451
#define Z_AT_PRICEINFO 7451
#define Z_AT_FILTERBOX 7444
#define Z_AT_FILTERBUTTON 7498
#define Z_AT_DETAILSTEXT 7488
#define Z_AT_BACKBUTTON 7449
//

View File

@@ -1,4 +1,4 @@
private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore"];
private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore","_categoryNumber"];
call Z_clearBuyList;
call Z_clearBuyingList;
Z_BuyableArray = [];
@@ -6,7 +6,8 @@ Z_BuyingArray = [];
_arrayOfTraderCat = Z_traderData;
_counter = 0;
{
_cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)];
_categoryNumber = if (Z_CategoryView) then {_this} else {(_arrayOfTraderCat select _forEachIndex select 1)};
_cat = format["Category_%1",_categoryNumber];
_cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat;
if (isNumber (_cfgtraders >> "duplicate")) then {
_cat = format["Category_%1",getNumber (_cfgtraders >> "duplicate")];
@@ -63,6 +64,11 @@ _counter = 0;
};
};
};
if (Z_CategoryView) exitWith { // Only filling items for one category
Z_CategoryView = false;
Z_Selling = !Z_Selling;
call Z_ChangeBuySell;
};
}forEach _arrayOfTraderCat;
Z_OriginalBuyableArray = [] + Z_BuyableArray;

View File

@@ -4,13 +4,26 @@ Z_Selling = !Z_Selling;
if(Z_Selling)then{
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText localize "STR_EPOCH_PLAYER_291";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText localize "STR_EPOCH_TRADE_SELLING";
{ctrlShow [_x,true];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON]; // show
{ctrlShow [_x,false];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY]; // hide
{ctrlShow [_x,true];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON,Z_AT_FILTERBOX]; // show
{ctrlShow [_x,false];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY,Z_AT_BACKBUTTON]; // hide
}else{
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText localize "STR_EPOCH_PLAYER_292";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText localize "STR_EPOCH_TRADE_BUYING";
{ctrlShow [_x,true];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY]; // show
{ctrlShow [_x,false];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON]; // hide
call Z_calcBuyableList;
};
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_FILTERBUTTON) ctrlSetText localize "STR_UI_FILTER";
{ctrlShow [_x,true];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY,Z_AT_FILTERBOX,Z_AT_BACKBUTTON]; // show
{ctrlShow [_x,false];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON]; // hide
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_BUYABLELIST) ctrlSetFontHeight 0.023; // reset
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_BUYABLELIST) ctrlSetPosition [(0.21* safezoneW + safezoneX),(0.41 * safezoneH + safezoneY),(0.13 * safezoneW),(0.30 * safezoneH)]; //reset
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_BUYABLELIST) ctrlCommit 0;
if (Z_CategoryView) then {
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_FILTERBUTTON) ctrlSetText localize "STR_EPOCH_VIEW";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_BUYABLELIST) ctrlSetFontHeight 0.026; // Slightly bigger in category view
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_BUYABLELIST) ctrlSetPosition [(0.21* safezoneW + safezoneX),(0.43 * safezoneH + safezoneY),(0.13 * safezoneW),(0.30 * safezoneH)];
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_BUYABLELIST) ctrlCommit 0;
{ctrlShow [_x,false];} forEach [Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_FILTERBOX,Z_AT_BACKBUTTON]; // hide
call Z_fillCategories;
};
};
[2] call Z_getContainer; // default gear

View File

@@ -0,0 +1,9 @@
private "_index";
#include "defines.sqf";
call Z_clearBuyList;
call Z_clearBuyingList;
{
_index = lbAdd [Z_AT_BUYABLELIST,_x select 0];
lbSetPicture [Z_AT_BUYABLELIST,_index,"\z\addons\dayz_code\gui\epoch\arrow_right.paa"];
} forEach Z_traderData;

View File

@@ -0,0 +1,11 @@
private ["_categoryName","_categoryNumber"];
#include "defines.sqf";
_categoryName = lbText [Z_AT_BUYABLELIST,_this];
{
if (_x select 0 == _categoryName) exitWith {
_categoryNumber = _x select 1;
};
} forEach Z_traderData;
_categoryNumber call Z_calcBuyableList;

View File

@@ -61,6 +61,7 @@ if(isNil "Z_AdvancedTradingInit")then{
Z_clearSellableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearSellableList.sqf");
Z_clearBuyList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearBuyList.sqf");
Z_clearBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearBuyingList.sqf");
Z_fillCategories = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillCategories.sqf");
Z_getItemInfo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getItemInfo.sqf");
Z_getItemConfig = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getItemConfig.sqf");
Z_displayItemInfo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_displayItemInfo.sqf");
@@ -75,6 +76,7 @@ if(isNil "Z_AdvancedTradingInit")then{
Z_filterList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_filterList.sqf");
Z_checkArrayInConfig = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_checkArrayInConfig.sqf");
Z_calcPrice = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcPrice.sqf");
Z_fillCategoryList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillCategoryList.sqf");
Z_fillSellList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillSellList.sqf");
Z_fillSellingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillSellingList.sqf");
Z_pushItemToList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_pushItemToList.sqf");
@@ -102,12 +104,13 @@ if(isNil "Z_AdvancedTradingInit")then{
};
Z_Selling = true; // Always start menu in buy mode (flipped in z_at_changeBuySell.sqf on startup)
Z_CategoryView = true; // Always start in category view
createDialog "AdvancedTrading";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVESELLITEMBUTTON) ctrlSetText " < ";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVEALLSELLITEMBUTTON) ctrlSetText " << ";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVEBUYITEMBUTTON) ctrlSetText " < ";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVEALLBUYITEMBUTTON) ctrlSetText " << ";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl 7488) ctrlSetText " " + localize "STR_EPOCH_TRADE_DETAILS";
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_DETAILSTEXT) ctrlSetText " " + localize "STR_EPOCH_TRADE_DETAILS";
call Z_ChangeBuySell;

Binary file not shown.

View File

@@ -17356,5 +17356,28 @@
<German>KI</German>
<Czech>AI</Czech>
</Key>
<Key ID="STR_EPOCH_VIEW">
<English>View</English>
<French>Voir</French>
<Spanish>Vista</Spanish>
<Italian>Vista</Italian>
<Hungarian>Nézet</Hungarian>
<Polish>Widok</Polish>
<Russian>Вид</Russian>
<German>Ansicht</German>
<Czech>Pohled</Czech>
</Key>
<Key ID="STR_EPOCH_BACK">
<English>Back</English>
<French>Retour</French>
<Spanish>Atrás</Spanish>
<Italian>Indietro</Italian>
<Hungarian>Vissza</Hungarian>
<Polish>Powrót</Polish>
<Russian>Назад</Russian>
<German>Zurück</German>
<Czech>Zpět</Czech>
<Japanese>戻る</Japanese>
</Key>
</Package>
</Project>