コード例 #1
0
        public virtual void SetData(ItemSheet.Row itemRow)
        {
            if (itemRow is null)
            {
                Clear();
                return;
            }

            Sprite gradeSprite;

            switch (imageSizeType)
            {
            case ImageSizeType.Small:
                gradeSprite = SpriteHelper.GetSmallItemBackground(itemRow.Grade);
                break;

            case ImageSizeType.Middle:
                gradeSprite = SpriteHelper.GetItemBackground(itemRow.Grade);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(imageSizeType), imageSizeType, null);
            }
            gradeImage.overrideSprite = gradeSprite;

            var itemSprite = SpriteHelper.GetItemIcon(itemRow.Id);

            if (itemSprite is null)
            {
                throw new FailedToLoadResourceException <Sprite>(itemRow.Id.ToString());
            }

            iconImage.enabled        = true;
            iconImage.overrideSprite = itemSprite;
            iconImage.SetNativeSize();
        }