public InGameEditor() { resizeable = false; avaliableBiomes = DefDatabase <BiomeDef> .AllDefs.ToList(); FieldInfo fieldlayers = typeof(WorldRenderer).GetField("layers", BindingFlags.NonPublic | BindingFlags.Instance); FieldInfo fieldMeshes = typeof(WorldLayer).GetField("subMeshes", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); var tempLayers = fieldlayers.GetValue(Find.World.renderer) as List <WorldLayer>; Layers = new Dictionary <string, WorldLayer>(tempLayers.Count); LayersSubMeshes = new Dictionary <string, List <LayerSubMesh> >(tempLayers.Count); foreach (var layer in tempLayers) { Layers.Add(layer.GetType().Name, layer); List <LayerSubMesh> meshes = fieldMeshes.GetValue(layer) as List <LayerSubMesh>; LayersSubMeshes.Add(layer.GetType().Name, meshes); } WorldUpdater = WorldEditor.WorldUpdater; layersWindow = new LayersWindow(); factionEditor = new FactionMenu(); worldObjectsEditor = new WorldObjectsEditor(); }
public static void InitEditor() { if (isEdit || Settings.FullyActiveEditor) { if (!isInit) { WorldUpdater = new WorldUpdater(); Editor = new InGameEditor(); isInit = true; } } }