Ejemplo n.º 1
0
        public static EditConnectionGeneForm ShowDialogue(Window window, RMP_ConnectionGene _connection, CloseEvent closeFunction = null, string category = null, ISkinFile file = null)
        {
            var form = new EditConnectionGeneForm();

            form.Initialize(_connection, closeFunction, "Edit Connection-gene", true, true, category, file);
            form.Show(window);

            return(form);
        }
Ejemplo n.º 2
0
        public override void AddedToContainer()
        {
            base.AddedToContainer();

            columnListBox = new ColumnListBox();
            columnListBox.Initialize(4);
            AddDrawBox(columnListBox);
            columnListBox.SetIntOrStringSort(true, true, false, true);
            columnListBox.SetColumnName(0, "ID");
            columnListBox.SetColumnName(1, "Target");
            columnListBox.SetColumnName(2, "IsOutputConnection");
            columnListBox.SetColumnName(3, "Weight");
            columnListBox.Width  = 200;
            columnListBox.Height = 200;

            columnListBox.ItemDoubleClicked += delegate(object sender, TakaGUI.DrawBoxes.ColumnListBox.ListBoxRow item, int index)
            {
                RMP_ConnectionGene connectionGene = null;
                foreach (var gene in connections)
                {
                    if (gene.ID == (uint)item.Values[0])
                    {
                        connectionGene = gene;
                    }
                }

                if (connectionGene != null)
                {
                    EditConnectionGeneForm.ShowDialogue(Parent, connectionGene, delegate(object _sender)
                    {
                        ReloadListBox();
                    });
                }
            };

            ReloadListBox();

            var label = new Label("Connections To Add: ");

            label.Initialize();
            AddDrawBox(label);
            Push.ToTheBottomSideOf(label, columnListBox, 5, Push.VerticalAlign.Left);

            var connectionsToAddIntegerField = new IntegerField();

            connectionsToAddIntegerField.Initialize();
            AddDrawBox(connectionsToAddIntegerField);
            Push.ToTheRightSideOf(connectionsToAddIntegerField, label, 3, Push.HorizontalAlign.Top);
            connectionsToAddIntegerField.Width = 200 - connectionsToAddIntegerField.X;

            var generateConnectionsButton = new ResizableButton();

            generateConnectionsButton.Initialize();
            AddDrawBox(generateConnectionsButton);
            generateConnectionsButton.Title = "Generate Connections";
            generateConnectionsButton.FitToText();
            Push.ToTheBottomSideOf(generateConnectionsButton, label, 5, Push.VerticalAlign.Left);
            generateConnectionsButton.Width  = 200;
            generateConnectionsButton.Click += delegate(object sender)
            {
                GenerateConnections((int)connectionsToAddIntegerField.Value);
                ReloadListBox();
            };

            var okButton = new ResizableButton();

            okButton.Initialize();
            AddDrawBox(okButton);
            okButton.Title = "OK";
            okButton.FitToText();
            Push.ToTheBottomSideOf(okButton, generateConnectionsButton, 3, Push.VerticalAlign.Left);
            okButton.Width  = 200;
            okButton.Click += delegate(object sender)
            {
                Close();
            };

            Wrap();

            columnListBox.Alignment = DrawBoxAlignment.GetFull();
            label.Alignment         = DrawBoxAlignment.GetLeftBottom();
            connectionsToAddIntegerField.Alignment = DrawBoxAlignment.GetLeftRightBottom();
            generateConnectionsButton.Alignment    = DrawBoxAlignment.GetLeftRightBottom();
            okButton.Alignment = DrawBoxAlignment.GetLeftRightBottom();

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