Unity3D技术之获取关卡的流进度语法详解

Application.GetStreamProgressForLevel 获取关卡的流进度

 

 

static function GetStreamProgressForLevel (levelIndex : int) : float

 

Description描述

 

How far has the download progressed? [01]

 

下载的进度是多少?

 

In the webplayer this returns the progress of this level.

 

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

 

参见: CanStreamedLevelBeLoaded 函数.

 

C#

 

JavaScript

 

 

using UnityEngine;using System.Collections;public class example : 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();

                }

        }

}

// Print on a guiText how much has been streamed level at index 1

//在文本框打印在场景1里下载了多少?// When finished streaming, print "Level 1 has been fully streamed!"

//当完成时,打印"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();

        }

}

 

static function GetStreamProgressForLevel (levelName : string) : float

 

Description描述

 

How far has the download progressed? [01]

 

 

下载的进度是多少?

 

In the webplayer this returns the progress of this level.

 

 

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

 

参见: CanStreamedLevelBeLoaded 函数

 

C#

 

JavaScript

 

 

using UnityEngine;using System.Collections;public class example : 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();

                }

        }

}

// Print on a guiText how much has been streamed "Level1"//在文本框打印在场景"Level1"里下载了多少?// When finished streaming, 

 

 

print "Level1 has been fully streamed!"//当完成时,

 

 

打印"Level 1 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();

        }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值