public void CloseItemInfoPanel() { if (ItemInfoPanel != null && ItemInfoPanel.activeSelf) { ItemInfoPanel.SetActive(false); } }
public void OpenItemInfoPanel() { if (ItemInfoPanel != null && !ItemInfoPanel.activeSelf) { ItemInfoPanel.SetActive(true); } }
/// <summary> /// 아이템의 정보를 창에 띄워 표시해줌 /// </summary> /// <param name="itemInfo">아이템의 정보</param> private void ShowWindow(ItemInfo itemInfo) { ItemInfoPanel.SetActive(true); var infoWindow = ItemInfoPanel.transform.Find("ItemInfoWindow").GetComponent <ItemInfoWindow>(); infoWindow.gameObject.SetActive(true); infoWindow.ItemImg.sprite = Resources.Load <Sprite>(itemInfo.ImagePath); infoWindow.ItemName.text = itemInfo.Name; infoWindow.ItemSort.text = itemInfo.Group; /*infoWindow.ItemGrade.text = itemInfo.Grade;*/ infoWindow.ItemCost.text = "획득 보상 : " + itemInfo.SellPrice + " 골드"; infoWindow.ItemText.text = itemInfo.Description; }
/*// cnt : 총 cell 갯수, minColsInARow : 한 행에 최소 cell 갯수, maxRow : 최대 행 수. * private void SetDynamicGrid(RectTransform targetCanvas, GridLayoutGroup targetGrid, int cnt, int minColsInARow, * int maxRow) * { * /*var originWidth = targetCanvas.rect.width; * var originHeight = targetCanvas.rect.height; * * var rows = Mathf.Clamp ( Mathf.CeilToInt((float) cnt / minColsInARow), 1, maxRow + 1); * var cols = Mathf.CeilToInt ((float)cnt / rows); * * var spaceW = (targetGrid.padding.left + targetGrid.padding.right) + (targetGrid.spacing.x * (cols - 1)); * var spaceH = (targetGrid.padding.top + targetGrid.padding.bottom) + (targetGrid.spacing.y * (rows - 1)); * * var maxWidth = originWidth - spaceW; * var maxHeight = originHeight - spaceH; * * var width = Mathf.Min(targetCanvas.rect.width - (targetGrid.padding.left + targetGrid.padding.right) - (targetGrid.spacing.x * (cols-1)) , maxWidth); * var height = Mathf.Min(targetCanvas.rect.height - (targetGrid.padding.top + targetGrid.padding.bottom) - (targetGrid.spacing.y * (rows-1)), maxHeight); * * targetGrid.cellSize = new Vector2 (width / cols, height / rows);#1# * * Debug.Log("Screen.width : " + Screen.width); * Debug.Log("_contentPanel.rect.width : " + _contentPanel.rect.width); * * targetGrid.cellSize = new Vector2(Screen.width * 0.18518f, Screen.width * 0.18518f); * targetGrid.spacing = new Vector2(Screen.width * 0.01389f, Screen.width * 0.01389f); * } * * private static float PxtoDp(float px) * { * return px * 160 / Screen.dpi; * }*/ private void ShowWindow(ItemInfo itemInfo) { ItemInfoPanel.SetActive(true); var infoWindow = ItemInfoPanel.transform.Find("ItemInfoWindow").GetComponent <ItemInfoWindow>(); infoWindow.gameObject.SetActive(true); infoWindow.ItemImg.sprite = Resources.Load <Sprite>(itemInfo.ImagePath); infoWindow.ItemName.text = itemInfo.Name; infoWindow.ItemSort.text = itemInfo.Group; infoWindow.ItemGrade.text = string.Format("{0}레벨 아이템", itemInfo.Grade); infoWindow.ItemCost.text = string.Format("판매 가격 : {0}", itemInfo.SellPrice); infoWindow.ItemText.text = itemInfo.Description; }