示例#1
0
        public GPropPanel(Control parent)
        {
            this.BackColor = Color.FromArgb(50, 50, 50);
            this.Width     = 280;
            this.Height    = 85;
            parent.Controls.Add(this);
            this.Left    = 0;
            this.Top     = parent.Height - this.Height;
            this.TabStop = false;

            but            = new GButtonFlat[2];
            but[0]         = new GButtonFlat(this);
            but[1]         = new GButtonFlat(this);
            but[0].TabStop = false;
            but[1].TabStop = false;
            but[0].Text    = "Кубик";
            but[1].Text    = "Сфера";
            but[1].Top     = but[0].Height;
            but[0].Click  += (o, e) =>
            {
                Clicks(o, e);
            };
            but[1].Click += (o, e) =>
            {
                Clicks(o, e);
            };

            textBox             = new GTextBox[2];
            textBox[0]          = new GTextBox(this);
            textBox[0].Location = new Point(this.Width - textBox[0].Width, 0);
            textBox[1]          = new GTextBox(this);
            textBox[1].Location = new Point(this.Width - textBox[0].Width, but[1].Top + 4);
            textBox[0].Text     = "R:0,0 G:1,0 B:0,0";
            textBox[1].Text     = "1";

            Label[] lab = new Label[2];
            lab[0]           = new Label();
            lab[0].ForeColor = Color.FromArgb(192, 192, 192);
            lab[0].Text      = "Цвет:";
            lab[0].Left      = but[0].Right;
            lab[0].Top       = 3;
            this.Controls.Add(lab[0]);

            lab[1]           = new Label();
            lab[1].ForeColor = Color.FromArgb(192, 192, 192);
            lab[1].Text      = "Размер:";
            lab[1].Left      = but[1].Right;
            lab[1].Top       = but[1].Top + 5;
            this.Controls.Add(lab[1]);

            this.Visible = false;
        }
示例#2
0
        private void SaveObjects_Load(object sender, EventArgs e)
        {
            this.Width  = 320;
            this.Height = 100;
            Label lab = new Label();

            lab.ForeColor = Color.FromArgb(192, 192, 192);
            lab.Text      = "Имя проекта: ";
            lab.Left      = 0;
            lab.Top       = 3;
            this.Controls.Add(lab);

            textBox          = new GTextBox(this);
            textBox.Location = new Point(150, 1);

            GButtonFlat but = new GButtonFlat(this);

            but.Text     = "Сохранить";
            but.Location = new Point(this.Width / 2 - but.Width / 2, 30);
            but.Click   += (o, ee) =>
            {
                List <Models.GSaveObject> objects = new List <Models.GSaveObject>();
                var mod = engine.GetWorld().GetListModels();
                for (int i = 0; i < mod.Count; i++)
                {
                    Models.GSaveObject obj = new Models.GSaveObject();
                    obj.x   = mod[i].x;
                    obj.y   = mod[i].y;
                    obj.z   = mod[i].z;
                    obj.r   = mod[i].r;
                    obj.g   = mod[i].g;
                    obj.b   = mod[i].b;
                    obj.rad = mod[i].rad;

                    if (mod[i].GetType() == typeof(Models.GBox))
                    {
                        obj.type = Models.GSaveObject.TYPE.Cube;
                    }
                    else if (mod[i].GetType() == typeof(Models.GSphere))
                    {
                        obj.type = Models.GSaveObject.TYPE.Sphere;
                    }

                    objects.Add(obj);
                }

                engine.GetManagerFile().SetDataXMLFile(textBox.Text, objects);
                this.Close();
            };
        }