Пример #1
0
    public void Shutdown()
    {
        if (!Persistent.Instance.isNetworkActive)
        {
            return;
        }

        int Result = 0;

        if (!Persistent.Instance.isServer && AndrickPlugin.DidServerAcceptOurConnection(ref Result) == 1)
        {
            AndrickPlugin.DisconnectUser();
        }

        if (AndrickPlugin.ShutdownNetwork() == 0)
        {
            Debug.Log("Shutdown is a no-go");
        }
        else
        {
            Debug.Log("I've died inside again");
        }

        Persistent.Instance.isNetworkActive = false;
    }
Пример #2
0
    IEnumerator WaitForClientConnectingResult(ClientConnectionInfo ClientInfo)
    {
        StartCoroutine(ElipseLoader());
        float WaitCounter = 0.0f;

        if (!AndrickPlugin.ActivateClient(ClientInfo.ipAddress, ClientInfo.username))
        {
            Debug.Log("Failed to successfully activate the client.");
            GetSceneTracker().LoadSceneSynchronously(SceneInfoList.TITLE_MENU);
        }
        else
        {
            while (!AndrickPlugin.DidWeInitiallyConnectToServer())
            {
                if (WaitCounter >= MAX_WAIT_TIME)
                {
                    Debug.Log("Wait time is too long for initial connection.");
                    GetSceneTracker().LoadSceneSynchronously(SceneInfoList.TITLE_MENU);
                    yield return(null);
                }

                AndrickPlugin.ProcessPackets();
                AndrickPlugin.ExecuteEvents();
                AndrickPlugin.SendPackets();
                WaitCounter += Time.deltaTime;
                yield return(new WaitForEndOfFrame());
            }

            WaitCounter = 0.0f;
            int Result = 0;
            while (AndrickPlugin.DidServerAcceptOurConnection(ref Result) == 0)
            {
                if (WaitCounter >= MAX_WAIT_TIME)
                {
                    Debug.Log("Wait time is too long for server authentification.");
                    GetSceneTracker().LoadSceneSynchronously(SceneInfoList.TITLE_MENU);
                    yield return(null);
                }

                AndrickPlugin.ProcessPackets();
                AndrickPlugin.ExecuteEvents();
                AndrickPlugin.SendPackets();
                WaitCounter += Time.deltaTime;
                yield return(new WaitForEndOfFrame());
            }

            ClientConnectionCoroutine = null;

            if (Result == 1)
            {
                GetSceneTracker().LoadSceneSynchronously(SceneInfoList.LOBBY);
            }
            else
            {
                GetSceneTracker().LoadSceneSynchronously(SceneInfoList.TITLE_MENU);
            }
        }

        IsLoading = false;
        yield return(null);
    }