Beispiel #1
0
        private static async ValueTask <IReadOnlyList <GamePackage> > CreateGamePackages(GameServiceClient client)
        {
            var sets = new[]
            {
                new GamePackage {
                    Name = "Legendary", PackageType = GamePackageType.BaseGame, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Legendary Marvel Studios", PackageType = GamePackageType.BaseGame, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Legendary Villains", PackageType = GamePackageType.BaseGame, BaseMap = GameBaseMap.Villains
                },

                new GamePackage {
                    Name = "X-Men", PackageType = GamePackageType.LargeExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "World War Hulk", PackageType = GamePackageType.LargeExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Secret Wars Volume 1", PackageType = GamePackageType.LargeExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Secret Wars Volume 2", PackageType = GamePackageType.LargeExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Civil War", PackageType = GamePackageType.LargeExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Revelations", PackageType = GamePackageType.LargeExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Dark City", PackageType = GamePackageType.LargeExpansion, BaseMap = GameBaseMap.Legendary
                },

                new GamePackage {
                    Name = "Venom", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Spider-Man Homecoming", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Paint the Town Red (Spider-Man)", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Noir", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Guardians of the Galaxy", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Fantastic Four", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Deadpool", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Champions", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Captain America 75th Anniversary", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Ant-Man", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Dimensions", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "S.H.I.E.L.D.", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Legendary
                },
                new GamePackage {
                    Name = "Fear Itself", PackageType = GamePackageType.SmallExpansion, BaseMap = GameBaseMap.Villains
                },
            };

            var existingPackages = await GamePackageUtility.GetGamePackagesAsync(client, null);

            if (existingPackages.Any())
            {
                return(existingPackages);
            }

            foreach (var set in sets)
            {
                var createRequest = new CreateGamePackageRequest
                {
                    Name        = set.Name,
                    PackageType = set.PackageType,
                    BaseMap     = set.BaseMap
                };

                var createResponse = await client.CreateGamePackageAsync(createRequest);

                ConsoleUtility.WriteLine($"{set.Name} - {createResponse.Id} : {createResponse.Status?.Code}");
            }

            return(await GamePackageUtility.GetGamePackagesAsync(client, null));
        }
Beispiel #2
0
 public override async Task <GetGamePackagesReply> GetGamePackages(GetGamePackagesRequest request, ServerCallContext context)
 {
     return(await GamePackageUtility.GetGamePackagesAsync(request, context));
 }