Beispiel #1
0
 public static void Cleanup()
 {
     Verticies   = new VertexPositionColor[MaxTriangles * 3];
     VertexCount = 0;
     Effect      = null;
     Camera      = null;
     Boxes.Clear();
     Segments.Clear();
 }
Beispiel #2
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();
                }
            }
        }
        private void ImagesOnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case nameof(ImagesModel.Size):
                OnHasChanged();
                break;

            case nameof(ImagesModel.ImageType):
                // not supported
                if (images.ImageType == typeof(Texture3D))
                {
                    Boxes.Clear();
                }

                break;
            }
        }
Beispiel #4
0
        public void Reconnect()
        {
            Console.WriteLine("Connection lost. Reconnecting.");
            _vanillaClient.pingThread?.Abort();
            Boxes.Clear();
            MemorizedBoxes.Clear();
            Ores.Clear();
            Ships.Clear();
            Gates.Clear();
            Buildings.Clear();
            _proxy.Reset();

            if (_vanillaClient.tcpClient.Connected)
            {
                _vanillaClient.Disconnect();
            }

            _vanillaClient.thread?.Abort();
        }
Beispiel #5
0
        public void HandleBoxes()
        {
            if (Voxels == null)
            {
                Voxels = new List <Voxel>();
            }

            if (Boxes == null)
            {
                Boxes = new List <Body>();
            }

            if (Voxels.Count == 0)
            {
                foreach (Body component in Boxes)
                {
                    KillBox(component);
                }
                Boxes.Clear();
            }

            int numBoxes = Math.Min(Math.Max(Resources.CurrentResourceCount / ResourcesPerVoxel, 1), Voxels.Count);

            if (Boxes.Count > numBoxes)
            {
                for (int i = Boxes.Count - 1; i >= numBoxes; i--)
                {
                    KillBox(Boxes[i]);
                    Boxes.RemoveAt(i);
                }
            }
            else if (Boxes.Count < numBoxes)
            {
                for (int i = Boxes.Count; i < numBoxes; i++)
                {
                    CreateBox(Voxels[i].Position + VertexNoise.GetNoiseVectorFromRepeatingTexture(Voxels[i].Position));
                }
            }
        }
Beispiel #6
0
 public void DeleteGame()
 {
     Boxes.Clear();
     _XRecord = 0;
     _ORecord = 0;
 }
Beispiel #7
0
 private void ResetPuzzle()
 {
     PlayField.Clear();
     Boxes.Clear();
     levelCompleted = false;
 }