mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-29 08:37:58 +01:00
46 lines
1 KiB
C#
46 lines
1 KiB
C#
|
using 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.inRoom )
|
|||
|
{
|
|||
|
enabled = false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
string GetConnectingDots()
|
|||
|
{
|
|||
|
string str = "";
|
|||
|
int numberOfDots = Mathf.FloorToInt( Time.timeSinceLevelLoad * 3f % 4 );
|
|||
|
|
|||
|
for( int i = 0; i < numberOfDots; ++i )
|
|||
|
{
|
|||
|
str += " .";
|
|||
|
}
|
|||
|
|
|||
|
return str;
|
|||
|
}
|
|||
|
}
|