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

[feature] Custom Class integration like Cocos Studio C++ #169

Open
drelaptop opened this issue May 3, 2018 · 0 comments
Open

[feature] Custom Class integration like Cocos Studio C++ #169

drelaptop opened this issue May 3, 2018 · 0 comments

Comments

@drelaptop
Copy link
Contributor

Discuss

https://discuss.cocos2d-x.org/t/creator-custom-class-integration-like-cocos-studio-c/42471

this feature is put forward and doing by @pabitrapadhy

Example Repo

https://github.com/pabitrapadhy/CocosCreatorCppDemo

Introduce from Discuss

Earlier, I have been programming cocos2dx games using Cocos Studio.
The concept of Custom Class and ability to create a separate Layer csd file was pretty handy.

Since, Cocos Creator has no functionality to directly read CustomClass name, neither to export only Layer files. I’ve been working to bridge this issue.

These are the following things that I’ve added to the project -

Used specific naming convention i.e “Layer_ClassName_NodeName” in nodes, that I can attach custom class. The reason behind it to create a runtime class of that type from the string, directly while reading the ccreator file. Ex - CustomLayer class in my project. (Used Factory Pattern).

Subclassed the reader to create the Scene of custom type, while reading from the ccreator file directly. Ex - CustomScene class in my project.
So, by doing this the CustomLayer object would be created, while reading the Scene
or if you want to create objects in the runtime, it will do so.

Wrote meta codes, to handle for - CustomScene, CustomLayer, ButtonClickEvent etc.

Related Discusses

https://discuss.cocos2d-x.org/t/help-with-creator-cpp-layering/42468
https://discuss.cocos2d-x.org/t/solved-creator-cpp-custom-class-integration/42469

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

No branches or pull requests

1 participant