forked from fchb1239/PhotonVR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhotonVRManagerGUI.cs
58 lines (50 loc) · 1.75 KB
/
PhotonVRManagerGUI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#if UNITY_EDITOR
using System;
using System.Net;
using System.IO;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEditor;
using Photon.Pun;
namespace Photon.VR
{
[CustomEditor(typeof(PhotonVRManager))]
public class PhotonVRManagerGUI : Editor
{
private Texture2D logo;
public override void OnInspectorGUI()
{
if (logo == null)
logo = Resources.Load<Texture2D>("PhotonVR/Assets/PhotonVRWide");
GUILayout.Label(new GUIContent() { image = logo });
PhotonVRManager manager = (PhotonVRManager)target;
base.OnInspectorGUI();
GUILayout.Space(10);
if (PhotonNetwork.IsConnected)
{
GUILayout.Label($"State: {PhotonVRManager.GetConnectionState()}");
GUILayout.Label($"Ping: {PhotonNetwork.GetPing()}");
GUILayout.Label($"Room: {(PhotonNetwork.InRoom ? PhotonNetwork.CurrentRoom.Name : "Not in a room")}");
if(!PhotonNetwork.InRoom && !manager.JoinRoomOnConnect)
if (GUILayout.Button(CreateContent("Join", "Join a random public lobby")))
PhotonVRManager.JoinRandomRoom("Default", 16);
}
else
if (!manager.ConnectOnAwake)
if (GUILayout.Button("Connect"))
PhotonVRManager.Connect();
}
private GUIContent CreateContent(string text, string tooltip)
{
return new GUIContent()
{
text = text,
tooltip = tooltip
};
}
}
}
#endif