void Start() { HidePromotionUI(); m_MessageText = MessageTextParent.GetComponentInChildren <Text>(); m_SquareSize = BoardRect.rect.size / 8; var pieceSize = m_SquareSize * 0.7f; CheckIndicatorImage.GetComponent <RectTransform>().sizeDelta = m_SquareSize; PieceTemplate.GetComponent <RectTransform>().sizeDelta = pieceSize; foreach (var sprite in PieceSprites) { var color = sprite.name[0] == 'w' ? Color.White : Color.Black; var piece = Chessboard.CharToPiece(sprite.name[1], color); var dict = color == Color.White ? m_ImagePoolsByPieceWhite : m_ImagePoolsByPieceBlack; if (!dict.ContainsKey(piece)) { dict[piece] = new PieceImagePool(PieceTemplate, sprite, piece); } } Destroy(PieceTemplate.gameObject); Refresh(); SetDraggingEnabled(Color.White, false); SetDraggingEnabled(Color.Black, false); }
private void loadColoringImage() { coloringImage.sprite = currentColoringBook.ColoringBook.ColoringBookSprite; coloringImage.GetComponent <Paint>().example = currentColoringBook.ColoringBook.Example; textColoringImage.sprite = currentColoringBook.ColoringBook.TextColoringBook; }
private void relationCalculate() { float globalHeight = svg.GetComponent <RectTransform>().rect.height; float globalWidth = svg.GetComponent <RectTransform>().rect.width; float diff = mainCanvas.GetComponent <RectTransform>().rect.height - topPanel.GetComponent <RectTransform>().rect.height - globalHeight; localWidth = svg.sprite.rect.width; localHeight = svg.sprite.rect.height; float locRelation = localWidth / localHeight; float g_h = globalWidth / locRelation; float x = (globalHeight - g_h) / 2; heightDiff = x + diff; float locRelationH = y1 = g_h / localHeight; float locRelationW = x1 = globalWidth / localWidth; }