CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
[CriFs] Installing data

Description of the sample

Overview

cri4u_samples_crifs_scene03_game_mini.png

This sample installs data.
It installs a CPK file from a remote HTTP server (Step 1), binds the file (Step 2), loads a text file from the installed CPK file, and displays it.
When an image file is selected at Step 1, the sample displays the installed image file.

Operations

  • Step 1 Install from HTTP Server
    • Install CPK File button
      Installs a CPK file from a remote HTTPS server.

    • Install Image File button
      Installs an image file.

  • Step 2 Bind Installed CPK
    • Bind CPK File button
      Binds any CPK file.

  • Step 3 Load File
    • Load Image File button
      Displays the installed image file.

    • Load Text File button
      Loads a text file from the installed CPK file and displays it.

  • Reset button
    Resets the settings.

Scene information


Middleware FileMajik PRO (CRI File System)
Sample Basic samples
Location /CRIWARE/SDK/unity/samples/UnityProject/Assets/Scenes/crifilesystem/basic/
Scene file Scene_03_Install.unity


Description of the program

/* Request for the installation */
this.installRequest[request_index] = CriFsUtility.WebInstall(src_path, install_path, null);

Request the binding of the CPK file.
The binding is executed asynchronously in the background.

/* Wait untill the installation is completed. */
yield return this.installRequest[request_index].WaitForDone(this);
/* [Note]
* The request for the installation is stored on the application side.
* It is also used for a flag to avoid multiple installations.
*/
if (this.installRequest[request_index].error == null) {
Debug.Log("Completed installation." + src_path);
} else {
Debug.LogWarning("Failed installation." + src_path);
}

Wait until the installation is complete.
If null is returned, the installation was successful.

/* Issue a request for the file loading. */
var request = CriFsUtility.LoadFile(path);
/* Wait for the completion of loading. */
yield return request.WaitForDone(this);

Loads a file (if it is not a CPK file).

var request = CriFsUtility.BindCpk(this.binder, path);
yield return request.WaitForDone(this);

Binds a CPK file.