示例#1
0
        private void ComBox_ATTA_SelectedIndexChanged(object sender, EventArgs e)
        {
            TxtPipe.Text = "";
            ComboBox  comb      = sender as ComboBox;
            NameRef   nr        = (NameRef)comb.SelectedItem;
            DbElement dbElement = DbElement.GetElement(nr.Ref);
            DbElement Pipe      = dbElement.Owner.Owner;
            DrawList  dl        = DrawListManager.Instance.CurrentDrawList;

            TxtPipe.Text = Pipe.ToString();
            DbElement hanger = dbElement.GetElement(DbAttributeInstance.CREF);

            dl.Add(Pipe);
            dl.Add(hanger);
            //dl.AddToSelection();
            // DbElement Support = hanger.Owner.GetElement(DbAttributeInstance.STLR);
            ListBox_Element.Items.Clear();
            foreach (DbElement h in hanger.Members())
            {
                ListBox_Element.Items.Add(new NameRef(h.ToString(), h.RefNo()));
            }
            //foreach (DbElement s in Support.Owner.Members())
            //{
            //    ListBox_Element.Items.Add(new NameRef(s.ToString(), s.RefNo()));
            //}
            ListBox_Element.DisplayMember = "Name";
        }
示例#2
0
        /// <summary>
        /// Move selected items to back (end of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToBack()
        {
            int      n;
            int      i;
            DrawList tempList;

            tempList = new DrawList();
            n        = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in reverse order and add every item
            // to the end of the source list
            n = tempList.Count;

            for (i = n - 1; i >= 0; i--)
            {
                graphicsList.Add(tempList[i]);
            }

            return(n > 0);
        }
示例#3
0
        /// <summary>
        /// Move selected items to front (beginning of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToFront()
        {
            int      n;
            int      i;
            DrawList tempList;

            tempList = new DrawList();
            n        = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in direct order and insert every item
            // to the beginning of the source list
            n = tempList.Count;

            for (i = 0; i < n; i++)
            {
                graphicsList.Insert(0, tempList[i]);
            }

            return(n > 0);
        }
示例#4
0
            public void Fill(bool borderBlocks, Blockset.Block oldBlock, Blockset.Block newBlock, int destX, int destY)
            {
                Block[][] outArr = borderBlocks ? BorderBlocks : Blocks;
                int       width  = borderBlocks ? BorderWidth : Width;
                int       height = borderBlocks ? BorderHeight : Height;

                void Fill(int x, int y)
                {
                    if (x >= 0 && x < width && y >= 0 && y < height)
                    {
                        Block b = outArr[y][x];
                        if (b.BlocksetBlock == oldBlock)
                        {
                            b.BlocksetBlock = newBlock;
                            DrawList.Add(b);
                            Fill(x, y + 1);
                            Fill(x, y - 1);
                            Fill(x + 1, y);
                            Fill(x - 1, y);
                        }
                    }
                }

                Fill(destX, destY);
                Draw(borderBlocks);
            }
 private void AddToDrawList(MemberVisualizationField memberField, DrawList drawList)
 {
     if (!drawList.ContainsKey(memberField.gameObject))
     {
         drawList.Add(memberField.gameObject, new List <MemberVisualizationField>());
     }
     drawList[memberField.gameObject].Add(memberField);
 }
示例#6
0
        //LOAD OBJECTS AND OTHER STUFF IMPORTANT FOR THE GAMESTATE
        public void OnLoad()
        {
            var hive = new Hive(this, new Vector2(500, 500), 13);

            ObstacleList = GenerateListOfRandomObstacles();

            foreach (IEntity obstacle in ObstacleList)
            {
                DrawList.Add(obstacle);
            }

            DrawList.Add(new Spider(this, new Vector2(32, 32), new Vector2(100, 100), 2));
            DrawList.Add(new Hive(this, new Vector2(500, 500), 10));
            //DrawList.Insert(0, new Flower(this, new Vector2(300,300)));

            //HACK: Do rozróżnienia?
            UpdateList = DrawList;
        }
示例#7
0
        protected GraphicsList(SerializationInfo info, StreamingContext context)
        {
            _graphicsList = new DrawList();

            var n = info.GetInt32(EntryCount);

            for (int i = 0; i < n; i++)
            {
                var typeName = info.GetString(String.Format(CultureInfo.InvariantCulture, "{0}{1}", EntryType, i));

                var drawObject = (DrawObject)Assembly.GetExecutingAssembly().CreateInstance(typeName);

                if (drawObject == null)
                {
                    continue;
                }
                drawObject.LoadFromStream(info, i);

                _graphicsList.Add(drawObject);
            }
        }
示例#8
0
        protected GraphicsList(SerializationInfo info, StreamingContext context)
        {
            graphicsList = new DrawList();

            int        n = info.GetInt32(entryCount);
            string     typeName;
            DrawObject drawObject;

            for (int i = 0; i < n; i++)
            {
                typeName = info.GetString(
                    String.Format(CultureInfo.InvariantCulture,
                                  "{0}{1}",
                                  entryType, i));

                drawObject = (DrawObject)Assembly.GetExecutingAssembly().CreateInstance(
                    typeName);

                drawObject.LoadFromStream(info, i);

                graphicsList.Add(drawObject);
            }
        }
示例#9
0
        protected GraphicsList(SerializationInfo info, StreamingContext context)
        {
            graphicsList = new DrawList();

            int n = info.GetInt32(entryCount);
            string typeName;
            DrawObject drawObject;

            for (int i = 0; i < n; i++)
            {
                typeName = info.GetString(
                    String.Format(CultureInfo.InvariantCulture,
                        "{0}{1}",
                    entryType, i));

                drawObject = (DrawObject)Assembly.GetExecutingAssembly().CreateInstance(
                    typeName);

                drawObject.LoadFromStream(info, i);

                graphicsList.Add(drawObject);
            }

        }
示例#10
0
        /// <summary>
        /// Move selected items to back (end of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToBack()
        {
            int n;
            int i;
            DrawList tempList;

            tempList = new DrawList();
            n = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in reverse order and add every item
            // to the end of the source list
            n = tempList.Count;

            for (i = n - 1; i >= 0; i--)
            {
                graphicsList.Add(tempList[i]);
            }

            return (n > 0);
        }
示例#11
0
        /// <summary>
        /// Move selected items to front (beginning of the list)
        /// </summary>
        /// <returns>
        /// true if at least one object is moved
        /// </returns>
        public bool MoveSelectionToFront()
        {
            int n;
            int i;
            DrawList tempList;

            tempList = new DrawList();
            n = graphicsList.Count;

            // Read source list in reverse order, add every selected item
            // to temporary list and remove it from source list
            for (i = n - 1; i >= 0; i--)
            {
                if ((graphicsList[i]).Selected)
                {
                    tempList.Add(graphicsList[i]);
                    graphicsList.RemoveAt(i);
                }
            }

            // Read temporary list in direct order and insert every item
            // to the beginning of the source list
            n = tempList.Count;

            for (i = 0; i < n; i++)
            {
                graphicsList.Insert(0, tempList[i]);
            }

            return (n > 0);
        }