1
0
Fork 0

Add initial placeholder for approach vias

This commit is contained in:
legoboyvdlp R 2020-05-31 21:23:22 +01:00
parent 4a7243635e
commit 98163eb712

View file

@ -1,4 +1,5 @@
var isNoStar = [0, 0]; var isNoStar = [0, 0];
var isNoVia = [0, 0];
var arrivalPage = { var arrivalPage = {
title: [nil, nil, nil], title: [nil, nil, nil],
@ -39,9 +40,10 @@ var arrivalPage = {
enableScrollStars: 0, enableScrollStars: 0,
scrollApproach: 0, scrollApproach: 0,
scrollStars: 0, scrollStars: 0,
activePage: 0, # runways, stars, trans activePage: 0, # runways, stars, vias
hasPressNoTrans: 0, # temporary hasPressNoTrans: 0, # temporary
_approaches: nil, _approaches: nil,
_vias; nil,
_stars: nil, _stars: nil,
_transitions: nil, _transitions: nil,
new: func(icao, computer) { new: func(icao, computer) {
@ -415,6 +417,12 @@ var arrivalPage = {
} }
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateActiveVIAs: func() {
},
updateVIAs: func() {
#placeholder
},
clearTransitions: func() { clearTransitions: func() {
me.R2 = [nil, "TRANS", "wht"]; me.R2 = [nil, "TRANS", "wht"];
me.R3 = [nil, "TRANS", "wht"]; me.R3 = [nil, "TRANS", "wht"];
@ -519,7 +527,7 @@ var arrivalPage = {
} }
me.updateApproaches(); me.updateApproaches();
} }
} else { } elsif (me.activePage == 1) {
if (me.enableScrollStars) { if (me.enableScrollStars) {
me.scrollStars += 1; me.scrollStars += 1;
if (me.scrollStars > size(me.stars) - 4) { if (me.scrollStars > size(me.stars) - 4) {
@ -533,6 +541,14 @@ var arrivalPage = {
} }
me.hasPressNoTrans = 0; me.hasPressNoTrans = 0;
} }
} elsif (me.activePage == 2) {
if (me.enableScrollVias) {
me.scrollVias += 1;
if (me.scrollVias > size(me.vias) - 4) {
me.scrollVias = 0;
}
me.updateVIAs();
}
} }
}, },
scrollDn: func() { scrollDn: func() {
@ -544,7 +560,7 @@ var arrivalPage = {
} }
me.updateApproaches(); me.updateApproaches();
} }
} else { } elsif (me.activePage == 1) {
if (me.enableScrollStars) { if (me.enableScrollStars) {
me.scrollStars -= 1; me.scrollStars -= 1;
if (me.scrollStars < 0) { if (me.scrollStars < 0) {
@ -558,13 +574,23 @@ var arrivalPage = {
} }
me.hasPressNoTrans = 0; me.hasPressNoTrans = 0;
} }
} elsif (me.activePage == 2) {
if (me.enableScrollVias) {
me.scrollVias -= 1;
if (me.scrollVias < 0) {
me.scrollVias = size(me.vias) - 4;
}
me.updateVIAs();
}
} }
}, },
scrollLeft: func() { scrollLeft: func() {
if (me.activePage == 2) { return; }
me.activePage = !me.activePage; me.activePage = !me.activePage;
me.updatePage(); me.updatePage();
}, },
scrollRight: func() { scrollRight: func() {
if (me.activePage == 2) { return; }
me.activePage = !me.activePage; me.activePage = !me.activePage;
me.updatePage(); me.updatePage();
}, },
@ -597,7 +623,7 @@ var arrivalPage = {
} else { } else {
mcdu_message(me.computer, "NOT ALLOWED"); mcdu_message(me.computer, "NOT ALLOWED");
} }
} else { } elsif (me.activePage == 1) {
if (size(me.stars) >= (index - 2)) { if (size(me.stars) >= (index - 2)) {
if (!dirToFlag) { if (!dirToFlag) {
me.selectedSTAR = me.stars[index - 2 + me.scrollStars]; me.selectedSTAR = me.stars[index - 2 + me.scrollStars];
@ -628,6 +654,27 @@ var arrivalPage = {
} else { } else {
mcdu_message(me.computer, "NOT ALLOWED"); mcdu_message(me.computer, "NOT ALLOWED");
} }
} else {
if (size(me.vias) >= (index - 2)) {
if (!dirToFlag) {
my.selectedVIA = me.vias[index - 2 + me.scrollVias];
me.makeTmpy();
if (my.selectedVIA != "NO VIA") {
isNoVia[me.computer] = 0;
fmgc.flightPlanController.flightplans[me.computer].approach_trans = me.selectedVIA;
} else {
isNoVia[me.computer] = 1;
fmgc.flightPlanController.flightplans[me.computer].approach_trans = nil;
}
me.updateActiveVIAs();
me.updateVIAs();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
mcdu_message(me.computer, "DIR TO IN PROGRESS");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} }
}, },
arrPushbuttonRight: func(index) { arrPushbuttonRight: func(index) {