public void SpawnEntityInWorld(MapObjectSpawnDescriptor dragData) { WLog.Info(LogCategory.EditorCore, null, "Caught object to be spawned {0} in scene: {1}", dragData, SelectedScene); // Meh. MapEntityLoader loader = new MapEntityLoader(m_editorCore, Map); // We can skip post-processing the entities via MapEntityLoader b/c that just does reference fixups, and // because this is a new entity there's no references so no point in trying to fix them up. var newEnt = loader.CreateEntity(dragData); if (SelectedScene is Stage) { MapLoader.PostProcessStage((Stage)SelectedScene, new List <MapEntityLoader.RawMapEntity>(new[] { newEnt })); } if (SelectedScene is Room) { MapLoader.PostProcessRoom((Room)SelectedScene, new List <MapEntityLoader.RawMapEntity>(new[] { newEnt })); } // meh more hacks. foreach (var ent in SelectedScene.Entities) { ent.World = this; } }
private void LoadEditorTemplates() { string executionPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); WLog.Info(LogCategory.EditorCore, null, "Loading JSON templates from {0}.", executionPath); string entityDescriptorFolder = executionPath + "/WindWaker/Templates/MapEntityData/"; string objectDescriptorFolder = executionPath + "/WindWaker/Templates/ObjectData/"; Templates.LoadTemplates(entityDescriptorFolder, objectDescriptorFolder); }
public EditorCore() { WLog.Info(LogCategory.EditorCore, null, "Initializing Editor Core..."); m_stdOutLogger = new StandardOutLogger(); m_editorWorlds = new BindingList <WWorld>(); Templates = new TemplateManager(); m_mainWorld = new WWorld("main", this); m_editorWorlds.Add(m_mainWorld); m_mainWorld.InitializeSystem(); LoadEditorTemplates(); WLog.Info(LogCategory.EditorCore, null, "Editor Core Initialized."); }