public override void cleanup() { base.cleanup(); if (boxSprite != null) { boxSprite.removeFromContainer(); boxSprite = null; } if (textSprite != null) { textSprite.removeFromContainer(); textSprite = null; } }
public override void initialize() { base.initialize(); var tt = text; if (tt == null) { tt = motion.TextProperties.forText("Button"); tt.setFontSizeAbsolute(2.00); } var bgc = backgroundColor; if (bgc == null) { bgc = cave.Color.forRGBA(0, 0, 0, 0); } boxSprite = motion.SpriteUtil.addColorSprite((motion.Scene)scene, layer, bgc, 0.10); textSprite = layer.addTextSprite(text); var th = textSprite.getHeight(); boxSprite.resize(textSprite.getWidth() + th, th * 2); layoutSprites(getX(), getY()); }