jQuery自定义Loading动画插件spin.js | HTML5资源教程如何自定义Cocos2d-HTML5 Loading界面_百度知道
如何自定义Cocos2d-HTML5 Loading界面
提问者采纳
/, 1.getInstance(),
_processLayer. ".L
this.c4b(255,通过长度来标示加载的进度/,= 100)
this.p(- this!
/: function () { 可以启用锚点.,后面将会说明;%& 设置当前进度条层的长度
this._processLayerLength = 500..: null.; 2 - 50))).unschedule(/
this. 这里省略,
}自定义Cocos2d-html 5 Loading界面代码,
_texture2d: null.pAdd(centerPos, -logoHeight /;;
this.init().getPercentage();base64._processL 每帧更新
_updatePercent: .; 100);/._processLayer._processLayer.setString(tmpStr);
/,}.setPosition(cc._processLayer: null..prototype.getInstance().
//:/.._ onEnter ._super();
//._processLayerLength /:image/ 以下方法的实现并没有跟 LoaderScene 有什么不同
return this:function(){
///.extend(
_logo.Scene,/
_winSize., target) {
if (,添加了两个属性,
/.ignoreAnchorPointForPosition(false)._processLayer).getWinSize(); onE/ ; + percent + "._instance, 128),于 LoaderScene 同样
/., 100: _startLoading .addChild(/
var tmpStr = ",固做简写logoData = "._winSize =
/ _initStage._updatePercent)._bgLayer._instance = new Loading():/.changeWidth(this.
/ _logoFadeIn
/ 创建一个 Loading
this.; logo 图片和 label 的添加 .setAnchorPoint(/.D//.".
/,._instance) {
/ 构造函数 2;
}, 30);/Loading.create(cc,这里的编码内容挺多,
/.preload = function ( 这里于 LoaderScene 的实现同样L/..LayerC
if (percent >.init: null._processLayerLength * percent /..._label: null.S
/..: function () {
var percent = cc._processLayer = cc.,并设置以满足自己的需要
_logoT initWithResources .call(this); 相比 LoaderScene
的实现.,标示进度条层和进度条长度
_processLayerLLoading =/, 0)).p(0, 100,它就是一个红色颜色层:/,
_ 这里定义了 Logo 图片的 Base64 编码;data,至于为什么;/ 设置进度条层
电子产品技术支持
其他类似问题
cocos2d的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁如何自定义 Cocos2d-html5 Loading 界面_百度知道
如何自定义 Cocos2d-html5 Loading 界面
提问者采纳
& .pAdd(centerPthis:&//&&&& ..&&&&&&&//&{& . .getInstance();&&;&&// .extend( ._processL&&&&&&&=&&base64;构造函数&_startLoading ,&&+&100) :function(){&图片的 : ._bgLLoaderScene ._processL&&& ,&&&&&&}&_bgL ,并设置以满足自己的需要&=& .create(&&&&&&&{ .init.call(this); .p(0;this.setPosition(cc._processL& ,它就是一个红色颜色层;&100;&&&&&&&var .ignoreAnchorPointForPosition(false);percent&&;这里省略;&_&的实现同样Loading. .;tmpStr&&&&logo&& ._instance ._super();编码;&&&每帧更新&this..init();return&&同样 .unschedule(& .;&&&init..;&/& ._& .&+ ,&&};& :image/=& .getInstance(); 自定义Cocos2d-html&&//&&//&图片和 .;&&=&Loading&&&&& : .&&& .setString(tmpStr),这里的编码内容挺多;&}}); ,&&&&&&&function& .;&&&&//&&_updateP&&&1._winSize .;(&& ._cc,&&&的添加&&//& :// ,通过长度来标示加载的进度&LoaderScene&&;&percent& ,& ,&&&&5&- .,&function&&&& .addChild(设置进度条层;& .;&&有什么不同&&if ._&&": .p(-&>,&&&&%&&/&:// .;&这里于 .L .S&&if&var&//&//& !this,&&&()&()&LoaderScene&&= .S&&function&& ,固做简写logoData&创建一个&_winS//&=&100);& .D& .LayerC{&&& .preload&=& ._processLpercent&=&;&&};Loading..getWinSize()._processLayerLength&&(;&_processLayerLength.;128);onExit&&&&&&Loading界面代码; .&&& :& ._updatePercent);&&&&&&&这里定义了&&&&//&,&& .;&&&&&以下方法的实现并没有跟&&=&&//&500; :&&&&(percent&this.changeWidth(&&_processL&/&&& .setAnchorPoint(//&//&* :&100;30);&&& ._processLayer&可以启用锚点;设置当前进度条层的长度&2;&_logoT&& ,&&&target)&;&Loading();&",至于为什么;&0));this.c4b(255.&&&&Logo&LoaderScene&onEnter ._instance)&相比&&& ,后面将会说明;//&&& .&&_logoFadeIn&&& .;& .& ,&&&&_texture2d,添加了两个属性._processLayerLength ._processLayerLength&&& : ,&50)));的实现;= ._processLayer);&&new&.&&&_initStage.getPercentage();& ,&&initWithResources&&& ,&&&& .;//&2&&&&{ ,&&,标示进度条层和进度条长度&&label& , ,&Loading&};// , : ,于&Base64&&_-logoHeight :&&&//& ,
其他类似问题
cocos2d的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁cocos2d-x关于home键黑屏跟游戏loading界面_操作系统大全_优良自学吧 |
当前位置: >
> cocos2d-x关于home键黑屏跟游戏loading界面优良自学吧提供cocos2d-x关于home键黑屏跟游戏loading界面,cocos2d-x关于home键黑屏和游戏loading界面有时候场景中的资源加载过多的话就会引起游戏进入的时候很卡,因为那是边加载边显示。还有在游戏中按下home键 再进入游戏的时候会有一段时间的黑屏,那是因为游戏要重新加载资源,这样用户体验非常不好。 我在testscocos2d-x关于home键黑屏和游戏loading界面有时候场景中的资源加载过多的话就会引起游戏进入的时候很卡,因为那是边加载边显示。还有在游戏中按下home键 再进入游戏的时候会有一段时间的黑屏,那是因为游戏要重新加载资源,这样用户体验非常不好。
我在tests例子里面发现一个很好的例子叫做TextureCacheTest,里面讲解了如何写loading。
首先在类头文件里面写上:
//loading......callback
void loadingCallBack(cocos2d::CCObject *obj);
void addSprite();
cocos2d::CCLabelTTF *m_pLabelL
cocos2d::CCLabelTTF *m_pLabelP
int m_nNumberOfS//计数用 在构造函数中初始化成要加载的资源个数
int m_nNumberOfLoadedS//初始化为0然后在cpp里面实现:这是我随便截取的代码
CCSize size = CCDirector::sharedDirector()-&getWinSize();
//////////////////////////////////////////////////////////////////////////
//loading界面
m_pLabelLoading = CCLabelTTF::create(&loading...&, &Arial&, 15);
m_pLabelPercent = CCLabelTTF::create(&%0&, &Arial&, 15);
m_pLabelLoading-&setPosition(CCPointMake(size.width / 2, size.height / 2 - 20));
m_pLabelPercent-&setPosition(CCPointMake(size.width / 2, size.height / 2 + 20));
this-&addChild(m_pLabelLoading,10);
this-&addChild(m_pLabelPercent,10);
//////////////////////////////////////////////////////////////////////////
CCTextureCache::sharedTextureCache()-&addImageAsync(&gobacknormal.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&gobackselected.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/achievementnormal.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/achievementselected.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle1normal.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle2normal.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle3normal.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle1selected.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle2selected.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle3selected.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle1lock.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle2lock.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle3lock.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle2lockselected.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/Bighurdle3lockselected.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Bighurdle/main.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));
CCTextureCache::sharedTextureCache()-&addImageAsync(&Smallhurdle/starfull.png&, this, callfuncO_selector(BighurdleLayer::loadingCallBack));然后在回调函数
void BighurdleLayer::loadingCallBack(cocos2d::CCObject *obj)
++m_nNumberOfLoadedS
char tmp[10];
sprintf(tmp,&%%%d&, (int)(((float)m_nNumberOfLoadedSprites / m_nNumberOfSprites) * 100));
m_pLabelPercent-&setString(tmp);
if (m_nNumberOfLoadedSprites == m_nNumberOfSprites)
this-&removeChild(m_pLabelLoading, true);
this-&removeChild(m_pLabelPercent, true);
addSprite();//这里是自己写得添加精灵的函数
}如果有更好的方法,请告知我,谢谢 共同进步
(本文来自互联网,不代表搜站(/)的观点和立场)编辑推荐最近更新如何自定义 Cocos2d-HTML5 Loading 界面_百度知道
如何自定义 Cocos2d-HTML5 Loading 界面
提问者采纳
能看到命名为
gamecanvas
元素.html 页面,index,在页面的 DOM 树中,加载了
cocos2d.html
开始,另一点.js,以
HelloHTML5World
为例 在开始我们的替换工作之前,值得注意的有两点、cocos2d.js 和 main:浏览器首先加载 index。从其主页面
index,在页面的最后.js
文件,大致说一下必要的(只注重我们在乎的细节问题)原有的加载流程,我们需要了解三个文件的运作方式,它将会是游戏的画布.html
其他类似问题
cocos2d的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}