User avatar
jsantos
Site Admin
Posts: 2797
Joined: 20 Jan 2012, 17:18
Contact:

Re: 1.3 BETA4: SetTheme and ResourceDictionary

16 Feb 2017, 09:15

We abandoned that approach and reload UI completely by restarting NoesisGUI (so we needed to modify C# SDK code even more to support that approach and still have some issues like memory access violation, @jsantos promised us a proper NoesisGUI reload API in 1.3.x). Of course it leads to the UI state loss but in our case the game restores the state quickly (but not completely, so some opened menus will be closed).
The plan is only doing the restart in the C# side, but maintain the same C++ initialization (because having a proper init/shutdown in C++ is not possible right now). We are following this approach in Unity and it is working fine. Your scenario is a bit different because Unity is unloading and reloading all the assemblies, but I would say it is going to work for your game with minor modifications.

We expect to provide a new beta with this functionality this week.
 
User avatar
ai_enabled
Posts: 220
Joined: 18 Jul 2013, 05:28
Contact:

Re: 1.3 BETA4: SetTheme and ResourceDictionary

16 Feb 2017, 10:14

@jsantos, thanks! That's will be enough for our needs. Looking forward for the next build!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
 
Ziriax
Topic Author
Posts: 60
Joined: 10 Dec 2015, 17:59
Location: Belgium
Contact:

Re: 1.3 BETA4: SetTheme and ResourceDictionary

16 Feb 2017, 11:55

@jsantos: yes, just calling SetTheme once is good enough for us, my "trick" seems to work fine. But I can't update my github code yet because 1.3 BETA4 makes the constructor of ResourceDictionary private, so I had to disable that code (not a major limitation since I just include the resources in XAML then)

@ai_enabled: Again many thanks for your feedback, you seem to have much more experience than I do with this. I'll certainly look at the serializer you provided and Roslyn rewriting code. I did write an "infinite" .NET serializer a long time ago, ie a serializer that was able to serialize IEnumerable<object> to a stream. It also serialized simple delegates (not closures) using surrogates, but it never worked perfectly, although it did the job most of the time ;-)

I currently just use the DataContractSerializer for my view-models. I also use that for debugging and taking the state of my application. This serializer doesn't clone referenced objects, it keeps the references. But my app is not a real game, it is more like a visual programming language editor for kids, and currently I do not use co-routines or continuations, so I hope this will work good enough. Just remembering and restoring the current screen would already be a tremendous speedup.

Since I use reactive-programming in my view-models, I just use the OnDeserializedAttribute attribute to restore the logic of computed properties. Stateful reactive graphs (like RX Scan, accumulators) are indeed lost like this, but currently I have my own little reactive system that just does not allow that :-)

Exciting times!
Peter Verswyvelen,
Strongly Typed Solutions

Who is online

Users browsing this forum: No registered users and 12 guests