private void CreateGameBoard(GameBoard board) { var newBoardGameObject = new GameObject(board.Id, typeof(RectTransform)); var boardRectTransform = (RectTransform)newBoardGameObject.transform; boardRectTransform.SetParent(playMat.transform); boardRectTransform.anchorMin = Vector2.zero; boardRectTransform.anchorMax = Vector2.zero; boardRectTransform.offsetMin = new Vector2(board.OffsetMin.X, board.OffsetMin.Y) * CardGameManager.PixelsPerInch; boardRectTransform.offsetMax = new Vector2(board.OffsetMin.X, board.OffsetMin.Y) * CardGameManager.PixelsPerInch + boardRectTransform.offsetMin; var boardFilepath = CardGameManager.Current.GameBoardsDirectoryPath + "/" + board.Id + "." + CardGameManager.Current.GameBoardImageFileType; var boardImageSprite = File.Exists(boardFilepath) ? UnityFileMethods.CreateSprite(boardFilepath) : null; if (boardImageSprite != null) { newBoardGameObject.AddComponent <Image>().sprite = boardImageSprite; } boardRectTransform.localScale = Vector3.one; }
public string UpdateDeckName(string newName) { newName ??= string.Empty; newName = UnityFileMethods.GetSafeFileName(newName); nameText.text = newName + (HasChanged ? ChangeIndicator : string.Empty); return(newName); }
public void ValidateDeckName(string deckName) { nameInputField.text = UnityFileMethods.GetSafeFileName(deckName); }