fkworld / cocos-game-framework Goto Github PK
View Code? Open in Web Editor NEWcocos-creator游戏框架,typescript版本。
License: MIT License
cocos-creator游戏框架,typescript版本。
License: MIT License
在 load_res_in_editor 方法中,如果资源是 png 的图,那么路径需要为:……/x.png/x
,与 load_res 需要给出的路径不统一。
应该做成统一的,然后在方法内部进行路径的转换。
与原生之间的互相调用分为android和ios2部分,需要封装。
现有的mpanel逻辑导致:
在界面第1次打开时,调用2次打开逻辑导致界面打开2次的bug。
出现bug的原因是:
第1次进入了loadRes的异步过程,第2次在异步过程未结束时也进入了一个loadRes的异步过程。
在游戏启动时,如果打开了页面但是此页面还未载入成功,则会导致打开失败。
请问从哪获取到的 cocos2d-js-min.js?
我想在自己的项目里使用并保持持续更新应该怎么做?
你的cocos2d-js-min.js是不是就是这里的cocos2d-js-for-preview.js?
promise应该是可以实现异步的,但是在引擎中却是一个半同步的状态,猜测与引擎对promise的es5实现有关。具体问题参考:https://forum.cocos.com/t/or-promise-bug/78686 。
目前对游戏内无重大影响。
是由FVersion.version并未直接赋值引发的,表现为在使用dev_console或者dev_console_namespace,就会报错:
load script [……] failed : TypeError: Cannot read property 'has_state' of null
在本地存储中,所有类型均会转化为string存储。但是为了加快存储的读写,新增了临时存储对象cache,确是以直接的类型存储的。这就导致了一些类型差异的bug。
在测试环境中,特指浏览器环境,一些类需要设置为全局变量,供开发者在控制台中调用。
针对类,建议使用类的装饰器来设置为全局变量。
应该设定为:如果搜索的id不存在,则返回一个由开发者自己设定的默认值。
现在对 meta 数据的处理为,如果为空,则赋值为此行的 id。
这种赋值方式是不恰当的,因为确实存在空字符串为其配置信息。
bug表现:
在使用 cc.tween.repeatForever 时,如果前置了任意 tween,则会报错:[Action update]. override me
bug临时处理方案:
不要在使用此方法时前置 tween
后续处理
已经向官方提交了 issue:cocos/cocos-engine#5322
await FPanel.open(PanelLoading, {})
await FPanel.close(PanelLoading, {})
await FPanel.open(PanelGame, {})
看代码应该是传入一些动画效果,但是这个动画应该怎么写?
type ParamsPanelOpen = Parameters<T["prototype"]["on_open"]>[0] extends undefined ? {} : Parameters<T["prototype"]["on_open"]>[0];
这个东西看的有点懵,不知道应该怎么做?望大神解答
bug表现:bgm(声音&loop为true)在打包为android后无法播放
bug原因:cc.audioEngine.getState方法,在web平台和android平台下的返回值不同。
在web平台中:
cc.audioEngine.getState(undefined)===-1
,其中-1代表cc.audioEngine.AudioState.ERROR
。
在android平台中:
cc.audioEngine.getState(undefined)===undefined
。
bug临时处理方案:
针对undefined的这一特殊返回值进行处理,与cc.audioEngine.AudioState.ERROR的处理逻辑相同。
最近的工作主要是接SDK,游戏制作水平没有什么进步。抽空写一下框架中需要更改的部分:
目前会在最后1次执行前抛出resolve
改为
return new Promise(res => {
let count = (all_count - 1) * interval // 执行总帧数
let frame_index = 0 // 帧index
let f_index = 0 // 函数执行index
ccc.schedule(() => {
if (frame_index % interval === 0) {
f(f_index)
f_index += 1
}
frame_index += 1
frame_index > count && res()
}, 0, count)
})
比如: Apanel 里面有个逻辑需要更新Bpanel某个变量的值
请问准确姿势是怎么做
另外,框架写的很优美,新手的我一目了然,非常感谢
带优先级的实现方式:
错误表现:
Function-name属性在构建后不可用。
可能的原因:
cocos-creator编辑器没有完善Function-name属性的es5实现,导致了在编辑器预览是可用,构建后不可用。
修复方案一:
我搜索了源码,除了MPanel中使用较多,其余使用地方均为在log中,影响不大。
建议在所有的子panel中手动实现一个static fname
属性,并且将MPanel.ts中所有的panel.name
更换为panel.fname
。即可修复此bug。
修复方案二:
我会在近期更新一个MPanel基于非name的实现。
修复方案三:
等待cocos-creator官方修复,已经提了issue:cocos/cocos-engine#4358
这是一个ts语言的相关bug,相关的issue也很多,但都还没有解决。
表现为:
const a = () => {};
export const b = () => {};
console.log(a.name === "a", b.name === "b", b.name === "");
// true false true
可以看到,如果是普通的箭头函数,则可以正确获取函数名;如果是被导出的箭头函数,则无法正确获取函数名。
因此,在此bug未被官方解决之前,建议使用export function
来定义函数。同时,在tsconfig中添加noImplicitThis
配置来防止this的滥用。
应该简化 sound 的配置信息,使其仅保留文件路径。
需要区分开来音乐和音效。
需要对声音的大小进行外部调整处理,在游戏内部以 1 的大小进行播放。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.