Exemplo n.º 1
0
        public PlantType(XmlReader r, Grass parent, WorldEditor app)
        {
            this.app    = app;
            this.parent = parent;

            FromXml(r);
        }
Exemplo n.º 2
0
        public void Clone(IWorldContainer copyParent)
        {
            Grass clone = new Grass(copyParent as Boundary, app, name);

            foreach (IWorldObject child in plantList)
            {
                child.Clone(clone);
            }
            copyParent.Add(clone);
        }
Exemplo n.º 3
0
 public PlantType(WorldEditor app, Grass parent, uint instances, string name, string imageName, float scaleWidthLow, float scaleWidthHi, float scaleHeightLow, float scaleHeightHi, ColorEx color, float colorMultLow, float colorMultHi, float windMagnitude)
 {
     this.app = app;
     this.parent = parent;
     this.instances = instances;
     this.name = name;
     this.imageName = imageName;
     this.scaleWidthLow = scaleWidthLow;
     this.scaleWidthHi = scaleWidthHi;
     this.scaleHeightLow = scaleHeightLow;
     this.scaleHeightHi = scaleHeightHi;
     this.color = color;
     this.colorMultLow = colorMultLow;
     this.colorMultHi = colorMultHi;
     this.windMagnitude = windMagnitude;
 }
Exemplo n.º 4
0
 public PlantType(WorldEditor app, Grass parent, uint instances, string name, string imageName, float scaleWidthLow, float scaleWidthHi, float scaleHeightLow, float scaleHeightHi, ColorEx color, float colorMultLow, float colorMultHi, float windMagnitude)
 {
     this.app            = app;
     this.parent         = parent;
     this.instances      = instances;
     this.name           = name;
     this.imageName      = imageName;
     this.scaleWidthLow  = scaleWidthLow;
     this.scaleWidthHi   = scaleWidthHi;
     this.scaleHeightLow = scaleHeightLow;
     this.scaleHeightHi  = scaleHeightHi;
     this.color          = color;
     this.colorMultLow   = colorMultLow;
     this.colorMultHi    = colorMultHi;
     this.windMagnitude  = windMagnitude;
 }
        public void Execute()
        {
            if (grass == null)
            {
                grass = new Grass(parent, app, this.Name);
            }
            parent.Add(grass);

            for (int i = app.SelectedObject.Count - 1; i >= 0; i--)
            {
                app.SelectedObject[i].Node.UnSelect();
            }
            if (grass.Node != null)
            {
                grass.Node.Select();
            }
        }
        public void Execute()
        {
            if (grass == null)
            {
                grass = new Grass(parent, app, this.Name);
            }
            parent.Add(grass);

            for (int i = app.SelectedObject.Count - 1; i >= 0; i--)
            {
                app.SelectedObject[i].Node.UnSelect();
            }
            if (grass.Node != null)
            {
                grass.Node.Select();
            }
        }
        public AddPlantTypeCommand(WorldEditor worldEditorin, Grass parentin, uint instancesin, string namein,
			string imageNamein, float scaleWidthHiin, float scaleWidthLowin, float scaleHeightHiin, float scaleHeightLowin,
			ColorEx colorin, float colorMultHiin, float colorMultLowin, float windMagnitudein)
        {
            this.app = worldEditorin;
            this.parent = parentin;
            this.instances = instancesin;
            this.name = namein;
            this.imageName = imageNamein;
            this.scaleWidthHi = scaleWidthHiin;
            this.scaleWidthLow = scaleWidthLowin;
            this.scaleHeightHi = scaleHeightHiin;
            this.scaleHeightLow = scaleHeightLowin;
            this.colorRGB = colorin;
            this.colorMultHi = colorMultHiin;
            this.colorMultLow = colorMultLowin;
            this.windMagnitude = windMagnitudein;
        }
 public AddPlantTypeCommand(WorldEditor worldEditorin, Grass parentin, uint instancesin, string namein,
                            string imageNamein, float scaleWidthHiin, float scaleWidthLowin, float scaleHeightHiin, float scaleHeightLowin,
                            ColorEx colorin, float colorMultHiin, float colorMultLowin, float windMagnitudein)
 {
     this.app            = worldEditorin;
     this.parent         = parentin;
     this.instances      = instancesin;
     this.name           = namein;
     this.imageName      = imageNamein;
     this.scaleWidthHi   = scaleWidthHiin;
     this.scaleWidthLow  = scaleWidthLowin;
     this.scaleHeightHi  = scaleHeightHiin;
     this.scaleHeightLow = scaleHeightLowin;
     this.colorRGB       = colorin;
     this.colorMultHi    = colorMultHiin;
     this.colorMultLow   = colorMultLowin;
     this.windMagnitude  = windMagnitudein;
 }
Exemplo n.º 9
0
        public void AddToTree(WorldTreeNode parentNode)
        {
            this.parentNode = parentNode;
            inTree          = true;

            // create a node for the collection and add it to the parent
            node = app.MakeTreeNode(this, NodeName);

            parentNode.Nodes.Add(node);
            Grass grass = this;
            CommandMenuBuilder menuBuilder = new CommandMenuBuilder();

            menuBuilder.Add("Add Plant Type", new AddPlantTypeCommandFactory(app, grass), app.DefaultCommandClickHandler);
            menuBuilder.Add("Copy Description", "", app.copyToClipboardMenuButton_Click);
            menuBuilder.Add("Help", "Grass", app.HelpClickHandler);
            menuBuilder.Add("Delete", new DeleteObjectCommandFactory(app, parent, this), app.DefaultCommandClickHandler);
            node.ContextMenuStrip = menuBuilder.Menu;

            foreach (IWorldObject plant in plantList)
            {
                plant.AddToTree(node);
            }
            buttonBar = menuBuilder.ButtonBar;
        }
 public AddPlantTypeCommandFactory(WorldEditor worldEditorin, Grass parentin)
 {
     this.app = worldEditorin;
     this.parent = parentin;
 }
Exemplo n.º 11
0
        public PlantType(XmlReader r, Grass parent, WorldEditor app)
        {
            this.app = app;
            this.parent = parent;

            FromXml(r);
        }
 public AddPlantTypeCommandFactory(WorldEditor worldEditorin, Grass parentin)
 {
     this.app    = worldEditorin;
     this.parent = parentin;
 }
Exemplo n.º 13
0
        protected void FromXml(XmlReader r)
        {
            // first parse the attributes
            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);

                // set the field in this object based on the element we just read
                switch (r.Name)
                {
                    case "Name":
                        this.name = r.Value;
                        break;
                    case "Priority":
                        this.priority = int.Parse(r.Value);
                        break;
                }
            }
            r.MoveToElement(); //Moves the reader back to the element node.

            while (r.Read())
            {
                if (r.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name)
                    {
                        case "PointCollection":
                            if (!r.IsEmptyElement)
                            {
                                this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial,MPPointType.Boundary, r);
                                Add(points);
                                points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler);
                            }
                            break;
                        case "NameValuePairs":
                            this.nameValuePairs = new NameValueObject(r);
                            break;
                        case "Forest":
                            Forest forest = new Forest(r, this, app);
                            Add(forest);
                            break;
                        case "Fog":
                            Fog fog = new Fog(r, this, app);
                            Add(fog);
                            break;
                        case "Water":
                            Water water = new Water(r, this, app);
                            Add(water);
                            break;
                        case "Sound":
                            Sound sound = new Sound(r, (IWorldContainer)this, app);
                            Add(sound);
                            break;
                        case "Grass":
                            Grass grass = new Grass(r, this, app);
                            Add(grass);
                            break;
                        case "SpawnGen":
                            SpawnGen mob = new SpawnGen(r, app, this);
                            Add(mob);
                            break;
                        case "AmbientLight":
                            AmbientLight ambientLight = new AmbientLight(app, this, r);
                            Add(ambientLight);
                            break;
                        case "DirectionalLight":
                            DirectionalLight directionalLight = new DirectionalLight(app, this, r);
                            Add(directionalLight);
                            break;
                    }
                }
            }
            if (points == null)
            {
                this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary);
                Add(points);
                points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler);
            }
        }
Exemplo n.º 14
0
 public void Clone(IWorldContainer copyParent)
 {
     Grass clone = new Grass(copyParent as Boundary, app, name);
     foreach (IWorldObject child in plantList)
     {
         child.Clone(clone);
     }
     copyParent.Add(clone);
 }
Exemplo n.º 15
0
        protected void FromXml(XmlReader r)
        {
            // first parse the attributes
            for (int i = 0; i < r.AttributeCount; i++)
            {
                r.MoveToAttribute(i);

                // set the field in this object based on the element we just read
                switch (r.Name)
                {
                case "Name":
                    this.name = r.Value;
                    break;

                case "Priority":
                    this.priority = int.Parse(r.Value);
                    break;
                }
            }
            r.MoveToElement(); //Moves the reader back to the element node.

            while (r.Read())
            {
                if (r.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name)
                    {
                    case "PointCollection":
                        if (!r.IsEmptyElement)
                        {
                            this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary, r);
                            Add(points);
                            points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler);
                        }
                        break;

                    case "NameValuePairs":
                        this.nameValuePairs = new NameValueObject(r);
                        break;

                    case "Forest":
                        Forest forest = new Forest(r, this, app);
                        Add(forest);
                        break;

                    case "Fog":
                        Fog fog = new Fog(r, this, app);
                        Add(fog);
                        break;

                    case "Water":
                        Water water = new Water(r, this, app);
                        Add(water);
                        break;

                    case "Sound":
                        Sound sound = new Sound(r, (IWorldContainer)this, app);
                        Add(sound);
                        break;

                    case "Grass":
                        Grass grass = new Grass(r, this, app);
                        Add(grass);
                        break;

                    case "SpawnGen":
                        SpawnGen mob = new SpawnGen(r, app, this);
                        Add(mob);
                        break;

                    case "AmbientLight":
                        AmbientLight ambientLight = new AmbientLight(app, this, r);
                        Add(ambientLight);
                        break;

                    case "DirectionalLight":
                        DirectionalLight directionalLight = new DirectionalLight(app, this, r);
                        Add(directionalLight);
                        break;
                    }
                }
            }
            if (points == null)
            {
                this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary);
                Add(points);
                points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler);
            }
        }