private void OnDestroy() { if (peer != null && peer.PeerState == PeerStateValue.Connected) { peer.Disconnect(); } }
private void OnDisable() { if (null != clientpeer) { clientpeer.Disconnect(); } }
private void OnDestroy() { if (peer != null && peer.PeerState == PeerStateValue.Disconnected) //判断连接状态 { peer.Disconnect(); //断开连接 } }
private void OnDestroy() { if (peer != null && peer.PeerState == PeerStateValue.Connected) // 当脚本销毁时,如果peer不为空且连接状态处于连接时,断开连接 { peer.Disconnect(); } }
private static bool CheckConnection(string serverAddress, string appId, ConnectionProtocol protocol) { var listner = new PhotonListener(false); var peer = new PhotonPeer(listner, protocol); if (!peer.Connect(serverAddress, appId)) { return(false); } var counter = 100; while (--counter > 0) { peer.Service(); if (listner.WaitForConnection(0)) { var res = peer.PeerState == PeerStateValue.Connected; peer.Disconnect(); return(res); } Thread.Sleep(50); } return(false); }
public override void ShutDown() { if (peer != null && peer.PeerState == PeerStateValue.Connected) { peer.Disconnect(); } }
public void OnDestroy() { if (selfPeer != null) { selfPeer.Disconnect(); } }
public void Close() { PhotonClient.Disconnect(); StopService(); StopExecute(); }
private void Disconnect() { if (PhotonPeer != null) { PhotonPeer.Disconnect(); } }
private void ExecuteCommand(string cmd) { if (!connected) { return; } switch (cmd.Trim().ToLower()) { case "push": { Dictionary <byte, object> parameters = new Dictionary <byte, object> { { (byte)ParameterCode.Type, (byte)ClientSettings.Default.PushType }, { (byte)ParameterCode.Body, ClientSettings.Default.Body }, { (byte)ParameterCode.Title, ClientSettings.Default.Title } }; mPeer.OpCustom((byte)SelectCharacterOperationCode.SendPushToPlayers, parameters, true); Console.WriteLine("push sended"); } break; case "exit": { mPeer.Disconnect(); mLoopStarted = false; } break; } }
/// <summary> /// 切断 /// </summary> public void Disconnect() { if (Peer != null) { Peer.Disconnect(); Peer = null; } }
void OnDestroy() { //判断是否已经断开连接 if (peer.PeerState == PeerStateValue.Disconnected) { peer.Disconnect(); } }
//当游戏关闭的时候(停止运行)调用OnDestroy private void OnDestroy() { //如果peer不等于空并且状态为正在连接 if (peer != null && peer.PeerState == PeerStateValue.Connected) { peer.Disconnect();//断开连接 } }
protected override void OnDestroy() { //base.OnDestroy(); if (peer != null && peer.PeerState == PeerStateValue.Connected) { peer.Disconnect(); //程序退出,关闭连接 } }
void OnDestroy() { Peer.Disconnect(); // if (peer!=null&&peer.PeerState==PeerStateValue.Connected) // { // peer.Disconnect(); // } }
public void Disconnect() { if (peer != null) { peer.Disconnect(); peer = null; } }
void OnDestroy() { // explicitly disconnect if the client game object is destroyed if (Connected) { Connection.Disconnect(); } }
public void Disconnect() { if (_peer != null) { _peer.Disconnect(); } _state = new Disconnected(); }
public void SocketDisconnect() { GameDataSend(); user = null; userattribute = null; socket.Shutdown(SocketShutdown.Both); myPeer.Disconnect(); socket.Close(); }
private void OnDestroy() { try { peer.Disconnect(); } catch (Exception e) { Debug.Log(e.Message); } }
public void Disconnect() { try { peer.Disconnect(); } catch (Exception ex) { DebugReturn(DebugLevel.ERROR, ex.Message); DebugReturn(DebugLevel.ERROR, ex.StackTrace); } }
public void Disconnect() { try { if (this.peer != null) { peer.Disconnect(); } } catch (Exception ex) { throw ex; } }
private static bool CheckConnection(string serverAddress, string appId, ConnectionProtocol protocol) { var listner = new PhotonListener(false); var peer = new PhotonPeer(listner, protocol); if (!peer.Connect(serverAddress, appId)) { return false; } var counter = 100; while (--counter > 0) { peer.Service(); if (listner.WaitForConnection(0)) { var res = peer.PeerState == PeerStateValue.Connected; peer.Disconnect(); return res; } Thread.Sleep(50); } return false; }
void OnDestroy() { m_Peer.Disconnect(); }
void OnApplicationQuit() { peer.Disconnect(); }
public void OnApplicationQuit() { _photonPeer.Disconnect(); }
private void OnDestroy() { peer.Disconnect(); }
public void Disconnect() { _peer.Disconnect(); }
private void Disconnect() { m_PhotonPeer.Disconnect(); Connected = false; }
public void Disconnect() { _peer.SendOutgoingCommands(); _peer.Disconnect(); }
// Thread method that implements a finite state machine to connect to photon server and send outgoing messages periodically private void photonUpdate() { // Keep looping until conditions are met to terminate and exit fsm while (currState != State.TERMINATED) { // Print out if any state transitions have been made if (prevState != currState) { Log.debug("PhotonLiteCommManager: " + getStateString(prevState) + " -> " + getStateString(currState)); } // Make copy of current state prevState = currState; // Take action based on current state and whether we are in normal // operation mode or trying to terminate switch (currState) { case State.DISCONNECTED: // No connections exist and no pending connections { if (terminateRequested) { // Indicate to the fsm to stop and exit currState = State.TERMINATED; } else { // Try (re)connecting to the photon server currState = State.CONNECTING; Log.debug("PhotonLiteCommManager: Connecting to Photon server at " + ipAddress); peer.Connect(ipAddress, roomName); } break; } case State.CONNECTING: // Current connecting to server { if (terminateRequested) { // Cancel request to connect to server currState = State.DISCONNECTING; peer.Disconnect(); } else { // Do nothing, just wait for response } break; } case State.CONNECTED: // Connected to the server, no request to join room sent yet { if (terminateRequested) { // Disconnect from the server currState = State.DISCONNECTING; peer.Disconnect(); } else { // Connected to Photon server, now join our game Log.debug("PhotonLiteCommManager: Joining room \"" + roomName + "\""); currState = State.JOINING; Dictionary <byte, object> opParams = new Dictionary <byte, object>(); opParams[LiteOpKey.GameId] = roomName; peer.OpCustom((byte)LiteOpCode.Join, opParams, true); } break; } case State.JOINING: // Currently joining a room { if (terminateRequested) { // Cancel request to join room currState = State.LEAVING; Dictionary <byte, object> opParams = new Dictionary <byte, object>(); opParams[LiteOpKey.GameId] = roomName; peer.OpCustom((byte)LiteOpCode.Leave, opParams, true); } else { // Do nothing, just wait for response } break; } case State.JOINED: // Connected to both server and game { if (terminateRequested) { // Leave the room first currState = State.LEAVING; Dictionary <byte, object> opParams = new Dictionary <byte, object>(); opParams[LiteOpKey.GameId] = roomName; peer.OpCustom((byte)LiteOpCode.Leave, opParams, true); } else { // We are within a game room. Send any messages waiting // on our outgoing queue sendOutgoing(); } break; } default: break; } // Print out if any state transitions have been made if (prevState != currState) { Log.debug("PhotonLiteCommManager: " + getStateString(prevState) + " -> " + getStateString(currState)); } // Make copy of current state prevState = currState; // Communicate with Photon server peer.Service(); // Wait a while before talking with server again System.Threading.Thread.Sleep(updateSleepTime_ms); } }