public override void Initialize() { screenWidth = ScreenManager.GraphicsDevice.Viewport.Width; screenHeight = ScreenManager.GraphicsDevice.Viewport.Height; colorDataList = new List <byte[]>(); player = new Player(); generator = new ItemsGenerator(); current = generator.GenerateMore(); bgLayer1 = new ParallaxingBackground(); bgLayer2 = new ParallaxingBackground(); bgLayer3 = new ParallaxingBackground(); bar = new Bar(100, 20, 15, 270, 30); score = new Score(870, 10, Color.Peru); currentSprite = new List <Sprite>(); items = new List <Texture2D>(); songs = new Song[2]; soundEffects = new SoundEffect[10]; updateImmunityCounter = 0; alertTimer = 0; playQueue = 1; displayAlert = false; enablePause = true; Constants.ResetFlags(); player.Initialize(); base.Initialize(); }
void onStart(SocketIOEvent e) { statusGame = STARTING; Debug.Log("Starting Game"); Debug.Log(e.data.ToString()); JSONObject[] itemList = e.data.GetField("data").GetField("items").list.ToArray(); Debug.Log(itemList); MapGenerator mapGen = map.GetComponent <MapGenerator> (); mapGen.GenerateMap(); Debug.Log("Generate Randomizer"); PositionRandomizer randomizer = map.GetComponent <PositionRandomizer> (); ItemsGenerator itemsGen = items.GetComponent <ItemsGenerator> (); itemsGen.GenerateItems(randomizer, itemList); EnvironmentGenerator enviGen = environment.GetComponent <EnvironmentGenerator> (); enviGen.GenerateEnvironment(randomizer); player.transform.position = randomizer.RandomPosition(PositionRandomizer.PLAYER); EnemyManager enemyManager = enemies.GetComponent <EnemyManager> (); enemyManager.CreateEnemyManager(randomizer); socket.Emit("GAME_STATUS_READY"); }
public async Task <Item> MethodWithSameName(string resultItemName) { var item = await ItemsGenerator.GenerateItem().ConfigureAwait(false); item.Name = resultItemName; return(item); }
public async Task TestItemListResult() { var result = await _controller.ItemListResult(); var expectedItems = await ItemsGenerator.GenerateItems(); Assert.Equal(expectedItems, result); }
public async Task TestNoPathWithBodyParameter() { var item = await ItemsGenerator.GenerateItem(); var result = await _service.EmptyPathWithBodyParameter(item); Assert.True(result); }
private async Task <bool> IsItemCorrect(Item item) { var expectedItem = await ItemsGenerator.GenerateItem(); var isItemCorrect = expectedItem.Equals(item); return(isItemCorrect); }
void Start() { map_gen = GetComponent <MapGenerator>(); mesh_gen = GetComponent <MeshGenerator>(); items_gen = GetComponent <ItemsGenerator>(); GenerateAll(); }
private IEnumerable <Item> GenerateItems(int level = 0) { if (level == 0) { level = GetNewLevel(); } return(ItemsGenerator.GenerateAtLevel(level)); }
public async Task TestBodyParameterAsLastParameter(FormatterSelection formatter) { var client = Client <ISerializeParameterController>(formatter); var expectedItem = await ItemsGenerator.GenerateItem(); var actualItem = await client.GetItemBodyParameterAsLastParameter(ItemsGenerator.TestGuid, "Test", expectedItem); Assert.Equal(expectedItem, actualItem); }
public async Task TestBodyParameterWithNoAttribute(FormatterSelection formatter) { var client = Client <ISerializeParameterController>(formatter); var expectedItem = await ItemsGenerator.GenerateItem(); var actualItem = await client.GetItemBodyParameterWithNoAttribute(expectedItem); Assert.NotEqual(expectedItem, actualItem); }
public async Task <Stream> GetFileStream() { var testFilePath = ItemsGenerator.CreateTestFilename(); await ItemsGenerator.CreateTestFile(testFilePath); var fileStream = new FileStream(testFilePath, FileMode.Open, FileAccess.Read, FileShare.None, 4096, FileOptions.DeleteOnClose); return(fileStream); }
public VirtualList(IEnumerable <T> items, int pageSize = 15) { var generator = new ItemsGenerator <T>(items, pageSize); int maxItems = generator.Count; _generator = generator; _cachedItems = new T[maxItems]; }
static void Main(string[] args) { MenuBuilder menuBuilder = new MenuBuilder(); CarFactory carFactory = new CarFactory(); ItemsGenerator itemsGenerator = new ItemsGenerator(); menuBuilder.Add(new AddItemMenuItem(itemsGenerator, carFactory)); menuBuilder.Execute(); }
public async Task TestNoPathWithAllParameterTypes() { var item = await ItemsGenerator.GenerateItem(); var result = await _service.EmptyPathWithAllParameters( item, ItemsGenerator.TestString, ItemsGenerator.TestInt, ItemsGenerator.TestGuid, ItemsGenerator.TestDate, ItemsGenerator.TestString, ItemsGenerator.TestInt, ItemsGenerator.TestGuid, ItemsGenerator.TestDate); Assert.True(result); }
public async Task TestUpdateFileById() { await ItemsGenerator.CreateTestFile(_testFileName); using (var fileStream = File.OpenRead(_testFileName)) { var fileContent = await _controller.UpdateFileById(fileStream, ItemsGenerator.TestGuid); Assert.Equal(ItemsGenerator.TestFileContent, fileContent); } ItemsGenerator.DeleteFile(_testFileName); }
public async Task TestGetStream() { using (var stream = await _controller.GetFileStream()) using (var fileStream = File.OpenWrite(_testFileName)) { await stream.CopyToAsync(fileStream); } var text = File.ReadAllText(_testFileName); ItemsGenerator.DeleteFile(_testFileName); Assert.Equal(ItemsGenerator.TestFileContent, text); }
public async Task TestMethodsWithSameNames() { var item = await _controller.MethodWithSameName(); var expectedItem = await ItemsGenerator.GenerateItem(); Assert.Equal(expectedItem, item); var resultItemName = "ResultItemName"; var resultItem = await _controller.MethodWithSameName(resultItemName); Assert.Equal(resultItemName, resultItem.Name); }
private void SpawnNewItems() { //int -> number of position to move down, List<GridItem> -> list of items to move down about this(key) positions. Dictionary <int, List <GridItem> > itemsToMove = new Dictionary <int, List <GridItem> >(); int lenghtY = GridItems.GetLength(1); foreach (int x in positionsForNewItems.Keys) { int numberOfDestroyedItems = 0; for (int y = 0; y < lenghtY; y++) { if (GridItems[x, y] == null) { numberOfDestroyedItems++; } else if (numberOfDestroyedItems > 0) { if (!itemsToMove.ContainsKey(numberOfDestroyedItems)) { itemsToMove.Add(numberOfDestroyedItems, new List <GridItem>()); } int newY = y - numberOfDestroyedItems; GridItems[x, newY] = GridItems[x, y]; GridItems[x, newY].Position = new IntVector2(x, newY); itemsToMove[numberOfDestroyedItems].Add(GridItems[x, newY]); #if UNITY_EDITOR GridItems[x, newY].UpdateGameObjectName(); #endif } } if (!itemsToMove.ContainsKey(numberOfDestroyedItems)) { itemsToMove.Add(numberOfDestroyedItems, new List <GridItem>()); } //Spawn new items for (int i = lenghtY - numberOfDestroyedItems; i < lenghtY; i++) { ItemsGenerator.GenerateNewItem(x, i, numberOfDestroyedItems, true); itemsToMove[numberOfDestroyedItems].Add(GridItems[x, i]); } } MoveItems(itemsToMove, false, AnimManager.FallDownItems); }
public async Task TestUpdateStreamItem() { await ItemsGenerator.CreateTestFile(_testFileName); using (var fileStream = File.OpenRead(_testFileName)) { var streamItem = new StreamItem { Stream = fileStream, Id = ItemsGenerator.TestGuid }; var fileContent = await _controller.UpdateStreamItem(streamItem); Assert.Equal(ItemsGenerator.TestFileContent, fileContent); } }
public async Task <string> UpdateFileById(Stream stream, Guid id) { var testFilePath = ItemsGenerator.CreateTestFilename(); try { using (var fileStream = File.OpenWrite(testFilePath)) { await stream.CopyToAsync(fileStream); } var fileContent = File.ReadAllText(testFilePath); return(fileContent); } finally { ItemsGenerator.DeleteFile(testFilePath); } }
public override void Dispose() { base.Dispose(); ItemsGenerator.DeleteFile(_testFileName); }
public StreamTests() { _controller = Client <IFileStreamController>(FormatterSelection.Json); _testFileName = ItemsGenerator.CreateTestFilename(); }
public async Task<Item> MethodWithSameUrl2() { var item = await ItemsGenerator.GenerateItem().ConfigureAwait(false); return item; }
public async Task <Item> ItemResult() { var item = await ItemsGenerator.GenerateItem(); return(item); }
public Startup(IConfiguration configuration) { ItemsGenerator.Generate(); Configuration = configuration; }
public async Task <List <Item> > ItemListResult() { var items = await ItemsGenerator.GenerateItems(); return(await Task.FromResult(items)); }
public AddItemMenuItem(ItemsGenerator itemsGenerator, CarFactory carFactory) { ItemsGenerator = itemsGenerator; CarFactory = carFactory; }