1+ function DataSlate () constructor{
2+ static_line=1 ;
3+ title=" " ;
4+ sub_title=" " ;
5+ body_text = " " ;
6+ inside_method = " " ;
7+ XX=0 ;
8+ YY=0 ;
9+ width=0 ;
10+ height=0 ;
11+ percent_cut=0 ;
12+ set_width = false ;
13+
14+ style = " default" ;
15+
16+ tooltip_drawing = [];
17+
18+ blend_col = 5998382 ;
19+
20+ static entered = function (){
21+ return (scr_hit (
22+ XX-4 ,
23+ YY,
24+ XX + width,
25+ YY + height,
26+ ));
27+ }
28+
29+ static draw_with_dimensions = function (xx = -1 ,yy = -1 , Width=-1 , Height=-1 ){
30+ if (Width != -1 ){
31+ width = Width;
32+ }
33+ if (Height != -1 ){
34+ height = Height;
35+ }
36+ var _scale_x = width/860 ;
37+ var _scale_y = height/850 ;
38+ draw (xx,yy, _scale_x, _scale_y);
39+ }
40+
41+ static draw = function (xx= -1 ,yy = -1 , scale_x=1 , scale_y=1 ){
42+ if (xx != -1 ){
43+ XX=xx;
44+ }
45+ if (yy != -1 ){
46+ YY=yy;
47+ }
48+
49+ if (!set_width){
50+ width = 860 *scale_x;
51+ height = 850 *scale_y;
52+ }
53+
54+ switch (style){
55+ case " default" :
56+ draw_sprite_ext (spr_data_slate,1 , XX,YY, scale_x, scale_y, 0 , c_white, 1 );
57+ break ;
58+ case " decorated" :
59+ draw_sprite_stretched (spr_data_slate_back, 0 , XX,YY, width, height);
60+ draw_sprite_stretched (spr_slate_side, 0 , XX,YY, width, height);
61+ draw_rectangle_color_simple (xx,YY, XX+width,YY+height, 0 , blend_col, 0.05 );
62+ break ;
63+
64+ case " plain" :
65+ draw_sprite_stretched (spr_data_slate_back, 0 , XX,YY, width, height);
66+ draw_rectangle_color_simple (xx,YY, XX+width,YY+height, 0 , blend_col, 0.05 );
67+ break ;
68+ }
69+
70+ if (is_callable (inside_method)){
71+ inside_method ();
72+ }
73+ if (static_line<=10 ) then draw_set_alpha (static_line/10 );
74+ if (static_line>10 ) then draw_set_alpha (1 -((static_line-10 )/10 ));
75+ draw_set_color (5998382 );
76+ var line_move = YY+(70 *scale_y)+((36 *scale_y)*static_line);
77+ draw_line (XX+(30 *scale_x),line_move,XX+(820 *scale_x),line_move);
78+ draw_set_alpha (1 );
79+ if (irandom (75 )=0 && static_line>1 ){static_line--;}
80+ else {
81+ static_line+=0.1 ;
82+ }
83+ if (static_line>20 ) then static_line=1 ;
84+ draw_set_color (c_gray);
85+ draw_set_halign (fa_center);
86+ var draw_height = 5 ;
87+ if (title!=" " ){
88+ draw_text_transformed (XX+(0.5 *width), YY+(50 *scale_y), title, 3 *scale_x, 3 *scale_y, 0 );
89+ draw_height += (string_height (title)*3 )*scale_y;
90+ }
91+ if (sub_title!=" " ){
92+ draw_text_transformed (XX+(0.5 *width), YY+(50 *scale_y)+draw_height, sub_title, 2 *scale_x, 2 *scale_y, 0 );
93+ draw_height+=(25 *scale_y) +(string_height (sub_title)*2 )*scale_y;
94+ }
95+ if (body_text!=" " ){
96+ draw_text_ext (XX+(0.5 *width), YY+(50 *scale_y)+draw_height, string_hash_to_newline (body_text), -1 , width-60 );
97+ }
98+ switch (style){
99+ case " decorated" :
100+ var _slate_scalex = width/sprite_get_width (spr_slate_side);
101+ var _slate_scaley = height/sprite_get_height (spr_slate_side);
102+ draw_sprite (spr_data_slate_corner_decoration, 0 ,XX+width - (70 *_slate_scalex), YY + (7 *_slate_scaley));
103+ break ;
104+
105+ }
106+ }
107+
108+ static draw_cut = function (xx,yy, scale_x=1 , scale_y=1 , middle_percent=percent_cut){
109+ XX=xx;
110+ YY=yy;
111+ draw_sprite_part_ext (spr_data_slate,1 , 0 , 0 , 850 , 69 , XX, YY, scale_x, scale_y, c_white, 1 );
112+ draw_sprite_part_ext (spr_data_slate,1 , 0 , 69 , 850 , 683 *(middle_percent/100 ), XX, YY+(69 *scale_y), scale_x, scale_y, c_white, 1 );
113+ draw_sprite_part_ext (spr_data_slate,1 , 0 , 752 , 850 , 98 , XX, YY+(69 +683 *((middle_percent/100 )))*scale_y, scale_x, scale_y, c_white, 1 );
114+ width = 860 *scale_x;
115+ height = (69 +(683 *(middle_percent/100 ))+98 )*scale_y;
116+ if (is_callable (inside_method)){
117+ inside_method ();
118+ }
119+ }
120+
121+ static percent_mod_draw_cut = function (xx,yy, scale_x=1 , scale_y=1 , mod_edit=1 ){
122+ percent_cut = min (percent_cut+mod_edit, 100 );
123+ if (!percent_cut) then percent_cut=0 ;
124+ draw_cut (xx,yy, scale_x, scale_y);
125+ }
126+ }
127+
128+
129+
130+
131+
1132function draw_building_builder (xx, yy, req_require, building_sprite){
2133 var clicked =false ;
3134 draw_sprite_ext (building_sprite, 0 , xx, yy, 0.5 , 0.5 , 0 , c_white, 1 );
@@ -41,7 +172,7 @@ function DataSlateMKTwo()constructor{
41172 }
42173}
43174
44- function RackAndPinion (Type=" forward" ) constructor{
175+ function RackAndPinion (Type=" forward" , scale = 1 ) constructor{
45176 reverse =false ;
46177 rack_y=0 ;
47178 rotation = 360 ;
@@ -189,25 +320,35 @@ function ShutterButton() constructor{
189320 height=0 ;
190321 right_rack = new RackAndPinion ();
191322 left_rack = new RackAndPinion (" backward" );
323+ background = new DataSlate ();
324+ background.style = " plain" ;
325+
326+ /* draw_with_dimensions = function(xx,yy, ,width, entered){
327+ draw_shutter();
328+ }*/
329+
192330 draw_shutter = function (xx,yy,text, scale=1 , entered = " " ){
193331 XX=xx;
194332 YY=yy;
195333 draw_set_alpha (1 );
196-
334+ self.scale = scale;
335+ self.text = text;
197336 draw_set_font (fnt_40k_12);
198337 draw_set_halign (fa_left);
199338 draw_set_color (c_gray);
200339 width = Width *scale;
201340 height = Height *scale;
202341 if (text==" " ) then entered = false ;
342+
203343 if (entered==" " ){
204344 entered = scr_hit (xx, yy, xx+width, yy+height);
205345 } else {
206346 entered=entered;
207347 }
348+
208349 var shutter_backdrop = 5 ;
209350 if (entered || click_timer>0 ){
210- if (time_open<20 ){
351+ if (time_open<24 ){
211352 time_open++;
212353 right_rack.draw (xx+width, yy, false , false );
213354 left_rack.draw (xx, yy, false , false );
@@ -227,28 +368,32 @@ function ShutterButton() constructor{
227368 right_rack.draw (xx+width, yy, true );
228369 left_rack.draw (xx, yy, true );
229370 }
230- var text_draw = xx+(width/ 2 )-( string_width (text)*( 3 *scale)/ 2 );
371+
231372 var main_sprite = 0 ;
232373 if (time_open<2 ){
233374 draw_sprite_ext (spr_shutter_button, main_sprite, xx, yy, scale, scale, 0 , c_white, 1 )
234- } else if (time_open<8 && time_open>=2 ){
235- main_sprite=1 ;
236- }else if (time_open<13 && time_open>=8 ){
237- main_sprite=2 ;
238- }else if (time_open<18 && time_open>=13 ){
239- main_sprite=3 ;
240- } else if (time_open>=18 ){
241- main_sprite=4 ;
242- }
243- if (time_open>=2 ){
244- draw_sprite_ext (spr_shutter_button, shutter_backdrop, xx, yy, scale, scale, 0 , c_white, 1 )
245- draw_set_color (c_red);
246- if (click_timer>0 ){
247- draw_text_transformed (text_draw, yy+(24 *scale), text, 3 *scale, 3 *scale, 0 );
248- } else {
249- draw_text_transformed (text_draw, yy+(20 *scale), text, 3 *scale, 3 *scale, 0 );
375+ } else if (time_open>=2 ){
376+
377+ main_sprite=floor (time_open/6 ) + 1 ;
378+
379+ // draw_sprite_ext(spr_shutter_button, shutter_backdrop, xx, yy, scale, scale, 0, c_white, 1)
380+ background.inside_method = function (){
381+ var yy = YY;
382+ var xx = XX;
383+ var text_draw = xx+(width/2 )-(string_width (text)*(3 *scale)/2 );
384+ if (scr_hit (xx, yy, xx+width, yy+height)){
385+ draw_rectangle_color_simple (xx, yy, xx+width, yy+height, false , CM_GREEN_COLOR, 0.35 )
386+ }
387+ draw_set_halign (fa_left);
388+ draw_set_color (c_red);
389+ if (click_timer>0 ){
390+ draw_text_transformed (text_draw, yy+(24 *scale), text, 3 *scale, 3 *scale, 0 );
391+ } else {
392+ draw_text_transformed (text_draw, yy+(20 *scale), text, 3 *scale, 3 *scale, 0 );
393+ }
250394 }
251- draw_sprite_ext (spr_shutter_button, main_sprite, xx, yy, scale, scale, 0 , c_white, 1 )
395+ background.draw_with_dimensions (xx, yy, width, height);
396+ draw_sprite_ext (spr_shutter_button, main_sprite, xx, yy, scale, scale, 0 , c_white, 1 );
252397 }
253398 draw_set_color (c_grey);
254399 if (click_timer>7 ){
@@ -260,85 +405,5 @@ function ShutterButton() constructor{
260405 }
261406}
262407
263- function DataSlate () constructor{
264- static_line=1 ;
265- title=" " ;
266- sub_title=" " ;
267- body_text = " " ;
268- inside_method = " " ;
269- XX=0 ;
270- YY=0 ;
271- width=0 ;
272- height=0 ;
273- percent_cut=0 ;
274-
275- static entered = function (){
276- return (scr_hit (
277- XX-4 ,
278- YY,
279- XX + width,
280- YY + height,
281- ));
282- }
283- static draw_with_dimensions = function (xx,yy, width , height){
284- var _scale_x = width/860 ;
285- var _scale_y = height/850 ;
286- draw (xx,yy, _scale_x, _scale_y);
287- }
288- static draw = function (xx,yy, scale_x=1 , scale_y=1 ){
289- XX=xx;
290- YY=yy;
291- width = 860 *scale_x;
292- height = 850 *scale_y;
293- draw_sprite_ext (spr_data_slate,1 , xx,yy, scale_x, scale_y, 0 , c_white, 1 );
294- if (is_callable (inside_method)){
295- inside_method ();
296- }
297- if (static_line<=10 ) then draw_set_alpha (static_line/10 );
298- if (static_line>10 ) then draw_set_alpha (1 -((static_line-10 )/10 ));
299- draw_set_color (5998382 );
300- var line_move = yy+(70 *scale_y)+((36 *scale_y)*static_line);
301- draw_line (xx+(30 *scale_x),line_move,xx+(820 *scale_x),line_move);
302- draw_set_alpha (1 );
303- if (irandom (75 )=0 && static_line>1 ){static_line--;}
304- else {
305- static_line+=0.1 ;
306- }
307- if (static_line>20 ) then static_line=1 ;
308- draw_set_color (c_gray);
309- draw_set_halign (fa_center);
310- var draw_height = 5 ;
311- if (title!=" " ){
312- draw_text_transformed (xx+(0.5 *width), yy+(50 *scale_y), title, 3 *scale_x, 3 *scale_y, 0 );
313- draw_height += (string_height (title)*3 )*scale_y;
314- }
315- if (sub_title!=" " ){
316- draw_text_transformed (xx+(0.5 *width), yy+(50 *scale_y)+draw_height, sub_title, 2 *scale_x, 2 *scale_y, 0 );
317- draw_height+=(25 *scale_y) +(string_height (sub_title)*2 )*scale_y;
318- }
319- if (body_text!=" " ){
320- draw_text_ext (xx+(0.5 *width), yy+(50 *scale_y)+draw_height, string_hash_to_newline (body_text), -1 , width-60 );
321- }
322- }
323- static draw_cut = function (xx,yy, scale_x=1 , scale_y=1 , middle_percent=percent_cut){
324- XX=xx;
325- YY=yy;
326- draw_sprite_part_ext (spr_data_slate,1 , 0 , 0 , 850 , 69 , XX, YY, scale_x, scale_y, c_white, 1 );
327- draw_sprite_part_ext (spr_data_slate,1 , 0 , 69 , 850 , 683 *(middle_percent/100 ), XX, YY+(69 *scale_y), scale_x, scale_y, c_white, 1 );
328- draw_sprite_part_ext (spr_data_slate,1 , 0 , 752 , 850 , 98 , XX, YY+(69 +683 *((middle_percent/100 )))*scale_y, scale_x, scale_y, c_white, 1 );
329- width = 860 *scale_x;
330- height = (69 +(683 *(middle_percent/100 ))+98 )*scale_y;
331- if (is_callable (inside_method)){
332- inside_method ();
333- }
334- }
335-
336- static percent_mod_draw_cut = function (xx,yy, scale_x=1 , scale_y=1 , mod_edit=1 ){
337- percent_cut = min (percent_cut+mod_edit, 100 );
338- if (!percent_cut) then percent_cut=0 ;
339- draw_cut (xx,yy, scale_x, scale_y);
340- }
341- }
342-
343408
344409
0 commit comments