Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component Hook. #97

Closed
wants to merge 5 commits into from
Closed

Conversation

lihaochen910
Copy link

Add component-related event handling.
(Code may need tidying up)

@genaray
Copy link
Owner

genaray commented Apr 25, 2023

Thanks a lot! That looks promising ^^

Could you please update the branch to the latest master? If i saw that correctly its still using a slightly older version. And could you provide a small code sample aswell? :D

@lihaochen910
Copy link
Author

Sorry forgot to merge to latest, this is my second time using Pull Request operation. please advise. :)

@lihaochen910
Copy link
Author

An example of use is as follows:

var componentHook = new ComponentHookRecord< Transform >{
    OnAdd = ( in Entity entity, ref Transform component ) =>
    {

    },
    OnSet = ( in Entity entity, ref Transform component ) =>
    {

    }, 
    OnRemove = ( in Entity entity, ref Transform component ) =>
    {

    }
};
world.RegisterComponentHook(componentHook);

@genaray
Copy link
Owner

genaray commented Apr 25, 2023

An example of use is as follows:

var componentHook = new ComponentHookRecord< Transform >{
    OnAdd = ( in Entity entity, ref Transform component ) =>
    {

    },
    OnSet = ( in Entity entity, ref Transform component ) =>
    {

    }, 
    OnRemove = ( in Entity entity, ref Transform component ) =>
    {

    }
};
world.RegisterComponentHook(componentHook);

Thanks, looks great! I'll gonna test it later and then merge it :) (Once I'm home).
Could you probably add documentation later on? That would be great since i haven't written the code... and for others to understand it. Should fit the other documentations from the rest of the project ^^

@lihaochen910
Copy link
Author

Ok, I'll submit it after I finish the documentation.

@genaray
Copy link
Owner

genaray commented May 9, 2023

Closed in favor for #98

@genaray genaray closed this May 9, 2023
@DrSmugleaf DrSmugleaf mentioned this pull request May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants