Exemple #1
0
 public static CD_CHAR CreateSpaceChar(CD referCd, hglParser.Element e)
 {
     if (referCd != null)
     {
         CD_CHAR        refcd = (CD_CHAR)referCd;
         hgMesh.CD_CHAR cd    = new hgMesh.CD_CHAR(e);
         cd.bmFont     = refcd.bmFont;
         cd.code       = ' ';
         cd.fontSize   = refcd.fontSize;
         cd.vspace     = refcd.vspace;
         cd.hspace     = refcd.hspace;
         cd.colorIndex = 0;
         return(cd);
     }
     else if (e != null)
     {
         hgMesh.CD_CHAR cd = new hgMesh.CD_CHAR(e);
         cd.bmFont     = e.GetTags().m_htmlRender.m_renderInfo.m_bmFont.m_bmFonrData;
         cd.code       = ' ';
         cd.fontSize   = e.thisStyle.GetFloat(StyleKey.font_size, float.NaN);
         cd.vspace     = 0;
         cd.hspace     = 0;
         cd.colorIndex = 0;
         return(cd);
     }
     return(null);
 }
Exemple #2
0
            public override void ElementWork(hglParser.Element te)
            {
                var atrs = te.attrib;

                hglTags.m_hglForm = new hglForm();
                hglTags.m_hglForm.Init(atrs, hglTags);
            }
Exemple #3
0
 public void CommentWork(hglParser.Element xe)
 {
     if (xe.parent != null && xe.parent.baseBody != null)
     {
         hglBaseBody tag = (hglBaseBody)xe.parent.baseBody;
         tag.CommentWork(xe.text);
     }
 }
Exemple #4
0
            public override void TextWork(hglParser.Element te)
            {
                if (!te.thisStyle.HasKey(StyleKey.text_decoration))
                {
                    te.thisStyle.Set(StyleKey.text_decoration, "underline");
                }

                base.TextWork(te);
            }
Exemple #5
0
        public void TextWork(hglParser.Element xe)
        {
            hglBaseBody tag = (hglBaseBody)xe.parent.baseBody;

            if (tag != null)
            {
                tag.TextWork(xe);
            }
        }
Exemple #6
0
            public override void ElementWork(hglParser.Element te)
            {
                var atrs = te.attrib;

                if (hglTags.m_hglForm != null)
                {
                    hglTags.m_hglForm.CreateInputUI(atrs);
                }
            }
Exemple #7
0
            public override void ElementWork(hglParser.Element te)
            {
                var atrs = te.attrib;

                if (hglTags.m_hglForm != null)
                {
                    //var u = xmlTags.m_xmlForm.CreateSelectUI(atrs);
                    //xmlTags.AddChild((string)atrs["id"],u.gameObject);
                }
            }
Exemple #8
0
 public void EndElementWork(hglParser.Element xe)
 {
     if (xe.baseBody != null)
     {
         var         name = xe.text;
         hglBaseBody tag  = (hglBaseBody)xe.baseBody;
         tag.EndElementWork(xe);
         tag.PostElementWork(xe);
     }
 }
Exemple #9
0
            public override void ElementWork(hglParser.Element te)
            {
                var color = te.thisStyle.GetColor(StyleKey.color);

                color = hglEtc.GetColor("color", te.attrib, color);
                te.thisStyle.SetColor(StyleKey.color, color);
                var size = te.thisStyle.GetFloat(StyleKey.font_size, float.NaN);

                size = hglEtc.GetFloat("size", te.attrib, size);
                te.thisStyle.Set(StyleKey.font_size, size);
            }
Exemple #10
0
        public virtual void PostElementWork(hglParser.Element te)
        {
            Color?curBack = te.thisStyle.GetColorErrorNull(StyleKey.background_color);

            if (hglElement.id != null || curBack != null)
            {
                if (curBack == null)
                {
                    curBack = new Color(0, 0, 0, 0);
                }
                te.backcolorIndex = hglTags.m_htmlRender.m_htmlColor.GetNewIndex((Color)curBack);
            }
        }
Exemple #11
0
        public virtual void PreElementWork(hglParser.Element xe)
        {
            hglElement = xe;
            xe.id      = xe.attrib["id"] != null ? (string)xe.attrib["id"] : null;
            hglTags.StyleElementWork(this);
            xe.colorIndex = hglTags.m_htmlRender.m_htmlColor.GetNewIndex(Color.white);
            hglConverter.referenceFontSize = xe.thisStyle.GetFloat(StyleKey.font_size, float.NaN);

            if (xe.attrib["onclick"] != null)
            {
                ainfo       = new hglAnchor.Info();
                ainfo.m_url = "javascript:" + (string)xe.attrib["onclick"];
            }
        }
Exemple #12
0
        public void ElementWork(hglParser.Element xe)
        {
            var         name = xe.text;
            hglBaseBody work = (hglBaseBody)m_tags[name];

            if (work != null)
            {
                hglBaseBody tag = work.Clone();
                xe.baseBody = tag;

                tag.PreElementWork(xe);
                tag.ElementWork(xe);
            }
        }
Exemple #13
0
            public override void ElementWork(hglParser.Element te)
            {
                var atrs = te.attrib;
                var dt   = "<img : ";

                if (atrs != null && atrs.Keys.Count != 0)
                {
                    foreach (var k in atrs.Keys)
                    {
                        dt += "[" + (string)k + "]=" + (string)atrs[k] + ";";
                    }
                }
//            Debug.Log(dt);

                hglTags.m_htmlRender.DrawImage(te);
                //xmlTags.CreateImageItem(atrs);
            }
Exemple #14
0
            public override void ElementWork(hglParser.Element te)
            {
                var   atrs  = te.attrib;
                ALIGN align = ALIGN.LEFT;

                if ((string)atrs["align"] == "center")
                {
                    align = ALIGN.CENTER;
                }
                if ((string)atrs["align"] == "right")
                {
                    align = ALIGN.RIGHT;
                }
                float height = hglEtc.GetFloat("height", atrs, 0f);

                hglTags.m_htmlRender.CreateTableRow(te, align, height);
            }
Exemple #15
0
            public override void ElementWork(hglParser.Element te)
            {
                var   atrs  = te.attrib;
                ALIGN align = ALIGN.NONE;

                if ((string)atrs["align"] == "left")
                {
                    align = ALIGN.LEFT;
                }
                if ((string)atrs["align"] == "center")
                {
                    align = ALIGN.CENTER;
                }
                if ((string)atrs["align"] == "right")
                {
                    align = ALIGN.RIGHT;
                }
                if (align == ALIGN.NONE)
                {
                    var margin = te.thisStyle.GetMargin();
                    if (margin[1] == -(float)0x0a && margin[3] == -(float)0x0a)
                    {
                        align = ALIGN.CENTER;
                    }
                }

                float cellpadding = hglEtc.GetFloat("cellpadding", atrs, 0f);
                float hspace      = hglEtc.GetFloat("hspace", atrs, 0f);
                float vspace      = hglEtc.GetFloat("vspace", atrs, 0f);
                float width       = hglEtc.GetFloat("width", atrs, 0f);
                float height      = hglEtc.GetFloat("height", atrs, 0f);
                float border      = hglEtc.GetFloat("border", atrs, 1f);
                Color bordercolor = hglEtc.GetColor("bordercolor", atrs, te.thisStyle.GetColor(StyleKey.color));

                te.thisStyle.Set(StyleKey.border_width, border);
                te.thisStyle.SetColor(StyleKey.border_color, bordercolor);

                Color?bgColor = hglEtc.GetColorIfErrorNull("bgcolor", atrs);

                if (bgColor != null)
                {
                    te.thisStyle.SetColor(StyleKey.background_color, (Color)bgColor);
                }

                hglTags.m_htmlRender.CreateTableBlock(te, align, cellpadding, hspace, vspace, width, height);
            }
Exemple #16
0
            public override void ElementWork(hglParser.Element te)
            {
                var   atrs  = te.attrib;
                ALIGN align = ALIGN.LEFT;

                if ((string)atrs["align"] == "center")
                {
                    align = ALIGN.CENTER;
                }
                if ((string)atrs["align"] == "right")
                {
                    align = ALIGN.RIGHT;
                }
                int colspan = (int)hglEtc.GetFloat("colspan", atrs, 0);
                int rowspan = (int)hglEtc.GetFloat("rowspan", atrs, 0);

                hglTags.m_htmlRender.CreateTableData(te, align, colspan, rowspan);
            }
Exemple #17
0
            public override void ElementWork(hglParser.Element te)
            {
                var    atrs   = te.attrib;
                int    intnum = 1;
                string num    = (string)atrs["num"];

                if (num != null && num.Length > 0)
                {
                    try
                    {
                        intnum = int.Parse(num);
                    }
                    catch
                    {
                    }
                }
                //xmlTags.WriteSpace(intnum);
            }
Exemple #18
0
            //http://www.htmq.com/html5/canvas.shtml
            public override void ElementWork(hglParser.Element te)
            {
                var atrs = te.attrib;

                string width = atrs["width"] != null ? (string)atrs["width"] : "300";
                string height = atrs["height"] != null ? (string)atrs["height"]: "150";
                float  w, h;

                if (float.TryParse(width, out w))
                {
                    te.thisStyle.Set(StyleKey.width, width);
                }
                if (float.TryParse(height, out h))
                {
                    te.thisStyle.Set(StyleKey.height, height);
                }

                hglTags.m_htmlRender.CreateChildBlock(te, true);

                hglTags.m_htmlRender.WriteText(te, " ", hglRender.TextMode.RAW); // dummy
            }
Exemple #19
0
            public override void ElementWork(hglParser.Element te)
            {
                string url = null;

                m_mode = hglAnchor.MODE.JUMP;

                var atrs = te.attrib;

                if (atrs["href"] != null)
                {
                    if (ainfo == null)
                    {
                        ainfo = new hglAnchor.Info();
                    }
                    ainfo       = new hglAnchor.Info();
                    ainfo.m_url = (string)atrs["href"];
                }
                //if (atrs["onclick"] != null)   // @@ onclick has been processed at hglBaseBody @@
                //{
                //    url = "javascript:" + (string)atrs["onclick"] ;
                //}
                if (atrs["a"] != null)
                {
                    m_mode = hglAnchor.MODE.ANCHOR;
                    url    = (string)atrs["a"];
                }

                if (ainfo != null)
                {
                    //Color
                    ainfo.m_hover   = (hglTags.m_styleSheet.GetLinkStyleColor("a:hover", out ainfo.m_hover) || hglTags.m_styleSheet.GetLinkStyleColor(":hover", out ainfo.m_hover))     ? ainfo.m_hover   : Color.green;
                    ainfo.m_link    = (hglTags.m_styleSheet.GetLinkStyleColor("a:link", out ainfo.m_link) || hglTags.m_styleSheet.GetLinkStyleColor(":link", out ainfo.m_link))      ? ainfo.m_link    : Color.blue;
                    ainfo.m_visited = (hglTags.m_styleSheet.GetLinkStyleColor("a:visited", out ainfo.m_visited) || hglTags.m_styleSheet.GetLinkStyleColor(":visited", out ainfo.m_visited))   ? ainfo.m_visited : Color.gray;
                    ainfo.m_pressed = (hglTags.m_styleSheet.GetLinkStyleColor("a:pressed", out ainfo.m_pressed) || hglTags.m_styleSheet.GetLinkStyleColor(":pressed", out ainfo.m_pressed))   ? ainfo.m_pressed : Color.red;
                }
            }
Exemple #20
0
 public override void TextWork(hglParser.Element te) //Because underline is not inherit.
 {
     te.thisStyle.Set(StyleKey.text_decoration, "underline");
     base.TextWork(te);
 }
Exemple #21
0
 public override void ElementWork(hglParser.Element te)
 {
     te.thisStyle.Set(StyleKey.font_style, "italic");
 }
Exemple #22
0
 public CD_IMAGE(hglParser.Element e)
 {
     id = -1;  isCR = false;  colorIndex = -1; effectColorIndex = -1;  xe = e;
 }
Exemple #23
0
 public override void EndElementWork(hglParser.Element te)
 {
     hglTags.m_htmlRender.MoveToParent();
 }
Exemple #24
0
 public override void EndElementWork(hglParser.Element te)
 {
     hglTags.m_hglForm = null;
 }
Exemple #25
0
 public override void ElementWork(hglParser.Element te)
 {
     te.thisStyle.Set(StyleKey.font_weight, "bold");
 }
Exemple #26
0
 public override void ElementWork(hglParser.Element te)
 {
     hglTags.m_htmlRender.DrawHR(te);
 }
Exemple #27
0
 public override void EndElementWork(hglParser.Element te)
 {
     hglTags.m_htmlRender.WriteCR(te);
 }
Exemple #28
0
 public override void TextWork(hglParser.Element te)
 {
     te.thisStyle.Set(StyleKey.text_decoration, "line-through");
     base.TextWork(te);
 }
Exemple #29
0
 public override void TextWork(hglParser.Element te)
 {
     hglTags.m_htmlRender.WriteText(te, te.text, hglRender.TextMode.RAW);
 }
Exemple #30
0
 public override void ElementWork(hglParser.Element te)
 {
     hglTags.m_htmlRender.CreateChildBlock(te, true);
 }