Update
This commit is contained in:
		
							parent
							
								
									e347b454ad
								
							
						
					
					
						commit
						fee637f0eb
					
				| 
						 | 
					@ -107,9 +107,10 @@ SetSpriteImage = function(asset, x, y, z) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TEXT
 | 
					// TEXT
 | 
				
			||||||
ubuntufont = "Ubuntu Mono Regular 16";
 | 
					common_font = "Noto Sans Mono Regular 10";
 | 
				
			||||||
perfont = "Ubuntu Mono Regular 16";
 | 
					progressfont = "Noto Sans Mono Regular 12";
 | 
				
			||||||
progressfont = "Ubuntu Mono Regular 16";
 | 
					link_font = "Noto Sans Italic 16";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
starting_text = "Starting up...";
 | 
					starting_text = "Starting up...";
 | 
				
			||||||
bye_text = "System is shutting down";
 | 
					bye_text = "System is shutting down";
 | 
				
			||||||
progress_t= 0;
 | 
					progress_t= 0;
 | 
				
			||||||
| 
						 | 
					@ -173,7 +174,7 @@ side_logo.sprite.SetOpacity(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// **************************************** //
 | 
					// **************************************** //
 | 
				
			||||||
 | 
					
 | 
				
			||||||
project_link.image = Image.Text("https://github.com/Melawy", 0.5, 0.5, 0.5, 1, perfont);
 | 
					project_link.image = Image.Text("https://github.com/Melawy", 0.5, 0.5, 0.5, 1, link_font);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
project_link.width = project_link.image.GetWidth();
 | 
					project_link.width = project_link.image.GetWidth();
 | 
				
			||||||
project_link.height = project_link.image.GetHeight();
 | 
					project_link.height = project_link.image.GetHeight();
 | 
				
			||||||
| 
						 | 
					@ -218,8 +219,8 @@ spinner.image = spinner.image.Scale(Percent(1, screen.width), Percent(1, screen.
 | 
				
			||||||
spinner.width = spinner.image.GetWidth();
 | 
					spinner.width = spinner.image.GetWidth();
 | 
				
			||||||
spinner.height = spinner.image.GetHeight();
 | 
					spinner.height = spinner.image.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spinner.x = progress_form.x + progress_form.width - spinner.width;
 | 
					spinner.x = progress_form.x + progress_form.width - spinner.width - spinner.width / 2;
 | 
				
			||||||
spinner.y = progress_form.y + spinner.height / 10;
 | 
					spinner.y = progress_form.y + spinner.height / 10 + spinner.height / 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spinner.sprite = Sprite(spinner.image);
 | 
					spinner.sprite = Sprite(spinner.image);
 | 
				
			||||||
spinner.sprite.SetPosition(spinner.x, spinner.y, 3); // позиция за или перед
 | 
					spinner.sprite.SetPosition(spinner.x, spinner.y, 3); // позиция за или перед
 | 
				
			||||||
| 
						 | 
					@ -231,8 +232,9 @@ progress_text.image = Image.Text(progress_t + "%", 255, 255, 255, 1, progressfon
 | 
				
			||||||
progress_text.width = progress_text.image.GetWidth();
 | 
					progress_text.width = progress_text.image.GetWidth();
 | 
				
			||||||
progress_text.height = progress_text.image.GetHeight();
 | 
					progress_text.height = progress_text.image.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
progress_text.x = progress_form.x;// + progress_form.width - (4 * Percent(70, progress_text.height)); // позиция % по X
 | 
					progress_text.x = progress_form.x + progress_text.width / 2;// + progress_form.width - (4 * Percent(70, progress_text.height)); // позиция % по X
 | 
				
			||||||
progress_text.y = progress_form.y;// + progress_text.height; // позиция % по Y
 | 
					// progress_text.y = progress_form.y + progress_text.height / 2;// + progress_text.height; // позиция % по Y
 | 
				
			||||||
 | 
					progress_text.y = spinner.y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
progress_text.sprite = SpriteNew();
 | 
					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, 3);
 | 
				
			||||||
| 
						 | 
					@ -298,8 +300,8 @@ function dialog_setup() {
 | 
				
			||||||
    local.box_form;
 | 
					    local.box_form;
 | 
				
			||||||
    local.lock;
 | 
					    local.lock;
 | 
				
			||||||
    local.entry;
 | 
					    local.entry;
 | 
				
			||||||
    local.prompt_sprite;
 | 
					    local.hint;
 | 
				
			||||||
 | 
					    local.bullet_i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    box_form.image = Image("BOX.png");
 | 
					    box_form.image = Image("BOX.png");
 | 
				
			||||||
    box_form.image = box_form.image.Scale(Percent(20, screen.width), Percent(10, screen.height));
 | 
					    box_form.image = box_form.image.Scale(Percent(20, screen.width), Percent(10, screen.height));
 | 
				
			||||||
| 
						 | 
					@ -342,15 +344,21 @@ function dialog_setup() {
 | 
				
			||||||
    lock.sprite.SetPosition(lock.x, lock.y, lock.z);
 | 
					    lock.sprite.SetPosition(lock.x, lock.y, lock.z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    prompt_sprite = SpriteNew();
 | 
					    hint.sprite = SpriteNew();
 | 
				
			||||||
    prompt_sprite.SetPosition(entry.x, box_form.y + entry.height/2, box_form.z + 1);
 | 
					    hint.sprite.SetPosition(entry.x, box_form.y + entry.height/2, box_form.z + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bullet_i.image = Image("BULLET.png");
 | 
				
			||||||
 | 
					    bullet_i.image = bullet_i.image.Scale(Percent(50, entry.height), Percent(50, entry.height));
 | 
				
			||||||
 | 
					    bullet_i.width = bullet_i.image.GetWidth();
 | 
				
			||||||
 | 
					    bullet_i.height = bullet_i.image.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    global.dialog.box_form = box_form;
 | 
					    global.dialog.box_form = box_form;
 | 
				
			||||||
    global.dialog.lock = lock;
 | 
					    global.dialog.lock = lock;
 | 
				
			||||||
    global.dialog.entry = entry;
 | 
					    global.dialog.entry = entry;
 | 
				
			||||||
    global.dialog.bullet_image = Image("BULLET.png");
 | 
					    global.dialog.hint = hint;
 | 
				
			||||||
    global.dialog.prompt_sprite = prompt_sprite;
 | 
					    global.dialog.bullet_i = bullet_i;
 | 
				
			||||||
    dialog_opacity(1);
 | 
					    dialog_opacity(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -365,13 +373,14 @@ function dialog_opacity(opacity) {
 | 
				
			||||||
        dialog.entry.sprite.SetOpacity(opacity);
 | 
					        dialog.entry.sprite.SetOpacity(opacity);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dialog.prompt_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);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function display_normal_callback() {
 | 
					function display_normal_callback() {
 | 
				
			||||||
    global.status = "normal";
 | 
					    global.status = "normal";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -379,7 +388,10 @@ function display_normal_callback() {
 | 
				
			||||||
        dialog_opacity(0);
 | 
					        dialog_opacity(0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function display_password_callback(prompt, bullets) {
 | 
					Plymouth.SetDisplayNormalFunction(display_normal_callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function display_password_callback(prompt_text, bullets) {
 | 
				
			||||||
    global.status = "password";
 | 
					    global.status = "password";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!global.dialog)
 | 
					    if (!global.dialog)
 | 
				
			||||||
| 
						 | 
					@ -387,14 +399,14 @@ function display_password_callback(prompt, bullets) {
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        dialog_opacity(1);
 | 
					        dialog_opacity(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dialog.image = Image.Text(prompt, 1.0, 1.0, 1.0, 1, ubuntufont);
 | 
					    dialog.hint.image = Image.Text(prompt_text, 1.0, 1.0, 1.0, 1, common_font);
 | 
				
			||||||
    dialog.prompt_sprite.SetImage(dialog.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_image);
 | 
					            dialog.bullet[index].sprite = Sprite(dialog.bullet_i.image);
 | 
				
			||||||
            dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth() / 0.9 - dialog.entry.image.GetHeight() * -0.2; // отступ точки от точки и от поля(modified)
 | 
					            dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_i.width / 0.9 - dialog.entry.height * -0.2; // отступ точки от точки и от поля(modified)
 | 
				
			||||||
            dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
 | 
					            dialog.bullet[index].y = dialog.entry.y + (dialog.entry.height - dialog.bullet_i.height) / 2;
 | 
				
			||||||
            dialog.bullet[index].z = dialog.entry.z + 1;
 | 
					            dialog.bullet[index].z = dialog.entry.z + 1;
 | 
				
			||||||
            dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
 | 
					            dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -405,30 +417,9 @@ function display_password_callback(prompt, bullets) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function display_message_callback(prompt) {
 | 
					 | 
				
			||||||
    prompt = Image.Text(prompt, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					 | 
				
			||||||
    sprite_prompt.SetImage(prompt);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Plymouth.SetDisplayNormalFunction(display_normal_callback);
 | 
					 | 
				
			||||||
Plymouth.SetDisplayPasswordFunction(display_password_callback);
 | 
					Plymouth.SetDisplayPasswordFunction(display_password_callback);
 | 
				
			||||||
Plymouth.SetMessageFunction(display_message_callback);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* this function only goes up to 100
 | 
					 | 
				
			||||||
because thats all thats needed for
 | 
					 | 
				
			||||||
the progress meter bar */
 | 
					 | 
				
			||||||
function atoi(str) {
 | 
					 | 
				
			||||||
    int = -1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for(i = 0; i <= 100; i++) {
 | 
					 | 
				
			||||||
        if (i + "" == str) {
 | 
					 | 
				
			||||||
            int = i;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return int;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
time = 1;
 | 
					time = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -436,7 +427,7 @@ function refreshHandler() {
 | 
				
			||||||
    if (global.status == "normal" &&  Plymouth.GetMode() == "boot") {
 | 
					    if (global.status == "normal" &&  Plymouth.GetMode() == "boot") {
 | 
				
			||||||
        progress_fade.sprite.SetOpacity (0); // полностью прозрачный
 | 
					        progress_fade.sprite.SetOpacity (0); // полностью прозрачный
 | 
				
			||||||
        progress_bar.sprite.SetOpacity (1);
 | 
					        progress_bar.sprite.SetOpacity (1);
 | 
				
			||||||
        text.image = Image.Text(starting_text, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					        text.image = Image.Text(starting_text, 0.5, 0.5, 0.5, 1, common_font);
 | 
				
			||||||
        text.sprite = Sprite(text.image);
 | 
					        text.sprite = Sprite(text.image);
 | 
				
			||||||
        text.x = progress_box.x;
 | 
					        text.x = progress_box.x;
 | 
				
			||||||
        text.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
					        text.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
				
			||||||
| 
						 | 
					@ -445,7 +436,7 @@ function refreshHandler() {
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        progress_fade.sprite.SetOpacity (1);
 | 
					        progress_fade.sprite.SetOpacity (1);
 | 
				
			||||||
        progress_bar.sprite.SetOpacity (0);
 | 
					        progress_bar.sprite.SetOpacity (0);
 | 
				
			||||||
        text_end.image = Image.Text(bye_text, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					        text_end.image = Image.Text(bye_text, 0.5, 0.5, 0.5, 1, common_font);
 | 
				
			||||||
        text_end.sprite = Sprite(text_end.image);
 | 
					        text_end.sprite = Sprite(text_end.image);
 | 
				
			||||||
        text_end.x = progress_box.x;
 | 
					        text_end.x = progress_box.x;
 | 
				
			||||||
        text_end.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
					        text_end.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
				
			||||||
| 
						 | 
					@ -495,14 +486,16 @@ function refreshHandler() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Plymouth.SetRefreshFunction(refreshHandler);
 | 
					Plymouth.SetRefreshFunction(refreshHandler);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LOG //
 | 
					// LOG //
 | 
				
			||||||
NUM_SCROLL_LINES=25; //количество строк лога
 | 
					NUM_SCROLL_LINES=25; //количество строк лога
 | 
				
			||||||
LINE_WIDTH=35; //ширина строк лога
 | 
					LINE_WIDTH=35; //ширина строк лога
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message_sprite=SpriteNew();
 | 
					message_sprite=SpriteNew();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function message_callback(prompt) {
 | 
					function message_callback(prompt_text) {
 | 
				
			||||||
    message = Image.Text(prompt, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					    message = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
 | 
				
			||||||
    message_sprite.SetImage(message);
 | 
					    message_sprite.SetImage(message);
 | 
				
			||||||
    message_sprite.SetPosition(Percent(2, screen.width), Percent(50, screen.height), 2);
 | 
					    message_sprite.SetPosition(Percent(2, screen.width), Percent(50, screen.height), 2);
 | 
				
			||||||
    message_sprite.SetOpacity(1);
 | 
					    message_sprite.SetOpacity(1);
 | 
				
			||||||
| 
						 | 
					@ -513,7 +506,7 @@ Plymouth.SetMessageFunction(message_callback);
 | 
				
			||||||
// 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, ubuntufont); //цвет строк
 | 
					    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(Percent(2, screen.width), Percent(5, screen.height) + (i * 17), 2);
 | 
					    message_sprite[i].SetPosition(Percent(2, screen.width), Percent(5, screen.height) + (i * 17), 2);
 | 
				
			||||||
}                                    //высота строк           //отступ строк
 | 
					}                                    //высота строк           //отступ строк
 | 
				
			||||||
| 
						 | 
					@ -538,7 +531,7 @@ function scroll_message_callback(text) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //  Create the image for the latest message
 | 
					    //  Create the image for the latest message
 | 
				
			||||||
    lines[i] = Image.Text(text, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					    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++) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,9 +107,10 @@ SetSpriteImage = fun(asset, x, y, z) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TEXT
 | 
					// TEXT
 | 
				
			||||||
ubuntufont = "Ubuntu Mono Regular 16";
 | 
					common_font = "Noto Sans Mono Regular 10";
 | 
				
			||||||
perfont = "Ubuntu Mono Regular 16";
 | 
					progressfont = "Noto Sans Mono Regular 12";
 | 
				
			||||||
progressfont = "Ubuntu Mono Regular 16";
 | 
					link_font = "Noto Sans Italic 16";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
starting_text = "Starting up...";
 | 
					starting_text = "Starting up...";
 | 
				
			||||||
bye_text = "System is shutting down";
 | 
					bye_text = "System is shutting down";
 | 
				
			||||||
progress_t= 0;
 | 
					progress_t= 0;
 | 
				
			||||||
| 
						 | 
					@ -173,7 +174,7 @@ side_logo.sprite.SetOpacity(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// **************************************** //
 | 
					// **************************************** //
 | 
				
			||||||
 | 
					
 | 
				
			||||||
project_link.image = Image.Text("https://github.com/Melawy", 0.5, 0.5, 0.5, 1, perfont);
 | 
					project_link.image = Image.Text("https://github.com/Melawy", 0.5, 0.5, 0.5, 1, link_font);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
project_link.width = project_link.image.GetWidth();
 | 
					project_link.width = project_link.image.GetWidth();
 | 
				
			||||||
project_link.height = project_link.image.GetHeight();
 | 
					project_link.height = project_link.image.GetHeight();
 | 
				
			||||||
| 
						 | 
					@ -218,8 +219,8 @@ spinner.image = spinner.image.Scale(Percent(1, screen.width), Percent(1, screen.
 | 
				
			||||||
spinner.width = spinner.image.GetWidth();
 | 
					spinner.width = spinner.image.GetWidth();
 | 
				
			||||||
spinner.height = spinner.image.GetHeight();
 | 
					spinner.height = spinner.image.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spinner.x = progress_form.x + progress_form.width - spinner.width;
 | 
					spinner.x = progress_form.x + progress_form.width - spinner.width - spinner.width / 2;
 | 
				
			||||||
spinner.y = progress_form.y + spinner.height / 10;
 | 
					spinner.y = progress_form.y + spinner.height / 10 + spinner.height / 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spinner.sprite = Sprite(spinner.image);
 | 
					spinner.sprite = Sprite(spinner.image);
 | 
				
			||||||
spinner.sprite.SetPosition(spinner.x, spinner.y, 3); // позиция за или перед
 | 
					spinner.sprite.SetPosition(spinner.x, spinner.y, 3); // позиция за или перед
 | 
				
			||||||
| 
						 | 
					@ -231,8 +232,9 @@ progress_text.image = Image.Text(progress_t + "%", 255, 255, 255, 1, progressfon
 | 
				
			||||||
progress_text.width = progress_text.image.GetWidth();
 | 
					progress_text.width = progress_text.image.GetWidth();
 | 
				
			||||||
progress_text.height = progress_text.image.GetHeight();
 | 
					progress_text.height = progress_text.image.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
progress_text.x = progress_form.x;// + progress_form.width - (4 * Percent(70, progress_text.height)); // позиция % по X
 | 
					progress_text.x = progress_form.x + progress_text.width / 2;// + progress_form.width - (4 * Percent(70, progress_text.height)); // позиция % по X
 | 
				
			||||||
progress_text.y = progress_form.y;// + progress_text.height; // позиция % по Y
 | 
					// progress_text.y = progress_form.y + progress_text.height / 2;// + progress_text.height; // позиция % по Y
 | 
				
			||||||
 | 
					progress_text.y = spinner.y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
progress_text.sprite = SpriteNew();
 | 
					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, 3);
 | 
				
			||||||
| 
						 | 
					@ -298,8 +300,8 @@ fun dialog_setup() {
 | 
				
			||||||
    local.box_form;
 | 
					    local.box_form;
 | 
				
			||||||
    local.lock;
 | 
					    local.lock;
 | 
				
			||||||
    local.entry;
 | 
					    local.entry;
 | 
				
			||||||
    local.prompt_sprite;
 | 
					    local.hint;
 | 
				
			||||||
 | 
					    local.bullet_i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    box_form.image = Image("BOX.png");
 | 
					    box_form.image = Image("BOX.png");
 | 
				
			||||||
    box_form.image = box_form.image.Scale(Percent(20, screen.width), Percent(10, screen.height));
 | 
					    box_form.image = box_form.image.Scale(Percent(20, screen.width), Percent(10, screen.height));
 | 
				
			||||||
| 
						 | 
					@ -342,15 +344,21 @@ fun dialog_setup() {
 | 
				
			||||||
    lock.sprite.SetPosition(lock.x, lock.y, lock.z);
 | 
					    lock.sprite.SetPosition(lock.x, lock.y, lock.z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    prompt_sprite = SpriteNew();
 | 
					    hint.sprite = SpriteNew();
 | 
				
			||||||
    prompt_sprite.SetPosition(entry.x, box_form.y + entry.height/2, box_form.z + 1);
 | 
					    hint.sprite.SetPosition(entry.x, box_form.y + entry.height/2, box_form.z + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bullet_i.image = Image("BULLET.png");
 | 
				
			||||||
 | 
					    bullet_i.image = bullet_i.image.Scale(Percent(50, entry.height), Percent(50, entry.height));
 | 
				
			||||||
 | 
					    bullet_i.width = bullet_i.image.GetWidth();
 | 
				
			||||||
 | 
					    bullet_i.height = bullet_i.image.GetHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    global.dialog.box_form = box_form;
 | 
					    global.dialog.box_form = box_form;
 | 
				
			||||||
    global.dialog.lock = lock;
 | 
					    global.dialog.lock = lock;
 | 
				
			||||||
    global.dialog.entry = entry;
 | 
					    global.dialog.entry = entry;
 | 
				
			||||||
    global.dialog.bullet_image = Image("BULLET.png");
 | 
					    global.dialog.hint = hint;
 | 
				
			||||||
    global.dialog.prompt_sprite = prompt_sprite;
 | 
					    global.dialog.bullet_i = bullet_i;
 | 
				
			||||||
    dialog_opacity(1);
 | 
					    dialog_opacity(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -365,13 +373,14 @@ fun dialog_opacity(opacity) {
 | 
				
			||||||
        dialog.entry.sprite.SetOpacity(opacity);
 | 
					        dialog.entry.sprite.SetOpacity(opacity);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dialog.prompt_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);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fun display_normal_callback() {
 | 
					fun display_normal_callback() {
 | 
				
			||||||
    global.status = "normal";
 | 
					    global.status = "normal";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -379,7 +388,10 @@ fun display_normal_callback() {
 | 
				
			||||||
        dialog_opacity(0);
 | 
					        dialog_opacity(0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fun display_password_callback(prompt, bullets) {
 | 
					Plymouth.SetDisplayNormalFunction(display_normal_callback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fun display_password_callback(prompt_text, bullets) {
 | 
				
			||||||
    global.status = "password";
 | 
					    global.status = "password";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!global.dialog)
 | 
					    if (!global.dialog)
 | 
				
			||||||
| 
						 | 
					@ -387,14 +399,14 @@ fun display_password_callback(prompt, bullets) {
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        dialog_opacity(1);
 | 
					        dialog_opacity(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dialog.image = Image.Text(prompt, 1.0, 1.0, 1.0, 1, ubuntufont);
 | 
					    dialog.hint.image = Image.Text(prompt_text, 1.0, 1.0, 1.0, 1, common_font);
 | 
				
			||||||
    dialog.prompt_sprite.SetImage(dialog.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_image);
 | 
					            dialog.bullet[index].sprite = Sprite(dialog.bullet_i.image);
 | 
				
			||||||
            dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth() / 0.9 - dialog.entry.image.GetHeight() * -0.2; // отступ точки от точки и от поля(modified)
 | 
					            dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_i.width / 0.9 - dialog.entry.height * -0.2; // отступ точки от точки и от поля(modified)
 | 
				
			||||||
            dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
 | 
					            dialog.bullet[index].y = dialog.entry.y + (dialog.entry.height - dialog.bullet_i.height) / 2;
 | 
				
			||||||
            dialog.bullet[index].z = dialog.entry.z + 1;
 | 
					            dialog.bullet[index].z = dialog.entry.z + 1;
 | 
				
			||||||
            dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
 | 
					            dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -405,30 +417,9 @@ fun display_password_callback(prompt, bullets) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fun display_message_callback(prompt) {
 | 
					 | 
				
			||||||
    prompt = Image.Text(prompt, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					 | 
				
			||||||
    sprite_prompt.SetImage(prompt);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Plymouth.SetDisplayNormalFunction(display_normal_callback);
 | 
					 | 
				
			||||||
Plymouth.SetDisplayPasswordFunction(display_password_callback);
 | 
					Plymouth.SetDisplayPasswordFunction(display_password_callback);
 | 
				
			||||||
Plymouth.SetMessageFunction(display_message_callback);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* this fun only goes up to 100
 | 
					 | 
				
			||||||
because thats all thats needed for
 | 
					 | 
				
			||||||
the progress meter bar */
 | 
					 | 
				
			||||||
fun atoi(str) {
 | 
					 | 
				
			||||||
    int = -1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for(i = 0; i <= 100; i++) {
 | 
					 | 
				
			||||||
        if (i + "" == str) {
 | 
					 | 
				
			||||||
            int = i;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return int;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
time = 1;
 | 
					time = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -436,7 +427,7 @@ fun refreshHandler() {
 | 
				
			||||||
    if (global.status == "normal" &&  Plymouth.GetMode() == "boot") {
 | 
					    if (global.status == "normal" &&  Plymouth.GetMode() == "boot") {
 | 
				
			||||||
        progress_fade.sprite.SetOpacity (0); // полностью прозрачный
 | 
					        progress_fade.sprite.SetOpacity (0); // полностью прозрачный
 | 
				
			||||||
        progress_bar.sprite.SetOpacity (1);
 | 
					        progress_bar.sprite.SetOpacity (1);
 | 
				
			||||||
        text.image = Image.Text(starting_text, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					        text.image = Image.Text(starting_text, 0.5, 0.5, 0.5, 1, common_font);
 | 
				
			||||||
        text.sprite = Sprite(text.image);
 | 
					        text.sprite = Sprite(text.image);
 | 
				
			||||||
        text.x = progress_box.x;
 | 
					        text.x = progress_box.x;
 | 
				
			||||||
        text.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
					        text.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
				
			||||||
| 
						 | 
					@ -445,7 +436,7 @@ fun refreshHandler() {
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        progress_fade.sprite.SetOpacity (1);
 | 
					        progress_fade.sprite.SetOpacity (1);
 | 
				
			||||||
        progress_bar.sprite.SetOpacity (0);
 | 
					        progress_bar.sprite.SetOpacity (0);
 | 
				
			||||||
        text_end.image = Image.Text(bye_text, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					        text_end.image = Image.Text(bye_text, 0.5, 0.5, 0.5, 1, common_font);
 | 
				
			||||||
        text_end.sprite = Sprite(text_end.image);
 | 
					        text_end.sprite = Sprite(text_end.image);
 | 
				
			||||||
        text_end.x = progress_box.x;
 | 
					        text_end.x = progress_box.x;
 | 
				
			||||||
        text_end.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
					        text_end.y = progress_box.y - progress_text.image.GetHeight() * 2;
 | 
				
			||||||
| 
						 | 
					@ -495,14 +486,16 @@ fun refreshHandler() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Plymouth.SetRefreshFunction(refreshHandler);
 | 
					Plymouth.SetRefreshFunction(refreshHandler);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LOG //
 | 
					// LOG //
 | 
				
			||||||
NUM_SCROLL_LINES=25; //количество строк лога
 | 
					NUM_SCROLL_LINES=25; //количество строк лога
 | 
				
			||||||
LINE_WIDTH=35; //ширина строк лога
 | 
					LINE_WIDTH=35; //ширина строк лога
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message_sprite=SpriteNew();
 | 
					message_sprite=SpriteNew();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fun message_callback(prompt) {
 | 
					fun message_callback(prompt_text) {
 | 
				
			||||||
    message = Image.Text(prompt, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					    message = Image.Text(prompt_text, 0.5, 0.5, 0.5, 1, common_font);
 | 
				
			||||||
    message_sprite.SetImage(message);
 | 
					    message_sprite.SetImage(message);
 | 
				
			||||||
    message_sprite.SetPosition(Percent(2, screen.width), Percent(50, screen.height), 2);
 | 
					    message_sprite.SetPosition(Percent(2, screen.width), Percent(50, screen.height), 2);
 | 
				
			||||||
    message_sprite.SetOpacity(1);
 | 
					    message_sprite.SetOpacity(1);
 | 
				
			||||||
| 
						 | 
					@ -513,7 +506,7 @@ Plymouth.SetMessageFunction(message_callback);
 | 
				
			||||||
// 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, ubuntufont); //цвет строк
 | 
					    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(Percent(2, screen.width), Percent(5, screen.height) + (i * 17), 2);
 | 
					    message_sprite[i].SetPosition(Percent(2, screen.width), Percent(5, screen.height) + (i * 17), 2);
 | 
				
			||||||
}                                    //высота строк           //отступ строк
 | 
					}                                    //высота строк           //отступ строк
 | 
				
			||||||
| 
						 | 
					@ -538,7 +531,7 @@ fun scroll_message_callback(text) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //  Create the image for the latest message
 | 
					    //  Create the image for the latest message
 | 
				
			||||||
    lines[i] = Image.Text(text, 0.5, 0.5, 0.5, 1, ubuntufont);
 | 
					    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++) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue