21 lines
623 B
C#
21 lines
623 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using ClientState = ExitGames.Client.Photon.LoadBalancing.ClientState;
|
|
|
|
public class ButtonDisconnect : ButtonOnClick {
|
|
|
|
public ClientState state => NetworkManager.net.State;
|
|
public bool isDisconnected => state == ClientState.Disconnected || state == ClientState.PeerCreated;
|
|
|
|
public override void OnClick() {
|
|
if (GameTransition.Instance.state == GameState.Multiplayer) {
|
|
GameTransition.Instance.state = GameState.ConnectionInProgress;
|
|
NetworkManager.net.Service();
|
|
NetworkManager.net.Disconnect();
|
|
}
|
|
}
|
|
|
|
}
|