Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Evoluon.Editeur
- {
- [InitializeOnLoad]
- public class EditorEvents
- {
- static EditorEvents()
- {
- EditorPlayMode.PlayModeChanged -= ReplaceDatasByRuntime;
- EditorPlayMode.PlayModeChanged += ReplaceDatasByRuntime;
- }
- private static void ReplaceDatasByRuntime(PlayModeState currentMode, PlayModeState changedMode)
- {
- if (changedMode == PlayModeState.Stopped)
- {
- WorldManager wm = Object.FindObjectOfType<WorldManager>();
- Debug.Log("Count saves : " + wm.saves.Count);
- ThreadPool.QueueUserWorkItem(state => ReplaceDatas(wm));
- }
- }
- public static void ReplaceDatas(WorldManager wm)
- {
- Thread.Sleep(2000);
- foreach (Save s in wm.saves)
- {
- Debug.Log(s.datas.GetType());
- Debug.Log("Saved data " + ((TurbuDatas)s.datas).octave);
- EditeurZone zone = wm._zonesT.Where(p => p == s.zone).Single();
- Debug.Log("Reel data " + zone.Turbu.datas.octave);
- s.zone.Turbu.datas = (TurbuDatas)s.datas;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement