GithubHelp home page GithubHelp logo

esengine / ecs-framework Goto Github PK

View Code? Open in Web Editor NEW
254.0 8.0 74.0 20.39 MB

一套ecs框架,可用于egret/laya/cocos及其他使用ts/js语言的引擎

License: Apache License 2.0

JavaScript 51.12% TypeScript 48.88%
system-ecs scene-ecs vector2 rectangle collider ecs-framework collider-deltamovement boxcastbroadphase-collider entity startcoroutine

ecs-framework's Issues

以下情况LockUtils是否会失效

假设有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()

烦请大佬指点 谢谢

Emitter类移除监听时是否有错

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;来做类型检查

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.