esengine / ecs-framework Goto Github PK
View Code? Open in Web Editor NEW一套ecs框架,可用于egret/laya/cocos及其他使用ts/js语言的引擎
License: Apache License 2.0
一套ecs框架,可用于egret/laya/cocos及其他使用ts/js语言的引擎
License: Apache License 2.0
class Emitter<T> {
private _messageTable: Map<T, FuncPack[]>;
...
public addObserver(eventType: T, handler: Function, context: any){
let list: FuncPack[] = this._messageTable.get(eventType);
if (!list){
list = [];
this._messageTable.set(eventType, list);
}
if (list.contains(handler))
console.warn("您试图添加相同的观察者两次");
list.push(new FuncPack(handler, context));
}
public removeObserver(eventType: T, handler: Function){
this._messageTable.get(eventType).remove(handler);
}
...
}
removeObserver
删除的handler是一个Function而messageTable里存的应该是FuncPack,所以应该是怎么删也删不掉的。
建议在Extension中将remove(element): boolean;
改成remove(element: T): boolean;
来做类型检查
RenderLayer设置任何值都无效果
假设有1,2两个线程在执行
_keyX被依次设置为1,2
且他们同时通过了!getItem(this._keyY) === null检查
①假设_keyY被依次设置为1,2
setItem(this._keyY, 1);
10毫秒后线程1即将开始resolve()
此时线程2 setItem(this._keyY, 2);
他们可能同时resolve()
②假设_keyY被依次设置为2,1
setItem(this._keyY, 2);
线程2即将开始resolve()
此时线程1 setItem(this._keyY, 1);
10毫秒后开始resolve()
他们可能同时resolve()
烦请大佬指点 谢谢
组件渲染层级还是无效果
实体如果绘制过会导致界面加载过慢,并且掉帧
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.