Skip to content

Commit

Permalink
Password Prompt Support
Browse files Browse the repository at this point in the history
  • Loading branch information
adi1090x committed Mar 28, 2020
1 parent a7aae7d commit 57981bb
Show file tree
Hide file tree
Showing 21 changed files with 2,373 additions and 0 deletions.
113 changes: 113 additions & 0 deletions pack_1/abstract_ring/abstract_ring.script
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,116 @@ fun refresh_callback ()
}

Plymouth.SetRefreshFunction (refresh_callback);

# dialogue --------------------------------

status = "normal";

fun dialog_setup()
{
local.box;
local.lock;
local.entry;

box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");

box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);

lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);

entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);

global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}

fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}

fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}

fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
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);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}

Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);

# quit --------------------------------

fun quit_callback ()
{
logo.sprite.SetOpacity (1);
}

Plymouth.SetQuitFunction(quit_callback);

# message --------------------------------

message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);

fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
}

fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
}

Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);
113 changes: 113 additions & 0 deletions pack_1/abstract_ring_alt/abstract_ring_alt.script
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,116 @@ fun refresh_callback ()
}

Plymouth.SetRefreshFunction (refresh_callback);

# dialogue --------------------------------

status = "normal";

fun dialog_setup()
{
local.box;
local.lock;
local.entry;

box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");

box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);

lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);

entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);

global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}

fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}

fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}

fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
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);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}

Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);

# quit --------------------------------

fun quit_callback ()
{
logo.sprite.SetOpacity (1);
}

Plymouth.SetQuitFunction(quit_callback);

# message --------------------------------

message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);

fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
}

fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
}

Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);
113 changes: 113 additions & 0 deletions pack_1/alienware/alienware.script
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,116 @@ fun refresh_callback ()
}

Plymouth.SetRefreshFunction (refresh_callback);

# dialogue --------------------------------

status = "normal";

fun dialog_setup()
{
local.box;
local.lock;
local.entry;

box.image = Image("box.png");
lock.image = Image("lock.png");
entry.image = Image("entry.png");

box.sprite = Sprite(box.image);
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
box.z = 10000;
box.sprite.SetPosition(box.x, box.y, box.z);

lock.sprite = Sprite(lock.image);
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
lock.z = box.z + 1;
lock.sprite.SetPosition(lock.x, lock.y, lock.z);

entry.sprite = Sprite(entry.image);
entry.x = lock.x + lock.image.GetWidth();
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
entry.z = box.z + 1;
entry.sprite.SetPosition(entry.x, entry.y, entry.z);

global.dialog.box = box;
global.dialog.lock = lock;
global.dialog.entry = entry;
global.dialog.bullet_image = Image("bullet.png");
dialog_opacity (1);
}

fun dialog_opacity(opacity)
{
dialog.box.sprite.SetOpacity (opacity);
dialog.lock.sprite.SetOpacity (opacity);
dialog.entry.sprite.SetOpacity (opacity);
for (index = 0; dialog.bullet[index]; index++)
{
dialog.bullet[index].sprite.SetOpacity(opacity);
}
}

fun display_normal_callback ()
{
global.status = "normal";
if (global.dialog)
dialog_opacity (0);
}

fun display_password_callback (prompt, bullets)
{
global.status = "password";
if (!global.dialog)
dialog_setup();
else
dialog_opacity(1);
for (index = 0; dialog.bullet[index] || index < bullets; index++)
{
if (!dialog.bullet[index])
{
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
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);
}
if (index < bullets)
dialog.bullet[index].sprite.SetOpacity(1);
else
dialog.bullet[index].sprite.SetOpacity(0);
}
}

Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);

# quit --------------------------------

fun quit_callback ()
{
logo.sprite.SetOpacity (1);
}

Plymouth.SetQuitFunction(quit_callback);

# message --------------------------------

message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);

fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
}

fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
}

Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);
Loading

0 comments on commit 57981bb

Please sign in to comment.