摘要: 按钮的自定义参数--》是字符串参数,需要转整数 on_button_click:function(e,level){ level = parseInt(level);//按钮传进的参数是字符串 } 按钮响应事件: onLoad:function(){ this.red_button = this.n 阅读全文
posted @ 2021-02-05 11:55 zhuheNiu 阅读(1078) 评论(0) 推荐(0)
摘要: //1、UI_ctrl 把本脚本挂载到有需要的根节点。 cc.Class({ extends: cc.Component, properties: , load_all_object(root, path) { for(let i = 0; i < root.childrenCount; i ++) 阅读全文
posted @ 2021-02-05 11:52 zhuheNiu 阅读(1325) 评论(0) 推荐(0)
摘要: 问题描述 在cocos creator中测试cc.AudioSource功能的时候,发现了一个特别奇怪的现象 从谷歌浏览器中运行时,怎么都听不到声音,然后F12查看发现有这样一个警告 The AudioContext was not allowed to start. It must be resu 阅读全文
posted @ 2021-02-05 11:45 zhuheNiu 阅读(1272) 评论(0) 推荐(0)
摘要: //适用于需要轮播公告系统,本文仅是前端写法 cc.Class({ extends: cc.Component, properties: { maskNode:cc.Node, label:cc.Label, _startPos:cc.Vec2, contentArr:[""], }, onLoad 阅读全文
posted @ 2021-02-05 11:44 zhuheNiu 阅读(442) 评论(0) 推荐(0)
摘要: /* 显示[1, 100]这个数据 (1)我们将我们滚动列表里面的每个项分成三个页 (2)每一个页面我们制定一个数目,例如8个,根据你的scrollview的大小来决定; (3)总共使用的滚动列表里面的想 PAGE_NUM * 3 = 24个; (4) 有限的项要显示 超过它数目的数据记录? */ 阅读全文
posted @ 2021-02-05 11:42 zhuheNiu 阅读(512) 评论(0) 推荐(0)
摘要: //加载场景进度--预加载资源,是做公开属性数组,把所有需要加载的资源,手动拖到数组里,把脚本挂到场景上就相当于预加载资源了 //completedCount:已完成的项目数目 //totalCount:项目的总数 //item:从项目中流出的最新项 cc.loader.onProgress = f 阅读全文
posted @ 2021-02-05 11:41 zhuheNiu 阅读(962) 评论(0) 推荐(0)
摘要: get:提交请求 post:上传文件 var http = { // calback(err, data) // url 站点: http://www.baidu.com // path 子路径 /index.htm // params: key1=value1&key2=value2&key3=v 阅读全文
posted @ 2021-02-05 11:39 zhuheNiu 阅读(1296) 评论(0) 推荐(0)
摘要: //此文是日常用到的一些获取点击,跟随,位移,朝向与两点之间的距离总结 this.startPos = cc.v2(0, 0); //开始位置 this.endPos = cc.v2(0, 0); //结束位置 //获取点击的位置 this.node.on(cc.Node.EventType.TOU 阅读全文
posted @ 2021-02-05 11:32 zhuheNiu 阅读(1290) 评论(0) 推荐(0)
摘要: let tween = cc.tween(item) //几个tween同时进行 .parallel( //兼容多种写法 cc.jumpTo(time, cc.v2(this.curCardBg.x, this.curCardBg.y), 300, 1), cc.tween().to(time, { 阅读全文
posted @ 2021-02-05 11:27 zhuheNiu 阅读(1667) 评论(0) 推荐(0)