Ejemplo n.º 1
0
        override public void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            XML xml = cxml.GetNode("Button");

            if (xml == null)
            {
                return;
            }

            this.title = (string)xml.GetAttribute("title");
            this.icon  = (string)xml.GetAttribute("icon");
            string str;

            str = (string)xml.GetAttribute("titleColor");
            if (str != null)
            {
                this.titleColor = UtilsStr.ConvertFromHtmlColor(str);
            }
            str = (string)xml.GetAttribute("controller");
            if (str != null)
            {
                _relatedController = parent.GetController(str);
            }
            else
            {
                _relatedController = null;
            }
            _pageOption.id = (string)xml.GetAttribute("page");
            this.selected  = (string)xml.GetAttribute("checked") == "true";
        }
Ejemplo n.º 2
0
        override public void Setup_BeforeAdd(XML xml)
        {
            string str;
            string type = (string)xml.GetAttribute("type");

            if (type != null && type != "empty")
            {
                _shape         = new UIShape(this);
                _shape.gOwner  = this;
                _displayObject = _shape;
            }

            base.Setup_BeforeAdd(xml);

            if (_shape != null)
            {
                int lineSize;
                str = (string)xml.GetAttribute("lineSize");
                if (str != null)
                {
                    lineSize = int.Parse(str);
                }
                else
                {
                    lineSize = 1;
                }

                uint lineColor;
                str = (string)xml.GetAttribute("lineColor");
                if (str != null)
                {
                    lineColor = UtilsStr.ConvertFromHtmlColor(str, true);
                }
                else
                {
                    lineColor = 0xFF000000;
                }

                uint fillColor;
                str = (string)xml.GetAttribute("fillColor");
                if (str != null)
                {
                    fillColor = UtilsStr.ConvertFromHtmlColor(str, true);
                }
                else
                {
                    fillColor = 0xFFFFFFFF;
                }

                string corner;
                str = (string)xml.GetAttribute("corner");
                if (str != null)
                {
                    corner = str;
                }

                _shape.DrawRect(this.width, this.height, lineSize, lineColor, fillColor);
            }
        }
Ejemplo n.º 3
0
        public void GetEntries()   //private
        {
            iEntries      = new List <ZipEntry>();
            iSourceSize   = 0;
            iCompressSize = 0;

            iStream.position = iStream.length - 22;
            byte[] tmpBuf = new byte[22];

            //iStream.readBytes(buf, 0, 22);
            iStream.ReadBytes(ref tmpBuf, 0, 22);
            ByteBuffer buf = new ByteBuffer(tmpBuf);

            buf.endian   = ByteBuffer.Endian.LITTLE_ENDIAN;
            buf.position = 10;
            int entryCount = buf.ReadUshort();

            buf.position     = 16;
            iStream.position = (int)buf.ReadUint();
            //buf.length = 0;


            for (int i = 0; i < entryCount; i++)
            {
                tmpBuf = new byte[46];
                iStream.ReadBytes(ref tmpBuf, 0, 46);
                buf          = new ByteBuffer(tmpBuf);
                buf.endian   = ByteBuffer.Endian.LITTLE_ENDIAN;
                buf.position = 28;
                uint   len  = buf.ReadUshort();
                string name = iStream.ReadString((int)len);
                int    len2 = buf.ReadUshort() + buf.ReadUshort();
                iStream.position += len2;
                if (UtilsStr.EndsWith(name, "/") || UtilsStr.EndsWith(name, "\\"))
                {
                    continue;
                }

                //name = name.Replace() .replace(/\\/g, "/");
                name = name.Replace("\\", "/");
                ZipEntry e = new ZipEntry();
                e.name         = name;
                buf.position   = 10;
                e.compress     = buf.ReadUshort();
                buf.position   = 16;
                e.crc          = buf.ReadUint();
                e.size         = buf.ReadUint();
                e.sourceSize   = buf.ReadUint();
                iCompressSize += (int)e.size;
                iSourceSize   += (int)e.sourceSize;
                buf.position   = 42;
                e.offset       = buf.ReadUint() + 30 + len;
                e.pkg          = iPkg;

                iEntries.Add(e);    // .push(e);
            }
        }
Ejemplo n.º 4
0
 public static PackageItem GetItemByURL(string url)
 {
     if (UtilsStr.StartsWith(url, "ui://"))
     {
         string    pkgId = url.Substring(5, 8);
         string    srcId = url.Substring(13);
         UIPackage pkg   = GetById(pkgId);
         if (pkg != null)
         {
             return(pkg.GetItem(srcId));
         }
     }
     return(null);
 }
Ejemplo n.º 5
0
        override public void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            XML xml = cxml.GetNode("ComboBox");

            if (xml == null)
            {
                return;
            }

            string str;

            str = (string)xml.GetAttribute("titleColor");
            if (str != null)
            {
                this.titleColor = UtilsStr.ConvertFromHtmlColor(str);
            }
            str = (string)xml.GetAttribute("visibleItemCount");
            if (str != null)
            {
                _visibleItemCount = int.Parse(str);
            }
            XMLList col = xml.Elements("item");

            _items  = new string[col.Count];
            _values = new string[col.Count];
            int i = 0;

            foreach (XML ix in col)
            {
                _items[i]  = ix.GetAttribute("title");
                _values[i] = ix.GetAttribute("value");
                i++;
            }
            this.text = (string)xml.GetAttribute("title");
            if (str != null && str.Length > 0)
            {
                _selectedIndex = Array.IndexOf(_items, this.text);
            }
            else if (_items.Length > 0)
            {
                _selectedIndex = 0;
            }
            else
            {
                _selectedIndex = -1;
            }
        }
Ejemplo n.º 6
0
        override public void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            XML xml = cxml.GetNode("Label");
            if (xml == null)
                return;


            this.title = (string)xml.GetAttribute("title");
            this.icon = (string)xml.GetAttribute("icon");
            string str = (string)xml.GetAttribute("titleColor");
            if(str!=null)
                this.titleColor = UtilsStr.ConvertFromHtmlColor(str);
        }
Ejemplo n.º 7
0
        protected void LoadContent()
        {
            ClearContent();

            if (_url == null || _url == "")
            {
                return;
            }

            if (UtilsStr.StartsWith(_url, "ui://"))
            {
                string pkgId  = _url.Substring(5, 8);
                string itemid = _url.Substring(13);
                _contentItem = UIPackage.GetItemByURL(_url);
                bool error = false;
                if (_contentItem != null)
                {
                    _contentType         = _contentItem.type;
                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;

                    if (_contentType == "jta")
                    {
                        LoadJtaContent();
                    }
                    else if (_contentType == "sound")
                    {
                        byte[] ba = _contentItem.owner.GetResRawDataById(_contentItem.id);
                        if (ba != null)
                        {
                            //_sound = new SoundExt(ba);
                            //setContent(_sound);
                        }
                        else
                        {
                            error = true;
                        }
                    }
                    else if (_contentItem.imageData != null)
                    {
                        __uiResLoaded(_contentItem.imageData);
                    }
                    else
                    {
                        _contentItem.owner.AddItemCallback(_contentItem, __uiResLoaded);
                        _loading = 2;
                    }
                }
                else
                {
                    error = true;
                }
                if (error)
                {
                    _contentItem = null;
                    SetErrorState();
                }
                return;
            }

            _contentType = UtilsStr.GetFileExt(_url);
            if (_contentType == "png" || _contentType == "jpg")
            {
                _contentType = "image";
            }
            else if (_contentType == "wav" || _contentType == "mp3")
            {
                _contentType = "sound";
            }

            if (_contentType == "jta")
            {
                //    loadJtaContent();
            }
            else if (_contentType == "sound")
            {
                //    _sound = new SoundExt(_url);
                //    setContent(_sound);
            }
            else
            {
                if (_loader == null)
                {
                    _loader = new Loader();
                    _loader.AddEventListenerObsolete(EventContext.COMPLETE, __etcLoaded);
                    _loader.AddEventListenerObsolete(EventContext.ERROR, __etcLoadFailed);
                }
                _loader.load(_url);
                _loading = 1;
            }
        }
Ejemplo n.º 8
0
 override protected object ReadValue(string value)
 {
     return(UtilsStr.ConvertFromHtmlColor(value));
 }
Ejemplo n.º 9
0
        override public void Setup_BeforeAdd(XML xml)
        {
            base.Setup_BeforeAdd(xml);

            string str;

            this.displayAsPassword = (string)xml.GetAttribute("password") == "true";
            str = (string)xml.GetAttribute("font");
            if (str != null)
            {
                _font = str;
            }

            str = (string)xml.GetAttribute("fontSize");
            if (str != null)
            {
                _fontSize = int.Parse(str);
            }

            str = (string)xml.GetAttribute("color");
            if (str != null)
            {
                _color = UtilsStr.ConvertFromHtmlColor(str);
            }

            str = (string)xml.GetAttribute("align");
            if (str != null)
            {
                _align = FieldTypes.parseAlign(str);
            }

            str = (string)xml.GetAttribute("vAlign");
            if (str != null)
            {
                _verticalAlign = FieldTypes.parseVerticalAlign(str);
            }

            str = (string)xml.GetAttribute("leading");
            if (str != null)
            {
                _leading = int.Parse(str);
            }
            else
            {
                _leading = 3;
            }

            str = (string)xml.GetAttribute("letterSpacing");
            if (str != null)
            {
                _letterSpacing = int.Parse(str);
            }

            _ubbEnabled = (string)xml.GetAttribute("ubb") == "true";

            this.displayAsPassword = (string)xml.GetAttribute("password") == "true";

            str           = (string)xml.GetAttribute("autoSize");
            _updatingSize = true;
            if (str != null)
            {
                this.autoSize = FieldTypes.parseAutoSizeType(str);
            }

            UpdateTextFormat();
            _updatingSize = false;

            str = (string)xml.GetAttribute("text");
            if (str != null && str.Length > 0)
            {
                this.text = (string)xml.GetAttribute("text");
            }
            else
            {
                this.text = (string)xml.GetAttribute("demoText");
            }
        }