Reset() 공개 메소드

public Reset ( ) : void
리턴 void
    public void Cancel()
    {
        if (verboseLogging)
        {
            Debug.Log("Game DisConnect");
        }

        if (gameHasStarted)
        {
            if (IsHost())
            {
                SendGame();
            }

            gameHasStarted = false;
            Invoke("Cancel", 0.1f);
            return;
        }

        // ここで CancelInvoke(maybeStartHostingFunction)を使うと特定の状況でクラッシュ
        CancelInvoke();

        if (discoveryClient.running && discoveryClient.hostId != -1)
        {
            discoveryClient.StopBroadcast();
        }

        discoveryClient.Reset();

        if (discoveryServer.running && discoveryServer.hostId != -1)
        {
            discoveryServer.StopBroadcast();
        }

        discoveryServer.Reset();

        StopClient();
        StopServer();

        if (NetworkServer.active)
        {
            NetworkServer.Reset();
        }
    }
예제 #2
0
    public void Cancel()
    {
        if (verboseLogging)
        {
            Debug.Log("#CaptainsMess# Cancelling!");
        }

        if (gameHasStarted)
        {
            if (IsHost())
            {
                SendAbortGameMessage();
            }
            gameHasStarted = false;
            Invoke("Cancel", 0.1f);
            return;
        }

        // NOTE: Calling CancelInvoke(maybeStartHostingFunction) here crashes the game in certain cases
        // so I'm using the more general version instead.
        CancelInvoke();

        if (discoveryClient.running && discoveryClient.hostId != -1)
        {
            discoveryClient.StopBroadcast();
        }
        discoveryClient.Reset();

        if (discoveryServer.running && discoveryServer.hostId != -1)
        {
            discoveryServer.StopBroadcast();
        }
        discoveryServer.Reset();

        StopClient();
        StopServer();

        if (NetworkServer.active)
        {
            NetworkServer.Reset();
        }
    }