Esempio n. 1
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public TestImGuiScreenView(Screen screen) : base(screen)
        {
            TestImGuiMenu = new TestImGuiMenu();

            // Make a button
            // ReSharper disable once ObjectCreationAsStatement
            for (var i = 0; i < 5000; i++)
            {
                Boxes.Add(new ImageButton(WobbleAssets.WhiteBox, (sender, args) => Logger.Important("CLICKED", LogType.Runtime, false))
                {
                    Parent    = Container,
                    Alignment = Alignment.MidCenter,
                    Size      = new ScalableVector2(100, 100),
                    Tint      = Color.Crimson,
                });
            }

            // ReSharper disable once ObjectCreationAsStatement
            var box2 = new Sprite()
            {
                Parent    = Container,
                Alignment = Alignment.TopLeft,
                Size      = new ScalableVector2(75, 75),
                Position  = new ScalableVector2(0, 400),
                Tint      = Color.Red,
                Rotation  = 60
            };

            box2.MoveToX(1200, Easing.OutQuint, 4000);
        }
Esempio n. 2
0
 public void AddBox(Box box)
 {
     if (TotalWeight + box.Weight > MaxWeight)
     {
         throw new BoxAddException();
     }
     Boxes.Add(box);
 }
Esempio n. 3
0
 public void PopulateBoxes()
 {
     Boxes.Add(new Box());
     Boxes.Add(new Box());
     Boxes.Add(new Box());
     Boxes.Add(new Box());
     Boxes.Add(new Box());
 }
Esempio n. 4
0
 public void InitializeBoxCollection()
 {
     Boxes.Add(new Box("21877/8 паллет 1", 3.17, 1.82, 1.59, 770, 1, false));
     Boxes.Add(new Box("21877/8 паллет 2", 2.27, 2.07, 1.45, 900, 1, false));
     Boxes.Add(new Box("21877/8 паллет 3", 2.67, 2.17, 1.25, 650, 1, false));
     Boxes.Add(new Box("21877/8 паллет 4", 3.2, 0.52, 0.71, 297, 1, false));
     OnPropertyChanged("Boxex");
 }
Esempio n. 5
0
 public void AddBox(Box box)
 {
     if (!box.IsValid)
     {
         throw new GraphicsException("Box is invalid and cannot be drawn!");
     }
     Boxes.Add(box);
 }
Esempio n. 6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Surface surf = new Surface();

            surf.ContainerHeight = heightMain;
            surf.ContainerWidth  = widthMain;

            foreach (var box in MyBoxes)
            {
                sumSqr += (box.Width * box.Height);
            }

            if (sumSqr > surf.MainSquare)
            {
                MessageBox.Show("The area of the pieces is larger than the surface area !");
                MyBoxes.Clear();

                this.mainHeight.Text = "0";
                this.mainWidth.Text  = "0";

                return;
            }

            caunter = MyBoxes.Count();

            for (int i = 0; i < Math.Pow(2, caunter); i++)
            {
                Boxes.Clear();
                string str = Convert.ToString(i, 2).PadLeft(caunter, '0');

                for (int j = 0; j < caunter; j++)
                {
                    Boxes.Add(new Surface {
                        Height = MyBoxes[j].Height, Width = MyBoxes[j].Width
                    });

                    if (str[j] == '1')
                    {
                        double width = Boxes[j].Width;
                        Boxes[j].Width  = Boxes[j].Height;
                        Boxes[j].Height = width;
                    }
                }

                packer = new Packer(Boxes, surf.ContainerHeight, surf.ContainerWidth);

                if (packer.ResBoxes.Count() == caunter)
                {
                    NavigationWindow win = new NavigationWindow();
                    win.Content = new PageResult(surf.ContainerWidth, surf.ContainerHeight, packer.ResBoxes);
                    win.Show();
                }
            }
        }
Esempio n. 7
0
        public void CreateBox(Vector3 pos)
        {
            Vector3 startPos = pos + new Vector3(0.0f, -0.1f, 0.0f);
            Vector3 endPos   = pos + new Vector3(0.0f, 0.9f, 0.0f);

            Body crate = EntityFactory.CreateEntity <Body>("Crate", startPos);

            crate.AnimationQueue.Add(new EaseMotion(0.8f, crate.LocalTransform, endPos));
            Boxes.Add(crate);
            SoundManager.PlaySound(ContentPaths.Audio.whoosh, startPos);
            PlayState.ParticleManager.Trigger("puff", pos + new Vector3(0.5f, 1.5f, 0.5f), Color.White, 90);
        }
Esempio n. 8
0
        public async Task <Box> FindBox(QRCodeWrapper oQRCode)
        {
            CurrentBox = Boxes.FirstOrDefault(oBox => oBox.QRCode == oQRCode);
            if (CurrentBox == null)
            {
                CurrentBox = new Box(this, oQRCode);
                await MoveFolder.CreateFolderAsync(CurrentBox.ImageFolder);

                Boxes.Add(CurrentBox);
            }

            return(CurrentBox);
        }
Esempio n. 9
0
        private void AddBox(string title, CGRect frame, int level, NSColor color)
        {
            var node = Utils.SCBoxNode(title, frame, color, 2.0f, true);

            node.Pivot    = SCNMatrix4.CreateTranslation(0, frame.Size.Height / 2, 0);
            node.Scale    = new SCNVector3(0.02f, 0.02f, 0.02f);
            node.Position = new SCNVector3(-5, (0.02f * frame.Size.Height / 2) + (1.5f * level), 10.0f);
            node.Rotation = new SCNVector4(1, 0, 0, (float)(Math.PI / 2));
            node.Opacity  = 0.0f;
            ContentNode.AddChildNode(node);

            Boxes.Add(node);
        }
Esempio n. 10
0
        private void Init()
        {
            foreach (Point2D p in Points)
            {
                BoxVisual3D box = new BoxVisual3D {
                    Center = new Point3D(p.x, p.y, BoxInitHeight / 2), Width = BoxSize, Length = BoxSize, Height = BoxInitHeight, Fill = System.Windows.Media.Brushes.Cyan
                };
                Boxes.Add(box);
                Viewport.Children.Add(box);
            }
            var center = new TongJi.Geometry.Extent2D(Points).Center;

            Viewport.LookAt(new System.Windows.Media.Media3D.Point3D(center.x, center.y, 0), new System.Windows.Media.Media3D.Vector3D(0, 1, -0.8), 500);
            Viewport.ZoomExtents(1000);
        }
Esempio n. 11
0
        public Box GetBox(int number)
        {
            var targetBox = Boxes.FirstOrDefault(n => n.Number == number);

            if (targetBox != null)
            {
                return(targetBox);
            }

            Boxes.Add(new Box {
                Number = number
            });
            SaveChanges();
            return(Boxes.FirstOrDefault(n => n.Number == number));
        }
        public BattleField()
        {
            InitializeComponent();
            bool flag = true;

            for (int i = 1; i <= 100; i++)
            {
                if (i % 10 == 1)
                {
                    flag = !flag;
                }
                Color color = flag ? Color.FromArgb(80, 211, 211, 211) : Color.FromArgb(150, 211, 211, 211);
                flag = !flag;
                boxes.Add(new Box((StackPanel)this.FindName($"Box{i}"), color));
                //boxes.GetLastPanel().MouseMove += BattleField_MouseMove;
                //boxes.GetLastPanel().MouseLeave += BattleField_MouseLeave;
            }
        }
Esempio n. 13
0
        // Adds a box to this body. Boxes are all defined in local space
        // of their owning body. Boxes cannot be defined relative to one
        // another. The body will recalculate its mass values. No contacts
        // will be created until the next Scene::Step( ) call.
        public Box AddBox(BoxDef def)
        {
            AABB aabb;
            Box  box = new Box()
            {
                local       = def.Tx,
                e           = def.E,
                body        = this,
                friction    = def.Friction,
                restitution = def.Restitution,
                density     = def.Density,
                sensor      = def.Sensor,
            };

            Boxes.Add(box);
            box.ComputeAABB(Tx, out aabb);

            CalculateMassData();

            Scene.ContactManager.Broadphase.InsertBox(box, aabb);
            Scene.NewBox = true;

            return(box);
        }
Esempio n. 14
0
 public void Add(BoxGeneric b)
 {
     Boxes.Add(b);
 }
Esempio n. 15
0
 public void Add(Box box)
 {
     Boxes.Add(box);
     Initialize(Boxes);
 }
Esempio n. 16
0
    public void GenerateLevel(int level)
    {
        currLevel = level;
        var projectPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)));
        var fullPath    = new Uri(projectPath + @"\Doolhof\doolhof" + level + ".txt").LocalPath;

        // Bevat het level(speelveld)
        textFile = File.ReadAllLines(fullPath);

        int row    = 0;
        int column = 0;

        char[] squares;
        Square newSquare = null;

        foreach (string line in textFile)
        {
            squares = line.ToCharArray();

            foreach (char square in squares)
            {
                switch (square)
                {
                case '#':
                    newSquare = new WallSquare(row, column);
                    row++;
                    break;

                case '.':
                    newSquare = new NormalSquare(row, column);
                    row++;
                    break;

                case '@':
                    newSquare = new NormalSquare(row, column);
                    newSquare.addMovableObject(Spike);
                    Spike.Square = newSquare;
                    Spike.Square.CalculateShape();
                    row++;
                    break;

                case 'x':
                    newSquare = new GoalSquare(row, column);
                    row++;
                    break;

                case 'o':
                    newSquare = new NormalSquare(row, column);
                    Box box = new Box();
                    newSquare.addMovableObject(box);
                    box.Square = newSquare;
                    box.Square.CalculateShape();
                    Boxes.Add(box);     // add box to the array
                    row++;
                    break;

                case '~':
                    newSquare = new PitFallSquare(row, column);
                    row++;
                    break;

                case '$':
                    newSquare = new NormalSquare(row, column);
                    newSquare.addMovableObject(Collaborator);
                    Collaborator.Square = newSquare;
                    Collaborator.Square.CalculateShape();
                    row++;
                    CollaboratorActive = true;
                    break;

                default:                                           // add empty square
                    PlayField.Add("e" + row + ":" + column, null); // indicate an emty square should be written
                    row++;
                    break;
                } // end switch

                if (newSquare != null)
                {
                    PlayField.Add(newSquare.ID, newSquare);
                }

                newSquare = null;
            } // end for-loop -> for each char in string
            column++;
            row = 0;
            PlayField.Add("n" + row + ":" + column, null); // indicate an enter has to be written
        } // end for-loop -> for each string in string[]
        gameController.PrintField(PlayField);
    }
        public bool GenerateGraph(decimal width, decimal height, decimal sideLength)
        {
            var result          = true;
            int x               = 0;
            int y               = 0;
            int boxCounter      = 0;
            int triangleCounter = 0;

            if ((width / sideLength) % 1 != 0
                ||
                (height / sideLength) % 1 != 0)
            {
                Console.WriteLine("Given parameters would not generate a symmetrical grid");
                return(false);
            }

            while (y < height / sideLength)
            {
                while (x < width / sideLength)
                {
                    boxCounter++;
                    triangleCounter++;
                    Box CurrentBox = new Box
                    {
                        BoxName = AlphabetNamesByRow[y] + "Box" + boxCounter,
                        V1      = new Point {
                            X = x, Y = y
                        },
                        V2 = new Point {
                            X = x + 1, Y = y
                        },
                        V3 = new Point {
                            X = x, Y = y + 1
                        },
                        V4 = new Point {
                            X = x + 1, Y = y + 1
                        }
                    };
                    Boxes.Add(CurrentBox);

                    Triangles.Add(new Triangle
                    {
                        TriangleName = AlphabetNamesByRow[y] + triangleCounter.ToString(),
                        V1           = CurrentBox.V1,
                        V2           = CurrentBox.V3,
                        V3           = CurrentBox.V4
                    });

                    triangleCounter++;
                    Triangles.Add(new Triangle {
                        TriangleName = AlphabetNamesByRow[y] + triangleCounter.ToString(),
                        V1           = CurrentBox.V1,
                        V2           = CurrentBox.V2,
                        V3           = CurrentBox.V4
                    });
                    x++;
                }
                x               = 0;
                boxCounter      = 0;
                triangleCounter = 0;
                y++;
            }

            return(result);
        }