摘要: 今天遇到一个问题,在forEach中不会等待异步完成 ActivityImgPath[this.activityName].forEach((path,index) => async () => { const key = ActivityImgName[this.activityName][ind 阅读全文
posted @ 2023-11-21 17:58 赋流 阅读(40) 评论(0) 推荐(0) 编辑
摘要: https://www.chuyouxiang.com/archives/940 引用这段: 以使用最广泛的资源图片为例,引擎每加载一张新的图片,都会在内存中为3种对象各创建一个实例,分别是 SpriteFrame、Texture2D、ImageAsset。在动态合图开启的情况下,这3个实例自动记录 阅读全文
posted @ 2023-11-09 14:23 赋流 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 今天开发时,释放了预制体资源引起报错,这里直接使用了bundle.release 因为预制体的精灵图片是动态加载的,释放时将精灵图片一并释放了,引起错误 改为引用计数,解决问题 cocos资源释放文档:https://docs.cocos.com/creator/manual/zh/asset/re 阅读全文
posted @ 2023-11-08 17:11 赋流 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 在C++中,vector<int>是一个动态数组,可以存储整数类型的元素。locationVec是一个vector<int>类型的对象。 locationVec.at(i)和locationVec[i]都用于访问locationVec中的元素,但它们有一些区别。 locationVec.at(i): 阅读全文
posted @ 2023-08-04 10:13 赋流 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 在 TS 中,类似数组、字符串、数组、接口这些常见的类型都非常常见,但是如果要定义一个对象的 key 和 value 类型该怎么做呢?这时候就需要用到 TS 的 Record 了。 来自TypeScript 之 Record - 简书 (jianshu.com) 【TypeScript】TypeSc 阅读全文
posted @ 2023-08-02 10:02 赋流 阅读(156) 评论(0) 推荐(0) 编辑
摘要: enum BlockPrefab{ BLOCK2 = 0, BLOCK4, BLOCK8, BLOCK16, BLOCK32, BLOCK64, BLOCK128, BLOCK256, BLOCK512, BLOCK1024, BLOCK2048 } let num = BlockPrefab.BL 阅读全文
posted @ 2023-07-26 16:49 赋流 阅读(431) 评论(0) 推荐(0) 编辑
摘要: const animationComponent = i.addComponent(Animation); if(animationComponent){ const component = animationComponent.getComponent(Animation); if(compone 阅读全文
posted @ 2023-07-24 20:03 赋流 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 今天在开发过程中遇到深拷贝与浅拷贝的问题 const userData1: number[][] = this.dataMangager.getUserDataMap(); 该行代码中的userData1 是一个指向 this.dataMangager.getUserDataMap() 返回的二维数 阅读全文
posted @ 2023-07-24 15:11 赋流 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 出现这种情况一般为节点未成功创建 阅读全文
posted @ 2023-07-21 09:16 赋流 阅读(113) 评论(0) 推荐(0) 编辑
摘要: private _dataMap:Vec3[][] = []; private _userDataMap:number[][] = []; init() { for(let i = 1; i <= 4; i++){ for(let j = 1; j <= 4; j++){this._dataMap[ 阅读全文
posted @ 2023-07-20 19:49 赋流 阅读(894) 评论(0) 推荐(0) 编辑