mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 20:29:24 +00:00
Cleanup
This commit is contained in:
@ -48,6 +48,11 @@ fun refresh_callback ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Plymouth.SetRefreshFunction (refresh_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Helper Functions --------------------------------
|
||||||
|
|
||||||
fun update_progress_bar(progress)
|
fun update_progress_bar(progress)
|
||||||
{
|
{
|
||||||
width = Math.Int(progress_bar.original_image.GetWidth() * progress);
|
width = Math.Int(progress_bar.original_image.GetWidth() * progress);
|
||||||
@ -57,8 +62,45 @@ fun update_progress_bar(progress)
|
|||||||
progress_bar.sprite.SetImage(progress_bar.image);
|
progress_bar.sprite.SetImage(progress_bar.image);
|
||||||
}
|
}
|
||||||
|
|
||||||
Plymouth.SetRefreshFunction (refresh_callback);
|
fun show_progress_bar()
|
||||||
|
{
|
||||||
|
progress_box.sprite.SetOpacity(1);
|
||||||
|
progress_bar.sprite.SetOpacity(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun hide_progress_bar()
|
||||||
|
{
|
||||||
|
progress_box.sprite.SetOpacity(0);
|
||||||
|
progress_bar.sprite.SetOpacity(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun show_password_dialog()
|
||||||
|
{
|
||||||
|
lock.sprite.SetOpacity(1);
|
||||||
|
entry.sprite.SetOpacity(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun hide_password_dialog()
|
||||||
|
{
|
||||||
|
lock.sprite.SetOpacity(0);
|
||||||
|
entry.sprite.SetOpacity(0);
|
||||||
|
for (index = 0; bullet.sprites[index]; index++)
|
||||||
|
bullet.sprites[index].SetOpacity(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun start_fake_progress()
|
||||||
|
{
|
||||||
|
global.fake_progress = 0.0;
|
||||||
|
global.real_progress = 0.0;
|
||||||
|
global.fake_progress_active = 1;
|
||||||
|
global.animation_frame = 0;
|
||||||
|
update_progress_bar(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun stop_fake_progress()
|
||||||
|
{
|
||||||
|
global.fake_progress_active = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------- Dialogue --------------------------------
|
#----------------------------------------- Dialogue --------------------------------
|
||||||
|
|
||||||
@ -84,12 +126,7 @@ bullet.sprites = [];
|
|||||||
|
|
||||||
fun display_normal_callback ()
|
fun display_normal_callback ()
|
||||||
{
|
{
|
||||||
|
hide_password_dialog();
|
||||||
# Hide dialog
|
|
||||||
lock.sprite.SetOpacity(0);
|
|
||||||
entry.sprite.SetOpacity(0);
|
|
||||||
for (index = 0; bullet.sprites[index]; index++)
|
|
||||||
bullet.sprites[index].SetOpacity(0);
|
|
||||||
|
|
||||||
# Get current mode
|
# Get current mode
|
||||||
mode = Plymouth.GetMode();
|
mode = Plymouth.GetMode();
|
||||||
@ -103,18 +140,8 @@ fun display_normal_callback ()
|
|||||||
|
|
||||||
if (show_progress == 1)
|
if (show_progress == 1)
|
||||||
{
|
{
|
||||||
# Show progress
|
show_progress_bar();
|
||||||
progress_box.sprite.SetOpacity(1);
|
start_fake_progress();
|
||||||
progress_bar.sprite.SetOpacity(1);
|
|
||||||
|
|
||||||
# Reset and start fake progress animation
|
|
||||||
global.fake_progress = 0.0;
|
|
||||||
global.real_progress = 0.0;
|
|
||||||
global.fake_progress_active = 1;
|
|
||||||
global.animation_frame = 0; # Reset timer
|
|
||||||
|
|
||||||
# Reset progress bar to empty
|
|
||||||
update_progress_bar(0.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,16 +149,9 @@ fun display_password_callback (prompt, bullets)
|
|||||||
{
|
{
|
||||||
global.password_shown = 1; # Mark that password dialog has been shown
|
global.password_shown = 1; # Mark that password dialog has been shown
|
||||||
|
|
||||||
# Stop fake progress animation
|
stop_fake_progress();
|
||||||
global.fake_progress_active = 0;
|
hide_progress_bar();
|
||||||
|
show_password_dialog();
|
||||||
# Hide progress
|
|
||||||
progress_box.sprite.SetOpacity(0);
|
|
||||||
progress_bar.sprite.SetOpacity(0);
|
|
||||||
|
|
||||||
# Show dialog
|
|
||||||
lock.sprite.SetOpacity(1);
|
|
||||||
entry.sprite.SetOpacity(1);
|
|
||||||
|
|
||||||
# Clear all bullets first
|
# Clear all bullets first
|
||||||
for (index = 0; bullet.sprites[index]; index++)
|
for (index = 0; bullet.sprites[index]; index++)
|
||||||
@ -180,7 +200,7 @@ fun progress_callback (duration, progress)
|
|||||||
# If real progress is above limit, stop fake progress and use real progress
|
# If real progress is above limit, stop fake progress and use real progress
|
||||||
if (progress > global.fake_progress_limit)
|
if (progress > global.fake_progress_limit)
|
||||||
{
|
{
|
||||||
global.fake_progress_active = 0;
|
stop_fake_progress();
|
||||||
update_progress_bar(progress);
|
update_progress_bar(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user