davebac
Topic Author
Posts: 19
Joined: 09 May 2014, 03:21

NoesisToUnity CodeSmith Template

30 May 2015, 00:25

I'll be placing this on GitHub.

For simple cases, this CodeSmith Generator template will produce a MonoBehaviour that you can use in conjunction with NoesisGUI in Unity. Place the NoesisGUIPanel and the generated behavior on the same GameObject (for example -- on the Camera).

For each XAML, two C# files are generated. One C# file contains property definitions for each named element in the XAML. The other C# file contains an Awake function that calls InitializeComponent().

The C# file that contains the Awake function is only created if it does not exist, otherwise I leave it alone. Therefore you can put whatever code you need in that file. (the .g.cs file is the one that gets overwritten every time, the .cs file gets left alone, if you're used to Visual Studio you probably have seen this pattern once or twice)

This only handles extremely simple cases -- which turns out to be all I need right now. If someone else ends up using it and needs it to do more, or if I end up needing more than this at some point, I'll update it. I'm not quite ready to set it up on GitHub.

As is normal, generated files are yours under whatever license you choose to apply.

The CST files themselves are going to be MIT when I upload them.
Attachments
NoesisToUnity.zip
(2.46 KiB) Downloaded 315 times
 
User avatar
jsantos
Site Admin
Posts: 4264
Joined: 20 Jan 2012, 17:18
Contact:

Re: NoesisToUnity CodeSmith Template

01 Jun 2015, 22:58

This is great!

If you want, we could host it at our contrib repository. Or if you prefer having your own repository we can branch it at our account.

Thanks for sharing this with the community.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests