Ejemplo n.º 1
0
    public static IEnumerator OpenStream(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        TcpClient _socketConnection;

        try
        {
            _socketConnection = new TcpClient(ServerControlForm.GetUrl(), ServerControlForm.GetPort());
            PublicLevel.SetServerStream(_socketConnection.GetStream());
        }
        catch (SocketException socketException)
        {
            Debug.Log("SocketException " + socketException.ToString());
            StageButtonMultiplayer.NetworkErrorPanelactive();
        }
    }
Ejemplo n.º 2
0
    public static IEnumerator ListenForHostileCreatureList(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        buffer = new byte[bufferSize];
        try
        {
            Vector2Int[] _hostileType = new Vector2Int[PublicLevel.usingCreatureNum];
            PublicLevel.GetServerStream().BeginRead(buffer, 0, bufferSize, OnReceive, null);

            creatureReceiveSuccess = true;
            // load after creaturelist receive is complete
            LoadingSceneManager.LoadScene("DefaultIngameCopy");
        }
        catch (Exception listSendException)
        {
            Debug.Log("ListSendException " + listSendException.ToString());
            StageButtonMultiplayer.NetworkErrorPanelactive();
        }
        StageButtonMultiplayer.SetCreatureFlag(true);
        StageButtonMultiplayer.NetworkWaitPanelInactive();
    }