protected override void loadCompact(aBinaryReader reader) { base.loadCompact(reader); var finder = bloResourceFinder.getFinder(); mFont = finder.find <bloResFont>(reader, "font"); mTopColor = new bloColor(reader.Read32()); mBottomColor = new bloColor(reader.Read32()); int hbinding = reader.Read8(); mHBinding = (bloTextboxHBinding)(hbinding & 127); mVBinding = (bloTextboxVBinding)reader.Read8(); if ((hbinding & 0x80) != 0) { mFontSpacing = reader.ReadS16(); mFontLeading = reader.ReadS16(); mFontWidth = reader.Read16(); mFontHeight = reader.Read16(); } else if (mFont != null) { mFontSpacing = 0; mFontLeading = mFont.getLeading(); mFontWidth = mFont.getWidth(); mFontHeight = mFont.getHeight(); } else { mFontSpacing = 0; mFontLeading = 0; mFontWidth = 0; mFontHeight = 0; } int strlen = reader.Read16(); setString(reader.Read8s(strlen)); mFromColor = new bloColor(bloColor.cZero); mToColor = new bloColor(bloColor.cOne); reader.Skip(4); }
protected override void loadXml(xElement element) { base.loadXml(element); var finder = bloResourceFinder.getFinder(); mFont = finder.find <bloResFont>(element.Element("font"), "font"); mText = bloXml.loadTextBuffer(element.Element("text"), mFont); var white = new bloColor(bloColor.cWhite); var colors = element.Element("colors"); mTopColor = bloXml.loadColor(colors.Element("top"), white); mBottomColor = bloXml.loadColor(colors.Element("bottom"), white); var binding = element.Element("binding"); if (!Enum.TryParse <bloTextboxHBinding>(binding.Element("horizontal"), true, out mHBinding)) { mHBinding = bloTextboxHBinding.Left; } if (!Enum.TryParse <bloTextboxVBinding>(binding.Element("vertical"), true, out mVBinding)) { mVBinding = bloTextboxVBinding.Top; } var typesetting = element.Element("typesetting"); int leading = (mFont != null ? mFont.getLeading() : 20); int width = (mFont != null ? mFont.getWidth() : 20); int height = (mFont != null ? mFont.getHeight() : 20); mFontSpacing = (typesetting.Element("spacing") | 0); mFontLeading = (typesetting.Element("leading") | leading); mFontWidth = (typesetting.Element("width") | width); mFontHeight = (typesetting.Element("height") | height); bloXml.loadGradient(element.Element("gradient"), out mFromColor, out mToColor); }