43 lines
906 B
C#
43 lines
906 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Photon.Pun;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class MenuController : MonoBehaviourPunCallbacks
|
|
{
|
|
|
|
public GameObject connectingPanel;
|
|
|
|
void Start()
|
|
{
|
|
if(PhotonNetwork.IsConnected){
|
|
connectingPanel.SetActive(false);
|
|
}else{
|
|
connectingPanel.SetActive(true);
|
|
PhotonNetwork.ConnectUsingSettings();
|
|
}
|
|
}
|
|
|
|
public override void OnConnectedToMaster()
|
|
{
|
|
base.OnConnectedToMaster();
|
|
|
|
connectingPanel.SetActive(false);
|
|
}
|
|
|
|
|
|
public void Play(){
|
|
|
|
PhotonNetwork.JoinRandomOrCreateRoom(new ExitGames.Client.Photon.Hashtable(), 2);
|
|
connectingPanel.SetActive(true);
|
|
}
|
|
|
|
public override void OnJoinedRoom()
|
|
{
|
|
base.OnJoinedRoom();
|
|
|
|
SceneManager.LoadScene("Game");
|
|
}
|
|
}
|