- Home /
Question by
zak666 · Jul 30, 2015 at 02:28 PM ·
scriptingbasics
Streaming and displaying score with photon?
Hit their, I would like to know if i'm on the wright track with this. I have come to my end game screen were i get usernames and scores of all players and display them on the screen in order from highest to lowest. //retreving usernames and displaying them with their high scores.... any tips on how to go about this inside of photon?
using System.Collections;
using UnityEngine.UI;
public class NetworkEndScore : MonoBehaviour {
public float OurScore = 0;
//user score game objects to set score........................................................................
public GUIText ScoreUser1;
public GUIText ScoreUser2;
public GUIText ScoreUser3;
public GUIText ScoreUser4;
public GUIText ScoreUser5;
// user Text Display Name Of Users............................................................................
public GUIText User1;
public GUIText User2;
public GUIText User3;
public GUIText User4;
public GUIText User5;
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if(stream.isWriting)
{
// Send our username to Other Players.....
stream.SendNext(global.username);
OurScore = (float)stream.ReceiveNext();
}
else
{
// Receave usernames of other Players................
// Receave scores from other players..................
global.username = stream.ReceiveNext();
OurScore = (float)stream.ReceiveNext();
global.username = stream.ReceiveNext();
OurScore = (float)stream.ReceiveNext();
global.username = stream.ReceiveNext();
OurScore = (float)stream.ReceiveNext();
global.username = stream.ReceiveNext();
OurScore = (float)stream.ReceiveNext();
}
} // end of Stream.................................................
void ONGUI ()
{
// Diplasy All Streamed Scores in order with their username...........
} // End of OnGUI..........
} // End of Class............................................................................................................
Comment
Your answer
Follow this Question
Related Questions
Digging technique counter 1 Answer
How to make one object's rotation match another? 1 Answer
number that crease and decrease 1 Answer
Creating complex colliders 1 Answer