This commit is contained in:
Valeria Fadeeva 2023-11-24 21:30:49 +05:00
parent 14d34edb2f
commit 7408d35649
3 changed files with 253 additions and 79 deletions

View File

@ -12,7 +12,7 @@ sudo plymouth message --text="resuming boot"
sudo plymouth unpause-progress
#sudo plymouth ask-question --prompt "what is your name? " | /usr/bin/tee
sudo plymouth ask-for-password --prompt "specify password: " | /usr/bin/tee
sudo plymouth ask-for-password --prompt "specify password: /dev/sda8: LABEL=\"Data\" UUID=\"2fd2a700-319b-41f2-853f-c57667d4081d\" UUID_SUB=\"62109da7-2b4b-4c2d-b590-1c0436c7c3a4\" PARTUUID=\"c05c942b-bd7e-487a-87a0-592df3334ff5\"" | /usr/bin/tee
#sudo plymouth message --text="Hello"

View File

@ -105,12 +105,62 @@ SetSpriteImage = function(asset, x, y, z) {
return sprite;
};
Blur = function(background_src, foreground_src, x, y, z, width, height, scale_width, scale_height) {
index = 0;
local.image[index];
image[index].image = Image(background_src);
image[index].image = ScaleImage(image[index].image, Limit(scale_width, scale_height, 100));
image[index].image = image[index].image.Crop(x, y, width, height);
image[index].image = ScaleImage(image[index].image, Limit(Percent(120, width), Percent(120, height), 100));
image[index].image = image[index].image.Crop(x, y, width, height);
image[index].sprite0 = Sprite(image[index].image);
image[index].sprite1 = Sprite(image[index].image);
image[index].sprite2 = Sprite(image[index].image);
image[index].sprite3 = Sprite(image[index].image);
image[index].sprite4 = Sprite(image[index].image);
image[index].sprite0.SetOpacity(0.25);
image[index].sprite1.SetOpacity(0.25);
image[index].sprite2.SetOpacity(0.25);
image[index].sprite3.SetOpacity(0.25);
image[index].sprite4.SetOpacity(0.25);
image[index].sprite0.SetPosition(x, y, z);
image[index].sprite1.SetPosition(x++, y, z++);
image[index].sprite2.SetPosition(x, y++, z++);
image[index].sprite3.SetPosition(x--, y, z++);
image[index].sprite5.SetPosition(x, y--, z++);
index = 1;
image[index].image = Image(foreground_src);
image[index].image = image[index].image.Scale(width, height);
image[index].sprite = Sprite(image[index].image);
image[index].sprite.SetOpacity(0.75);
image[index].sprite.SetPosition(x, y, z++);
return local.image;
};
// TEXT
common_font = "Noto Sans Mono Regular 10";
progress_font = "Noto Sans Mono Regular 12";
link_font = "Noto Sans Italic 16";
common_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, common_font);
common_symbol.height = common_symbol.image.GetHeight(); // высота символа
common_symbol.width = common_symbol.image.GetWidth(); // ширина символа
progress_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, progress_font);
progress_symbol.height = progress_symbol.image.GetHeight(); // высота символа
progress_symbol.width = progress_symbol.image.GetWidth(); // ширина символа
link_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, link_font);
link_symbol.height = link_symbol.image.GetHeight(); // высота символа
link_symbol.width = link_symbol.image.GetWidth(); // ширина символа
starting_text = "Starting up...";
bye_text = "System is shutting down";
progress_t= 0;
@ -140,22 +190,19 @@ background.y = y0 + screen.height / 2 - background.height / 2;
background.sprite = SpriteNew();
background.sprite.SetImage(background.image);
background.sprite.SetPosition(background.x, background.y, 0);
background.sprite.SetOpacity(1);
background.sprite.SetPosition(background.x, background.y, 0);
// SIDE BACKGROUND
side_panel.image = Image("SIDE_BACKGROUND2.png");
side_panel.image = side_panel.image.Scale(Percent(25, screen.width), Percent(100, screen.height));
side_panel.width = side_panel.image.GetWidth();
side_panel.height = side_panel.image.GetHeight();
side_panel.background_src = "BACKGROUND.png";
side_panel.foreground_src = "SIDE_BACKGROUND2.png";
side_panel.x = x0;
side_panel.y = y0;
side_panel.z = 1;
side_panel.width = Percent(33.33, screen.width);
side_panel.height = Percent(100, screen.height);
side_panel.sprite = Sprite(side_panel.image);
side_panel.sprite.SetPosition(side_panel.x, side_panel.y, 1);
side_panel.sprite.SetOpacity(0.75);
blur = Blur(side_panel.background_src, side_panel.foreground_src, side_panel.x, side_panel.y, side_panel.z, side_panel.width, side_panel.height, screen.width, screen.height);
// MESSAGES BOX
messages_box.image = Image("MESSAGES_BOX.png");
@ -168,8 +215,8 @@ messages_box.x = Percent(50, side_panel.width) - messages_box.width / 2;
messages_box.y = Percent(45, side_panel.height) - messages_box.height;
messages_box.sprite = Sprite(messages_box.image);
messages_box.sprite.SetPosition(messages_box.x, messages_box.y, 2);
messages_box.sprite.SetOpacity(1);
messages_box.sprite.SetPosition(messages_box.x, messages_box.y, 12);
// Sise Logo
side_logo.image = Image("Melawy_Linux_640x320.png");
@ -182,8 +229,8 @@ side_logo.x = (side_panel.width - side_logo.width) / 2;
side_logo.y = side_panel.height - side_panel.height * 0.25;
side_logo.sprite = Sprite(side_logo.image);
side_logo.sprite.SetPosition(side_logo.x, side_logo.y, 2);
side_logo.sprite.SetOpacity(1);
side_logo.sprite.SetPosition(side_logo.x, side_logo.y, 12);
// **************************************** //
@ -196,8 +243,8 @@ project_link.sprite = Sprite(project_link.image);
project_link.x = (side_panel.width - project_link.width) / 2;
project_link.y = side_logo.y + side_logo.height;
project_link.sprite.SetPosition(project_link.x, project_link.y, 2);
project_link.sprite.SetOpacity(1);
project_link.sprite.SetPosition(project_link.x, project_link.y, 12);
// **************************************** //
@ -208,8 +255,8 @@ logo.image = FitIntoDimensions(logo.image, Limit(screen.width, screen.height, 35
logo.sprite = Sprite(logo.image);
logo.x = screen.width / 2 - logo.image.GetWidth() / 2; // позиция логотипа X
logo.y = Percent(10, screen.height); // позиция логотипа Y
logo.sprite.SetPosition(logo.x, logo.y, 2);
logo.sprite.SetOpacity(1);
logo.sprite.SetPosition(logo.x, logo.y, 12);
// PROGRESS FORM
progress_form.image = Image("PROGRESS_FORM.png");
@ -222,8 +269,8 @@ progress_form.x = Percent(50, side_panel.width) - progress_form.width / 2;
progress_form.y = Percent(75, side_panel.height) - progress_form.height;
progress_form.sprite = Sprite(progress_form.image);
progress_form.sprite.SetPosition(progress_form.x, progress_form.y, 2);
progress_form.sprite.SetOpacity(1);
progress_form.sprite.SetPosition(progress_form.x, progress_form.y, 12);
// SPINNER
spinner.image = Image("SPINNER.png");
@ -236,7 +283,7 @@ spinner.x = progress_form.x + progress_form.width - Percent(10, progress_form.wi
spinner.y = progress_form.y + Percent(10, progress_form.height);
spinner.sprite = Sprite(spinner.image);
spinner.sprite.SetPosition(spinner.x, spinner.y, 3); // позиция за или перед
spinner.sprite.SetPosition(spinner.x, spinner.y, 13); // позиция за или перед
// PROGRESS TEXT
@ -249,7 +296,7 @@ progress_text.x = progress_form.x + Percent(5, progress_form.width); // пози
progress_text.y = progress_form.y + Percent(10, progress_form.height); // позиция % по Y
progress_text.sprite = SpriteNew();
progress_text.sprite.SetPosition(progress_text.x, progress_text.y, 3);
progress_text.sprite.SetPosition(progress_text.x, progress_text.y, 13);
// PROGRESS BOX
progress_box.image = Image("PROGRESS_BOX.png");
@ -262,7 +309,7 @@ progress_box.x = progress_form.x + (progress_form.width - progress_box.width) /
progress_box.y = progress_form.y + (progress_form.height - progress_box.height) / 2;
progress_box.sprite = Sprite(progress_box.image);
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 3);
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 13);
// PROGRESS BAR
progress_bar.original_image = Image("PROGRESS_BAR.png");
@ -275,7 +322,7 @@ progress_bar.x = progress_form.x + (progress_form.width - progress_bar.original_
progress_bar.y = progress_form.y + (progress_form.height - progress_bar.original_image.GetHeight()) / 2;
progress_bar.sprite = Sprite();
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 4);
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 14);
// PROGRESS FADE
progress_fade.image = Image("PROGRESS_FADE.png");
@ -291,7 +338,6 @@ counter = 0;
max_counter = progress_box.width - progress_fade.width;
function progress_callback(duration, progress) {
if (progress_bar.image.GetWidth() != Math.Int(progress_bar.original_image.GetWidth() * progress)) {
progress_bar.image = progress_bar.original_image.Scale(progress_bar.original_image.GetWidth(progress_bar.original_image) * progress, progress_bar.original_image.GetHeight());
@ -306,11 +352,11 @@ function progress_callback(duration, progress) {
Plymouth.SetBootProgressFunction(progress_callback);
// DIALOG
status = "normal";
//count = 0;
function dialog_setup() {
local.box_form;
local.lock;
@ -319,7 +365,7 @@ function dialog_setup() {
local.bullet_i;
box_form.image = Image("BOX.png");
box_form.image = box_form.image.Scale(Percent(80, side_panel.width), Percent(10, side_panel.height));
box_form.image = box_form.image.Scale(Percent(80, side_panel.width), Percent(18, side_panel.height));
box_form.width = box_form.image.GetWidth();
box_form.height = box_form.image.GetHeight();
@ -329,17 +375,17 @@ function dialog_setup() {
box_form.z = 10000;
box_form.sprite = Sprite(box_form.image);
box_form.sprite.SetPosition(box_form.x, box_form.y, box_form.z);
box_form.sprite.SetOpacity(1);
box_form.sprite.SetPosition(box_form.x, box_form.y, box_form.z);
entry.image = Image("ENTRY.png");
entry.image = entry.image.Scale(Percent(90, box_form.width), Percent(33, box_form.height));
entry.image = entry.image.Scale(Percent(90, box_form.width), Percent(20, box_form.height));
entry.width = entry.image.GetWidth();
entry.height = entry.image.GetHeight();
entry.x = box_form.x + box_form.width/2 - entry.width/2;
entry.y = box_form.y + box_form.height/2 - entry.height/2;
entry.y = box_form.y + (box_form.height/3 * 2) - entry.height/2;
entry.z = box_form.z + 1;
entry.sprite = Sprite(entry.image);
@ -377,6 +423,7 @@ function dialog_setup() {
dialog_opacity(1);
}
function dialog_opacity(opacity) {
if (opacity == 0) {
dialog.box_form.sprite.SetOpacity(opacity);
@ -406,7 +453,6 @@ function display_normal_callback() {
Plymouth.SetDisplayNormalFunction(display_normal_callback);
function display_password_callback(prompt_text, bullets) {
global.status = "password";
@ -415,6 +461,51 @@ function display_password_callback(prompt_text, bullets) {
else
dialog_opacity(1);
padding_top_bottom = Percent(10, dialog.box_form.height); // отступы сверху и снизу
padding_left_right = Percent(5, dialog.box_form.width); // отступы слева и справа
LINE_WIDTH = 100;
for(index = LINE_WIDTH; index > 0; index--) {
if((LINE_WIDTH * common_symbol.width) > (dialog.box_form.width - (padding_left_right * 2))) {
LINE_WIDTH = LINE_WIDTH - 1;
}
else {
break;
}
}
str_len = StringLength(prompt_text);
for (i = 1; LINE_WIDTH * i <= str_len; i++) {
line_count = i;
}
if (str_len % line_count > 0) {
line_count = line_count + 1;
}
i = 1;
start = 0;
end = LINE_WIDTH;
text = "";
for(i = 1; i <= line_count; i++) {
text += prompt_text.SubString(start, end);
text += "\n";
start = end;
if (LINE_WIDTH * i < str_len) {
end = end + LINE_WIDTH;
}
else {
end = str_len - 1;
}
}
prompt_text = text;
dialog.hint.image = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
dialog.hint.sprite.SetImage(dialog.hint.image);
@ -436,7 +527,6 @@ function display_password_callback(prompt_text, bullets) {
Plymouth.SetDisplayPasswordFunction(display_password_callback);
time = 1;
function refreshHandler() {
@ -447,7 +537,7 @@ function refreshHandler() {
text.sprite = Sprite(text.image);
text.x = progress_box.x;
text.y = progress_box.y - progress_text.image.GetHeight() * 2;
text.sprite.SetPosition(text.x, text.y, 3);
text.sprite.SetPosition(text.x, text.y, 13);
}
else {
progress_fade.sprite.SetOpacity (1);
@ -456,12 +546,12 @@ function refreshHandler() {
text_end.sprite = Sprite(text_end.image);
text_end.x = progress_box.x;
text_end.y = progress_box.y - progress_text.image.GetHeight() * 2;
text_end.sprite.SetPosition(text_end.x, text_end.y, 3);
text_end.sprite.SetPosition(text_end.x, text_end.y, 13);
}
progress_fade.x = progress_bar.x;
progress_fade.y = progress_bar.y;
progress_fade.sprite.SetPosition(counter + progress_fade.x, progress_fade.y, 4);
progress_fade.sprite.SetPosition(counter + progress_fade.x, progress_fade.y, 14);
if (fade_dir == 0) {
counter++;
@ -503,7 +593,6 @@ function refreshHandler() {
Plymouth.SetRefreshFunction(refreshHandler);
message_status.sprite = SpriteNew();
function message_callback(prompt_text) {
@ -512,12 +601,13 @@ function message_callback(prompt_text) {
message_status.height = message_status.image.GetHeight();
message_status.x = messages_box.x + Percent(5, messages_box.width);
message_status.y = messages_box.y + messages_box.height - Percent(7, messages_box.height);
message_status.sprite.SetPosition(message_status.x, message_status.y, 3);
message_status.sprite.SetOpacity(1);
message_status.sprite.SetPosition(message_status.x, message_status.y, 13);
}
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
@ -538,10 +628,6 @@ message_sprite_.x = messages_box.x + (padding_left_right); // позиция %
message_sprite_.y = messages_box.y + (padding_top_bottom); // позиция % по Y (сверху вниз)
// LOG //
common_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, common_font);
common_symbol.height = common_symbol.image.GetHeight(); // высота символа
common_symbol.width = common_symbol.image.GetWidth(); // ширина символа
NUM_SCROLL_LINES=100; //количество строк лога
LINE_WIDTH=100; //ширина строк лога
LINE_HEIGHT = common_symbol.height * 1.5; // межстрочный интервал x1,5
@ -569,9 +655,10 @@ for (index = LINE_WIDTH; index > 0; index--) {
for (i=0; i < NUM_SCROLL_LINES; i++) {
lines[i]= Image.Text("", 0.5, 0.5, 0.5, 1, common_font); //цвет строк
message_sprite[i] = SpriteNew();
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * LINE_HEIGHT), 3);
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * LINE_HEIGHT), 13);
} //высота строк //отступ строк
function StringLength(string) {
index = 0;
str = String(string);
@ -579,6 +666,7 @@ function StringLength(string) {
return index;
}
function scroll_message_callback(text) {
// Truncate the message if too long
if (StringLength(text) > LINE_WIDTH) {
@ -603,7 +691,6 @@ function scroll_message_callback(text) {
Plymouth.SetUpdateStatusFunction(scroll_message_callback);
// QUIT
function quit_callback() {
progress_fade.sprite.SetOpacity (1);

View File

@ -105,12 +105,62 @@ SetSpriteImage = fun(asset, x, y, z) {
return sprite;
};
Blur = fun(background_src, foreground_src, x, y, z, width, height, scale_width, scale_height) {
index = 0;
local.image[index];
image[index].image = Image(background_src);
image[index].image = ScaleImage(image[index].image, Limit(scale_width, scale_height, 100));
image[index].image = image[index].image.Crop(x, y, width, height);
image[index].image = ScaleImage(image[index].image, Limit(Percent(120, width), Percent(120, height), 100));
image[index].image = image[index].image.Crop(x, y, width, height);
image[index].sprite0 = Sprite(image[index].image);
image[index].sprite1 = Sprite(image[index].image);
image[index].sprite2 = Sprite(image[index].image);
image[index].sprite3 = Sprite(image[index].image);
image[index].sprite4 = Sprite(image[index].image);
image[index].sprite0.SetOpacity(0.25);
image[index].sprite1.SetOpacity(0.25);
image[index].sprite2.SetOpacity(0.25);
image[index].sprite3.SetOpacity(0.25);
image[index].sprite4.SetOpacity(0.25);
image[index].sprite0.SetPosition(x, y, z);
image[index].sprite1.SetPosition(x++, y, z++);
image[index].sprite2.SetPosition(x, y++, z++);
image[index].sprite3.SetPosition(x--, y, z++);
image[index].sprite5.SetPosition(x, y--, z++);
index = 1;
image[index].image = Image(foreground_src);
image[index].image = image[index].image.Scale(width, height);
image[index].sprite = Sprite(image[index].image);
image[index].sprite.SetOpacity(0.75);
image[index].sprite.SetPosition(x, y, z++);
return local.image;
};
// TEXT
common_font = "Noto Sans Mono Regular 10";
progress_font = "Noto Sans Mono Regular 12";
link_font = "Noto Sans Italic 16";
common_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, common_font);
common_symbol.height = common_symbol.image.GetHeight(); // высота символа
common_symbol.width = common_symbol.image.GetWidth(); // ширина символа
progress_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, progress_font);
progress_symbol.height = progress_symbol.image.GetHeight(); // высота символа
progress_symbol.width = progress_symbol.image.GetWidth(); // ширина символа
link_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, link_font);
link_symbol.height = link_symbol.image.GetHeight(); // высота символа
link_symbol.width = link_symbol.image.GetWidth(); // ширина символа
starting_text = "Starting up...";
bye_text = "System is shutting down";
progress_t= 0;
@ -140,22 +190,19 @@ background.y = y0 + screen.height / 2 - background.height / 2;
background.sprite = SpriteNew();
background.sprite.SetImage(background.image);
background.sprite.SetPosition(background.x, background.y, 0);
background.sprite.SetOpacity(1);
background.sprite.SetPosition(background.x, background.y, 0);
// SIDE BACKGROUND
side_panel.image = Image("SIDE_BACKGROUND2.png");
side_panel.image = side_panel.image.Scale(Percent(25, screen.width), Percent(100, screen.height));
side_panel.width = side_panel.image.GetWidth();
side_panel.height = side_panel.image.GetHeight();
side_panel.background_src = "BACKGROUND.png";
side_panel.foreground_src = "SIDE_BACKGROUND2.png";
side_panel.x = x0;
side_panel.y = y0;
side_panel.z = 1;
side_panel.width = Percent(33.33, screen.width);
side_panel.height = Percent(100, screen.height);
side_panel.sprite = Sprite(side_panel.image);
side_panel.sprite.SetPosition(side_panel.x, side_panel.y, 1);
side_panel.sprite.SetOpacity(0.75);
blur = Blur(side_panel.background_src, side_panel.foreground_src, side_panel.x, side_panel.y, side_panel.z, side_panel.width, side_panel.height, screen.width, screen.height);
// MESSAGES BOX
messages_box.image = Image("MESSAGES_BOX.png");
@ -168,8 +215,8 @@ messages_box.x = Percent(50, side_panel.width) - messages_box.width / 2;
messages_box.y = Percent(45, side_panel.height) - messages_box.height;
messages_box.sprite = Sprite(messages_box.image);
messages_box.sprite.SetPosition(messages_box.x, messages_box.y, 2);
messages_box.sprite.SetOpacity(1);
messages_box.sprite.SetPosition(messages_box.x, messages_box.y, 12);
// Sise Logo
side_logo.image = Image("Melawy_Linux_640x320.png");
@ -182,8 +229,8 @@ side_logo.x = (side_panel.width - side_logo.width) / 2;
side_logo.y = side_panel.height - side_panel.height * 0.25;
side_logo.sprite = Sprite(side_logo.image);
side_logo.sprite.SetPosition(side_logo.x, side_logo.y, 2);
side_logo.sprite.SetOpacity(1);
side_logo.sprite.SetPosition(side_logo.x, side_logo.y, 12);
// **************************************** //
@ -196,8 +243,8 @@ project_link.sprite = Sprite(project_link.image);
project_link.x = (side_panel.width - project_link.width) / 2;
project_link.y = side_logo.y + side_logo.height;
project_link.sprite.SetPosition(project_link.x, project_link.y, 2);
project_link.sprite.SetOpacity(1);
project_link.sprite.SetPosition(project_link.x, project_link.y, 12);
// **************************************** //
@ -208,8 +255,8 @@ logo.image = FitIntoDimensions(logo.image, Limit(screen.width, screen.height, 35
logo.sprite = Sprite(logo.image);
logo.x = screen.width / 2 - logo.image.GetWidth() / 2; // позиция логотипа X
logo.y = Percent(10, screen.height); // позиция логотипа Y
logo.sprite.SetPosition(logo.x, logo.y, 2);
logo.sprite.SetOpacity(1);
logo.sprite.SetPosition(logo.x, logo.y, 12);
// PROGRESS FORM
progress_form.image = Image("PROGRESS_FORM.png");
@ -222,8 +269,8 @@ progress_form.x = Percent(50, side_panel.width) - progress_form.width / 2;
progress_form.y = Percent(75, side_panel.height) - progress_form.height;
progress_form.sprite = Sprite(progress_form.image);
progress_form.sprite.SetPosition(progress_form.x, progress_form.y, 2);
progress_form.sprite.SetOpacity(1);
progress_form.sprite.SetPosition(progress_form.x, progress_form.y, 12);
// SPINNER
spinner.image = Image("SPINNER.png");
@ -236,7 +283,7 @@ spinner.x = progress_form.x + progress_form.width - Percent(10, progress_form.wi
spinner.y = progress_form.y + Percent(10, progress_form.height);
spinner.sprite = Sprite(spinner.image);
spinner.sprite.SetPosition(spinner.x, spinner.y, 3); // позиция за или перед
spinner.sprite.SetPosition(spinner.x, spinner.y, 13); // позиция за или перед
// PROGRESS TEXT
@ -249,7 +296,7 @@ progress_text.x = progress_form.x + Percent(5, progress_form.width); // пози
progress_text.y = progress_form.y + Percent(10, progress_form.height); // позиция % по Y
progress_text.sprite = SpriteNew();
progress_text.sprite.SetPosition(progress_text.x, progress_text.y, 3);
progress_text.sprite.SetPosition(progress_text.x, progress_text.y, 13);
// PROGRESS BOX
progress_box.image = Image("PROGRESS_BOX.png");
@ -262,7 +309,7 @@ progress_box.x = progress_form.x + (progress_form.width - progress_box.width) /
progress_box.y = progress_form.y + (progress_form.height - progress_box.height) / 2;
progress_box.sprite = Sprite(progress_box.image);
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 3);
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 13);
// PROGRESS BAR
progress_bar.original_image = Image("PROGRESS_BAR.png");
@ -275,7 +322,7 @@ progress_bar.x = progress_form.x + (progress_form.width - progress_bar.original_
progress_bar.y = progress_form.y + (progress_form.height - progress_bar.original_image.GetHeight()) / 2;
progress_bar.sprite = Sprite();
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 4);
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 14);
// PROGRESS FADE
progress_fade.image = Image("PROGRESS_FADE.png");
@ -291,7 +338,6 @@ counter = 0;
max_counter = progress_box.width - progress_fade.width;
fun progress_callback(duration, progress) {
if (progress_bar.image.GetWidth() != Math.Int(progress_bar.original_image.GetWidth() * progress)) {
progress_bar.image = progress_bar.original_image.Scale(progress_bar.original_image.GetWidth(progress_bar.original_image) * progress, progress_bar.original_image.GetHeight());
@ -306,11 +352,11 @@ fun progress_callback(duration, progress) {
Plymouth.SetBootProgressFunction(progress_callback);
// DIALOG
status = "normal";
//count = 0;
fun dialog_setup() {
local.box_form;
local.lock;
@ -319,7 +365,7 @@ fun dialog_setup() {
local.bullet_i;
box_form.image = Image("BOX.png");
box_form.image = box_form.image.Scale(Percent(80, side_panel.width), Percent(10, side_panel.height));
box_form.image = box_form.image.Scale(Percent(80, side_panel.width), Percent(18, side_panel.height));
box_form.width = box_form.image.GetWidth();
box_form.height = box_form.image.GetHeight();
@ -329,17 +375,17 @@ fun dialog_setup() {
box_form.z = 10000;
box_form.sprite = Sprite(box_form.image);
box_form.sprite.SetPosition(box_form.x, box_form.y, box_form.z);
box_form.sprite.SetOpacity(1);
box_form.sprite.SetPosition(box_form.x, box_form.y, box_form.z);
entry.image = Image("ENTRY.png");
entry.image = entry.image.Scale(Percent(90, box_form.width), Percent(33, box_form.height));
entry.image = entry.image.Scale(Percent(90, box_form.width), Percent(20, box_form.height));
entry.width = entry.image.GetWidth();
entry.height = entry.image.GetHeight();
entry.x = box_form.x + box_form.width/2 - entry.width/2;
entry.y = box_form.y + box_form.height/2 - entry.height/2;
entry.y = box_form.y + (box_form.height/3 * 2) - entry.height/2;
entry.z = box_form.z + 1;
entry.sprite = Sprite(entry.image);
@ -377,6 +423,7 @@ fun dialog_setup() {
dialog_opacity(1);
}
fun dialog_opacity(opacity) {
if (opacity == 0) {
dialog.box_form.sprite.SetOpacity(opacity);
@ -406,7 +453,6 @@ fun display_normal_callback() {
Plymouth.SetDisplayNormalFunction(display_normal_callback);
fun display_password_callback(prompt_text, bullets) {
global.status = "password";
@ -415,6 +461,51 @@ fun display_password_callback(prompt_text, bullets) {
else
dialog_opacity(1);
padding_top_bottom = Percent(10, dialog.box_form.height); // отступы сверху и снизу
padding_left_right = Percent(5, dialog.box_form.width); // отступы слева и справа
LINE_WIDTH = 100;
for(index = LINE_WIDTH; index > 0; index--) {
if((LINE_WIDTH * common_symbol.width) > (dialog.box_form.width - (padding_left_right * 2))) {
LINE_WIDTH = LINE_WIDTH - 1;
}
else {
break;
}
}
str_len = StringLength(prompt_text);
for (i = 1; LINE_WIDTH * i <= str_len; i++) {
line_count = i;
}
if (str_len % line_count > 0) {
line_count = line_count + 1;
}
i = 1;
start = 0;
end = LINE_WIDTH;
text = "";
for(i = 1; i <= line_count; i++) {
text += prompt_text.SubString(start, end);
text += "\n";
start = end;
if (LINE_WIDTH * i < str_len) {
end = end + LINE_WIDTH;
}
else {
end = str_len - 1;
}
}
prompt_text = text;
dialog.hint.image = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
dialog.hint.sprite.SetImage(dialog.hint.image);
@ -436,7 +527,6 @@ fun display_password_callback(prompt_text, bullets) {
Plymouth.SetDisplayPasswordFunction(display_password_callback);
time = 1;
fun refreshHandler() {
@ -447,7 +537,7 @@ fun refreshHandler() {
text.sprite = Sprite(text.image);
text.x = progress_box.x;
text.y = progress_box.y - progress_text.image.GetHeight() * 2;
text.sprite.SetPosition(text.x, text.y, 3);
text.sprite.SetPosition(text.x, text.y, 13);
}
else {
progress_fade.sprite.SetOpacity (1);
@ -456,12 +546,12 @@ fun refreshHandler() {
text_end.sprite = Sprite(text_end.image);
text_end.x = progress_box.x;
text_end.y = progress_box.y - progress_text.image.GetHeight() * 2;
text_end.sprite.SetPosition(text_end.x, text_end.y, 3);
text_end.sprite.SetPosition(text_end.x, text_end.y, 13);
}
progress_fade.x = progress_bar.x;
progress_fade.y = progress_bar.y;
progress_fade.sprite.SetPosition(counter + progress_fade.x, progress_fade.y, 4);
progress_fade.sprite.SetPosition(counter + progress_fade.x, progress_fade.y, 14);
if (fade_dir == 0) {
counter++;
@ -503,7 +593,6 @@ fun refreshHandler() {
Plymouth.SetRefreshFunction(refreshHandler);
message_status.sprite = SpriteNew();
fun message_callback(prompt_text) {
@ -512,12 +601,13 @@ fun message_callback(prompt_text) {
message_status.height = message_status.image.GetHeight();
message_status.x = messages_box.x + Percent(5, messages_box.width);
message_status.y = messages_box.y + messages_box.height - Percent(7, messages_box.height);
message_status.sprite.SetPosition(message_status.x, message_status.y, 3);
message_status.sprite.SetOpacity(1);
message_status.sprite.SetPosition(message_status.x, message_status.y, 13);
}
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
@ -538,10 +628,6 @@ message_sprite_.x = messages_box.x + (padding_left_right); // позиция %
message_sprite_.y = messages_box.y + (padding_top_bottom); // позиция % по Y (сверху вниз)
// LOG //
common_symbol.image = Image.Text("M", 0.5, 0.5, 0.5, 1, common_font);
common_symbol.height = common_symbol.image.GetHeight(); // высота символа
common_symbol.width = common_symbol.image.GetWidth(); // ширина символа
NUM_SCROLL_LINES=100; //количество строк лога
LINE_WIDTH=100; //ширина строк лога
LINE_HEIGHT = common_symbol.height * 1.5; // межстрочный интервал x1,5
@ -569,9 +655,10 @@ for (index = LINE_WIDTH; index > 0; index--) {
for (i=0; i < NUM_SCROLL_LINES; i++) {
lines[i]= Image.Text("", 0.5, 0.5, 0.5, 1, common_font); //цвет строк
message_sprite[i] = SpriteNew();
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * LINE_HEIGHT), 3);
message_sprite[i].SetPosition(message_sprite_.x, message_sprite_.y + (i * LINE_HEIGHT), 13);
} //высота строк //отступ строк
fun StringLength(string) {
index = 0;
str = String(string);
@ -579,6 +666,7 @@ fun StringLength(string) {
return index;
}
fun scroll_message_callback(text) {
// Truncate the message if too long
if (StringLength(text) > LINE_WIDTH) {
@ -603,7 +691,6 @@ fun scroll_message_callback(text) {
Plymouth.SetUpdateStatusFunction(scroll_message_callback);
// QUIT
fun quit_callback() {
progress_fade.sprite.SetOpacity (1);