Exemplo n.º 1
0
        public override void AddedToContainer()
        {
            base.AddedToContainer();

            var builder = new FieldBuilder();

            builder.BuildSessionStart(this);

            var fileNameTextField = builder.AddBrowseField(FileForm.FileFormTypes.File, FileForm.OperationTypes.Save, "File Directory: ").DrawBox1;

            var worldTemplatesComboBox = builder.AddComboBoxField("World: ");

            worldTemplatesComboBox.Items.AddRange(EditorData.WorldTemplates.Select(s => s.TemplateName));
            worldTemplatesComboBox.Index = 0;

            builder.AddResizableButtonField("OK", delegate(object sender)
            {
                if (worldTemplatesComboBox.Index == -1)
                {
                    AlertForm.ShowDialogue(Parent, null, "Choose a world-template");
                }
                else
                {
                    Result          = new Simulation();
                    Result.World    = EditorData.WorldTemplates[worldTemplatesComboBox.Index].World.Clone();
                    Result.FileName = fileNameTextField.Text;

                    AddDefaultEntityPainters(Result);

                    Close();
                }
            });

            builder.BuildSessionEnd();

            X = (Parent.Width / 2) - (Width / 2);
            Y = (Parent.Height / 2) - (Height / 2);

            CanResizeFormVertically = false;
        }