Example #1
0
        public override T Rework <T>(GameObject template, T marker)
        {
            var(param, image) = AbsolutelyPhysicalPath.LoadSprite();

            var sprite = template.GetComponentInChildren <SpriteRenderer>().sprite;

            if (!ImageConversion.LoadImage(sprite.texture, image))
            {
                throw new InvalidOperationException();
            }
            sprite.rect.Set(param.rect.position.x, param.rect.position.y, param.rect.size.x, param.rect.size.y);
            sprite.textureRect.Set(param.rect.position.x, param.rect.position.y, param.rect.size.x, param.rect.size.y);
            sprite.pivot.Set(param.pivot.x, param.pivot.y);
            sprite.border.Set(param.border.x, param.border.y, param.border.z, param.border.w);
            // 袖子 暂时先去掉
            var nodes = template.GetComponentsInChildren <Transform>();

            foreach (Transform child in nodes)
            {
                if (child.name == "youbi_1")
                {
                    child.gameObject.active = false;
                    break;
                }
            }

            return(template.Cast <T>());
        }
Example #2
0
        public override GameObject Rework(GameObject template)
        {
            var(param, image) = AbsolutelyPhysicalPath.LoadSprite();

            var sprite = template.GetComponent <SpriteRenderer>().sprite;

            ImageConversion.LoadImage(sprite.texture, image);
            sprite.rect.Set(param.rect.position.x, param.rect.position.y, param.rect.size.x, param.rect.size.y);
            sprite.textureRect.Set(param.rect.position.x, param.rect.position.y, param.rect.size.x, param.rect.size.y);
            sprite.pivot.Set(param.pivot.x, param.pivot.y);
            sprite.border.Set(param.border.x, param.border.y, param.border.z, param.border.w);

            return(template);
        }