当前位置: 首页>>代码示例>>C#>>正文


C# Factory.ConvertColor方法代码示例

本文整理汇总了C#中Factory.ConvertColor方法的典型用法代码示例。如果您正苦于以下问题:C# Factory.ConvertColor方法的具体用法?C# Factory.ConvertColor怎么用?C# Factory.ConvertColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Factory的用法示例。


在下文中一共展示了Factory.ConvertColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TextContext

            public TextContext(Factory f, GameObject p, Data data, Format.Text text)
            {
                factory = f;
                parent = p;

                Format.TextProperty textProperty =
                data.textProperties[text.textPropertyId];
                Format.Font fontProperty = data.fonts[textProperty.fontId];
                color = factory.ConvertColor(data.colors[text.colorId]);

                string str = data.strings[text.stringId];
                string fontName = data.strings[fontProperty.stringId];
                string fontPath = factory.fontPrefix + fontName;
                float fontHeight = (float)textProperty.fontHeight;
                float width = (float)text.width;
                float height = (float)text.height;
                float lineSpacing = 1.0f + (float)textProperty.leading / fontHeight;
                float letterSpacing = (float)fontProperty.letterspacing / fontHeight;
                float tabSpacing = 4.0f;
                float leftMargin = textProperty.leftMargin / fontHeight;
                float rightMargin = textProperty.rightMargin / fontHeight;

                if (fontName.StartsWith("_")) {

                ISystemFontRenderer.Style style = ISystemFontRenderer.Style.NORMAL;

                ISystemFontRenderer.Align align;
                int a = textProperty.align & (int)Align.ALIGN_MASK;
                switch (a) {
                default:
                case (int)Align.LEFT:
                align = ISystemFontRenderer.Align.LEFT;   break;
                case (int)Align.RIGHT:
                align = ISystemFontRenderer.Align.RIGHT;  break;
                case (int)Align.CENTER:
                align = ISystemFontRenderer.Align.CENTER; break;
                }

                ISystemFontRenderer.VerticalAlign valign;
                int va = textProperty.align & (int)Align.VERTICAL_MASK;
                switch (va) {
                default:
                valign = ISystemFontRenderer.VerticalAlign.TOP;
                break;
                case (int)Align.VERTICAL_BOTTOM:
                valign = ISystemFontRenderer.VerticalAlign.BOTTOM;
                break;
                case (int)Align.VERTICAL_MIDDLE:
                valign = ISystemFontRenderer.VerticalAlign.MIDDLE;
                break;
                }

                systemFontRendererParameter = new ISystemFontRenderer.Parameter(
                fontHeight, width, height, style, align, valign, lineSpacing,
                letterSpacing, leftMargin, rightMargin);
                systemFontRenderer = ISystemFontRenderer.Construct();
                systemFontRenderer.SetText(str, color);

                } else {

                BitmapFont.Renderer.Align align;
                int a = textProperty.align & (int)Align.ALIGN_MASK;
                switch (a) {
                default:
                case (int)Align.LEFT:
                align = BitmapFont.Renderer.Align.LEFT;   break;
                case (int)Align.RIGHT:
                align = BitmapFont.Renderer.Align.RIGHT;  break;
                case (int)Align.CENTER:
                align = BitmapFont.Renderer.Align.CENTER; break;
                }

                BitmapFont.Renderer.VerticalAlign valign;
                int va = textProperty.align & (int)Align.VERTICAL_MASK;
                switch (va) {
                default:
                valign = BitmapFont.Renderer.VerticalAlign.TOP;
                break;
                case (int)Align.VERTICAL_BOTTOM:
                valign = BitmapFont.Renderer.VerticalAlign.BOTTOM;
                break;
                case (int)Align.VERTICAL_MIDDLE:
                valign = BitmapFont.Renderer.VerticalAlign.MIDDLE;
                break;
                }

                bitmapFontRenderer = new BitmapFont.Renderer(fontPath,
                fontHeight,
                width,
                height,
                align,
                valign,
                0.25f,
                lineSpacing,
                letterSpacing,
                tabSpacing,
                leftMargin,
                rightMargin);
                bitmapFontRenderer.SetText(str, color);

//.........这里部分代码省略.........
开发者ID:99corps,项目名称:lwf,代码行数:101,代码来源:lwf_unity_text.cs


注:本文中的Factory.ConvertColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。