Mercurial > MadButterfly
changeset 1065:eb3719020866
Add support for the second level page.
author | wycc |
---|---|
date | Tue, 30 Nov 2010 03:57:14 +0800 |
parents | 16c69756ef5d |
children | 292fbb86d8f3 |
files | nodejs/examples/mce/epg.js nodejs/examples/mce/main.svg nodejs/examples/mce/mainmenu.js |
diffstat | 3 files changed, 69 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/nodejs/examples/mce/epg.js Tue Nov 30 03:52:43 2010 +0800 +++ b/nodejs/examples/mce/epg.js Tue Nov 30 03:57:14 2010 +0800 @@ -146,13 +146,42 @@ EPG.prototype.onLoad = function(res) { cats = res['ProgramCat']; this.pend = cats.length; + this.maincat = cats; for (i in cats) { c = cats[i]; httpGetFile(c['ProgramPIC'],'cat'+i+'.png',this); } } +EPG.prototype.getList=function(item,func) { + var epgsrv = http.createClient(8080, '211.23.50.144'); + var cmd = '{"Protocol":"EPG-CSP","Command":"SearchRequest","ProgramSub":"'+item.Category+'"}'; + var headers={ + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Host':'211.23.50.144:8080', + 'User-Agent':'MadButterfly', + 'Content-Type':'application/x-www-form-urlencoded' + }; + headers['Content-Length'] = cmd.length; + var request = epgsrv.request('POST', '/IPTV_EPG/EPGService.do?timestamp='+new Date().getTime(),headers); + var self = this; + sys.puts("aaaa"); + var js = ''; + request.write(cmd); + request.end(); + request.on('response', function(res) { + sys.puts("connected"); + res.on('data',function (data) { + js = js + data; + }); + res.on('end', function () { + res = JSON.parse(js); + sys.puts("parsed"); + func(); + }); + }); +} EPG.prototype.onInitDone=function() { if (this.loadCallback) this.loadCallback();
--- a/nodejs/examples/mce/main.svg Tue Nov 30 03:52:43 2010 +0800 +++ b/nodejs/examples/mce/main.svg Tue Nov 30 03:57:14 2010 +0800 @@ -56,10 +56,10 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" - inkscape:cx="574.12471" + inkscape:cx="206.98185" inkscape:cy="483.73232" inkscape:document-units="px" - inkscape:current-layer="Layer 1s1841" + inkscape:current-layer="Layer 1s235" showgrid="false" inkscape:window-width="1680" inkscape:window-height="976" @@ -109,7 +109,7 @@ <g id="Layer 1s1841" inkscape:groupmode="layer" - style="display:inline"> + style="display:none"> <g transform="translate(7.14163,8.5714057)" id="g2999" @@ -175,7 +175,7 @@ inkscape:bbox-height="291.09415" /> </g> <g - transform="translate(7.14163,8.5714057)" + transform="translate(7.14163,8.571406)" id="g2926" inkscape:label="cat2" inkscape:bbox-x="599.07141" @@ -334,7 +334,7 @@ <g id="Layer 1s235" inkscape:groupmode="layer" - style="display:none"> + style="display:inline"> <rect x="0" y="0" @@ -349,6 +349,28 @@ id="image3245" x="0" y="-27.637817" /> + <g + transform="matrix(1.1857143,0,0,1.2748252,-274.497,-403.36247)" + id="g29230" + inkscape:label="current" + inkscape:bbox-x="359.21432" + inkscape:bbox-y="455.42856" + inkscape:bbox-width="200" + inkscape:bbox-height="291.09415"> + <image + sodipodi:absref="/home/wycc/devel/md7/MadButterfly/nodejs/examples/mce/./cat1.png" + xlink:href="./cat1.png" + inkscape:bbox-height="291.09415" + inkscape:bbox-width="200" + inkscape:bbox-y="455.42856" + inkscape:bbox-x="359.21432" + inkscape:label="" + width="200" + height="291.09415" + id="image3116-4" + x="330.29868" + y="458.24133" /> + </g> </g> </g> </svg>
--- a/nodejs/examples/mce/mainmenu.js Tue Nov 30 03:52:43 2010 +0800 +++ b/nodejs/examples/mce/mainmenu.js Tue Nov 30 03:57:14 2010 +0800 @@ -16,6 +16,7 @@ var self = this; var epg = new EPG.EPG(); epg.registerInitDone(function() { self.init();}); + app.epg = epg; //self.init(); } MainMenu.prototype.init=function() @@ -127,12 +128,15 @@ MainMenu.prototype.key_enter=function() { + var self = this; var target = this.items[this.item]; - var sx = 500 - target.center.x; - var sy = 220 - target.center.y; - var an = new animate.shift(this.app,target,sx,sy); - var self = this; - animate.run([an],0,2.5,function() {self.changePage();}); + var an = new animate.scale(this.app, target, 1/1.1, 1/1.5); + animate.run([an], 0, 0.3,function() { + var sx = 259 - target.center.x; + var sy = 355 - target.center.y; + var an1 = new animate.shift(self.app,target,sx,sy); + animate.run([an1],0,1,function() {self.changePage(self.item);}); + }); for(i=0;i<this.items.length;i++) { if (i == this.item) continue; if (i > this.item) { @@ -149,8 +153,11 @@ } } -MainMenu.prototype.changePage=function() { +MainMenu.prototype.onNextPage=function() { this.app.changeScene(2); } +MainMenu.prototype.changePage=function(item) { + this.epg.getList(item,self.onNextPage()); +} exports.MainMenu=MainMenu;