Ejemplo n.º 1
0
    /// <summary>
    /// Creates a build
    /// </summary>
    /// <returns>
    /// Boolean representing whether the call was successful or not
    /// </returns>
    public async Task <bool> CreateBuild(
        string strName,
        ContainerFlavor containerFlavor,
        List <AssetReferenceParams> lstGameAssets,
        List <GameCertificateReferenceParams> lstCertificates,
        List <Port> lstPorts,
        Dictionary <string, string> metaData,
        List <BuildRegionParams> lstRegions,
        int multiplayerServerCountPerVm,
        string strStartGameCommand,
        AzureVmSize VMSize
        )
    {
        // Create a build with the requested specificaitons
        CreateBuildWithManagedContainerRequest createRequest = new CreateBuildWithManagedContainerRequest()
        {
            BuildName                 = strName,
            ContainerFlavor           = containerFlavor,
            GameAssetReferences       = lstGameAssets,
            GameCertificateReferences = lstCertificates,
            Ports                         = lstPorts,
            Metadata                      = metaData,
            RegionConfigurations          = lstRegions,
            MultiplayerServerCountPerVm   = multiplayerServerCountPerVm,
            StartMultiplayerServerCommand = strStartGameCommand,
            VmSize                        = VMSize
        };

        var createResp = await PlayFabMultiplayerAPI.CreateBuildWithManagedContainerAsync(createRequest);

        bool hasError = CheckForError(createResp);

        if (hasError)
        {
            throw new Exception(String.Format("Create Build failed with error: {0}", createResp.Error.ErrorMessage));
        }

        return(!hasError);
    }