PCKPacker

继承: RefCounted < Object

Creates packages that can be loaded into a running project.

描述

The PCKPacker is used to create packages that can be loaded into a running project using 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();

The above PCKPacker creates package test.pck, then adds a file named text.txt at the root of the package.

方法

Erroradd_file ( pck_path: String, source_path: String, encrypt: bool = false )
Errorflush ( verbose: bool = false )
Errorpck_start ( pck_path: String, alignment: int = 32, key: String = "0000000000000000000000000000000000000000000000000000000000000000", encrypt_directory: bool = false )

方法说明

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

Adds the source_path file to the current PCK package at the pck_path internal path (should start with res://).


Error flush ( verbose: bool = false )

Writes the files specified using all add_file calls since the last flush. If verbose is true, a list of files added will be printed to the console for easier debugging.


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

Creates a new PCK file at the file path pck_path. The .pck file extension isn't added automatically, so it should be part of pck_path (even though it's not required).

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。