Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
PCKPacker
Eredita: RefCounted < Object
Crea pacchetti che possono essere caricati in un progetto in esecuzione.
Descrizione
PCKPacker serve per creare pacchetti che è possibile caricare in un progetto in esecuzione attraverso ProjectSettings.load_resource_pack().
var packer = PCKPacker.new()
packer.pck_start("test.pck")
packer.add_file("res://text.txt", "text.txt")
packer.flush()
var packer = new PckPacker();
packer.PckStart("test.pck");
packer.AddFile("res://text.txt", "text.txt");
packer.Flush();
Il PCKPacker soprastante crea il pacchetto test.pck, quindi aggiunge un file denominato text.txt alla radice del pacchetto.
Nota: PCK è il formato di file impacchettato di Godot. Per creare archivi ZIP che è possibile leggere da qualsiasi programma, usa invece ZIPPacker.
Metodi
add_file(target_path: String, source_path: String, encrypt: bool = false) |
|
add_file_from_buffer(target_path: String, data: PackedByteArray, encrypt: bool = false) |
|
add_file_removal(target_path: String) |
|
pck_start(pck_path: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = false) |
Descrizioni dei metodi
Error add_file(target_path: String, source_path: String, encrypt: bool = false) 🔗
Aggiunge il file nel percorso source_path al pacchetto PCK attuale nel percorso interno target_path. Il prefisso res:// per target_path è facoltativo e rimosso internamente. Il contenuto del file viene scritto immediatamente sul PCK.
Error add_file_from_buffer(target_path: String, data: PackedByteArray, encrypt: bool = false) 🔗
Adds the data to the current PCK package at the target_path internal path. The res:// prefix for target_path is optional and stripped internally. File content is immediately written to the PCK.
Error add_file_removal(target_path: String) 🔗
Registra una rimozione di file del percorso interno target_path al PCK. Questo è usato principalmente per le patch. Se il file in questo percorso è stato caricato da un PCK precedente, verrà rimosso. Il prefisso res:// per target_path è facoltativo e rimosso internamente.
Error flush(verbose: bool = false) 🔗
Scrive la cartella dei file e chiude il PCK. Se verbose è true, sarà visualizzato un elenco dei file aggiunti sulla console per facilitare il debug.
Nota: FileAccess si chiuderà automaticamente quando viene liberato, il che accade quando esce dall'ambito o quando gli viene assegnato null. In C# il riferimento deve essere eliminato manualmente, il che può essere fatto con l'istruzione using o chiamando direttamente il metodo Dispose.
Error pck_start(pck_path: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = false) 🔗
Crea un nuovo file PCK con al percorso pck_path. L'estensione del file .pck non viene aggiunta automaticamente, quindi dovrebbe far parte di pck_path (anche se non è obbligatoria).