Exemple #1
0
    // Single method for error handling
    private void HandleDocumentError(JCloudDocumentError documentError)
    {
        switch (documentError)
        {
        case JCloudDocumentError.InvalidPlatform:                 // Web player -- no file access. Do not use JCloudDocument.
            error = "No file access allowed on this platform.";
            break;

        case JCloudDocumentError.PluginError:
        case JCloudDocumentError.NativeError:
        case JCloudDocumentError.InvalidArguments:                 // Look out for this one as it means you passed invalid path
            // Offer the user to retry
            error = "An error ocurred while loading game data. Please retry. Error: " + documentError.ToString();
            break;

        case JCloudDocumentError.DocumentNotFound:
            error = "There is no saved game present on this device. Start a new game.";
            break;

        case JCloudDocumentError.DownloadTimeout:
            // Offer the user to retry
            error = "Could not download the save game data. Please retry.";
            break;

        case JCloudDocumentError.InvalidVersionIdentifier:
        case JCloudDocumentError.InvalidVersionsHash:
            // Offer the user to retry
            error = "An error occured while handling conflict versions of your save game data. Please retry.";
            break;

        default:                 // We should never get there
            break;
        }
    }
    // Single method for error handling
    private void HandleDocumentError(JCloudDocumentError documentError, System.Action <UserCloudDownloadDelegateEventArgs> onResul)
    {
        string error = "";

        switch (documentError)
        {
        case JCloudDocumentError.InvalidPlatform:                 // Web player -- no file access. Do not use JCloudDocument.
            error = "No file access allowed on this platform.";
            break;

        case JCloudDocumentError.PluginError:
        case JCloudDocumentError.NativeError:
        case JCloudDocumentError.InvalidArguments:                 // Look out for this one as it means you passed invalid path
            // Offer the user to retry
            error = "An error ocurred while loading game data. Please retry.";
            break;

        case JCloudDocumentError.DocumentNotFound:
            error = "There is no saved game present on this device. Start a new game.";
            break;

        case JCloudDocumentError.DownloadTimeout:
            // Offer the user to retry
            error = "Could not download the save game data. Please retry.";
            break;

        case JCloudDocumentError.InvalidVersionIdentifier:
        case JCloudDocumentError.InvalidVersionsHash:
            // Offer the user to retry
            error = "An error occured while handling conflict versions of your save game data. Please retry.";
            break;

        default:                 // We should never get there
            break;
        }
        UserCloudDownloadDelegateEventArgs args = new UserCloudDownloadDelegateEventArgs();

        Debug.Log(error);

        args.Error     = error;
        args.Message   = "There was an error downloading from iCloud by checking conflicts";
        args.Result    = false;
        args.ErrorType = documentError;

        RaiseUserHasBeenDownloaded(args, onResul);
    }
	// Single method for error handling
	private void HandleDocumentError(JCloudDocumentError documentError) {
		switch (documentError) {
			case JCloudDocumentError.InvalidPlatform: // Web player -- no file access. Do not use JCloudDocument.
				error = "No file access allowed on this platform.";
				break;
			case JCloudDocumentError.PluginError:
			case JCloudDocumentError.NativeError:
			case JCloudDocumentError.InvalidArguments: // Look out for this one as it means you passed invalid path
				// Offer the user to retry
				error = "An error ocurred while loading game data. Please retry. Error: " + documentError.ToString();
				break;
			case JCloudDocumentError.DocumentNotFound:
				error = "There is no saved game present on this device. Start a new game.";
				break;
			case JCloudDocumentError.DownloadTimeout:
				// Offer the user to retry
				error = "Could not download the save game data. Please retry.";
				break;
			case JCloudDocumentError.InvalidVersionIdentifier:
			case JCloudDocumentError.InvalidVersionsHash:
				// Offer the user to retry
				error = "An error occured while handling conflict versions of your save game data. Please retry.";
				break;
			default: // We should never get there
				break;
		}
	}