public static void AddToMacro(string macroTitle) { int append = 0; if (File.Exists($"Presets/Geology/Macros/{macroTitle}.macro")) { LoadGeologyMacro(macroTitle); } else { macro = new GeologyPreset[0]; } if (macro != null) { append = macro.Length; } GeologyPreset[] newMacro = new GeologyPreset[append + 1]; for (int i = 0; i < append; i++) { newMacro[i] = macro[i]; } newMacro[append] = geology; macro = newMacro; SaveGeologyMacro(macroTitle); }
public EditorSettings ( string rustDirectory = @"C:\Program Files (x86)\Steam\steamapps\common\Rust", float prefabRenderDistance = 700f, float pathRenderDistance = 200f, float waterTransparency = 0.2f, bool loadbundleonlaunch = false, bool terrainTextureSet = false, bool style = true, CrazingPreset crazing = new CrazingPreset(), PerlinSplatPreset perlinSplat = new PerlinSplatPreset(), RipplePreset ripple = new RipplePreset(), OceanPreset ocean = new OceanPreset(), TerracingPreset terracing = new TerracingPreset(), PerlinPreset perlin = new PerlinPreset(), GeologyPreset geology = new GeologyPreset(), ReplacerPreset replacer = new ReplacerPreset(), RustCityPreset city = new RustCityPreset()) { this.rustDirectory = rustDirectory; this.prefabRenderDistance = prefabRenderDistance; this.pathRenderDistance = pathRenderDistance; this.waterTransparency = waterTransparency; this.loadbundleonlaunch = loadbundleonlaunch; this.terrainTextureSet = terrainTextureSet; this.style = style; this.crazing = crazing; this.perlinSplat = perlinSplat; this.prefabPaths = SettingsManager.PrefabPaths; this.ripple = ripple; this.ocean = ocean; this.terracing = terracing; this.perlin = perlin; this.geology = geology; this.replacer = replacer; this.city = city; }
public static void LoadGeologyMacro(string filename) { using (StreamReader reader = new StreamReader($"Presets/Geology/Macros/{filename}.macro")) { string macroFile = reader.ReadToEnd(); char[] delimiters = { '*' }; string[] parse = macroFile.Split(delimiters); int length = parse.Length - 1; GeologyPreset[] newMacro = new GeologyPreset[length]; for (int i = 0; i < length; i++) { newMacro[i] = JsonUtility.FromJson <GeologyPreset>(parse[i]); } macro = newMacro; } }