示例#1
1
        public Resource Load(string url)
        {
            Resource ret = new Resource();
            ret.Finished = false;

            XmlHttpRequest req = new XmlHttpRequest();

            req.Open(HttpVerb.Get, url, true);
            req.OnReadyStateChange = delegate() {
                if (req.ReadyState == ReadyState.Loaded && req.Status == 200) {
                    ret.Finished = true;

                    /*parse the xml document*/
                    ret.Data = this.ParseShader(XmlDocumentParser.Parse(req.ResponseText));
                }
            };

            req.Send();
            return ret;
        }
示例#2
0
        public Resource Load(string url)
        {
            Resource ret = new Resource();

            Audio audio = new Audio();
            audio.Src = url;

            /*onload does not work for audio*/
            ret.Finished = true;
            ret.Data = audio;

            return ret;
        }
示例#3
0
        public Resource Load(string url)
        {
            Resource ret = new Resource();
            ret.Finished = false;

            Image img = new Image();
            img.OnLoad = delegate {
                ret.Finished = true;
                ret.Data = img;
            };
            img.Src = url;

            return ret;
        }
示例#4
0
        public Resource Load(string url)
        {
            Resource ret = new Resource();
            ret.Finished = false;

            XmlHttpRequest req = new XmlHttpRequest();

            req.Open(HttpVerb.Get, url, true);
            req.OnReadyStateChange = delegate () {
                if(req.ReadyState == ReadyState.Loaded && req.Status == 200) {
                    ret.Finished = true;
                    ret.Data = Json.Parse(req.ResponseText);
                }
            };

            req.Send();
            return ret;
        }