返回介绍

Application.GetStreamProgressForLevel 获取关卡的流数据进度

发布于 2019-12-18 15:37:18 字数 3524 浏览 829 评论 0 收藏 0

JavaScript => static function GetStreamProgressForLevel(levelIndex: int): float;
C# => static float GetStreamProgressForLevel(int levelIndex);

Description 描述

How far has the download progressed? [0…1].

下载的进度是多少?

In the webplayer this returns the progress of this level.

在web播放器中这将返回这个关卡的进度。

See Also: CanStreamedLevelBeLoaded function.

JavaScript:

	// Print on a guiText how much has been streamed level at index 1
	// When finished streaming, print "Level 1 has been fully streamed!"
	var percentageLoaded : float = 0;	function Update() {
		if(Application.GetStreamProgressForLevel(1) == 1) {
			guiText.text = "Level at index 1 has been fully streamed!";
		} else {
			percentageLoaded = Application.GetStreamProgressForLevel(1) * 100;
			guiText.text = percentageLoaded.ToString();
		}
	}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public float percentageLoaded = 0;
    void Update() {
        if (Application.GetStreamProgressForLevel(1) == 1)
            guiText.text = "Level at index 1 has been fully streamed!";
        else {
            percentageLoaded = Application.GetStreamProgressForLevel(1) * 100;
            guiText.text = percentageLoaded.ToString();
        }
    }
}

JavaScript => static function GetStreamProgressForLevel(levelName: string): float;
C# => static float GetStreamProgressForLevel(string levelName);

Description 描述

How far has the download progressed? [0…1].

下载的进度是多少?

In the webplayer this returns the progress of this level.

在web播放器中这将返回这个关卡的进度。

See Also: CanStreamedLevelBeLoaded function.

JavaScript:

	// Print on a guiText how much has been streamed "Level1"
	// When finished streaming, print "Level1 has been fully streamed!"
	var percentageLoaded : float = 0;	function Update() {
		if(Application.GetStreamProgressForLevel("Level1") == 1) {
			guiText.text = "Level 1 has been fully streamed!";
		} else {
			percentageLoaded = Application.GetStreamProgressForLevel("Level1") * 100;
			guiText.text = percentageLoaded.ToString();
		}
	}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public float percentageLoaded = 0;
    void Update() {
        if (Application.GetStreamProgressForLevel("Level1") == 1)
            guiText.text = "Level 1 has been fully streamed!";
        else {
            percentageLoaded = Application.GetStreamProgressForLevel("Level1") * 100;
            guiText.text = percentageLoaded.ToString();
        }
    }
}

Application

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文