コード例 #1
0
        // Token: 0x06001113 RID: 4371 RVA: 0x0006FE74 File Offset: 0x0006E274
        public FoliageToolFoliageCollectionAssetButton(FoliageInfoCollectionAsset 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);
        }
コード例 #2
0
ファイル: LandscapeTile.cs プロジェクト: sky-xk-nge/Unturned
        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);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
 // Token: 0x0600112C RID: 4396 RVA: 0x00070CAE File Offset: 0x0006F0AE
 public int Compare(FoliageInfoCollectionAsset x, FoliageInfoCollectionAsset y)
 {
     return(x.name.CompareTo(y.name));
 }
コード例 #4
0
        // Token: 0x06001126 RID: 4390 RVA: 0x0007084C File Offset: 0x0006EC4C
        protected virtual void handleSearchFieldTyped(Sleek2Field field, string value)
        {
            if (this.searchLength == -1 || value.Length < this.searchLength)
            {
                this.searchInfoAssets.Clear();
                Assets.find <FoliageInfoAsset>(this.searchInfoAssets);
                this.searchCollectionAssets.Clear();
                Assets.find <FoliageInfoCollectionAsset>(this.searchCollectionAssets);
            }
            this.searchLength = value.Length;
            this.foliagePanel.clearElements();
            this.foliagePanel.transform.offsetMin = new Vector2(0f, 0f);
            this.foliagePanel.transform.offsetMax = new Vector2(0f, 0f);
            if (value.Length > 0)
            {
                string[] array = value.Split(new char[]
                {
                    ' '
                });
                for (int i = this.searchInfoAssets.Count - 1; i >= 0; i--)
                {
                    FoliageInfoAsset foliageInfoAsset = this.searchInfoAssets[i];
                    bool             flag             = true;
                    switch (foliageInfoAsset.assetOrigin)
                    {
                    case EAssetOrigin.OFFICIAL:
                        flag &= FoliageToolWindow.showOfficialAssets;
                        break;

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

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

                    case EAssetOrigin.MISC:
                        flag &= FoliageToolWindow.showMiscAssets;
                        break;
                    }
                    if (flag)
                    {
                        foreach (string value2 in array)
                        {
                            if (foliageInfoAsset.name.IndexOf(value2, StringComparison.InvariantCultureIgnoreCase) == -1)
                            {
                                flag = false;
                                break;
                            }
                        }
                    }
                    if (!flag)
                    {
                        this.searchInfoAssets.RemoveAtFast(i);
                    }
                }
                for (int k = this.searchCollectionAssets.Count - 1; k >= 0; k--)
                {
                    FoliageInfoCollectionAsset foliageInfoCollectionAsset = this.searchCollectionAssets[k];
                    bool flag2 = true;
                    switch (foliageInfoCollectionAsset.assetOrigin)
                    {
                    case EAssetOrigin.OFFICIAL:
                        flag2 &= FoliageToolWindow.showOfficialAssets;
                        break;

                    case EAssetOrigin.CURATED:
                        flag2 &= FoliageToolWindow.showCuratedAssets;
                        break;

                    case EAssetOrigin.WORKSHOP:
                        flag2 &= FoliageToolWindow.showWorkshopAssets;
                        break;

                    case EAssetOrigin.MISC:
                        flag2 &= FoliageToolWindow.showMiscAssets;
                        break;
                    }
                    if (flag2)
                    {
                        foreach (string value3 in array)
                        {
                            if (foliageInfoCollectionAsset.name.IndexOf(value3, StringComparison.InvariantCultureIgnoreCase) == -1)
                            {
                                flag2 = false;
                                break;
                            }
                        }
                    }
                    if (!flag2)
                    {
                        this.searchCollectionAssets.RemoveAtFast(k);
                    }
                }
                if (this.searchInfoAssets.Count + this.searchCollectionAssets.Count <= 64)
                {
                    this.searchInfoAssets.Sort(new FoliageToolWindow.FoliageToolAssetComparer());
                    this.searchCollectionAssets.Sort(new FoliageToolWindow.FoliageToolAssetComparer());
                    foreach (FoliageInfoAsset newAsset in this.searchInfoAssets)
                    {
                        FoliageToolFoliageAssetButton foliageToolFoliageAssetButton = new FoliageToolFoliageAssetButton(newAsset);
                        foliageToolFoliageAssetButton.clicked += this.handleFoliageAssetButtonClicked;
                        this.foliagePanel.addElement(foliageToolFoliageAssetButton);
                    }
                    foreach (FoliageInfoCollectionAsset newAsset2 in this.searchCollectionAssets)
                    {
                        FoliageToolFoliageCollectionAssetButton foliageToolFoliageCollectionAssetButton = new FoliageToolFoliageCollectionAssetButton(newAsset2);
                        foliageToolFoliageCollectionAssetButton.clicked += this.handleFoliageCollectionAssetButtonClicked;
                        this.foliagePanel.addElement(foliageToolFoliageCollectionAssetButton);
                    }
                }
            }
        }