Exemplo n.º 1
0
        public virtual void LoadBrushWithBackAsset(EditorBrush brush, Editor.Editor parent, string name, string type)
        {
            string extension = EditorHelpers.GetExtensionFromBrushType(type);

            // Objects and NPCs must always be a front asset
            if (!brush.NeedsBackAsset || extension == null || type == "object" || type == "npc")
                return;

            // Load the background tile
            StarboundAsset asset = parent.LoadAsset(name, type);
            if ( asset == null )
            {
                // If this is an internal asset - liquids, etc
                // This is a hack to display liquids until liquid parsing has been implemented
                // (low priority)
                if (name == "lava")
                {
                    asset = new StarboundAsset();
                    //asset.AssetName = name;
                    asset.Image = EditorHelpers.GetGeneratedRectangle(8, 8, 207, 16, 32, 255);
                }
                else if (name == "acid")
                {
                    asset = new StarboundAsset();
                    //asset.AssetName = name;
                    asset.Image = EditorHelpers.GetGeneratedRectangle(8, 8, 107, 141, 63, 255);
                }
                else if (name == "water")
                {
                    asset = new StarboundAsset();
                    //asset.AssetName = name;
                    asset.Image = EditorHelpers.GetGeneratedRectangle(8, 8, 0, 78, 111, 255);
                }
                else if (name == "liquidtar" || name == "tentaclejuice")
                {
                    asset = new StarboundAsset();
                    //asset.AssetName = name;
                    asset.Image = EditorHelpers.GetGeneratedRectangle(8, 8, 200, 191, 231, 255);
                }
                //parent.RegisterAsset(name, type, asset);
            }

            if (asset != null)
                brush.BackAsset = asset;
        }
Exemplo n.º 2
0
        // This function is one big wall of useless repeated code
        // Fix it at some point
        private void LoadSpecialBrushes(Editor.Editor parent)
        {
            // Get all collision blocks
            foreach (DungeonBrush brush in BlockMap)
            {
                // If this brush is a connector
                if (brush.Connector != null && (bool) brush.Connector)
                {
                    string assetName = brush.Comment + ".INTERNAL";

                    StarboundAsset asset = parent.LoadAsset(assetName, "brush");
                    if (asset == null )
                    {
                        asset = new StarboundAsset();
                        //asset.AssetName = assetName;
                        asset.Image = EditorHelpers.GetGeneratedRectangle(8, 8,
                            brush.Colour.R,
                            brush.Colour.G,
                            brush.Colour.B,
                            brush.Colour.A);
                        //parent.RegisterAsset(assetName, "brush", asset);
                    }

                    brush.NeedsFrontAsset = true;
                    brush.FrontAsset = asset;
                    brush.IsSpecial = true;
                }

                // If this brush is surface foreground
                else if (brush.BrushTypes.Contains("surface"))
                {
                    string assetName = Editor.Editor.Settings.SurfaceForegroundTile;

                    StarboundAsset asset = parent.LoadAsset(assetName, "surface");
                    if (asset == null && assetName.Contains("INTERNAL"))
                    {
                        asset = new StarboundAsset();
                        //asset.AssetName = assetName;
                        asset.Image = EditorHelpers.GetGeneratedRectangle(8, 8,
                            87, 59, 12, 255);
                        //parent.RegisterAsset(assetName, "surface", asset);
                    }

                    brush.FrontAsset = asset;
                    brush.BrushTypes.Add("front");
                    brush.NeedsFrontAsset = true;
                }

                // If this brush is surface background
                else if (brush.BrushTypes.Contains("surfacebackground"))
                {
                    string assetName = Editor.Editor.Settings.SurfaceBackgroundTile;

                    StarboundAsset asset = parent.LoadAsset(assetName, "surfacebackground");
                    if (asset == null && assetName.Contains("INTERNAL"))
                    {
                        asset = new StarboundAsset();
                        //asset.AssetName = assetName;
                        asset.Image = EditorHelpers.GetGeneratedRectangle(8, 8,
                            87, 59, 12, 255);
                        //parent.RegisterAsset(assetName, "surfacebackground", asset);
                    }
                    brush.BackAsset = asset;
                    brush.BrushTypes.Add("back");
                    brush.NeedsBackAsset = true;
                }
            }
        }
Exemplo n.º 3
0
        public virtual void LoadBrushWithFrontAsset(EditorBrush brush, Editor.Editor parent, string name, string type)
        {
            string extension = EditorHelpers.GetExtensionFromBrushType(type);

            if (!brush.NeedsFrontAsset || extension == null)
                return;

            // Load the foreground tile
            StarboundAsset asset = parent.LoadAsset(name, type);
            if (asset != null)
                brush.FrontAsset = asset;
        }