Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private _display=uiNamespace getVariable["Lega_ChopShop",displayNull];
- if(isNull _display) then {createDialog"Lega_ChopShop";
- _display=uiNamespace getVariable["Lega_ChopShop",displayNull];};
- private _near_vehicles=(nearestObjects[player,["AllVehicles"],1000]) select{(!(_x isKindOf"CAManBase"))&&((damage _x)!=1)&&(!(_x isKindOf"Animal")) };
- private _list_controls=[];
- private _list_group=_display displayCtrl 1003;(ctrlPosition _list_group) params["_list_x","_list_y","_list_w","_list_h"];
- private _spacer=((((getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"dialog_width"))/4.5)*(profileNamespace getVariable["Lega_Dialog_Multiplier",0.70])*(10/4.5/(400/4.5)))*(pixelW*pixelGrid*0.50));
- private _position=[_spacer,0,((((getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"dialog_width"))/4.5)*(profileNamespace getVariable["lega_Dialog_Multiplier",0.70])*(380/4.5/(400/4.5)))*(pixelW*pixelGrid*0.50)),_list_h/6];
- _near_vehicles apply {private _background=_display ctrlCreate["Lega_RscStructuredText",-1,_list_group];
- private _displayName=getText(configFile>>"CfgVehicles">>(typeOf _x)>>"displayName");
- private _vehicle_cost=getNumber(missionConfigFile>>"LifeCfgVehicles">>(typeOf _x)>>"price");
- if((getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"damage_muliplier")) isEqualTo 1) then {_price=round(_vehicle_cost*(1-(damage _x)));};
- private _claiming_cost=_vehicle_cost*(getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"claim_multiplier"));
- private _selling_price=_vehicle_cost*(getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"sell_multiplier"));
- private _remove_ownershop_cost=_vehicle_cost*(getNumber(missionConfigFile>>"Lega_ChopShop_Config">>"removeOwner_multiplier"));
- private _claim_text=["claimtext",[([_claiming_cost]call Life_fnc_numberText)]]call Lega_fnc_chopShop_getString;
- private _sell_text=["selltext",[([_selling_price]call Life_fnc_numberText)]]call Lega_fnc_chopShop_getString;
- private _removal_text=["removaltext",[([_remove_ownershop_cost]call Life_fnc_numberText)]]call Lega_fnc_chopShop_getString;
- _background ctrlSetBackgroundColor[0.4,0.4,0.4,1];
- _background ctrlSetStructuredText parseText format["<t size='2.5' align='left'>%1</t><br/><t size='1.5' align='right'>%2</t><br/><t size='1.5' align='right'>%3</t><br/><t size='1.5' align='right'>%4</t>",_displayName,_claim_text,_sell_text,_removal_text ];
- _background ctrlSetPosition _position;
- _background ctrlCommit 0;
- _background setVariable["OriginalPositions",(ctrlPosition _background)];
- _background setVariable["vehicle",_x];
- _background setVariable["HoverPositions",[(_position select 0)-(_spacer*0.5),(_position select 1),(_position select 2)+_spacer,(_position select 3) ]];
- _background ctrlAddEventHandler["mouseEnter",{params[["_control",controlNull,[controlNull]]];
- if!(_control isEqualTo((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull])) then {_control ctrlSetBackgroundColor[0.7,0.7,0.7,1];
- _control ctrlSetPosition(_control getVariable["HoverPositions",[]]);
- _control ctrlCommit 0.2;};}];
- _background ctrlAddEventHandler["mouseExit",{params[["_control",controlNull,[controlNull]]];
- if!(_control isEqualTo((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull])) then {_control ctrlSetBackgroundColor[0.4,0.4,0.4,1];
- _control ctrlSetPosition(_control getVariable["OriginalPositions",[]]);
- _control ctrlCommit 0.2;};}];
- _background ctrlAddEventHandler["MouseButtonDblClick",{params[["_control",controlNull,[controlNull]]];
- if!(isNull((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull])) then {private _old_control=((uiNamespace getVariable["Lega_ChopShop",displayNull]) getVariable["Selected_Control",controlNull]);
- if(_old_control isEqualTo _control) exitWith{};
- _old_control ctrlSetTextColor[1,1,1,1];
- _old_control ctrlSetBackgroundColor[0.4,0.4,0.4,1];
- _old_control ctrlSetPosition(_old_control getVariable["OriginalPositions",[]]);
- _old_control ctrlCommit 0.2;};(uiNamespace getVariable["Lega_ChopShop",displayNull]) setVariable["Selected_Control",_control];
- _control ctrlSetBackgroundColor[1,1,1,1];
- _control ctrlSetTextColor[0.4,0.4,0.4,1];[_control]call Lega_fnc_chopShop_SelectionChanged;[(_control getVariable["vehicle",objNull])]spawn lega_fnc_chopShop_startPreview;}];
- _position set[1,((_position select 1)+((_position select 3)+(_spacer/2)))];};
- _list_group setVariable["OriginalWidth",_list_w];
- _list_group ctrlSetPosition[_list_x,_list_y,_list_w*1.1,_list_h];
- _list_group ctrlCommit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement