Esempio n. 1
0
    public void Test_SendFileToOpenReceiver(ulong _connectedClient)
    {
#if UNITY_EDITOR
        string path = UnityEditor.EditorUtility.OpenFolderPanel("BE CAREFUL: Choose a folder to test sending with", "", "*");
        if (path.Length != 0)
        {
            LargeRPC download = new LargeRPC("gameDownload");
            download.SendFiles(new List <string>(Directory.GetFiles(path)), NetworkingManager.Singleton.ConnectedClients[_connectedClient].ClientId);
        }
#endif
    }
Esempio n. 2
0
    void RequestDownloads()
    {
        ProgressUI.SetMessage("Downloading files", "Waiting for headers...");
        ProgressUI.Show();

        Debug.Log("Requesting downloads");
        LargeRPC download = new LargeRPC("InitialGameDownload");

        download.ListenForDownload();
        download.OnDownloadComplete += FinishedDownloadingFromHost;
        download.OnProgressUpdated  += UpdateProgressBar;

        CustomMessagingManager.SendNamedMessage("DownloadFilesRequest", NetworkingManager.Singleton.ServerClientId, Stream.Null);
    }
Esempio n. 3
0
    void DownloadRequestReceived(ulong _requesterClientID, Stream _data)
    {
        Debug.Log("Received download request from sender " + _requesterClientID);

        if (!inProgressDownloads.ContainsKey(_requesterClientID))
        {
            LargeRPC clientDownload = new LargeRPC("InitialGameDownload");
            inProgressDownloads.Add(_requesterClientID, clientDownload);
            clientDownload.OnDownloadComplete += ClientFinishedDownload;

            // TODO: Actually send files
            clientDownload.SendFolder(Paths.GetGamemodeFilesPath(SelectedGamemode), _requesterClientID);
        }
        else
        {
            Debug.LogWarning("User " + _requesterClientID + " is already downloading, ignoring request");
        }
    }
Esempio n. 4
0
    public void Test_OpenToFileReception()
    {
        LargeRPC download = new LargeRPC("gameDownload");

        download.ListenForDownload();
    }