TouhouLS/Assets/RealCode/Menu/ButtonS/ButtonDisconnect.cs

21 lines
623 B
C#
Raw Normal View History

2020-08-22 05:29:00 +00:00
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();
}
}
}