Page 1 sur 2

stream level

Publié : 22 Avr 2013 18:15
par namursite
hello une semaine
que je cherche , je voudrais faire du stream avec http://pastebin.com/pWLFMW46 depuis un serveur .


j en ai trouver un qui pas d 'erreur .

----

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class GameLoading : MonoBehaviour {

int progress;
void Start()
{

string url = "http://monsite.be/1objets/scene 1.unity3d";
StartCoroutine(StartDownloadScene(url));

}

void Update()
{

}

void OnGUI()
{
Vector2 pos = new Vector2(20, 40);
Vector2 size = new Vector2(360, 10);

GUIStyle customStyle = new GUIStyle();
Texture2D tex = new Texture2D(10, 10);
tex.SetPixel(10, 10, Color.gray);
customStyle.normal.background = tex;

if (progress != 100)
{
GUILayout.Label(progress + "%");
GUI.BeginGroup(new Rect(pos.x, pos.y, progress, size.y));

// Define progress bar texture within customStyle under Normal > Background
GUI.Box(new Rect(0, 0, size.x, size.y), "", customStyle);

// Always match BeginGroup calls with an EndGroup call
GUI.EndGroup();


}
}

IEnumerator StartDownloadScene(string url)
{
WWW download = new WWW(url);
while (!download.isDone)
{
//Ici on gère la barre de progression
progress = System.Convert.ToInt32(download.progress * 100);

//On attend sagement la fin du téléchargement
yield return null;
}
//On charge la scène ainsi téléchargée.
Application.LoadLevelAdditive("scene 1");
}


}


mais j ai dans uniity , le message suivant

can' t add scrip behaviour ; the scripts file name does not match the name of class defined in the script

comment faut il l ' appliquer .

je obstiné mais je commence haaaaaa , merci pour votre aide ;-) .

Re: stream level

Publié : 22 Avr 2013 18:21
par Max
namursite a écrit :can' t add scrip behaviour ; the scripts file name does not match the name of class defined in the script
En C# (pour résumer) ton fichier doit avoir le même nom que la classe définis, soit GameLoading.cs

Sinon, par pitié, crénondédiousse, utilises les balises

Code : Tout sélectionner

[/code.]  [img]http://r26.imgfast.net/users/2612/65/52/49/smiles/54660.gif[/img]
[size=65](edit message cela serait bien, sous peine de voir ton sujet vérouillé)[/size]

Re: stream level

Publié : 22 Avr 2013 18:46
par yoyoyaya
J'ai l'impression de lire pauslsta là. :roll:

Re: stream level

Publié : 22 Avr 2013 21:07
par namursite
// j aime bien le crénondédiousse, oui pardon les balises

merci une fois de plus pfff une bêtise , merci .

mais maintenant il ne va pas chercher le fichier sur le serveur mais lui même en boucle

vous avez compris que je ne suis pas programmeur ,




using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class GameLoading : MonoBehaviour {

int progress;
void Start()
{

string url = "http://namursite.be/1objets/GameLoading.unity3d";
StartCoroutine(StartDownloadScene(url));

}

void Update()
{

}

void OnGUI()
{
Vector2 pos = new Vector2(20, 40);
Vector2 size = new Vector2(360, 10);

GUIStyle customStyle = new GUIStyle();
Texture2D tex = new Texture2D(10, 10);
tex.SetPixel(10, 10, Color.gray);
customStyle.normal.background = tex;

if (progress != 100)
{
GUILayout.Label(progress + "%");
GUI.BeginGroup(new Rect(pos.x, pos.y, progress, size.y));

// Define progress bar texture within customStyle under Normal > Background
GUI.Box(new Rect(0, 0, size.x, size.y), "", customStyle);

// Always match BeginGroup calls with an EndGroup call
GUI.EndGroup();


}
}

IEnumerator StartDownloadScene(string url)
{
WWW download = new WWW(url);
while (!download.isDone)
{
//Ici on gère la barre de progression
progress = System.Convert.ToInt32(download.progress * 100);

//On attend sagement la fin du téléchargement
yield return null;
}
//On charge la scène ainsi téléchargée.
Application.LoadLevelAdditive("scene1");
}


}


heuuu , vous n 'avez sous la main un pack :-) qui fonctionne :-)[

encore merci d'avance pour votre gentillesse

Re: stream level

Publié : 22 Avr 2013 21:18
par cayou66
Et sinon les balises codes?

Re: stream level

Publié : 22 Avr 2013 21:18
par cayou66
yoyoyaya a écrit :J'ai l'impression de lire pauslsta là. :roll:
+100

Re: stream level

Publié : 22 Avr 2013 21:35
par namursite

Code : Tout sélectionner

Bon honnètement  les balises  , je ne le fais pas  exprès , vous parlez des smileys  ,   
:|

cette étape est la plus importante car je pourrai démarrer mon projet , j ai la plus part des scripts qui fonctionnent .

donc merci de votre compréhension , + 100 une petite précision :idea:

Re: stream level

Publié : 22 Avr 2013 21:50
par cayou66
Édite tes posts pour rajouter les balises codes, si tu sais pas comment faire, demande.
C'est pas compliqué, on comprend rien à un code sans ça.

Re: stream level

Publié : 22 Avr 2013 22:04
par namursite

Code : Tout sélectionner

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class GameLoading : MonoBehaviour {

	int progress;
	void Start()
	{

		string url = "http://namursite.be/1objets/GameLoading.unity3d";	
		StartCoroutine(StartDownloadScene(url));

	}

	void Update()
	{
     
	}

	void OnGUI()
	{
		Vector2 pos = new Vector2(20, 40);
		Vector2 size = new Vector2(360, 10);

		GUIStyle customStyle = new GUIStyle();
		Texture2D tex = new Texture2D(10, 10);
		tex.SetPixel(10, 10, Color.gray);
		customStyle.normal.background = tex;

		if (progress != 100)
		{
			GUILayout.Label(progress + "%");
			GUI.BeginGroup(new Rect(pos.x, pos.y, progress, size.y));

			// Define progress bar texture within customStyle under Normal > Background
			GUI.Box(new Rect(0, 0, size.x, size.y), "", customStyle);

			// Always match BeginGroup calls with an EndGroup call
			GUI.EndGroup();


		}
	}

IEnumerator StartDownloadScene(string url)
        {
                WWW download = new WWW(url);
                while (!download.isDone)
                {
                        //Ici on gère la barre de progression
                        progress = System.Convert.ToInt32(download.progress * +100);
                       
                        //On attend sagement la fin du téléchargement
                        yield return null;
                }
                //On charge la scène ainsi téléchargée.
                Application.LoadLevelAdditive("scene1");            
	}

	
}

Re: stream level

Publié : 23 Avr 2013 09:36
par namursite
bon je suppose que bon maintenant pour les balises ( voir posts précédents )
merci d avance ;-)