Beispiel #1
0
 public void updatePrototypes()
 {
     for (int i = 0; i < Landscape.SPLATMAP_LAYERS; i++)
     {
         LandscapeMaterialAsset landscapeMaterialAsset = Assets.find <LandscapeMaterialAsset>(this.materials[i]);
         if (landscapeMaterialAsset == null)
         {
             this.prototypes[i].texture   = Texture2D.blackTexture;
             this.prototypes[i].normalMap = Texture2D.blackTexture;
         }
         else
         {
             this.prototypes[i].texture = Assets.load <Texture2D>(landscapeMaterialAsset.texture);
             if (this.prototypes[i].texture == null)
             {
                 this.prototypes[i].texture = Texture2D.blackTexture;
             }
             this.prototypes[i].normalMap = Assets.load <Texture2D>(landscapeMaterialAsset.mask);
             if (this.prototypes[i].normalMap == null)
             {
                 this.prototypes[i].normalMap = Texture2D.blackTexture;
             }
         }
     }
     this.data.splatPrototypes = this.prototypes;
 }
Beispiel #2
0
        public LandscapeToolMaterialAssetButton(LandscapeMaterialAsset newAsset)
        {
            this.asset = newAsset;
            base.transform.anchorMin = new Vector2(0f, 1f);
            base.transform.anchorMax = new Vector2(1f, 1f);
            base.transform.pivot     = new Vector2(0.5f, 1f);
            base.transform.sizeDelta = new Vector2(0f, 30f);
            Sleek2Label sleek2Label = new Sleek2Label();

            sleek2Label.transform.reset();
            sleek2Label.textComponent.text  = this.asset.name;
            sleek2Label.textComponent.color = Sleek2Config.darkTextColor;
            this.addElement(sleek2Label);
        }
        // Token: 0x060012AC RID: 4780 RVA: 0x00077000 File Offset: 0x00075400
        public void update(int newLayer, AssetReference <LandscapeMaterialAsset> newAsset)
        {
            this.layer = newLayer;
            LandscapeMaterialAsset landscapeMaterialAsset = Assets.find <LandscapeMaterialAsset>(newAsset);

            if (landscapeMaterialAsset != null)
            {
                this.label.textComponent.text = landscapeMaterialAsset.name;
            }
            else
            {
                this.label.textComponent.text = "---";
            }
        }
Beispiel #4
0
        public void bakeFoliageSurface(FoliageBakeSettings bakeSettings, FoliageTile foliageTile)
        {
            int num  = (foliageTile.coord.y * FoliageSystem.TILE_SIZE_INT - this.coord.y * Landscape.TILE_SIZE_INT) / FoliageSystem.TILE_SIZE_INT * FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;
            int num2 = num + FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;
            int num3 = (foliageTile.coord.x * FoliageSystem.TILE_SIZE_INT - this.coord.x * Landscape.TILE_SIZE_INT) / FoliageSystem.TILE_SIZE_INT * FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;
            int num4 = num3 + FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;

            for (int i = num; i < num2; i++)
            {
                for (int j = num3; j < num4; j++)
                {
                    SplatmapCoord splatmapCoord = new SplatmapCoord(i, j);
                    float         num5          = (float)this.coord.x * Landscape.TILE_SIZE + (float)splatmapCoord.y * Landscape.SPLATMAP_WORLD_UNIT;
                    float         num6          = (float)this.coord.y * Landscape.TILE_SIZE + (float)splatmapCoord.x * Landscape.SPLATMAP_WORLD_UNIT;
                    Bounds        bounds        = default(Bounds);
                    bounds.min = new Vector3(num5, 0f, num6);
                    bounds.max = new Vector3(num5 + Landscape.SPLATMAP_WORLD_UNIT, 0f, num6 + Landscape.SPLATMAP_WORLD_UNIT);
                    for (int k = 0; k < Landscape.SPLATMAP_LAYERS; k++)
                    {
                        float num7 = this.sourceSplatmap[i, j, k];
                        if (num7 >= 0.01f)
                        {
                            LandscapeMaterialAsset landscapeMaterialAsset = Assets.find <LandscapeMaterialAsset>(this.materials[k]);
                            if (landscapeMaterialAsset != null)
                            {
                                FoliageInfoCollectionAsset foliageInfoCollectionAsset = Assets.find <FoliageInfoCollectionAsset>(landscapeMaterialAsset.foliage);
                                if (foliageInfoCollectionAsset != null)
                                {
                                    foliageInfoCollectionAsset.bakeFoliage(bakeSettings, this, bounds, num7);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
0
        protected virtual void handleSplatmapSearchFieldTyped(Sleek2Field field, string value)
        {
            if (this.searchLength == -1 || value.Length < this.searchLength)
            {
                this.searchResults.Clear();
                Assets.find <LandscapeMaterialAsset>(this.searchResults);
            }
            this.searchLength = value.Length;
            this.splatmapMaterialsPanel.clearElements();
            this.splatmapMaterialsPanel.transform.offsetMin = new Vector2(0f, 0f);
            this.splatmapMaterialsPanel.transform.offsetMax = new Vector2(0f, 0f);
            if (value.Length > 0)
            {
                string[] array = value.Split(new char[]
                {
                    ' '
                });
                for (int i = this.searchResults.Count - 1; i >= 0; i--)
                {
                    LandscapeMaterialAsset landscapeMaterialAsset = this.searchResults[i];
                    bool flag = true;
                    switch (landscapeMaterialAsset.assetOrigin)
                    {
                    case EAssetOrigin.OFFICIAL:
                        flag &= LandscapeToolWindow.showOfficialAssets;
                        break;

                    case EAssetOrigin.CURATED:
                        flag &= LandscapeToolWindow.showCuratedAssets;
                        break;

                    case EAssetOrigin.WORKSHOP:
                        flag &= LandscapeToolWindow.showWorkshopAssets;
                        break;

                    case EAssetOrigin.MISC:
                        flag &= LandscapeToolWindow.showMiscAssets;
                        break;
                    }
                    if (flag)
                    {
                        foreach (string value2 in array)
                        {
                            if (landscapeMaterialAsset.name.IndexOf(value2, StringComparison.InvariantCultureIgnoreCase) == -1)
                            {
                                flag = false;
                                break;
                            }
                        }
                    }
                    if (!flag)
                    {
                        this.searchResults.RemoveAtFast(i);
                    }
                }
                if (this.searchResults.Count <= 64)
                {
                    this.searchResults.Sort(new LandscapeToolWindow.LandscapeToolAssetComparer());
                    foreach (LandscapeMaterialAsset newAsset in this.searchResults)
                    {
                        LandscapeToolMaterialAssetButton landscapeToolMaterialAssetButton = new LandscapeToolMaterialAssetButton(newAsset);
                        landscapeToolMaterialAssetButton.clicked += this.handleMaterialAssetButtonClicked;
                        this.splatmapMaterialsPanel.addElement(landscapeToolMaterialAssetButton);
                    }
                }
            }
        }