public static void ModifyContent(ref ImageRenderer renderer, Resource.IResource res) { renderer.rectTranfrom = renderer.GetComponent <RectTransform>(); renderer.image = renderer.GetComponent <RawImage>(); renderer.ChangeContent(res); renderer.Attrs = res.Attrs; renderer.ApplyAttrs(res.Attrs); }
public static ImageRenderer Generate(Resource.IResource res, Transform root) { GameObject obj = new GameObject(res.Name); var render = obj.AddComponent <ImageRenderer>(); render.transform.parent = root; ModifyContent(ref render, res); return(render); }
public abstract void ChangeContent(Resource.IResource contentData);
public override void ChangeContent(Resource.IResource contentData) { image.texture = (Texture2D)((ImageResource)contentData).GetFile(); }
public override void ChangeContent(Resource.IResource contentData) { Content.text = (string)((TextResoure)contentData).GetFile(); }