Pixel-Composer/objects/o_dialog_release_note/Other_62.gml

52 lines
1.2 KiB
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
2024-04-09 05:32:00 +02:00
var _id = ds_map_find_value(async_load, "id");
var _status = ds_map_find_value(async_load, "status");
if (_id == note_get) {
if (_status == 0) {
2022-01-13 05:24:03 +01:00
note = ds_map_find_value(async_load, "result");
alarm[0] = 1;
}
2024-04-09 05:32:00 +02:00
} else if (_id == dl_get) {
if (_status == 0) {
var res = ds_map_find_value(async_load, "result");
dls = json_try_parse(res, []);
for( var i = 0, n = array_length(dls); i < n; i++ ) {
2024-04-10 05:02:23 +02:00
var _v = dls[i].version;
2024-04-09 05:32:00 +02:00
dls[i].status = 0;
dls[i].download_path = "";
dls[i].size_total = 0;
dls[i].size_downloaded = 0;
2024-04-10 05:02:23 +02:00
if(struct_has(PREFERENCES.versions, _v)) {
var _path = PREFERENCES.versions[$ _v];
if(file_exists(_path)) {
dls[i].status = 2;
dls[i].download_path = _path;
dls[i].size_total = file_size(_path);
}
}
2024-04-09 05:32:00 +02:00
}
2024-04-10 05:02:23 +02:00
PREF_SAVE();
2024-04-09 05:32:00 +02:00
}
} else if ( struct_has(downloading, _id)) {
var dl = downloading[$ _id];
if(_status == 0) {
dl.status = 2;
2024-04-10 05:02:23 +02:00
PREFERENCES.versions[$ dl.version] = dl.download_path;
PREF_SAVE();
2024-04-09 05:32:00 +02:00
} else if(_status == 1) {
dl.size_total = ds_map_find_value(async_load, "contentLength");
dl.size_downloaded = ds_map_find_value(async_load, "sizeDownloaded");
}
2022-01-13 05:24:03 +01:00
}