Skip to content

Commit 57981bb

Browse files
committed
Password Prompt Support
1 parent a7aae7d commit 57981bb

File tree

21 files changed

+2373
-0
lines changed

21 files changed

+2373
-0
lines changed

pack_1/abstract_ring/abstract_ring.script

+113
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,116 @@ fun refresh_callback ()
2424
}
2525

2626
Plymouth.SetRefreshFunction (refresh_callback);
27+
28+
# dialogue --------------------------------
29+
30+
status = "normal";
31+
32+
fun dialog_setup()
33+
{
34+
local.box;
35+
local.lock;
36+
local.entry;
37+
38+
box.image = Image("box.png");
39+
lock.image = Image("lock.png");
40+
entry.image = Image("entry.png");
41+
42+
box.sprite = Sprite(box.image);
43+
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
44+
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
45+
box.z = 10000;
46+
box.sprite.SetPosition(box.x, box.y, box.z);
47+
48+
lock.sprite = Sprite(lock.image);
49+
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
50+
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
51+
lock.z = box.z + 1;
52+
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
53+
54+
entry.sprite = Sprite(entry.image);
55+
entry.x = lock.x + lock.image.GetWidth();
56+
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
57+
entry.z = box.z + 1;
58+
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
59+
60+
global.dialog.box = box;
61+
global.dialog.lock = lock;
62+
global.dialog.entry = entry;
63+
global.dialog.bullet_image = Image("bullet.png");
64+
dialog_opacity (1);
65+
}
66+
67+
fun dialog_opacity(opacity)
68+
{
69+
dialog.box.sprite.SetOpacity (opacity);
70+
dialog.lock.sprite.SetOpacity (opacity);
71+
dialog.entry.sprite.SetOpacity (opacity);
72+
for (index = 0; dialog.bullet[index]; index++)
73+
{
74+
dialog.bullet[index].sprite.SetOpacity(opacity);
75+
}
76+
}
77+
78+
fun display_normal_callback ()
79+
{
80+
global.status = "normal";
81+
if (global.dialog)
82+
dialog_opacity (0);
83+
}
84+
85+
fun display_password_callback (prompt, bullets)
86+
{
87+
global.status = "password";
88+
if (!global.dialog)
89+
dialog_setup();
90+
else
91+
dialog_opacity(1);
92+
for (index = 0; dialog.bullet[index] || index < bullets; index++)
93+
{
94+
if (!dialog.bullet[index])
95+
{
96+
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
97+
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
98+
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
99+
dialog.bullet[index].z = dialog.entry.z + 1;
100+
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
101+
}
102+
if (index < bullets)
103+
dialog.bullet[index].sprite.SetOpacity(1);
104+
else
105+
dialog.bullet[index].sprite.SetOpacity(0);
106+
}
107+
}
108+
109+
Plymouth.SetDisplayNormalFunction(display_normal_callback);
110+
Plymouth.SetDisplayPasswordFunction(display_password_callback);
111+
112+
# quit --------------------------------
113+
114+
fun quit_callback ()
115+
{
116+
logo.sprite.SetOpacity (1);
117+
}
118+
119+
Plymouth.SetQuitFunction(quit_callback);
120+
121+
# message --------------------------------
122+
123+
message_sprite = Sprite();
124+
message_sprite.SetPosition(10, 10, 10000);
125+
126+
fun display_message_callback (text)
127+
{
128+
my_image = Image.Text(text, 1, 1, 1);
129+
message_sprite.SetImage(my_image);
130+
}
131+
132+
fun hide_message_callback (text)
133+
{
134+
message_sprite = Sprite();
135+
message_sprite.SetPosition(10, 10, 10000);
136+
}
137+
138+
Plymouth.SetDisplayMessageFunction (display_message_callback);
139+
Plymouth.SetHideMessageFunction (hide_message_callback);

pack_1/abstract_ring_alt/abstract_ring_alt.script

+113
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,116 @@ fun refresh_callback ()
2424
}
2525

2626
Plymouth.SetRefreshFunction (refresh_callback);
27+
28+
# dialogue --------------------------------
29+
30+
status = "normal";
31+
32+
fun dialog_setup()
33+
{
34+
local.box;
35+
local.lock;
36+
local.entry;
37+
38+
box.image = Image("box.png");
39+
lock.image = Image("lock.png");
40+
entry.image = Image("entry.png");
41+
42+
box.sprite = Sprite(box.image);
43+
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
44+
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
45+
box.z = 10000;
46+
box.sprite.SetPosition(box.x, box.y, box.z);
47+
48+
lock.sprite = Sprite(lock.image);
49+
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
50+
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
51+
lock.z = box.z + 1;
52+
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
53+
54+
entry.sprite = Sprite(entry.image);
55+
entry.x = lock.x + lock.image.GetWidth();
56+
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
57+
entry.z = box.z + 1;
58+
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
59+
60+
global.dialog.box = box;
61+
global.dialog.lock = lock;
62+
global.dialog.entry = entry;
63+
global.dialog.bullet_image = Image("bullet.png");
64+
dialog_opacity (1);
65+
}
66+
67+
fun dialog_opacity(opacity)
68+
{
69+
dialog.box.sprite.SetOpacity (opacity);
70+
dialog.lock.sprite.SetOpacity (opacity);
71+
dialog.entry.sprite.SetOpacity (opacity);
72+
for (index = 0; dialog.bullet[index]; index++)
73+
{
74+
dialog.bullet[index].sprite.SetOpacity(opacity);
75+
}
76+
}
77+
78+
fun display_normal_callback ()
79+
{
80+
global.status = "normal";
81+
if (global.dialog)
82+
dialog_opacity (0);
83+
}
84+
85+
fun display_password_callback (prompt, bullets)
86+
{
87+
global.status = "password";
88+
if (!global.dialog)
89+
dialog_setup();
90+
else
91+
dialog_opacity(1);
92+
for (index = 0; dialog.bullet[index] || index < bullets; index++)
93+
{
94+
if (!dialog.bullet[index])
95+
{
96+
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
97+
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
98+
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
99+
dialog.bullet[index].z = dialog.entry.z + 1;
100+
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
101+
}
102+
if (index < bullets)
103+
dialog.bullet[index].sprite.SetOpacity(1);
104+
else
105+
dialog.bullet[index].sprite.SetOpacity(0);
106+
}
107+
}
108+
109+
Plymouth.SetDisplayNormalFunction(display_normal_callback);
110+
Plymouth.SetDisplayPasswordFunction(display_password_callback);
111+
112+
# quit --------------------------------
113+
114+
fun quit_callback ()
115+
{
116+
logo.sprite.SetOpacity (1);
117+
}
118+
119+
Plymouth.SetQuitFunction(quit_callback);
120+
121+
# message --------------------------------
122+
123+
message_sprite = Sprite();
124+
message_sprite.SetPosition(10, 10, 10000);
125+
126+
fun display_message_callback (text)
127+
{
128+
my_image = Image.Text(text, 1, 1, 1);
129+
message_sprite.SetImage(my_image);
130+
}
131+
132+
fun hide_message_callback (text)
133+
{
134+
message_sprite = Sprite();
135+
message_sprite.SetPosition(10, 10, 10000);
136+
}
137+
138+
Plymouth.SetDisplayMessageFunction (display_message_callback);
139+
Plymouth.SetHideMessageFunction (hide_message_callback);

pack_1/alienware/alienware.script

+113
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,116 @@ fun refresh_callback ()
2424
}
2525

2626
Plymouth.SetRefreshFunction (refresh_callback);
27+
28+
# dialogue --------------------------------
29+
30+
status = "normal";
31+
32+
fun dialog_setup()
33+
{
34+
local.box;
35+
local.lock;
36+
local.entry;
37+
38+
box.image = Image("box.png");
39+
lock.image = Image("lock.png");
40+
entry.image = Image("entry.png");
41+
42+
box.sprite = Sprite(box.image);
43+
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
44+
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
45+
box.z = 10000;
46+
box.sprite.SetPosition(box.x, box.y, box.z);
47+
48+
lock.sprite = Sprite(lock.image);
49+
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
50+
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
51+
lock.z = box.z + 1;
52+
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
53+
54+
entry.sprite = Sprite(entry.image);
55+
entry.x = lock.x + lock.image.GetWidth();
56+
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
57+
entry.z = box.z + 1;
58+
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
59+
60+
global.dialog.box = box;
61+
global.dialog.lock = lock;
62+
global.dialog.entry = entry;
63+
global.dialog.bullet_image = Image("bullet.png");
64+
dialog_opacity (1);
65+
}
66+
67+
fun dialog_opacity(opacity)
68+
{
69+
dialog.box.sprite.SetOpacity (opacity);
70+
dialog.lock.sprite.SetOpacity (opacity);
71+
dialog.entry.sprite.SetOpacity (opacity);
72+
for (index = 0; dialog.bullet[index]; index++)
73+
{
74+
dialog.bullet[index].sprite.SetOpacity(opacity);
75+
}
76+
}
77+
78+
fun display_normal_callback ()
79+
{
80+
global.status = "normal";
81+
if (global.dialog)
82+
dialog_opacity (0);
83+
}
84+
85+
fun display_password_callback (prompt, bullets)
86+
{
87+
global.status = "password";
88+
if (!global.dialog)
89+
dialog_setup();
90+
else
91+
dialog_opacity(1);
92+
for (index = 0; dialog.bullet[index] || index < bullets; index++)
93+
{
94+
if (!dialog.bullet[index])
95+
{
96+
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
97+
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
98+
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
99+
dialog.bullet[index].z = dialog.entry.z + 1;
100+
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
101+
}
102+
if (index < bullets)
103+
dialog.bullet[index].sprite.SetOpacity(1);
104+
else
105+
dialog.bullet[index].sprite.SetOpacity(0);
106+
}
107+
}
108+
109+
Plymouth.SetDisplayNormalFunction(display_normal_callback);
110+
Plymouth.SetDisplayPasswordFunction(display_password_callback);
111+
112+
# quit --------------------------------
113+
114+
fun quit_callback ()
115+
{
116+
logo.sprite.SetOpacity (1);
117+
}
118+
119+
Plymouth.SetQuitFunction(quit_callback);
120+
121+
# message --------------------------------
122+
123+
message_sprite = Sprite();
124+
message_sprite.SetPosition(10, 10, 10000);
125+
126+
fun display_message_callback (text)
127+
{
128+
my_image = Image.Text(text, 1, 1, 1);
129+
message_sprite.SetImage(my_image);
130+
}
131+
132+
fun hide_message_callback (text)
133+
{
134+
message_sprite = Sprite();
135+
message_sprite.SetPosition(10, 10, 10000);
136+
}
137+
138+
Plymouth.SetDisplayMessageFunction (display_message_callback);
139+
Plymouth.SetHideMessageFunction (hide_message_callback);

0 commit comments

Comments
 (0)