public static LayoutDTO GetLayoutDTO(long layoutId) { LayoutDTO dto = new LayoutDTO(layoutId); try { using (DbManagerProxy manager = DbManagerFactory.Factory.Create()) { DbManager command = manager.SetSpCommand("spAsLayoutSelectLookup", manager.Parameter("LangID", Localizer.lngEn), manager.Parameter("LayoutID", layoutId)); using (IDataReader reader = command.ExecuteReader()) { if (reader.Read()) { dto.DefaultLayoutName = reader["strDefaultLayoutName"].ToString(); dto.QueryId = (long)reader["idflQuery"]; dto.UseArchivedData = (bool)reader["blnUseArchivedData"]; } } } } catch (Exception ex) { dto.DefaultLayoutName = ex.ToString(); } return(dto); }
public async Task <LayoutDTO> Update(LayoutDTO layoutDTO) { _context.Entry(layoutDTO).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _context.SaveChangesAsync(); return(layoutDTO); }
public async Task Delete(int id) { LayoutDTO layout = await GetLayout(id); _context.Entry(layout).State = Microsoft.EntityFrameworkCore.EntityState.Deleted; await _context.SaveChangesAsync(); }
public Layout(LayoutDTO dto) { ComputerWin = dto.ComputerWin; _gameId = dto.GameId; _positions = dto.Positions.ToArray(); _turn = dto.Turn; _turnPosition = dto.TurnPosition; }
public LayoutDTO getSmallLayoutInfo(decimal contentId, decimal?layoutId) { LayoutDTO layoutDTO = layoutEntity.getLayoutInfo(layoutId); layoutDTO.LayoutHTML = ""; layoutDTO.TokenizeString = ""; return(layoutDTO); }
public void Update(LayoutDTO obj) { if (!IsLayoutNameUniqueByVenueId(obj)) { throw new FaultException <NotUniqueNameException>(new NotUniqueNameException("name must be unique"), new FaultReason("name must be unique")); } layoutService.Update(FromLayoutDTOToBLLStandardLayoutDTO(obj)); }
private BLLStandard.DTO.LayoutDTO FromLayoutDTOToBLLStandardLayoutDTO(LayoutDTO layoutDTO) { return(new BLLStandard.DTO.LayoutDTO { Id = layoutDTO.Id, Name = layoutDTO.Name, VenueId = layoutDTO.VenueId, Description = layoutDTO.Description }); }
public override void Initialize(List <Grid <int> > initialPieceLayouts) { base.Start(); level = 1; chain = 0; multiplier = 1; turnsToLevelUp = level + 9; gracePeriod = 4f; multiplierBonusDecreasePeriod = 1f; bonusBarTimer = 0; hintTimer = TIME_TILL_HINT; timerGo = false; normalPiece = new LayoutDTO(); complicatedPiece = new LayoutDTO(); Board.Instance.Initialize(GameControl.Instance.mainCamera, GameControl.Instance.GameplayBounds, 5, 5); var complicationPreviewPrefab = Resources.Load <GameObject>("Prefabs/Complication Preview"); var complicationPreviewGameObject = Instantiate(complicationPreviewPrefab) as GameObject; complicationPreview = complicationPreviewGameObject.GetComponent <ComplicationPreview>(); int chosenIndex = Mathf.FloorToInt(UnityEngine.Random.Range(0, 6)); ComplicateNextPiece(chosenIndex); //Multiplier bar bonusBar = Instantiate(GameControl.Instance.bonusBarPrefab, new Vector3(4f, 5.4f, 0), Quaternion.identity) as MultiplierBar; bonusBar.name = GameControl.Instance.bonusBarPrefab.name; bonusBar.Foreground.SetSprite("MultBarFillGrowth"); var levelProgressIndicator = GameController.uiController.gameInfo.GetComponent <LevelProgressIndicator>(); levelProgressIndicator.Construct(this); layoutUsage = new Dictionary <int, int>(); pieceQueue = new Queue <PreviewPiece>(); for (int i = TOTAL_PIECE_PREVIEWS - 1; i >= 0; i--) { var previewPiece = GameControl.Instantiate(GameController.previewPiecePrefab, new Vector3(PIECE_PREVIEW_INITIAL_X, PIECE_PREVIEW_INITIAL_Y + i * 1.6f, 0), Quaternion.identity) as PreviewPiece; var index = UnityEngine.Random.Range(0, initialPieceLayouts.Count); previewPiece.gameObject.name = GameController.previewPiecePrefab.name; previewPiece.Init(initialPieceLayouts[index].Copy(), index); pieceQueue.Enqueue(previewPiece); } for (int i = 0; i < initialPieceLayouts.Count; i++) { layoutUsage.Add(i, 0); } initialBoardClearYPos = GameController.boardClearText.Position.y; }
public async Task <IActionResult> PutLayout(int id, LayoutDTO layout) { if (id != layout.ID) { return(BadRequest()); } var updateLayout = await _layout.Update(layout); return(Ok(updateLayout)); }
public void Update(LayoutDTO obj) { if (!IsLayoutNameUniqueByVenueId(obj)) { throw new NotUniqueNameException(); } repository.Update(new Layout { Id = obj.Id, Name = obj.Name, VenueId = obj.VenueId, Description = obj.Description }); }
public string getContentLazyFiles(ContentDTO contentDTO, string files, LayoutDTO layoutDTO) { List <string> tileNames = Parser.getPlaceHolderList(layoutDTO.TokenizeString, Constant.pattern); string str = ""; List <string> listStr = contentEntity.getContentLazyFiles(contentDTO.ContentId, tileNames); foreach (var file in listStr) { str += "," + file; } return(Parser.clearExtraComa(files + "," + str)); }
public bool IsLayoutNameUniqueByVenueId(LayoutDTO obj) { var list = repository.GetAll().ToList().FindAll(x => x.VenueId == obj.VenueId); var layoutWithTheSameName = list.FirstOrDefault(x => x.Name == obj.Name); if (layoutWithTheSameName != null && layoutWithTheSameName.Id == obj.Id && !String.Equals(layoutWithTheSameName.Description, obj.Description)) { return(true); } return(!repository.GetAll().ToList().FindAll(x => x.VenueId == obj.VenueId).Exists(x => x.Name == obj.Name)); }
public void Create_Correct_Layout() { //Arrange var layoutDTO = new LayoutDTO { Name = "one", Description = "o", VenueId = 1 }; //Act service.Create(layoutDTO); var res = service.GetByName("one"); //Assert Assert.AreEqual(res.Name, "one"); }
public List <TileDTO> getTileList(decimal layoutId, decimal pageContentId) { List <TileDTO> tileList = new List <TileDTO>(); LayoutDTO layoutDTO = layoutEntity.getLayoutInfo(layoutId); List <string> list = Parser.getPlaceHolderList(layoutDTO.TokenizeString, Constant.pattern); foreach (string tile in list) { TileDTO tileDTO = new TileDTO(); tileDTO.tileName = Parser.clean(tile); tileDTO.componentList = componentEntity.getPageContentComponentList(pageContentId, Parser.clean(tile)); tileList.Add(tileDTO); } return(tileList); }
public void Try_To_Create_Incorrect_Layout() { //Arrange var layoutDTO = new LayoutDTO { Name = "one", Description = "o", VenueId = 1 }; var incorrectLayoutDTO = new LayoutDTO { Name = "one", Description = "o", VenueId = 1 }; //Act service.Create(layoutDTO); //Assert Assert.Throws <NotUniqueNameException>(() => service.Create(incorrectLayoutDTO)); }
public void Try_To_Update_With_Incorrect_Layout() { //Arrange var layoutDTO = new LayoutDTO { Name = "test", Description = "test", VenueId = 1 }; //Act service.Create(layoutDTO); var incorrectLayoutDTOForUpdate = new LayoutDTO { Id = 0, Name = "test", Description = "update", VenueId = 1 }; //Assert Assert.Throws <NotUniqueNameException>(() => service.Update(incorrectLayoutDTOForUpdate)); }
public void Create_Correct_Layout() { //Arrange var layoutDTO = new LayoutDTO() { Name = "test", Description = "test", VenueId = 1 }; //Act service.Create(layoutDTO); var res = service.GetByName("test"); //Assert Assert.AreEqual(layoutDTO.Name, res.Name); service.Delete(res.Id); }
public LayoutDTO getLayoutWithHTML(decimal pageContentId, decimal layoutId) { LayoutDTO layoutDTO = layoutEntity.getLayoutInfo(layoutId); List <string> placeHolderList = Parser.getPlaceHolderList(layoutDTO.TokenizeString, Constant.pattern); string TokenizeString = layoutDTO.TokenizeString; foreach (var placeHolder in placeHolderList) { string tileName = Parser.clean(placeHolder); string fieldSetHTML = createFiledSet(pageContentId, tileName); TokenizeString = TokenizeString.Replace(placeHolder, fieldSetHTML); } layoutDTO.LayoutHTML = TokenizeString; layoutDTO.TokenizeString = ""; return(layoutDTO); }
public async Task <LayoutDTO> GetLayout(int id) { var layout = await _context.RoomLayouts.Where(x => x.ID == id) .Include(x => x.RoomAmenities) .ThenInclude(x => x.Amenity) .FirstOrDefaultAsync(); LayoutDTO layoutDTO = new LayoutDTO() { ID = layout.ID, Name = layout.Name, Layout = layout.Layout, RoomAmenities = (List <RoomAmenities>)layout.RoomAmenities }; return(layoutDTO); }
public void Delete() { //Arrange var layoutDTO = new LayoutDTO() { Name = "test", Description = "test", VenueId = 1 }; service.Create(layoutDTO); int id = service.GetByName("test").Id; //Act service.Delete(id); var res = service.GetByName("test"); //Assert Assert.AreEqual(res, null); }
public void Update_With_Correct_Layout() { //Arrange var layoutDTO = new LayoutDTO { Name = "test", Description = "test", VenueId = 1 }; //Act service.Create(layoutDTO); var layoutDTOForUpdate = new LayoutDTO { Id = 1, Name = "update", Description = "update", VenueId = 2 }; service.Update(layoutDTOForUpdate); //Assert Assert.AreEqual(service.GetById(1).Name, "update"); }
public int savePageAndContents(string exportPath, decimal pageId, int contentCnt) { PageDTO pageDTO = BLL.BLPage.getPageInfo(pageId); ProjectDTO projectDTO = BLL.BLProject.getProjectInfo(pageDTO.ProjectId); string path = exportPath + "/" + projectDTO.OwnerUserId + "/" + projectDTO.ProjectId; containerTypeDTO = BLL.BLContainerType.getContainerType(pageDTO.ContainerTypeId); List <ContentDTO> contentDTOs = BLL.BLPage.getPageContentList(pageId); contentResult = ""; templateTypeDTO = BLL.BLTemplateType.getTypeByName("global.js"); if (!Directory.Exists(path + "/Content/" + pageDTO.Path)) { Directory.CreateDirectory(path + "/Content/" + pageDTO.Path); } foreach (ContentDTO contentDTO in contentDTOs) { if (!Directory.Exists(path + "/Content/" + contentDTO.Path)) { Directory.CreateDirectory(path + "/Content/" + contentDTO.Path); } layoutDTO = BLL.BLLayout.getLayoutInfo(contentDTO.ContentId, contentDTO.LayoutId); contentResult = replaceLayouutComponent(contentDTO.PageContentId, contentDTO, layoutDTO); //contentResult += BLL.BLNavigation.getNavigationList(pageContentId); contentResult = Parser.removeUnUsableTokens(contentResult); contentResult = Parser.removeUnUsableAttributes(contentResult); contentResult = generateContentDesigns(pageDTO.ProjectId, pageDTO.PageId, contentResult, contentDTO); controllerResult = generateControllerResult(pageDTO.ProjectId, contentDTO, templateTypeDTO, contentDTO.PageContentId); saveFile(path, contentDTO.FullPath + ".html", contentResult); saveFile(path, contentDTO.FullPath + ".js", controllerResult); contentCnt++; } saveFile(path, pageDTO.FullPath + ".html", getPageResult(pageDTO)); return(contentCnt); }
public void Try_To_Create_Incorrect_Layout() { //Arrange var layoutDTO = new LayoutDTO() { Name = "test", Description = "test", VenueId = 1 }; var incorrectLayoutDTO = new LayoutDTO() { Name = "test", Description = "test", VenueId = 1 }; //Act service.Create(layoutDTO); //Assert Assert.Throws <NotUniqueNameException>(() => service.Create(incorrectLayoutDTO)); service.Delete(service.GetByName("test").Id); }
public void Update() { //Arrange var layoutDTO = new LayoutDTO() { Name = "test", Description = "test", VenueId = 1 }; var layoutForUpdate = new LayoutDTO() { Name = "update", Description = "update", VenueId = 1 }; service.Create(layoutDTO); layoutForUpdate.Id = service.GetByName("test").Id; //Act service.Update(layoutForUpdate); //Assert Assert.AreEqual(layoutForUpdate.Name, service.GetByName("update").Name); service.Delete(service.GetByName("update").Id); }
public override LayoutDTO GetNextPiece() { var nextPiece = pieceQueue.Peek(); var possiblePlays = Board.Instance.PossiblePlays(nextPiece.Layout); LayoutDTO layoutValues; if (possiblePlays > 0) { //Creates a new piecePreview to be enqueued var newPiecePreview = GameControl.Instantiate(GameController.previewPiecePrefab, new Vector3(PIECE_PREVIEW_INITIAL_X, -0.6f, 0), Quaternion.identity) as PreviewPiece; newPiecePreview.gameObject.name = GameController.previewPiecePrefab.name; //Selects what layout that piece will have var minUsage = layoutUsage.MinBy(x => x.Value); var newIndex = layoutUsage.Where(x => x.Value <= minUsage.Value + 1).RandomElement().Key; layoutUsage[newIndex]++; //Enqueues the new piecePreview newPiecePreview.Init(GameController.PieceLayouts[newIndex].Copy(), newIndex); pieceQueue.Enqueue(newPiecePreview); var position = 0; foreach (var piecePreview in pieceQueue) { iTween.MoveTo(piecePreview.gameObject, iTween.Hash( "name", "tweenY", "y", PIECE_PREVIEW_INITIAL_Y + (TOTAL_PIECE_PREVIEWS - position++) * 1.6f, "time", 1f)); } //Dequeues top piece var headPiece = pieceQueue.Dequeue(); layoutValues = new LayoutDTO { Layout = headPiece.Layout, Variant = headPiece.Variant }; iTween.ValueTo(headPiece.gameObject, iTween.Hash( "name", "tweenAlpha", "from", 1f, "to", 0f, "time", 0.25f, "easetype", "easeOutCubic", "onupdate", "TweenAlpha", "oncomplete", "Destroy")); //Destroy(headPiece.gameObject); } else { var layout = new Grid <int>(); layout[0, 0] = 4; layoutValues = new LayoutDTO { Layout = layout, Variant = Block.TOTAL_VARIANTS + 1 }; //This is a heart piece if (GameController.lifeCounter.Count >= 1) { GameController.lifeCounter.Count++; } } if (UserHasPlayed) //If the player has already started playing { StopCoroutine("DecreaseMultiplier"); StartCoroutine("DecreaseMultiplier"); hintTimer = TIME_TILL_HINT; } return(layoutValues); }
internal IEnumerator ResolveBoardChange(float blockDestructionDelay) { yield return(StartCoroutine(CurrentGameMode.ClearBoard(blockDestructionDelay))); if (!processNextMove) { StartCoroutine(ResolveBoardChange(blockDestructionDelay)); processNextMove = true; yield break; } if (CurrentGameMode.IsGameOver()) { this.DestroyAll(currentPiece.gameObject); //gameOverText.Text = "Game Over\r\n"; if (FB.IsLoggedIn) { //Try to save high score var result = PersistentUtility.Instance.SaveHighScore(CurrentGameMode); } //Send playthrough information to server var scoreParse = new ParseObject("Score"); scoreParse["score"] = currentGameMode.Score; scoreParse["player"] = GlobalData.Instance.playerName; scoreParse["facebookUserID"] = GlobalData.Instance.playerFacebookID; scoreParse["gameVersion"] = GlobalData.Instance.version; scoreParse["gameMode"] = currentGameMode.ModeName; scoreParse["squaresCleared"] = currentGameMode.SquaresCleared; scoreParse["blocksCleared"] = currentGameMode.BlocksCleared; scoreParse["piecesPlaced"] = currentGameMode.PiecesPlaced; scoreParse["levelReached"] = currentGameMode.Level; scoreParse["maxChain"] = currentGameMode.MaxChain; scoreParse["maxCombo"] = currentGameMode.MaxCombo; scoreParse["totalChains"] = currentGameMode.TotalChains; scoreParse["totalCombos"] = currentGameMode.TotalCombos; scoreParse["timePlayed"] = currentGameMode.TimePlayed; scoreParse["hintsUsed"] = currentGameMode.HintsUsed; if (currentGameMode.ModeName == "PeriodicMode") { scoreParse["seedUsed"] = GlobalData.Instance.periodicModeSeed; scoreParse["rawSeedUsed"] = GlobalData.Instance.rawSeed; } scoreParse.SaveAsync(); GlobalData.Instance.GameStats = scoreParse; //gameOverText.PlayAnimation(); GameUIController.Instance.noMoreMovesMessage.GetComponents <dfTweenGroup>().Single(tg => tg.TweenName == "TweenCombined").Play(); GameUIController.Instance.gameOverMessage.GetComponents <dfTweenVector3>().Single(t => t.TweenName == "TweenIn").Play(); GameOver = true; waitUntilGameOverDismissal = 1.25f; } else { CurrentGameMode.UserHasPlayed = true; if (currentPiece.gameObject.activeSelf) { LayoutDTO nextPieceInfo = CurrentGameMode.GetNextPiece(); if (nextPieceInfo.Variant == Block.TOTAL_VARIANTS + 1) { GameUIController.Instance.NoMoreMovesTweenAlone.Play(); CurrentPiece.gameObject.SetActive(false); } if (nextPieceInfo != null) { CurrentPiece.InitPiece(nextPieceInfo.Layout, nextPieceInfo.Variant); } else { this.DestroyAll(CurrentPiece.gameObject); } } } }
public async Task <HttpStatusCode> UpdateAsync(int id, LayoutDTO layout) { return(await PutAsync($"layouts/{id}", layout)); }
public async Task <HttpStatusCode> CreateAsync(LayoutDTO layout) { return(await PostAsync("layouts", layout)); }
public Resp_Binary Modify(LayoutDTO model) => _service.Modify(model);
public Resp_Binary Add_One(LayoutDTO model) => _service.Add_One(model);