Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/jackmawer/JacksWorld. An abandoned mini-project that I created while learning to use Unity with networking.
Something went wrong. Try again.
1.1 kB · 45 lines
C#
at master
12345678910111213141516171819202122232425262728293031323334353637383940414243444546using UnityEngine;using System.Collections;
public class ShowStatusWhenConnecting : MonoBehaviour { public GUISkin Skin;
void OnGUI() { if( Skin != null ) { GUI.skin = Skin; }
float width = 400; float height = 100;
Rect centeredRect = new Rect( ( Screen.width - width ) / 2, ( Screen.height - height ) / 2, width, height );
GUILayout.BeginArea( centeredRect, GUI.skin.box ); { GUILayout.Label( "Connecting" + GetConnectingDots(), GUI.skin.customStyles[ 0 ] ); GUILayout.Label( "Status: " + PhotonNetwork.connectionStateDetailed ); } GUILayout.EndArea();
if( PhotonNetwork.connectionStateDetailed == PeerState.Joined ) { enabled = false; } }
string GetConnectingDots() { string str = ""; int numberOfDots = Mathf.FloorToInt( Time.timeSinceLevelLoad * 3f % 4 );
for( int i = 0; i < numberOfDots; ++i ) { str += " ."; }
return str; }}