Update
This commit is contained in:
parent
20846bddfb
commit
59583a9a60
|
@ -390,7 +390,7 @@ function dialog_opacity(opacity) {
|
||||||
|
|
||||||
dialog.hint.sprite.SetOpacity(opacity);
|
dialog.hint.sprite.SetOpacity(opacity);
|
||||||
|
|
||||||
for(index = 0; dialog.bullet[index]; index++) {
|
for (index = 0; dialog.bullet[index]; index++) {
|
||||||
dialog.bullet[index].sprite.SetOpacity(opacity);
|
dialog.bullet[index].sprite.SetOpacity(opacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ function display_password_callback(prompt_text, bullets) {
|
||||||
dialog.hint.image = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
|
dialog.hint.image = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
|
||||||
dialog.hint.sprite.SetImage(dialog.hint.image);
|
dialog.hint.sprite.SetImage(dialog.hint.image);
|
||||||
|
|
||||||
for(index = 0; dialog.bullet[index] || index < bullets; index++) {
|
for (index = 0; dialog.bullet[index] || index < bullets; index++) {
|
||||||
if (!dialog.bullet[index]) {
|
if (!dialog.bullet[index]) {
|
||||||
dialog.bullet[index].sprite = Sprite(dialog.bullet_i.image);
|
dialog.bullet[index].sprite = Sprite(dialog.bullet_i.image);
|
||||||
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_i.width / 0.9 - dialog.entry.height * -0.2; // отступ точки от точки и от поля(modified)
|
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_i.width / 0.9 - dialog.entry.height * -0.2; // отступ точки от точки и от поля(modified)
|
||||||
|
@ -518,7 +518,11 @@ function message_callback(prompt_text) {
|
||||||
|
|
||||||
Plymouth.SetMessageFunction(message_callback);
|
Plymouth.SetMessageFunction(message_callback);
|
||||||
|
|
||||||
|
// высота messages_box = screen.height - 40% (1080 * 0,4 = 432)
|
||||||
|
// высота всех сообщений = NUM_SCROLL_LINES (20) * (LINE_HEIGHT) 17 = 340
|
||||||
|
// 10 процентов сверху от начала messages_box.x = 432 - 10% (432 * 0,1) = 432 - 43 = 389
|
||||||
|
// конечная точка, где допустимо показывать сообщения = 389 - 43 (10% от высоты messages_box.x) = 346
|
||||||
|
// если высота всех сообщений выше, чем высота (messages_box.height - 20%), то уменьшать количество строк, пока высота всех сообщений не быдет меньше (messages_box.height - 20%)
|
||||||
|
|
||||||
message_sprite_.x = messages_box.x + Percent(5, messages_box.width); // позиция % по X
|
message_sprite_.x = messages_box.x + Percent(5, messages_box.width); // позиция % по X
|
||||||
message_sprite_.y = messages_box.y + Percent(10, messages_box.height); // позиция % по Y
|
message_sprite_.y = messages_box.y + Percent(10, messages_box.height); // позиция % по Y
|
||||||
|
@ -526,13 +530,23 @@ message_sprite_.y = messages_box.y + Percent(10, messages_box.height); // поз
|
||||||
// LOG //
|
// LOG //
|
||||||
NUM_SCROLL_LINES=20; //количество строк лога
|
NUM_SCROLL_LINES=20; //количество строк лога
|
||||||
LINE_WIDTH=40; //ширина строк лога
|
LINE_WIDTH=40; //ширина строк лога
|
||||||
|
LINE_HEIGHT=17;
|
||||||
|
|
||||||
|
for (index = NUM_SCROLL_LINES; index > 0; index--) {
|
||||||
|
if ((NUM_SCROLL_LINES * LINE_HEIGHT) > messages_box.height) {
|
||||||
|
NUM_SCROLL_LINES=NUM_SCROLL_LINES-1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialising text images and their positions
|
// Initialising text images and their positions
|
||||||
// 20 is the height(including line spacing) of each line
|
// 20 is the height(including line spacing) of each line
|
||||||
for(i=0; i < NUM_SCROLL_LINES; i++) {
|
for (i=0; i < NUM_SCROLL_LINES; i++) {
|
||||||
lines[i]= Image.Text("", 0.5, 0.5, 0.5, 1, common_font); //цвет строк
|
lines[i]= Image.Text("", 0.5, 0.5, 0.5, 1, common_font); //цвет строк
|
||||||
message_sprite[i] = SpriteNew();
|
message_sprite[i] = SpriteNew();
|
||||||
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * 17), 3);
|
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * LINE_HEIGHT), 3);
|
||||||
} //высота строк //отступ строк
|
} //высота строк //отступ строк
|
||||||
|
|
||||||
function StringLength(string) {
|
function StringLength(string) {
|
||||||
|
@ -550,7 +564,7 @@ function scroll_message_callback(text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shift message one up
|
// Shift message one up
|
||||||
for(i = 0; i < NUM_SCROLL_LINES - 1; i++) {
|
for (i = 0; i < NUM_SCROLL_LINES - 1; i++) {
|
||||||
lines[i] = lines[i+1];
|
lines[i] = lines[i+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +572,7 @@ function scroll_message_callback(text) {
|
||||||
lines[i] = Image.Text(text, 0.5, 0.5, 0.5, 1, common_font);
|
lines[i] = Image.Text(text, 0.5, 0.5, 0.5, 1, common_font);
|
||||||
|
|
||||||
// Re-positioning the text images
|
// Re-positioning the text images
|
||||||
for(i = 0; i < NUM_SCROLL_LINES; i++) {
|
for (i = 0; i < NUM_SCROLL_LINES; i++) {
|
||||||
message_sprite[i].SetImage(lines[i]);
|
message_sprite[i].SetImage(lines[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ fun dialog_opacity(opacity) {
|
||||||
|
|
||||||
dialog.hint.sprite.SetOpacity(opacity);
|
dialog.hint.sprite.SetOpacity(opacity);
|
||||||
|
|
||||||
for(index = 0; dialog.bullet[index]; index++) {
|
for (index = 0; dialog.bullet[index]; index++) {
|
||||||
dialog.bullet[index].sprite.SetOpacity(opacity);
|
dialog.bullet[index].sprite.SetOpacity(opacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ fun display_password_callback(prompt_text, bullets) {
|
||||||
dialog.hint.image = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
|
dialog.hint.image = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
|
||||||
dialog.hint.sprite.SetImage(dialog.hint.image);
|
dialog.hint.sprite.SetImage(dialog.hint.image);
|
||||||
|
|
||||||
for(index = 0; dialog.bullet[index] || index < bullets; index++) {
|
for (index = 0; dialog.bullet[index] || index < bullets; index++) {
|
||||||
if (!dialog.bullet[index]) {
|
if (!dialog.bullet[index]) {
|
||||||
dialog.bullet[index].sprite = Sprite(dialog.bullet_i.image);
|
dialog.bullet[index].sprite = Sprite(dialog.bullet_i.image);
|
||||||
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_i.width / 0.9 - dialog.entry.height * -0.2; // отступ точки от точки и от поля(modified)
|
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_i.width / 0.9 - dialog.entry.height * -0.2; // отступ точки от точки и от поля(modified)
|
||||||
|
@ -518,7 +518,11 @@ fun message_callback(prompt_text) {
|
||||||
|
|
||||||
Plymouth.SetMessageFunction(message_callback);
|
Plymouth.SetMessageFunction(message_callback);
|
||||||
|
|
||||||
|
// высота messages_box = screen.height - 40% (1080 * 0,4 = 432)
|
||||||
|
// высота всех сообщений = NUM_SCROLL_LINES (20) * (LINE_HEIGHT) 17 = 340
|
||||||
|
// 10 процентов сверху от начала messages_box.x = 432 - 10% (432 * 0,1) = 432 - 43 = 389
|
||||||
|
// конечная точка, где допустимо показывать сообщения = 389 - 43 (10% от высоты messages_box.x) = 346
|
||||||
|
// если высота всех сообщений выше, чем высота (messages_box.height - 20%), то уменьшать количество строк, пока высота всех сообщений не быдет меньше (messages_box.height - 20%)
|
||||||
|
|
||||||
message_sprite_.x = messages_box.x + Percent(5, messages_box.width); // позиция % по X
|
message_sprite_.x = messages_box.x + Percent(5, messages_box.width); // позиция % по X
|
||||||
message_sprite_.y = messages_box.y + Percent(10, messages_box.height); // позиция % по Y
|
message_sprite_.y = messages_box.y + Percent(10, messages_box.height); // позиция % по Y
|
||||||
|
@ -526,13 +530,23 @@ message_sprite_.y = messages_box.y + Percent(10, messages_box.height); // поз
|
||||||
// LOG //
|
// LOG //
|
||||||
NUM_SCROLL_LINES=20; //количество строк лога
|
NUM_SCROLL_LINES=20; //количество строк лога
|
||||||
LINE_WIDTH=40; //ширина строк лога
|
LINE_WIDTH=40; //ширина строк лога
|
||||||
|
LINE_HEIGHT=17;
|
||||||
|
|
||||||
|
for (index = NUM_SCROLL_LINES; index > 0; index--) {
|
||||||
|
if ((NUM_SCROLL_LINES * LINE_HEIGHT) > messages_box.height) {
|
||||||
|
NUM_SCROLL_LINES=NUM_SCROLL_LINES-1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialising text images and their positions
|
// Initialising text images and their positions
|
||||||
// 20 is the height(including line spacing) of each line
|
// 20 is the height(including line spacing) of each line
|
||||||
for(i=0; i < NUM_SCROLL_LINES; i++) {
|
for (i=0; i < NUM_SCROLL_LINES; i++) {
|
||||||
lines[i]= Image.Text("", 0.5, 0.5, 0.5, 1, common_font); //цвет строк
|
lines[i]= Image.Text("", 0.5, 0.5, 0.5, 1, common_font); //цвет строк
|
||||||
message_sprite[i] = SpriteNew();
|
message_sprite[i] = SpriteNew();
|
||||||
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * 17), 3);
|
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * LINE_HEIGHT), 3);
|
||||||
} //высота строк //отступ строк
|
} //высота строк //отступ строк
|
||||||
|
|
||||||
fun StringLength(string) {
|
fun StringLength(string) {
|
||||||
|
@ -550,7 +564,7 @@ fun scroll_message_callback(text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shift message one up
|
// Shift message one up
|
||||||
for(i = 0; i < NUM_SCROLL_LINES - 1; i++) {
|
for (i = 0; i < NUM_SCROLL_LINES - 1; i++) {
|
||||||
lines[i] = lines[i+1];
|
lines[i] = lines[i+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +572,7 @@ fun scroll_message_callback(text) {
|
||||||
lines[i] = Image.Text(text, 0.5, 0.5, 0.5, 1, common_font);
|
lines[i] = Image.Text(text, 0.5, 0.5, 0.5, 1, common_font);
|
||||||
|
|
||||||
// Re-positioning the text images
|
// Re-positioning the text images
|
||||||
for(i = 0; i < NUM_SCROLL_LINES; i++) {
|
for (i = 0; i < NUM_SCROLL_LINES; i++) {
|
||||||
message_sprite[i].SetImage(lines[i]);
|
message_sprite[i].SetImage(lines[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue