Pixel-Composer/scripts/collection_data/collection_data.gml

39 lines
902 B
Plaintext
Raw Normal View History

function FileContext(_name, _path, _subfolder = false) constructor {
2022-01-13 05:24:03 +01:00
name = _name;
path = _path;
spr = -1;
subfolder = _subfolder;
2022-01-13 05:24:03 +01:00
}
function __init_collection() {
log_message("COLLECTION", "init");
globalvar COLLECTIONS;
COLLECTIONS = -1;
2022-01-13 05:24:03 +01:00
var _ = DIRECTORY + "Collections";
var _l = _ + "\\coll" + string(VERSION);
if(!file_exists(_l)) {
log_message("COLLECTION", "unzipping new collection to DIRECTORY.");
var f = file_text_open_write(_l);
file_text_write_real(f, 0);
file_text_close(f);
zip_unzip("Collections.zip", _);
}
searchCollections();
}
function searchCollections() {
log_message("COLLECTION", "refreshing collection base folder.");
if(!directory_exists(DIRECTORY + "Collections")) {
directory_create(DIRECTORY + "Collections");
return;
}
COLLECTIONS = new DirectoryObject("Collections", DIRECTORY + "Collections");
COLLECTIONS.open = true;
2022-01-13 05:24:03 +01:00
}