static public StringElement create(string aString, MeshTextBoard aParent) { StringElement aElement = MyBehaviour.create <StringElement>(); aElement.name = aString; aElement.mPro = aParent.createTextMesh(); aElement.mPro.text = aString; aElement.mWidth = aElement.mPro.preferredWidth; aElement.mHeight = aParent.mCurrentFontHeight; aElement.mPro.transform.SetParent(aElement.transform, false); return(aElement); }
static public ImageElement create(string aPath, MeshTextBoard aParent) { ImageElement aElement = MyBehaviour.create <ImageElement>(); aElement.name = "image:" + aPath; aElement.mRenderer = aElement.createChild <SpriteRenderer>(); aElement.mRenderer.sprite = Resources.Load <Sprite>(aPath); aElement.mHeight = aParent.mCurrentFontHeight; aElement.mWidth = aElement.mHeight * (aElement.mRenderer.sprite.bounds.size.x / aElement.mRenderer.sprite.bounds.size.y); float tScale = aElement.mHeight / aElement.mRenderer.sprite.bounds.size.y; aElement.mRenderer.transform.localScale = new Vector3(tScale, tScale, 1); return(aElement); }