Exemple #1
0
        public UIResizer()
        {
            width = 256;
            height = 256;
            mClient = appendFromXML(@"
            <rect size='512' clip='true' expand='true'>
            </rect>
            ") as UIRect;
            mResizer = appendFromXML(@"
            <rect size='32' color='silver' align='rightBottom'>
            </rect>
            ") as UIRect;
            float spx = 0;
            float spy = 0;
            float sw = 0;
            float sh = 0;
            Action<int, int> moveHandle = (nx, ny) =>
            {
                mResizer.updateFixPoint(nx, ny);
                var dspx = (float)(mResizer.px - spx);
                var dspy = (float)(mResizer.py - spy);
                width = max(sw + dspx, 0);
                height = max(sh + dspy, 0);
                this.setDirty(true);
            };

            Action<int, int> delHandle = null;
            delHandle += (nx, ny) =>
                {
                    UIRoot.Instance.evtMove -= moveHandle;
                    UIRoot.Instance.evtLeftUp -= delHandle;
                };
            mResizer.evtOnLMDown += (ui, x, y) =>
                {
                    mResizer.beginFixPoint((float)x, (float)y);
                    spx = mResizer.px;
                    spy = mResizer.py;
                    sw = width;
                    sh = height;
                    UIRoot.Instance.evtMove += moveHandle;
                    UIRoot.Instance.evtLeftUp += delHandle;
                    return false;
                };
        }
Exemple #2
0
        public UIMenu()
        {
            mRR = appendFromXML(XMLLayout) as UIRect;
            mRR.fillColor = mBColor;

            evtOnChar += (ui, kc, iC, iS) =>
            {
                //Console.WriteLine((int)kc);
                if (kc == 38)
                {
                    selectIndex(mSelectItem - 1);
                }
                else if (kc == 40)
                {
                    selectIndex(mSelectItem + 1);
                }
                return false;
            };
        }
        public UIPackageItem_package(Packge pkg)
        {
            mPkg = pkg;
            //shrinkAble = true;
            marginX = 5;
            marginY = 5;
            layout = ELayout.horizon;

            mTypeRect = appendFromXML(@"
            <rect padding='2' clip='true' shrink='true'>
                <lable size='12' text='dir' color='yellow'></lable>
            </rect>") as UIRect;

            mNameRect = appendFromXML(@"
            <rect padding='2' clip='true' shrink='true'></rect>
            ") as UIRect;
            mName = mNameRect.appendFromXML(@"
            <lable size='12' color='black'></lable>") as UILable;
            setName(pkg.cast<PackageItem>().name);
        }
Exemple #4
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;
        }
Exemple #5
0
 public CPage(string name, UIWidget p)
 {
     id = idCount++;
     mRoot = UIRoot.Instance.loadFromXML(XMLPAGE);
     mRoot.name = "";
     mSplit = mRoot.childOfPath("split") as UIRect;
     mSplit.name = "";
     mTab = mRoot.childOfPath("tab") as UIRect;
     mTab.name = "";
     mTabName = mTab.childOf("tabName") as UILable;
     mTabName.name = "";
     mTabName.text = name;
     mClient = mRoot.childOfPath("client");
     mClient.name = "";
     mRoot.paresent = p;
 }
Exemple #6
0
        public static XmlNodeList fromXML(XmlNode node, out UIWidget ui, UIWidget p)
        {
            float w = schemes.widgetWidth;
            float h = schemes.widgetHeight;
            uint fc = (uint)schemes.fillColor;
            uint sc = (uint)schemes.strokeColor;
            bool br = true;

            float lineWidth = (uint)getProp<float>(node, "lineWidth", 1, out br);

            fc = (uint)getProp<EColorUtil>(node, "color", (EColorUtil)schemes.fillColor, out br);
            if (!br)
            {
                fc = getProp(node, "color", (uint)(schemes.fillColor), out br);
                if (!br)
                {

                    fc = (uint)getProp<EColorUtil>(node, "fillColor", (EColorUtil)schemes.fillColor, out br);
                    if (!br)
                    {
                        fc = getProp(node, "fillColor", (uint)(schemes.fillColor), out br);
                    }
                }
            }
            sc = (uint)getProp<EColorUtil>(node, "strokeColor", (EColorUtil)schemes.strokeColor, out br);
            if (!br)
            {
                sc = getProp(node, "strokeColor", (uint)(schemes.strokeColor), out br);
            }

            ui = new UIRect(w, h, sc, fc);
            (ui as UIRect).setLineWidth(lineWidth);
            ui.fromXML(node);
            if(p != null)
                ui.paresent = p;
            return node.ChildNodes;
        }
Exemple #7
0
 public bool setItem(int idx, bool select, out UIRect orc)
 {
     if (idx >= 0 && idx < mItems.Count())
     {
         UIRect rc = mItems[idx];
         if(select)
             rc.fillColor = mSelectColor;
         else
             rc.fillColor = mBColor;
         orc = rc;
         return true;
     }
     orc = null;
     return false;
 }