It works, finished
This commit is contained in:
parent
76ce5deae2
commit
e32c7b6522
4 changed files with 267 additions and 1 deletions
|
@ -17,6 +17,7 @@ var myHold = [nil, nil];
|
|||
var myAirways = [nil, nil];
|
||||
var myDuplicate = [nil, nil];
|
||||
var myClosestAirport = [nil, nil];
|
||||
var myReceivedMessage = [nil, nil];
|
||||
var myReceivedMessages = [nil, nil];
|
||||
var myPilotWP = [nil, nil];
|
||||
var myWind = [nil, nil];
|
||||
|
@ -698,6 +699,7 @@ var canvas_MCDU_base = {
|
|||
me.hideAllArrowsButL6();
|
||||
|
||||
me["Simple_L0S"].hide();
|
||||
me["Simple_L6S"].hide();
|
||||
me["Simple_C3B"].hide();
|
||||
me["Simple_C4B"].hide();
|
||||
|
||||
|
@ -741,8 +743,8 @@ var canvas_MCDU_base = {
|
|||
me.dynamicPageFunc(myReceivedMessages[i].L3, "Simple_L3");
|
||||
me.dynamicPageFunc(myReceivedMessages[i].L4, "Simple_L4");
|
||||
me.dynamicPageFunc(myReceivedMessages[i].L5, "Simple_L5");
|
||||
me["Simple_L6"].setColor(WHITE);
|
||||
me.colorLeft(myReceivedMessages[i].L1[2],myReceivedMessages[i].L2[2],myReceivedMessages[i].L3[2],myReceivedMessages[i].L4[2],myReceivedMessages[i].L5[2],myReceivedMessages[i].L6[2]);
|
||||
me["Simple_L6"].setColor(WHITE);
|
||||
}
|
||||
pageSwitch[i].setBoolValue(1);
|
||||
}
|
||||
|
@ -752,6 +754,118 @@ var canvas_MCDU_base = {
|
|||
me.receivedTime = split(":", me._receivedTime)[0] ~ "." ~ split(":", me._receivedTime)[1] ~ "Z";
|
||||
me["Simple_L6"].setText(" RETURN " ~ me.receivedTime);
|
||||
}
|
||||
} else if (page == "RECEIVEDMSG") {
|
||||
if (!pageSwitch[i].getBoolValue()) {
|
||||
me.defaultHideWithCenter();
|
||||
me["Simple_Title"].show();
|
||||
me["arrowsDepArr"].hide();
|
||||
me.hideAllArrowsButL6();
|
||||
me["Simple_PageNum"].hide();
|
||||
me["ArrowLeft"].hide();
|
||||
me["ArrowRight"].hide();
|
||||
|
||||
me["Simple_L0S"].hide();
|
||||
me["Simple_L6S"].hide();
|
||||
me["Simple_C3B"].hide();
|
||||
me["Simple_C4B"].hide();
|
||||
|
||||
me.fontLeft(default, default, default, default, default, default);
|
||||
me.fontLeftS(default, default, default, default, default, default);
|
||||
me.fontRight(default, default, default, default, default, default);
|
||||
me.fontRightS(default, default, default, default, default, default);
|
||||
|
||||
me.fontSizeLeft(small, small, small, small, small, normal);
|
||||
me.fontSizeCenter(normal, normal, normal, normal, normal, normal);
|
||||
me.fontSizeRight(normal, normal, normal, normal, normal, normal);
|
||||
|
||||
me.colorLeftS("grn", "wht", "wht", "wht", "wht", "wht");
|
||||
me.colorCenterS("grn", "wht", "wht", "wht", "wht", "wht");
|
||||
me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
|
||||
|
||||
me.showCenter(-1, -1, -1, -1, -1, -1);
|
||||
me.showCenterS(1, -1, -1, -1, -1, -1);
|
||||
me.showRight(-1, -1, -1, -1, -1, -1);
|
||||
me.showRightS(1, -1, -1, -1, -1, -1);
|
||||
me.showRightArrow(-1, -1, -1, -1, -1, -1);
|
||||
|
||||
|
||||
if (myReceivedMessage[i] != nil) {
|
||||
me["Simple_Title"].setText(sprintf("%s", myReceivedMessage[i].title));
|
||||
|
||||
me["Simple_L6_Arrow"].setColor(getprop("/MCDUC/colors/" ~ myReceivedMessage[i].arrowsColour[0][5] ~ "/r"), getprop("/MCDUC/colors/" ~ myReceivedMessage[i].arrowsColour[0][5] ~ "/g"), getprop("/MCDUC/colors/" ~ myReceivedMessage[i].arrowsColour[0][5] ~ "/b"));
|
||||
|
||||
forindex (var matrixFont; myReceivedMessages[i].fontMatrix) {
|
||||
if (matrixFont == 0) {
|
||||
var sign = "L";
|
||||
} else {
|
||||
var sign = "R";
|
||||
}
|
||||
forindex (var item; myReceivedMessages[i].fontMatrix[matrixFont]) {
|
||||
if (myReceivedMessages[i].fontMatrix[matrixFont][item] == 1) {
|
||||
me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
|
||||
} else {
|
||||
me["Simple_" ~ sign ~ (item + 1)].setFont(default);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
me.dynamicPageArrowFunc(myReceivedMessage[i]);
|
||||
|
||||
if (myReceivedMessage[i].L1[0] != nil) {
|
||||
me["Simple_L1"].setText(myReceivedMessage[i].L1[0]);
|
||||
me["Simple_L1"].show();
|
||||
} else { me["Simple_L1"].hide(); }
|
||||
if (myReceivedMessage[i].L1[1] != nil) {
|
||||
me["Simple_L1S"].setText(myReceivedMessage[i].L1[1]);
|
||||
me["Simple_L1S"].show();
|
||||
} else { me["Simple_L1S"].hide(); }
|
||||
if (myReceivedMessage[i].L2[0] != nil) {
|
||||
me["Simple_L2"].setText(myReceivedMessage[i].L2[0]);
|
||||
me["Simple_L2"].show();
|
||||
} else { me["Simple_L2"].hide(); }
|
||||
if (myReceivedMessage[i].L2[1] != nil) {
|
||||
me["Simple_L2S"].setText(myReceivedMessage[i].L2[1]);
|
||||
me["Simple_L2S"].show();
|
||||
} else { me["Simple_L2S"].hide(); }
|
||||
if (myReceivedMessage[i].L3[0] != nil) {
|
||||
me["Simple_L3"].setText(myReceivedMessage[i].L3[0]);
|
||||
me["Simple_L3"].show();
|
||||
} else { me["Simple_L3"].hide(); }
|
||||
if (myReceivedMessage[i].L3[1] != nil) {
|
||||
me["Simple_L3S"].setText(myReceivedMessage[i].L3[1]);
|
||||
me["Simple_L3S"].show();
|
||||
} else { me["Simple_L3S"].hide(); }
|
||||
if (myReceivedMessage[i].L4[0] != nil) {
|
||||
me["Simple_L4"].setText(myReceivedMessage[i].L4[0]);
|
||||
me["Simple_L4"].show();
|
||||
} else { me["Simple_L4"].hide(); }
|
||||
if (myReceivedMessage[i].L4[1] != nil) {
|
||||
me["Simple_L4S"].setText(myReceivedMessage[i].L4[1]);
|
||||
me["Simple_L4S"].show();
|
||||
} else { me["Simple_L4S"].hide(); }
|
||||
if (myReceivedMessage[i].L5[0] != nil) {
|
||||
me["Simple_L5"].setText(myReceivedMessage[i].L5[0]);
|
||||
me["Simple_L5"].show();
|
||||
} else { me["Simple_L5"].hide(); }
|
||||
if (myReceivedMessage[i].L5[1] != nil) {
|
||||
me["Simple_L5S"].setText(myReceivedMessage[i].L5[1]);
|
||||
me["Simple_L5S"].show();
|
||||
} else { me["Simple_L5S"].hide(); }
|
||||
|
||||
me["Simple_C1S"].setText(myReceivedMessage[i].C1[1]);
|
||||
me["Simple_R1S"].setText(myReceivedMessage[i].R1[1]);
|
||||
me.colorLeft(myReceivedMessage[i].L1[2],myReceivedMessage[i].L2[2],myReceivedMessage[i].L3[2],myReceivedMessage[i].L4[2],myReceivedMessage[i].L5[2],myReceivedMessage[i].L6[2]);
|
||||
me["Simple_L6"].setColor(WHITE);
|
||||
me["Simple_C1S"].setColor(GREEN);
|
||||
}
|
||||
pageSwitch[i].setBoolValue(1);
|
||||
}
|
||||
|
||||
if (myReceivedMessage[i] != nil) {
|
||||
me._receivedTime = left(getprop("/sim/time/gmt-string"), 5);
|
||||
me.receivedTime = split(":", me._receivedTime)[0] ~ "." ~ split(":", me._receivedTime)[1] ~ "Z";
|
||||
me["Simple_L6"].setText(" RETURN " ~ me.receivedTime);
|
||||
}
|
||||
} else if (page == "ATCMENU") {
|
||||
if (!pageSwitch[i].getBoolValue()) {
|
||||
me.defaultHide();
|
||||
|
|
|
@ -889,6 +889,8 @@ var reset_FMGC = func {
|
|||
setprop("systems/ventilation/lavatory/extractvalve", "0");
|
||||
setprop("systems/pressurization/ambientpsi", "0");
|
||||
setprop("systems/pressurization/cabinpsi", "0");
|
||||
|
||||
mcdu.ReceivedMessagesDatabase.clearDatabase();
|
||||
}
|
||||
|
||||
#################
|
||||
|
|
|
@ -278,6 +278,8 @@ var lskbutton = func(btn, i) {
|
|||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") {
|
||||
atsu.AOC.selectedType = "HOURLY WX";
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(1);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -346,6 +348,8 @@ var lskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "DATAMODE");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(2);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -397,6 +401,8 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myDuplicate[i].pushButtonLeft(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "VOICEDIRECTORY");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(3);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -443,6 +449,8 @@ var lskbutton = func(btn, i) {
|
|||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(4);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -498,6 +506,8 @@ var lskbutton = func(btn, i) {
|
|||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "NOTIFICATION");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].leftKey(5);
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -561,6 +571,9 @@ var lskbutton = func(btn, i) {
|
|||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ" or getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS");
|
||||
canvas_mcdu.myReceivedMessages[i].update();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMINIT" or getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY" or getprop("/MCDU[" ~ i ~ "]/page") == "DATAMODE" or getprop("/MCDU[" ~ i ~ "]/page") == "COMMSTATUS" or getprop("/MCDU[" ~ i ~ "]/page") == "COMPANYCALL") {
|
||||
|
@ -941,6 +954,8 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myPilotWP[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") {
|
||||
canvas_mcdu.myReceivedMessage[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
|
@ -971,6 +986,8 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myPilotWP[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") {
|
||||
canvas_mcdu.myReceivedMessage[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
|
|
|
@ -132,6 +132,139 @@ var receivedMessagesPage = {
|
|||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
leftKey: func(index) {
|
||||
if (ReceivedMessagesDatabase.getSize() >= (-5 + index + (me.curPage * 5))) {
|
||||
canvas_mcdu.myReceivedMessage[me.computer] = receivedMessagePage.new(me.computer, (-6 + index + (me.curPage * 5)));
|
||||
setprop("MCDU[" ~ me.computer ~ "]/page", "RECEIVEDMSG");
|
||||
} else {
|
||||
mcdu_message(me.computer, "NOT ALLOWED");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var receivedMessagePage = {
|
||||
title: nil,
|
||||
fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
||||
arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
||||
arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
|
||||
L1: [nil, nil, "ack"], # content, title, colour
|
||||
L2: [nil, nil, "ack"],
|
||||
L3: [nil, nil, "ack"],
|
||||
L4: [nil, nil, "ack"],
|
||||
L5: [nil, nil, "ack"],
|
||||
L6: [nil, nil, "ack"],
|
||||
C1: [nil, nil, "ack"],
|
||||
C2: [nil, nil, "ack"],
|
||||
C3: [nil, nil, "ack"],
|
||||
C4: [nil, nil, "ack"],
|
||||
C5: [nil, nil, "ack"],
|
||||
C6: [nil, nil, "ack"],
|
||||
R1: [nil, nil, "ack"],
|
||||
R2: [nil, nil, "ack"],
|
||||
R3: [nil, nil, "ack"],
|
||||
R4: [nil, nil, "ack"],
|
||||
R5: [nil, nil, "ack"],
|
||||
R6: [nil, nil, "ack"],
|
||||
computer: nil,
|
||||
size: 0,
|
||||
new: func(computer, index) {
|
||||
var ap = {parents:[receivedMessagePage]};
|
||||
ap.computer = computer;
|
||||
ap.curPage = index + 1;
|
||||
ReceivedMessagesDatabase.database.vector[ap.curPage - 1].viewed = 1;
|
||||
ap._setupPageWithData();
|
||||
ap.update();
|
||||
return ap;
|
||||
},
|
||||
del: func() {
|
||||
return nil;
|
||||
},
|
||||
scrollLeft: func() {
|
||||
me.curPage -= 1;
|
||||
if (me.curPage < 1) {
|
||||
me.curPage = ReceivedMessagesDatabase.getSize();
|
||||
}
|
||||
ReceivedMessagesDatabase.database.vector[me.curPage - 1].viewed = 1;
|
||||
me.update();
|
||||
},
|
||||
scrollRight: func() {
|
||||
me.curPage += 1;
|
||||
if (me.curPage > ReceivedMessagesDatabase.getSize()) {
|
||||
me.curPage = 1;
|
||||
}
|
||||
ReceivedMessagesDatabase.database.vector[me.curPage - 1].viewed = 1;
|
||||
me.update();
|
||||
},
|
||||
_clearPage: func() {
|
||||
me.L1 = [nil, nil, "ack"];
|
||||
me.L2 = [nil, nil, "ack"];
|
||||
me.L3 = [nil, nil, "ack"];
|
||||
me.L4 = [nil, nil, "ack"];
|
||||
me.L5 = [nil, nil, "ack"];
|
||||
me.C1 = [nil, nil, "ack"];
|
||||
me.C2 = [nil, nil, "ack"];
|
||||
me.C3 = [nil, nil, "ack"];
|
||||
me.C4 = [nil, nil, "ack"];
|
||||
me.C5 = [nil, nil, "ack"];
|
||||
me.R1 = [nil, nil, "ack"];
|
||||
me.R2 = [nil, nil, "ack"];
|
||||
me.R3 = [nil, nil, "ack"];
|
||||
me.R4 = [nil, nil, "ack"];
|
||||
me.R5 = [nil, nil, "ack"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = "ACARS MESSAGE";
|
||||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["blu", "blu", "blu", "blu", "blu", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
update: func() {
|
||||
me._clearPage();
|
||||
me.size = ReceivedMessagesDatabase.getSize();
|
||||
var message = nil;
|
||||
if (me.size >= me.curPage) {
|
||||
message = ReceivedMessagesDatabase.database.vector[me.curPage - 1];
|
||||
me.L1[1] = message.time;
|
||||
me.C1[1] = "VIEWED";
|
||||
me.C1[2] = "grn";
|
||||
me.R1[1] = me.curPage ~ "/" ~ ReceivedMessagesDatabase.getSize();
|
||||
|
||||
me.L1[0] = left(message.body, size(message.body) > 30 ? 30 : size(message.body));
|
||||
me.L1[2] = "wht";
|
||||
me.L2[2] = "wht";
|
||||
me.L3[2] = "wht";
|
||||
me.L4[2] = "wht";
|
||||
me.L5[2] = "wht";
|
||||
if (size(message.body) > 30) {
|
||||
me.L2[1] = left(split(me.L1[0], message.body)[1], size(message.body) > 60 ? 30 : size(message.body) - 30);
|
||||
}
|
||||
if (size(message.body) > 60) {
|
||||
me.L2[0] = left(split(me.L2[1], message.body)[1], size(message.body) > 90 ? 30 : size(message.body) - 60);
|
||||
}
|
||||
if (size(message.body) > 90) {
|
||||
me.L3[1] = left(split(me.L2[0], message.body)[1], size(message.body) > 120 ? 30 : size(message.body) - 90);
|
||||
}
|
||||
if (size(message.body) > 120) {
|
||||
me.L3[0] = left(split(me.L3[1], message.body)[1], size(message.body) > 150 ? 30 : size(message.body) - 120);
|
||||
}
|
||||
if (size(message.body) > 150) {
|
||||
me.L4[1] = left(split(me.L3[0], message.body)[1], size(message.body) > 180 ? 30 : size(message.body) - 150);
|
||||
}
|
||||
if (size(message.body) > 180) {
|
||||
me.L4[0] = left(split(me.L4[1], message.body)[1], size(message.body) > 210 ? 30 : size(message.body) - 180);
|
||||
}
|
||||
if (size(message.body) > 210) {
|
||||
me.L5[1] = left(split(me.L4[0], message.body)[1], size(message.body) > 240 ? 30 : size(message.body) - 210);
|
||||
}
|
||||
if (size(message.body) > 240) {
|
||||
me.L5[0] = left(split(me.L5[1], message.body)[1], size(message.body) > 270 ? 30 : size(message.body) - 240);
|
||||
}
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
};
|
||||
|
||||
var ACARSMessage = {
|
||||
|
|
Loading…
Reference in a new issue