网上关于cocos2d-Js的资料有点少,都是自己研究官方的样例。。。做个记录
进度条就很常用的一个ui
ccui扩展提供了一个比较方便的实现
只要设置相关参数就可以使用,跟AndroID的进度条差不多
代码:
this._loading = new ccui.Loadingbar(); this._loading.setname("Loadingbar"); this._loading.loadTexture(res.loading_1);//设置进度条的加载图片 this._loading.setPercent(30);//开始的进度 this._loading.x = screenSize.wIDth / 2; this._loading.y = screenSize.height / 2 + this._loading.height / 4; this.addChild(this._loading); this.scheduleUpdate();//自动更新
update: function (dt) { this._count++; if (this._count > 100) { this._count = 0; } this._loading && this._loading.setPercent(this._count); }
以上大部分是官方dome给出的代码。
值得提醒的是,要是使用ccui相关扩展需要在Porject.Json文件中的modules中添加 extensions模块,不然会报错的哟!
"modules" : ["cocos2d","extensions"],总结
以上是内存溢出为你收集整理的cocos2d-js 进度条(ccui扩展)全部内容,希望文章能够帮你解决cocos2d-js 进度条(ccui扩展)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)