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.

PCKPacker

Hérite de : RefCounted < Object

Crée des paquets qui peuvent être chargés dans un projet lancé.

Description

PCKPacker est utilisé pour créer des paquets qui peuvent être chargés dans un projet en cours d'exécution en utilisant ProjectSettings.load_resource_pack().

var packer = PCKPacker.new()
packer.pck_start("test.pck")
packer.add_file("res://text.txt", "text.txt")
packer.flush()

Le PCKPacker ci-dessus crée le paquet test.pck, puis ajoute un fichier nommé text.txt à la racine du paquet.

Note : PCK est le format de fichier de paquet propre à Godot. Pour créer des archives ZIP qui peuvent être lues par n'importe quel programme, utilisez plutôt ZIPPacker.

Méthodes

Error

add_file(target_path: String, source_path: String, encrypt: bool = false)

Error

add_file_from_buffer(target_path: String, data: PackedByteArray, encrypt: bool = false)

Error

add_file_removal(target_path: String)

Error

flush(verbose: bool = false)

Error

pck_start(pck_path: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = false)


Descriptions des méthodes

Error add_file(target_path: String, source_path: String, encrypt: bool = false) 🔗

Ajoute le fichier source_path au paquet PCK actuel au chemin interne target_path. Le préfixe res:// pour target_path est facultatif et retiré en interne. Le contenu du fichier est immédiatement écrit au 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) 🔗

Enregistre une suppression de fichier au chemin interne target_path vers le PCK. Ceci est principalement utilisé pour les patches. Si le fichier de ce chemin a été chargé d'un PCK précédent, il sera supprimé. Le préfixe res:// pour target_path est facultatif et retiré en interne.


Error flush(verbose: bool = false) 🔗

Écrit le répertoire du fichier et ferme le PCK. Si verbose vaut true, une liste des fichiers ajoutés sera affichée à la console pour faciliter le débogage.

Note : PCKPacker appellera automatiquement cette méthode lorsqu'il sera libéré, ce qui se produit quand il sort de la portée ou quand null lui est affecté. En C#, la référence doit être éliminée après utilisation, soit avec l'instruction using, soit en appelant la méthode Dispose directement.


Error pck_start(pck_path: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = false) 🔗

Crée un nouveau fichier PCK avec le chemin de fichier pck_path. L'extension de fichier .pck n'est pas ajoutée automatiquement, elle doit donc être présente dans pck_path (mais cela n'est pas indispensable).