GetConnectingDots









How do I use Get Connecting Dots
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: ShowStatusWhenConnecting.cs Copy
8     void OnGUI()
9     {
10         if( Skin != null )
11         {
12             GUI.skin = Skin;
13         }
14
15         float width = 400;
16         float height = 100;
17
18         Rect centeredRect = new Rect( ( Screen.width - width ) / 2, ( Screen.height - height ) / 2, width, height );
19
20         GUILayout.BeginArea( centeredRect, GUI.skin.box );
21         {
22             GUILayout.Label( "Connecting" + GetConnectingDots(), GUI.skin.customStyles[ 0 ] );
23             GUILayout.Label( "Status: " + PhotonNetwork.connectionStateDetailed );
24         }
25         GUILayout.EndArea();
26
27         if( PhotonNetwork.connectionStateDetailed == PeerState.Joined )
28         {
29             enabled = false;
30         }
31     }
File name: ShowStatusWhenConnecting.cs Copy
33     string GetConnectingDots()
34     {
35         string str = "";
36         int numberOfDots = Mathf.FloorToInt( Time.timeSinceLevelLoad * 3f % 4 );
37
38         for( int i = 0; i < numberOfDots; ++i )
39         {
40             str += " .";
41         }
42
43         return str;
44     }

GetConnectingDots 113 lượt xem

Gõ tìm kiếm nhanh...