vfrz Posté(e) November 20, 2014 Signaler Posté(e) November 20, 2014 Bonjour, il s'agit d'un tutoriel assez simple, cependant il faut avoir un minimum de connaissances pour s'y retrouver ! Crédit : -RichHomieQuan pour le tutoriel sur altisliferpg.com -Moi pour la traduction C'est parti ! Ajoutez ceci dans le fichier functions.h, en dessous de "shops" : class licenses {}; Créez un fichier dans le dossier dialog, nommé LicensesDialog.hpp class LicenseShop { idd = 5546; name= "life_license_shop"; movingEnable = false; enableSimulation = true; onLoad = "uiNamespace setVariable [""LicenseShop"", _this select 0];"; objects[] = { }; class controls { class RscTitleBackground : Life_RscText { colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"}; idc = -1; text = "Licenses"; //--- ToDo: Localize; x = 0.1; y = 0.2; w = 0.775; h = 0.04; }; class Mainbackground : Life_RscText { colorBackground[] = {0,0,0,0.7}; idc = -1; x = 0.1; y = 0.244; w = 0.775; h = 0.52; }; class listbox: Life_RscListBox { idc = 55126; sizeEx = 0.035; x = 0.1125; y = 0.3; w = 0.3125; h = 0.4; }; class ShowLicenseslistbox: Life_RscListBox { idc = 55131; x = 0.55; y = 0.3; w = 0.3125; h = 0.4; }; class MyLicenses : Life_RscText { idc = 55130; text = "Available "; //--- ToDo: Localize; x = 0.1875; y = 0.24; w = 0.1375; h = 0.04; }; class ShowLicenses : Life_RscText { idc = 55129; text = "My Licenses"; //--- ToDo: Localize; x = 0.65; y = 0.24; w = 0.1375; h = 0.04; }; class buybutton: Life_RscButtonMenu { idc = 55127; text = "$STR_Global_Buy"; x = 0.4125; y = 0.72; w = 0.15; h = 0.04; colorText[] = {1,1,1,1}; colorBackground[] = {0,0,0,0.8}; action = "if( (lbData[55126,lbCurSel (55126)] != """") ) then { [false, false, false, lbData[55126,lbCurSel (55126)]] call life_fnc_buyLicense; closeDialog 0; };"; }; }; }; Créez un fichier nommé fn_licenses.sqf dans core/shops : private["_display","_listbox","_shortname","_longname","_price","_hasLicense","_displayname"]; _buyables = _this select 3; //called from action => select 3rd argument if(!dialog) then { if(!(createDialog "LicenseShop")) exitWith {}; }; disableSerialization; _display = findDisplay 5546; if(isNull _display) exitWith {}; _listbox = _display displayCtrl 55126; _mylic = _display displayCtrl 55131; _struct = ""; { _shortname = _x; _longname = ([_shortname, 0] call life_fnc_licenseType) select 0; _displayname = ([_shortname, 0] call life_fnc_licenseType) select 1; _price = [_shortname] call life_fnc_licensePrice; _hasLicense = missionNamespace getVariable _longname; if(!_hasLicense) then { _listbox lbAdd format["%1 ($%2)", _displayname, _price]; _listbox lbSetData [(lbSize _listbox) - 1, _shortname]; } else { _mylic lbAdd format["%1", _displayname]; _mylic lbSetData [(lbSize _mylic) - 1, _shortname]; }; } foreach _buyables; Il va falloir aussi changer l'initialisation des pnjs comme ceci (exemple) : this addAction["Licenses",life_fnc_licenses,["driver","boat","pilot","truck","home","gun"],0,true,true,"",' playerSide == civilian ']; Au lieu de : this addAction[format[""%1 ($%2)"",[""license_civ_driver""] call life_fnc_varToStr,[([""driver""] call life_fnc_licensePrice)] call life_fnc_numberText],life_fnc_buyLicense,""driver"",0,false,false,"""",' !license_civ_driver && playerSide == civilian ']; ... Voici un petit screenshot pour la fin :
subherox Posté(e) November 20, 2014 Signaler Posté(e) November 20, 2014 normal que tout soit a la ligne comme tu as mis ou pas? ^^ je préfère demander
vfrz Posté(e) November 20, 2014 Auteur Signaler Posté(e) November 20, 2014 Oui c'est normal mais cest pas grave, ça marche quand même
Twolk Posté(e) November 26, 2014 Signaler Posté(e) November 26, 2014 (modifié) Tu à sauter une étape Il faut aussi ajouter #include "LicensesDialog.hpp" Dans /dialog/MasterHandler.h Après ça marche parfaitement, merci à toi pour tout les partages que tu fait Modifié November 26, 2014 par Twolk
vfrz Posté(e) November 26, 2014 Auteur Signaler Posté(e) November 26, 2014 Ok merci je vais ajouter ceci
Recommended Posts
Veuillez vous connecter pour commenter
Vous pourrez laisser un commentaire après vous êtes connecté.
Connectez-vous maintenant