internal void SetFrom(TopDownValues values)
 {
     this.Name                        = values.Name;
     this.MaxSpeed                    = values.MaxSpeed;
     this.AccelerationTime            = values.AccelerationTime;
     this.DecelerationTime            = values.DecelerationTime;
     this.UpdateDirectionFromVelocity = values.UpdateDirectionFromVelocity;
 }
        internal TopDownValues ToValues()
        {
            var toReturn = new TopDownValues();

            toReturn.Name                        = this.Name;
            toReturn.MaxSpeed                    = this.MaxSpeed;
            toReturn.AccelerationTime            = this.AccelerationTime;
            toReturn.DecelerationTime            = this.DecelerationTime;
            toReturn.UpdateDirectionFromVelocity = this.UpdateDirectionFromVelocity;

            return(toReturn);
        }
示例#3
0
        private string GetCsvContents(EntitySave entity, TopDownEntityViewModel viewModel)
        {
            List <TopDownValues> values = new List <TopDownValues>();

            // create a default entry:
            var defaultValue = new TopDownValues();

            defaultValue.Name                        = "DefaultValues";
            defaultValue.MaxSpeed                    = 250;
            defaultValue.AccelerationTime            = 1;
            defaultValue.DecelerationTime            = .5f;
            defaultValue.UpdateDirectionFromVelocity = true;

            values.Add(defaultValue);

            RuntimeCsvRepresentation rcr = RuntimeCsvRepresentation.FromList(values);

            var nameHeader = rcr.Headers[0];

            nameHeader.IsRequired = true;
            // Setting it to IsRequired is not sufficient, need to
            // modify the "Original Text" prop
            // chop off the closing quote, and add ", required)"
            nameHeader.OriginalText = nameHeader.OriginalText.Substring(0, nameHeader.OriginalText.Length - 1) + ", required)";

            rcr.Headers[0] = nameHeader;

            var movementDefaults = new string[]
            {
            };

            rcr.Records.Add(movementDefaults);

            var toReturn = rcr.GenerateCsvString();

            return(toReturn);
        }