Esempio n. 1
0
 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;
 }
Esempio n. 2
0
    public void OnGUI()
    {
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);
        GUIContent[] mainMenu = new GUIContent[6];
        mainMenu[0] = new GUIContent("File");
        mainMenu[1] = new GUIContent("Settings");
        mainMenu[2] = new GUIContent("Prefabs");
        mainMenu[3] = new GUIContent("Layers");
        mainMenu[4] = new GUIContent("Generator");
        mainMenu[5] = new GUIContent("Advanced");

        mainMenuOptions = GUILayout.Toolbar(mainMenuOptions, mainMenu, EditorStyles.toolbarButton);

        Functions.SaveSettings();

        #region Menu
        switch (mainMenuOptions)
        {
            #region File
        case 0:
            Functions.EditorIO();
            Functions.NewMapOptions(ref mapSize, ref landHeight, ref layers);
            Functions.MapInfo();
            break;

            #endregion
            #region Prefabs
        case 1:
            Functions.EditorSettings();
            Functions.EditorInfo();

            Functions.EditorLinks();
            break;

        case 2:
            Functions.Replacer(ref replacer, ref replacerPresetIndex, ref replacerList);
            break;

            #endregion
        case 3:
            GUIContent[] layersMenu = new GUIContent[4];
            layersMenu[0] = new GUIContent("Ground");
            layersMenu[1] = new GUIContent("Biome");
            layersMenu[2] = new GUIContent("Alpha");
            layersMenu[3] = new GUIContent("Topology");

            EditorGUI.BeginChangeCheck();
            layerIndex = GUILayout.Toolbar(layerIndex, layersMenu, EditorStyles.toolbarButton);

            if (EditorGUI.EndChangeCheck())
            {
                Functions.SetLandLayer((LandLayers)layerIndex, TerrainTopology.TypeToIndex((int)layers.Topologies));
            }

            switch (TerrainManager.LandLayer)
            {
            case LandLayers.Ground:
                Functions.TextureSelect((LandLayers)layerIndex, ref layers);

                Functions.LayerTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground));



                crazing            = SettingsManager.crazing;
                crazing.splatLayer = TerrainTopology.TypeToIndex((int)layers.Ground);
                Functions.Crazing(ref crazing);

                perlinSplat            = SettingsManager.perlinSplat;
                perlinSplat.splatLayer = TerrainTopology.TypeToIndex((int)layers.Ground);
                Functions.PerlinSplat(ref perlinSplat);

                Functions.HeightTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref heightsInfo);
                Functions.SlopeTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref slopesInfo);

                Functions.RiverTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref aboveTerrain);

                break;

            case LandLayers.Biome:
                Functions.TextureSelect((LandLayers)layerIndex, ref layers);

                Functions.LayerTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome));


                Functions.HeightTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome), ref heightsInfo);
                Functions.SlopeTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome), ref slopesInfo);
                break;

            case LandLayers.Alpha:

                Functions.LayerTools(TerrainManager.LandLayer, 0, 1);

                break;

            case LandLayers.Topology:

                Functions.TopologyTools();

                Functions.TopologyLayerSelect(ref layers);

                Functions.LayerTools(TerrainManager.LandLayer, 0, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));


                Functions.HeightTools(TerrainManager.LandLayer, 0, ref heightsInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.SlopeTools(TerrainManager.LandLayer, 0, ref slopesInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));

                Functions.Combinator(ref layers, ref sourceLayers, ref tttWeight, ref thicc);


                Functions.RiverTools(TerrainManager.LandLayer, 0, ref aboveTerrain, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.LakeOcean(ref layers);
                break;
            }

            switch (mapToolsOptions)
            {
                /*
                 #region HeightMap
                 * case 0:
                 * GUIContent[] heightMapMenu = new GUIContent[2];
                 * heightMapMenu[0] = new GUIContent("Heights");
                 * heightMapMenu[1] = new GUIContent("Filters");
                 * heightMapOptions = GUILayout.Toolbar(heightMapOptions, heightMapMenu, EditorStyles.toolbarButton);
                 *
                 * switch (heightMapOptions)
                 * {
                 * case 0:
                 * Elements.BoldLabel(ToolTips.heightsLabel);
                 * Functions.OffsetMap(ref offset, ref clampOffset);
                 * Functions.SetHeight(ref heightSet);
                 * Functions.ClampHeight(ref heightLow, ref heightHigh);
                 * Elements.BoldLabel(ToolTips.miscLabel);
                 * Functions.InvertMap();
                 * break;
                 * case 1:
                 * Functions.NormaliseMap(ref normaliseLow, ref normaliseHigh, ref autoUpdate);
                 * Functions.SmoothMap(ref filterStrength, ref blurDirection, ref smoothPasses);
                 * Functions.TerraceMap(ref terraceErodeFeatureSize, ref terraceErodeInteriorCornerWeight);
                 * break;
                 * }
                 * break;
                 #endregion
                 *
                 #region Textures
                 * case 0:
                 * Functions.ConditionalPaint(ref conditionalPaintOptions, ref texture, ref conditions, ref layers);
                 * break;
                 #endregion
                 *
                 #region Misc
                 * case 2:
                 * Functions.RotateMap(ref rotateSelection);
                 * break;
                 #endregion
                 */
            }
            break;

        case 4:
            GUIContent[] generatorMenu = new GUIContent[3];
            generatorMenu[0] = new GUIContent("Heightmap");
            generatorMenu[1] = new GUIContent("Geology");
            generatorMenu[2] = new GUIContent("Monuments");

            generatorOptions = GUILayout.Toolbar(generatorOptions, generatorMenu, EditorStyles.toolbarButton);
            switch (generatorOptions)
            {
            case 0:
                Functions.SetHeight(ref heightSet);
                Functions.OffsetMap(ref offset, ref clampOffset);

                perlin = SettingsManager.perlin;
                Functions.PerlinTerrain(ref perlin);

                Functions.NormaliseMap(ref normaliseLow, ref normaliseHigh, ref autoUpdate);

                ocean = SettingsManager.ocean;
                Functions.Ocean(ref ocean);

                ripple = SettingsManager.ripple;
                Functions.Ripple(ref ripple);

                terracing = SettingsManager.terracing;
                Functions.RandomTerracing(ref terracing);

                break;

            case 1:
                Functions.Geology(ref activePreset, ref presetIndex, ref geologyList, ref macroIndex, ref macroList, ref macroTitle, ref macroDisplay, ref layers);
                break;

            case 2:
                city = SettingsManager.city;
                Functions.RustCity(ref city);
                break;
            }
            break;

        case 5:
            Functions.Merger(ref zOffset);
            break;
        }
        #endregion
        EditorGUILayout.EndScrollView();
    }