Aller au contenu

Fenêtre pour le vendeur de licences


vfrz
 Share

Recommended Posts

 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 :P

 

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 :

43af8e7fe6f0e28f936844c624531f97.png

Lien vers le commentaire
Partager sur d’autres sites

  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Invité
Répondre à ce sujet…

×   Vous avez collé du contenu avec mise en forme.   Supprimer la mise en forme

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Chargement
 Share

×
×
  • Créer...