description.ext:
- Kod: Zaznacz cały
//niezbedne stale:
#define CT_BUTTON 1
#define GUI_COMBO 4
#define ST_CENTER 0x02
#define FontM "Zeppelin32"
//moje stałe dla przejrzystosci:
#define TASK_SELECTOR_DIALOG 102
#define TASK_SELECTOR_COMBOBOX 103
#define TASK_SELECTOR_BUTTON 104
class AbstractButton : RscButton{
idc = -1;
type = CT_BUTTON;
style = ST_CENTER;
w = 0.12; h = 0.03;
colorText[] = { 0, 0, 0, 1 };
colorBackground[] = { 0.7, 0.7, 0.0, 0.75 };
colorDisabled[] = {0.5, 0.5, 0.5, 0.5};
colorFocused[] = {0.9, 0.96, 0.0, 0.75};
colorShadow[] = {0.1, 0.1, 0.0, 0.5};
offsetX = 0.01;
offsetY = 0.01;
offsetPressedX = 0.005;
offsetPressedY = 0.005;
colorBorder[] = {0.9, 0.3, 0.0, 0.9};
borderSize = 0.0;
colorBackgroundActive[] = {0.8, 0.8, 0.0, 0.8};
colorBackgroundDisabled[] = {0.2, 0.2, 0.2, 0.75};
font = FontM; sizeEx = 0.016;
soundEnter[] = { "", 0, 1 };
soundPush[] = { "", 0, 1 };
soundClick[] = { "", 0, 1 };
soundEscape[] = { "", 0, 1 };
};
class GUIList
{
style = ST_CENTER;
idc = -1;
colorText[] = { 0, 0, 0, 1 };
colorBackground[] = { 0.7, 0.7, 0.0, 0.75 };
colorSelect[] = {0.7, 0.7, 0.0, 1.0};
colorSelectBackground[] = {0,0,0,1};
font = FontM;
sizeEx = 0.016;
rowHeight = 0.03;
soundSelect[] = {"",0.1,1};
soundExpand[] = {"",0.1,1};
soundCollapse[] = {"",0.1,1};
w = 0.275;
h = 0.03;
};
class GUIComboBox:GUIList
{
type = GUI_COMBO;
wholeHeight = 0.4;
};
class SelectTaskDialog{
idd = TASK_SELECTOR_DIALOG;
movingEnable = false;
controlsBackground[] = { };
objects[] = { };
controls[] = {TasksCombo, TaskButton};
class Bg2: RscText
{
x = 0.25;
y = 0.27;
w = 0.04 + 0.46;
h = 0.04 + 0.16;
text = "";
colorBackground[] = {0.1, 0.1, 0.1, 0.3};
};
class BgClose2: RscText
{
x = 0.25;
y = 0.47;
w = 0.04 + 0.46;
h = 0.04 + 0.03;
text = "";
colorBackground[] = {0.03, 0.03, 0.01, 0.4};
};
class TasksCombo: GUIComboBox{
idc = TASK_SELECTOR_COMBOBOX;
x = 0.29; y = 0.30;
};
class TaskButton : AbstractButton {
idc = TASK_SELECTOR_BUTTON;
text = "Take order";
action = "";
x = 0.59; y = 0.30;
};
}//SelectTaskDialog
init.sqf lub jakieś inne miejsce na inicjalizację stałych dla przejrzystości:
- Kod: Zaznacz cały
//takie same wartości jak w description.ext
TASK_SELECTOR_DIALOG = 102;
TASK_SELECTOR_COMBOBOX = 103;
TASK_SELECTOR_BUTTON = 104;
skrypt, który odpowiada za wywołanie i ustawienie kontrolek:
- Kod: Zaznacz cały
createDialog "SelectTaskDialog";
lbClear TASK_SELECTOR_COMBOBOX;
//uzupelnianie comboboxa
for[{_i=0},{_i<MissionsCount},{_i=_i+1}]do
{
_ind = lbAdd[TASK_SELECTOR_COMBOBOX, missionsNameArray select _i];
lbSetValue [TASK_SELECTOR_COMBOBOX, _ind, _i];
};
lbSetCurSel [TASK_SELECTOR_COMBOBOX, 0];
_action = "[lbValue [TASK_SELECTOR_COMBOBOX, (lbCurSel TASK_SELECTOR_COMBOBOX)]] execVM ""jakis_skrypt.sqf""; closeDialog TASK_SELECTOR_DIALOG";
buttonSetAction [TASK_SELECTOR_BUTTON, _action];
gdzie missionNameArray to tablica napisaów, a MissionCount to ilośc elementów tej tablicy