Exemplo n.º 1
0
        public SchemeView(Scheme scheme, Style style)
        {
            FieldData data = scheme.GetFieldData();
            Font      nameFont;
            float     dvy = 0.0f;

            FieldDataView.Style dataStyle;

            if (style == Style.Small)
            {
                SetSize(153, 143);
                AddView(new RectView(0, 0, width, height, COLOR_BACK, Color.Black));
                nameFont         = Helper.fontSystem;
                dvy              = 13.0f;
                dataStyle.width  = 127;
                dataStyle.height = 86;
                dataStyle.iw     = 119;
                dataStyle.ih     = 79;
            }
            else if (style == Style.Large)
            {
                SetSize(215, 176);
                nameFont         = Helper.fontSystem;
                dataStyle.width  = 215;
                dataStyle.height = 145;
                dataStyle.iw     = 201;
                dataStyle.ih     = 132;
            }
            else
            {
                throw new ArgumentException("Unknown style: " + style);
            }

            FieldDataView dataView = new FieldDataView(data, dataStyle);

            dataView.x      = 0.5f * width;
            dataView.y      = dvy;
            dataView.alignX = View.ALIGN_CENTER;
            AddView(dataView);

            TextView nameView = new TextView(nameFont, scheme.GetName(), (int)width);

            nameView.x      = 0.5f * width;
            nameView.y      = 0.5f * (height + (dataView.y + dataView.height));
            nameView.alignX = nameView.alignY = View.ALIGN_CENTER;
            AddView(nameView);
        }
        public SchemeView(Scheme scheme, Style style)
        {
            FieldData data = scheme.GetFieldData();
            Font nameFont;
            float dvy = 0.0f;
            FieldDataView.Style dataStyle;

            if (style == Style.Small)
            {
                SetSize(153, 143);
                AddView(new RectView(0, 0, width, height, COLOR_BACK, Color.Black));
                nameFont = Helper.fontSystem;
                dvy = 13.0f;
                dataStyle.width = 127;
                dataStyle.height = 86;
                dataStyle.iw = 119;
                dataStyle.ih = 79;
            }
            else if (style == Style.Large)
            {
                SetSize(215, 176);
                nameFont = Helper.fontSystem;
                dataStyle.width = 215;
                dataStyle.height = 145;
                dataStyle.iw = 201;
                dataStyle.ih = 132;
            }
            else
            {
                throw new ArgumentException("Unknown style: " + style);
            }

            FieldDataView dataView = new FieldDataView(data, dataStyle);
            dataView.x = 0.5f * width;
            dataView.y = dvy;
            dataView.alignX = View.ALIGN_CENTER;
            AddView(dataView);

            TextView nameView = new TextView(nameFont, scheme.GetName(), (int)width);
            nameView.x = 0.5f * width;
            nameView.y = 0.5f * (height + (dataView.y + dataView.height));
            nameView.alignX = nameView.alignY = View.ALIGN_CENTER;
            AddView(nameView);
        }