Example #1
0
        public static XmlNodeList fromXML(XmlNode node, out UIWidget ui, UIWidget p)
        {
            ui = new UIBlank();
            //int w, h;
            //bool br = true;

            //h = w = getAttr<float>(node, "length", schemes.width, out br);
            //if (!br)
            //{
            //    w = getAttr<float>(node, "width", schemes.width, out br);
            //    h = getAttr<float>(node, "height", schemes.height, out br);
            //}

            //ui.width = w;
            //ui.height = h;
            ui.fromXML(node);

            ui.paresent = p;
            return node.ChildNodes;
        }
Example #2
0
        public UIScrolledMap()
        {
            width = schemes.frameWidth;
            height = schemes.frameHeight;

            dragAble = true;//默认dragAble
            rotateAble = true;//默认dragAble
            scaleAble = true;//默认scaleAble
            mMapClient = appendFromXML(@"<map name='client'></map>") as UIMap;

            evtOnLMUp += (ui, x, y) =>
                {
                    showMini();
                    setDirty(true);
                    return false;
                };

            mMiniMapDiv = appendFromXML(@"
            <div name='mini' clip='true' padding='16' shrink='true' align='rightTop'>
            <rect size='128' fillColor='transparent' strokeColor='transparent'><map>
            </map></rect></div>") as UIBlank;
            mMiniMapRect = mMiniMapDiv.findByTag("rect") as UIRect;
            mMiniMap = mMiniMapRect.findByTag("map") as UIMap;
            mMiniMapRect.height = mMiniMapRect.width = mMiniMapSize;
            mMiniMapRect.alignParesent = EAlign.rightTop;

            mMiniMap.evtOnPostDraw += g =>
                {
                    mMapClient.doDraw(g);
                };

            string xmlWindow = string.Format(xmlFmt, 0, 0, 128, 128);

            //var childrenUi = mMiniMap.appendFromXML(xmlChildren);
            mMiniWinow = mMiniMap.appendFromXML(xmlWindow) as UIRect;
        }