Esempio n. 1
0
    public static GameObject CreateObject(HtmlNode node, Transform parent)
    {
        var go = new GameObject(node.Name, typeof(RectTransform));

        go.transform.SetParent(parent);

        if (ctors.ContainsKey(node.Name))
        {
            var ctor = ctors[node.Name];
            var comp = go.AddComponent(ctor.DeclaringType);
            var cd   = new UtmlConstructionData(node);

            ctor.Invoke(comp, new object[] { cd });

            var id = cd.GetStringAttribute("id", null);
            if (id != null)
            {
                go.name = id;
            }

            var klass = cd.GetStringAttribute("class", null);
            if (klass != null)
            {
                go.AddComponent <UssClass>().classes = klass;
            }
        }

        return(go);
    }
Esempio n. 2
0
    public override void Construct(UtmlConstructionData cd)
    {
        var src = cd.GetStringAttribute("src", "");

        if (src.StartsWith("http"))
        {
            throw new System.NotImplementedException();
        }
        //InitializeWithHttp(src);
        else
        {
            InitializeWithResource(src);
        }
    }