Exemplo n.º 1
0
        public void Init(RequiredPartData data)
        {
            nameLabel.text  = data.Name;
            countLabel.text = string.Format(config.CountFormat, data.Count, data.RequiredCount);
            InitImage(data.Image);

            if (data.Count >= data.RequiredCount)
            {
                countLabel.color = config.AvailableColor;
            }
            else
            {
                countLabel.color = config.UnavailableColor;
            }
        }
Exemplo n.º 2
0
        public RequiredPartData[] GetRequiredParts(ItemData item)
        {
            var result = new RequiredPartData[item.RequiredParts.Length];

            for (int i = 0; i < result.Length; i++)
            {
                var itemPart = item.RequiredParts[i];
                var part     = GetPart(itemPart.PartId);
                result[i] = new RequiredPartData
                {
                    Id            = part.Id,
                    Name          = part.Name,
                    Image         = part.Image,
                    Count         = part.Count,
                    RequiredCount = itemPart.RequiredCount
                };
            }

            return(result);
        }