Pixel-Composer/objects/o_dialog_release_note/Create_0.gml

86 lines
2.6 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
event_inherited();
#region data
2022-12-18 03:20:38 +01:00
dialog_w = ui(720);
dialog_h = ui(480);
2022-01-13 05:24:03 +01:00
destroy_on_click_out = true;
note = "";
2022-12-18 03:20:38 +01:00
var link = "https://gist.githubusercontent.com/Ttanasart-pt/e7ab670299ce6b00cfd632646f3ac9a8/raw/1.0.0";
note_get = http_get(link);
2022-01-13 05:24:03 +01:00
2022-11-03 11:44:49 +01:00
sp_note = new scrollPane(dialog_w - ui(80), dialog_h - ui(88), function(_y, _m) {
2022-11-18 03:20:31 +01:00
draw_clear_alpha(COLORS.panel_bg_clear, 0);
2022-12-27 04:00:50 +01:00
BLEND_OVER
2022-01-13 05:24:03 +01:00
var yy = 0;
var txt = note;
while(string_length(txt) > 0) {
var nl = string_pos("\n", txt);
var line = string_copy(txt, 1, nl - 1);
var tab = 1;
while(string_char_at(line, tab) == " " && tab < string_length(line)) tab++;
line = string_copy(line, tab, string_length(line) - tab + 1);
if(nl == 0) {
line = txt;
txt = "";
} else {
txt = string_copy(txt, nl + 1, string_length(txt) - nl);
}
var sp = string_pos(" ", line);
var md = string_copy(line, 1, sp - 1);
2022-11-03 11:44:49 +01:00
var ww = dialog_w - ui(128);
var xx = (tab - 1) * ui(8);
2022-01-13 05:24:03 +01:00
switch(md) {
case "#" :
2022-12-18 03:20:38 +01:00
draw_set_text(f_h3, fa_left, fa_top, COLORS._main_text_title);
2022-01-13 05:24:03 +01:00
line = string_copy(line, sp + 1, string_length(line) - sp);
2022-11-03 11:44:49 +01:00
yy += ui(16);
2022-01-13 05:24:03 +01:00
draw_text_ext(xx, _y + yy, line, -1, ww);
2022-11-03 11:44:49 +01:00
yy += ui(4);
2022-01-13 05:24:03 +01:00
break;
case "##" :
2022-12-18 03:20:38 +01:00
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text_title);
line = string_copy(line, sp + 1, string_length(line) - sp);
yy += ui(8);
draw_text_ext(xx + ui(16), _y + yy, line, -1, ww);
yy += ui(4);
break;
case "###" :
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_accent);
2022-01-13 05:24:03 +01:00
line = string_copy(line, sp + 1, string_length(line) - sp);
2022-11-03 11:44:49 +01:00
yy += ui(8);
draw_text_ext(xx + ui(16), _y + yy, line, -1, ww);
yy += ui(4);
2022-01-13 05:24:03 +01:00
break;
case "-" :
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
2022-01-13 05:24:03 +01:00
line = string_copy(line, sp + 1, string_length(line) - sp);
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(THEME.text_bullet, 0, xx + ui(16), _y + yy + ui(10), 1, COLORS._main_icon);
2022-11-03 11:44:49 +01:00
draw_text_ext(xx + ui(28), _y + yy, line, -1, ww);
2022-01-13 05:24:03 +01:00
break;
case "+" :
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
2022-01-13 05:24:03 +01:00
line = string_copy(line, sp + 1, string_length(line) - sp);
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(THEME.text_bullet, 1, xx + ui(16), _y + yy + ui(10), 1, COLORS._main_value_positive);
2022-11-03 11:44:49 +01:00
draw_text_ext(xx + ui(28), _y + yy, line, -1, ww);
2022-01-13 05:24:03 +01:00
break;
default :
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
2022-01-13 05:24:03 +01:00
draw_text_ext(xx + 0, _y + yy, line, -1, ww);
break;
}
yy += string_height_ext(line, -1, ww);
}
2022-12-18 03:20:38 +01:00
BLEND_NORMAL
2022-11-03 11:44:49 +01:00
return yy + ui(64);
2022-01-13 05:24:03 +01:00
})
#endregion