예제 #1
0
        // Create/update the BoxList and BoxDrawList
        private void CreateBoxList()
        {
            BoxList.Clear();
            BoxDrawList.Clear();

            // on créé un tableau contenant la liste des sommets du modèles
            ModelMeshPart portionMaillage     = Modèle.Meshes[0].MeshParts[0];
            int           tailleSommetEnFloat = portionMaillage.VertexBuffer.VertexDeclaration.VertexStride / sizeof(float);
            int           tailleTamponEnFloat = portionMaillage.VertexBuffer.VertexCount * tailleSommetEnFloat;

            // On va chercher le contenu du tampon de sommets (vertex buffer) en float pour que cela fonctionne
            // avec les différents formats de sommets (VertexPositionNormalTexture, VertexPositionTexture, VertexPositionColor...)
            float[] sommetsDuModèles = new float[tailleTamponEnFloat];
            portionMaillage.VertexBuffer.GetData <float>(sommetsDuModèles);
            int début = 0;

            //On crée une boîte de collision par maillage (un modèle contient de 1 à N maillages)
            foreach (ModelMesh maillage in Modèle.Meshes)
            {
                //On crée la boîte de collision (BoundingBox) correspondant à une partie du modèle et on l'ajoute à la liste des boîtes de collision
                BoundingBox boîteCollision = CalculerBoundingBox(maillage, sommetsDuModèles, tailleSommetEnFloat, ref début);
                BoxList.Add(boîteCollision);
                BoxDrawList.Add(CreateBoundingBoxBuffers(boîteCollision, Jeu.GraphicsDevice));
            }
        }
예제 #2
0
        public void TestIssue30B()
        {
            var box1 = Factory.CreateBox("C_Small_1", 21, 21, 3, 1, 20, 20, 2, 100);
            var box2 = Factory.CreateBox("B_Large_2", 1301, 1301, 1301, 1, 1300, 1300, 1300, 1000);
            var box3 = Factory.CreateBox("A_Medium_3", 101, 101, 11, 5, 100, 100, 10, 500);

            var list1 = new BoxList();

            list1.Insert(box1);
            list1.Insert(box2);
            list1.Insert(box3);
            var sorted1 = list1.ToList();

            Assert.Equal(box1.Reference, sorted1[0].Reference);
            Assert.Equal(box3.Reference, sorted1[1].Reference);
            Assert.Equal(box2.Reference, sorted1[2].Reference);

            var list2 = new BoxList();

            list2.Insert(box1);
            list2.Insert(box2);
            list2.Insert(box3);
            var sorted2 = list1.ToList();

            Assert.Equal(box1.Reference, sorted1[0].Reference);
            Assert.Equal(box3.Reference, sorted1[1].Reference);
            Assert.Equal(box2.Reference, sorted1[2].Reference);
        }
예제 #3
0
파일: TicTacToe.cs 프로젝트: AdkaG/MVC_new
        private bool WinningMove(char symbol)
        {
            var playerMoves = BoxList.Where(b => b.Value == symbol).Select(b => b.BoxCoordinate).ToList(); //alla spelares/datorns drag

            for (int i = 0; i < 8; i++)                                                                    //WinningCombos[i,j]
            {
                var hit = 0;                                                                               //antal moves som stämmer med box i en WinningCombos
                for (int j = 0; j < 3; j++)
                {
                    foreach (int m in playerMoves)
                    {
                        var winningCombo = TicTacToeHelper.WinningCombos[i, j];
                        if (m != winningCombo)
                        {
                            continue;
                        }
                        hit++;
                        break;
                    }
                }
                if (hit == 3)
                {
                    return(false);//det finns vinnare - spelet stoppas
                }
            }
            return(true); //ingen vinner - spelet fortsätter
        }
예제 #4
0
        public void TestCanPackRepresentativeLargerSamples3D(string testId, BoxList boxes, List <ItemData> itemsData, Expected expected2D, Expected expected3D)
        {
            var expectedItemCount = 0;

            var packer = new Packer();

            foreach (var box in boxes)
            {
                packer.AddBox(box);
            }

            foreach (var iData in itemsData)
            {
                expectedItemCount += iData.qty;

                packer.AddItem(Factory.CreateItem(
                                   iData.name,
                                   iData.width,
                                   iData.length,
                                   iData.depth,
                                   iData.weight,
                                   true
                                   ), iData.qty
                               );
            }

            var packedBoxes3D = packer.Pack();

            var packedItemCount3D = packedBoxes3D.ToList().Sum(pb => pb?.PackedItems?.Count ?? 0);

            Assert.Equal(expected3D.boxes, packedBoxes3D.Count);
            Assert.Equal(expectedItemCount, packedItemCount3D);
            Assert.Equal(expected3D.utilisation, packedBoxes3D.GetVolumeUtilisation());
            Assert.Equal(expected3D.weightVariance, packedBoxes3D.GetWeightVariance());
        }
예제 #5
0
        private void fillCanvas(Canvas X, BoxList boxes)
        {
            int maxHeight = 0;
            int maxWidth  = 0;


            foreach (Box box in boxes.ListBox)
            {
                Rectangle r = new Rectangle();
                r.Height          = box.Height * 4;
                r.Width           = box.Width * 4;
                r.Stroke          = Brushes.Black;
                r.StrokeThickness = 2;

                if (r.Height > maxHeight)
                {
                    maxHeight = (int)r.Height;
                }
                if (r.Width > maxWidth)
                {
                    maxWidth = (int)r.Width;
                }
                if (spacingLeft + maxWidth > Main.Width)
                {
                    spacingLeft = 0;
                    spacingTop  = maxHeight + 10;
                }
                Canvas.SetLeft(r, spacingLeft);
                spacingLeft += (int)(r.Width + 10);
                Canvas.SetTop(r, spacingTop);
                X.Children.Add(r);
            }
            spacingLeft = 0;
            spacingTop  = 0;
        }
예제 #6
0
        /// <summary>
        /// This call lets you get all boxes contained in the specified pipeline.
        /// </summary>
        /// <param name="pipelineKey">The key of the pipeline for which you want the boxes listed</param>
        /// <param name="sortOptions">What order to sort the boxes by. There are two valid sorts creationTimestamp and lastUpdatedTimestamp. Both are in descending order. (optional)</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">Please specify a pipeline key!</exception>
        public BoxList ListAllBoxesInPipeline(string pipelineKey, SortOptions sortOptions = null)
        {
            if (string.IsNullOrEmpty(pipelineKey))
            {
                throw new ArgumentNullException(nameof(pipelineKey), "Please specify a pipeline key!");
            }
            var boxList = new BoxList
            {
                RawApiResponse = _rawBoxServices.ListAllBoxesInPipeline(pipelineKey, sortOptions)
            };

            try
            {
                boxList.Boxes = JsonConvert.DeserializeObject <List <Box> >(boxList.RawApiResponse.Json);
            }
            catch (Exception ex)
            {
                Console.WriteLine(boxList.RawApiResponse.Json);
                Console.WriteLine("\n\n\n:(\n\n\n");
                Console.WriteLine(ex.Message);
            }

            boxList.RawApiResponse = GetRawApiResponseOrNull(boxList.RawApiResponse);
            return(boxList);
        }
예제 #7
0
    public static void ShowPopup(BoxList boxList)
    {
        EventData e = new EventData("OnShowPopupWindowEvent");

        e.Data["Type"]    = typeof(XViewerWindow);
        e.Data["BoxList"] = boxList;
        AppManager.Instance.EventManager.CallOnShowPopupWindowEvent(e);
    }
예제 #8
0
        public void AddingBoxesGeneratesIds()
        {
            var box = new Box()
            {
                Description = "Small",
                OuterWidth  = 21,
                OuterLength = 21,
                OuterDepth  = 3,
                EmptyWeight = 1,
                InnerWidth  = 20,
                InnerLength = 20,
                InnerDepth  = 2,
                MaxWeight   = 100
            };

            var box2 = new Box()
            {
                Description = "Large",
                OuterWidth  = 201,
                OuterLength = 201,
                OuterDepth  = 21,
                EmptyWeight = 1,
                InnerWidth  = 200,
                InnerLength = 200,
                InnerDepth  = 20,
                MaxWeight   = 1000
            };

            var box3 = new Box()
            {
                Description = "Medium",
                OuterWidth  = 101,
                OuterLength = 101,
                OuterDepth  = 11,
                EmptyWeight = 5,
                InnerWidth  = 100,
                InnerLength = 100,
                InnerDepth  = 10,
                MaxWeight   = 500
            };

            var boxes = new BoxList();

            boxes.Insert(box);
            boxes.Insert(box2);
            boxes.Insert(box3);

            var packer = new Packer();

            packer.AddBoxes(boxes);

            var packerBoxes = packer.GetBoxes().GetContent().Cast <Box>();

            foreach (var packerBox in packerBoxes)
            {
                Assert.IsNotEmpty(packerBox.GeneratedId);
            }
        }
 public Packer(Boolean createBoxesForOverizedItems = false, bool startWithLargerBoxes = false)
 {
     Items = new ItemList();
     Boxes = new BoxList();
     CreateBoxesForOversizedItems = createBoxesForOverizedItems;
     StartWithLargerBoxes         = startWithLargerBoxes;
     _logger       = LogManager.GetCurrentClassLogger();
     WidthPadding  = 0.1;
     LengthPadding = 0.1;
 }
예제 #10
0
        /// <summary>
        /// This call lets you get all boxes that the current user has access to. The boxes returned here are across all pipelines a user has access to. This is a fairly expensive call so there is a lower API quota limit. If possible, get boxes using the pipeline key instead.
        /// </summary>
        /// <returns></returns>
        public BoxList ListAllBoxesUserHasAccessTo()
        {
            var boxList = new BoxList
            {
                RawApiResponse = _rawBoxServices.ListAllBoxesUserHasAccessTo()
            };

            boxList.Boxes          = JsonConvert.DeserializeObject <List <Box> >(boxList.RawApiResponse.Json);
            boxList.RawApiResponse = GetRawApiResponseOrNull(boxList.RawApiResponse);
            return(boxList);
        }
예제 #11
0
    public override void Show(Dictionary <string, object> data)
    {
        base.Show(data);
        _lastScannedTimer = 0.0f;
        Photo.gameObject.SetActive(false);
        UpdatePhotoButton.interactable = false;
        _boxList = data["BoxList"] as BoxList;
//#if !UNITY_EDITOR
        QRReader.EnableReader();
//#else
        //OnQRCodeDetected("0005");
//#endif
    }
        /// <summary>
        /// Add a pre-prepared set of boxes all at once
        /// </summary>
        /// <param name="boxes"></param>
        public void AddBoxes(BoxList boxes)
        {
            if (boxes == null)
            {
                throw new ArgumentNullException();
            }

            var tmpBoxes = boxes.GetContent().Cast <Box>();

            foreach (var box in tmpBoxes)
            {
                AddBox(box);
            }
        }
예제 #13
0
 private void btnSend_Click(object sender, RoutedEventArgs e)
 {
     if (NewBox != null)
     {
         BoxList.Add(NewBox);
         NewBox         = null;
         tbxLength.Text = null;
         tbxWidth.Text  = null;
         tbxHeight.Text = null;
         tbxWeight.Text = null;
         tbxPrice.Text  = null;
         lbxSendtPackets.Items.Refresh();
     }
 }
예제 #14
0
        protected void Page_Load()
        {
            if (!IsPostBack)
            {
                //DataSet ds = new DataSet();
                //ds.ReadXml(Server.MapPath("~/App_Data/LunchBox.xml"));
                BoxList.DataSource       = Enum.GetNames(typeof(BoxTypes));
                BoxListOrders.DataSource = Enum.GetNames(typeof(BoxTypes));
                //GridView_lunch.DataSource = ds;

                BoxList.DataBind();
                BoxListOrders.DataBind();
                //GridView_lunch.DataBind();

                Numdays.Items.AddRange(Enumerable.Range(1, 100).Select(e => new ListItem(e.ToString())).ToArray());
                CalculatePrice(null, EventArgs.Empty);
            }
        }
예제 #15
0
        public void TestSorting()
        {
            var box1 = Factory.CreateBox("C_Small", 21, 21, 3, 1, 20, 20, 2, 100);
            var box2 = Factory.CreateBox("B_Large", 201, 201, 21, 1, 200, 200, 20, 1000);
            var box3 = Factory.CreateBox("A_Medium", 101, 101, 11, 5, 100, 100, 10, 500);

            var list = new BoxList();

            list.Insert(box1);
            list.Insert(box2);
            list.Insert(box3);

            var sorted = list.ToList();

            Assert.Equal("C_Small", sorted[0].Reference);
            Assert.Equal("A_Medium", sorted[1].Reference);
            Assert.Equal("B_Large", sorted[2].Reference);
        }
예제 #16
0
        public void TestIssue163()
        {
            var box2 = Factory.CreateBox("C2", 202, 152, 32, 10, 200, 150, 30, 100);
            var box3 = Factory.CreateBox("B3", 202, 152, 32, 10, 200, 150, 30, 250);
            var box1 = Factory.CreateBox("A1", 202, 152, 32, 10, 200, 150, 30, 50);

            var list = new BoxList();

            list.Insert(box1);
            list.Insert(box2);
            list.Insert(box3);

            var sorted = list.ToList();

            Assert.Equal(box1.Reference, sorted[0].Reference);
            Assert.Equal(box2.Reference, sorted[1].Reference);
            Assert.Equal(box3.Reference, sorted[2].Reference);
        }
예제 #17
0
        public void TestLoad()
        {
            string filename = @"C:\Users\Mike\Desktop\t.txt";

            System.IO.StreamReader file = new System.IO.StreamReader(filename);
            string line = file.ReadToEnd();


            var BoxesTmp = InputOutput.InitializeList(line);
            var Boxes    = new BoxList();

            Boxes.CzyscListe();
            Boxes.DodajPudelka(BoxesTmp);
            Boxes.UstawPionowo();

            foreach (var item in Boxes.ListBox)
            {
                Assert.IsTrue(item.Width <= item.Height);
            }



            BoxList A = new BoxList();
            BoxList B = new BoxList();

            A.DodajPudelka(Boxes.GetBoxList());
            B.DodajPudelka(Boxes.GetBoxList());

            A.SortujPudelka(true);
            B.SortujPudelka(false);


            for (int i = 0; i < A.ListBox.Count - 2; i++)
            {
                Assert.IsTrue(A.ListBox[i].Height <= A.ListBox[i + 1].Height);
            }

            for (int i = 0; i < B.ListBox.Count - 2; i++)
            {
                Assert.IsTrue(B.ListBox[i].Width <= B.ListBox[i + 1].Width);
            }
        }
예제 #18
0
        public void ConstructionTest2()
        {
            // インスタンス生成時の、例外テスト

            {
                var obj = new BoxList<int>(0, 0);
                obj.MaxRows.Is(0);
                obj.MaxCols.Is(0);
            }

            AssertEx.Throws<ArgumentOutOfRangeException>(() =>
            {
                var obj = new BoxList<int>(3, 0);
            })
            .ParamName.Is("newCols");

            AssertEx.Throws<ArgumentOutOfRangeException>(() =>
            {
                var obj = new BoxList<int>(0, 3);
            })
            .ParamName.Is("newRows");
        }
예제 #19
0
파일: TicTacToe.cs 프로젝트: AdkaG/MVC_new
        public string GameOn(int coordinate, char symbol)
        {
            bool loop = true;

            do                                                //max 2 gånger: 1 varv - granska allt efter spelare; 2 varv - granskar allt efter datorn; då datorn hade sista drag loop = false
            {
                BoxList.Add(new BoxInfo(coordinate, symbol)); //upptagna boxes, varje gång efter drag

                bool continueGame = WinningMove(symbol);

                if (continueGame == false) //nån vann
                {
                    ActiveGameStatus.Text = $"Congratulation (( {symbol} )). You win!!!";
                    return(ActiveGameStatus.Status = "Winner");
                }

                if (BoxList.Count == 9) //alla boxes upptagna
                {
                    BordFull = true;
                    ActiveGameStatus.Text = "Game over. No winner.";
                    return(ActiveGameStatus.Status = "No winner");
                }

                if (symbol == 'x')//sista drag gjorts av spelare, dator måste spela
                {
                    var compMove = TicTacToeHelper.CompMove(BoxList);
                    coordinate = compMove.BoxCoordinate;
                    symbol     = compMove.Value;
                }
                else if (symbol == 'o')//sista drag gjorts av datorn, loop = false
                {
                    loop = false;
                }
            } while (loop);

            ActiveGameStatus.Text = "Next move, please...";//ingen vinnare, spelet sker
            return(ActiveGameStatus.Status = "Active");
        }
예제 #20
0
        public void ConstructionTest()
        {
            TestContext.Run((int maxrow, int maxcol) =>
            {
                var box = new BoxList<int>(maxrow, maxcol);
                box.MaxRows.Is(maxrow);
                box.MaxCols.Is(maxcol);

                // 全要素にアクセスする確認
                for (var row = 0; row < maxrow; row++)
                {
                    for (var col = 0; col < maxcol; col++)
                    {
                        // データを代入して、3通りの方法で読み出してみる
                        var data = row*0x1000 + col;
                        box[row, col] = data;
                        box[row, col].Is(data,"[,]");
                        box.Rows(col).ToList()[row].Is(data,"Rows");
                        box.Cols(row).ToList()[col].Is(data,"Cols");
                    }
                }
            });
        }
예제 #21
0
        private void _Start_Click(object sender, RoutedEventArgs e)
        {
            if (IsCalculated)
            {
                return;
            }
            if (Boxes.GetBoxNumber() == 0)
            {
                return;
            }



            Boxes.UstawPionowo();

            BoxList A = new BoxList();
            BoxList B = new BoxList();

            A.DodajPudelka(Boxes.GetBoxList());
            B.DodajPudelka(Boxes.GetBoxList());

            A.SortujPudelka(true);
            B.SortujPudelka(false);

            var watch = Stopwatch.StartNew();



            var tmp = Algorithm.NajdluzszyWspolnyPodciag(A.GetBoxList(), B.GetBoxList());

            watch.Stop();
            IsCalculated = true;
            FillData(watch.ElapsedMilliseconds.ToString(), tmp);
            SortedBoxes.ListBox = tmp;
            fillCanvas(SortedCanvas, SortedBoxes);
        }
예제 #22
0
 /// <summary>
 /// 构建矩形
 /// </summary>
 /// <param name="pageWidth">页宽</param>
 /// <param name="pageHeight">页高</param>
 public ZicoxPrintClient BuildBox(int pageWidth, int pageHeight)
 {
     BoxList.ForEach(x => CommandBuilder.DrawBox(pageWidth, pageHeight, x));
     return(this);
 }
예제 #23
0
        public void ResizeTest()
        {
            var obj = new BoxList<int>();
            obj.MaxRows.Is(0);      // 作成直後は、サイズが0
            obj.MaxCols.Is(0);

            obj.MaxRows = 3;        // 行を増やした時、
            obj.MaxRows.Is(3);
            obj.MaxCols.Is(1);      // 列が0だと、1に増やす

            obj.MaxRows = 0;        // 行を0にすると、
            obj.MaxRows.Is(0);      // 中身がからになる
            obj.MaxCols.Is(0);

            obj.MaxCols = 3;        // 列も同様
            obj.MaxRows.Is(1);
            obj.MaxCols.Is(3);

            obj.MaxCols = 0;
            obj.MaxRows.Is(0);
            obj.MaxCols.Is(0);
        }
예제 #24
0
        public static IEnumerable <object[]> GetCases_TestCanPackRepresentativeLargerSamples()
        {
            var expected2DDict = new Dictionary <string, Expected>();
            var expected3DDict = new Dictionary <string, Expected>();

            var boxes = new BoxList();

            var itemsDict = new Dictionary <string, List <ItemData> >();

            string[] expectedLines = File.ReadAllLines("./EfficiencyTest/Data/expected.csv");
            string[] boxesLines    = File.ReadAllLines("./EfficiencyTest/Data/boxes.csv");
            string[] itemsLines    = File.ReadAllLines("./EfficiencyTest/Data/items.csv");

            foreach (var expectedLine in expectedLines)
            {
                string[] data = expectedLine.Split(",");
                var      key  = data[0];
                expected2DDict.Add(key, new Expected
                {
                    boxes          = int.Parse(data[1]),
                    weightVariance = double.Parse(data[2], CultureInfo.InvariantCulture),
                    utilisation    = float.Parse(data[3], CultureInfo.InvariantCulture)
                }
                                   );
                expected3DDict.Add(key, new Expected
                {
                    boxes          = int.Parse(data[4]),
                    weightVariance = double.Parse(data[5], CultureInfo.InvariantCulture),
                    utilisation    = float.Parse(data[6], CultureInfo.InvariantCulture)
                }
                                   );
            }

            foreach (var boxLine in boxesLines)
            {
                string[] data = boxLine.Split(",");

                boxes.Insert(Factory.CreateBox(
                                 data[0],
                                 int.Parse(data[1]),
                                 int.Parse(data[2]),
                                 int.Parse(data[3]),
                                 int.Parse(data[4]),
                                 int.Parse(data[5]),
                                 int.Parse(data[6]),
                                 int.Parse(data[7]),
                                 int.Parse(data[8])
                                 )
                             );
            }

            foreach (var itemLine in itemsLines)
            {
                string[] data = itemLine.Split(",");
                var      key  = data[0];

                if (!itemsDict.ContainsKey(key))
                {
                    itemsDict.Add(key, new List <ItemData>());
                }

                itemsDict[key].Add(new ItemData
                {
                    qty    = int.Parse(data[1]),
                    name   = data[2],
                    width  = int.Parse(data[3]),
                    length = int.Parse(data[4]),
                    depth  = int.Parse(data[5]),
                    weight = int.Parse(data[6])
                }
                                   );
            }

            foreach (var kv in itemsDict)
            {
                yield return(new object[] {
                    kv.Key,
                    boxes,
                    itemsDict[kv.Key],
                    expected2DDict[kv.Key],
                    expected3DDict[kv.Key]
                });
            }
        }
예제 #25
0
 public Packer()
 {
     _items = new ItemList();
     _boxes = new BoxList();
 }
예제 #26
0
 public WeightRedistributor(BoxList _boxes)
 {
     boxes = _boxes;
 }
예제 #27
0
 public void SetBoxes(BoxList boxCollection)
 {
     _boxes = boxCollection;
 }
예제 #28
0
        public void CanAddBoxesInProperOrder()
        {
            var box = new Box()
            {
                Description = "Small",
                OuterWidth  = 21,
                OuterLength = 21,
                OuterDepth  = 3,
                EmptyWeight = 1,
                InnerWidth  = 20,
                InnerLength = 20,
                InnerDepth  = 2,
                MaxWeight   = 100
            };

            var box2 = new Box()
            {
                Description = "Large",
                OuterWidth  = 201,
                OuterLength = 201,
                OuterDepth  = 21,
                EmptyWeight = 1,
                InnerWidth  = 200,
                InnerLength = 200,
                InnerDepth  = 20,
                MaxWeight   = 1000
            };

            var box3 = new Box()
            {
                Description = "Medium",
                OuterWidth  = 101,
                OuterLength = 101,
                OuterDepth  = 11,
                EmptyWeight = 5,
                InnerWidth  = 100,
                InnerLength = 100,
                InnerDepth  = 10,
                MaxWeight   = 500
            };

            var boxes = new BoxList();

            boxes.Insert(box);
            boxes.Insert(box2);
            boxes.Insert(box3);

            var orderedItems = new List <Box>();

            while (!boxes.IsEmpty())
            {
                var bestItem = boxes.GetBest();
                orderedItems.Add(bestItem);
                boxes.ExtractBest();
            }

            var expectedOutcome = new List <Box>()
            {
                box, box3, box2
            };

            for (var counter = 0; counter < expectedOutcome.Count; counter++)
            {
                Assert.AreEqual(orderedItems[counter], expectedOutcome[counter]);
            }
        }
예제 #29
0
 public Chain(List <House> houses)
 {
     BoxList.AddRange(houses);
 }
예제 #30
0
 public void InitValueTests()
 {
     var box = new BoxList<string>();
     this.InitValue(box, 2, 3);
     box.Width.Is(2);
     box.Height.Is(3);
     for (var r = 0; r < box.Height; r++)
     {
         for (var c = 0; c < box.Width; c++)
         {
             box[c, r].Is($"{c},{r}");
         }
     }
 }
예제 #31
0
    //public void ShootBullet(BulletInfo bullet)
    //{
    //    //子弹的拥有者的旋转角度
    //    Vector3 bulletRotate = ActorList[bullet.userIndex].myRotationInfo.Rotation;
    //    Vector2 bullet2D = new Vector2(bullet.pos.x, bullet.pos.z);
    //    //子弹相对落地点(半径以内的x,y)
    //    Vector2 sPos = new Vector2(
    //        RoomActor.ShootRadius * Mathf.Sin((Mathf.PI / 180) * bulletRotate.y),
    //        RoomActor.ShootRadius * Mathf.Cos((Mathf.PI / 180) * bulletRotate.y));
    //    //子弹世界落地点
    //    Vector2 bulletWorldPos = sPos + bullet2D;


    //    foreach (var item in ActorList)//遍历是否射中其他玩家
    //    {
    //        bool isShooted = false;
    //        if (item.Value == null)
    //            continue;
    //        if (item.Value.UniqueID == bullet.userIndex)//子弹不检测自身
    //            continue;
    //        RoomActor actor = item.Value;
    //        //待碰撞人物的顶视图世界坐标
    //        Vector2 cP = new Vector2(actor.MyMoveInfo.Pos.x, actor.MyMoveInfo.Pos.z);
    //        //子弹发射点和待碰撞人物距离
    //        float bscDistance = Vector2.Distance(bullet2D, cP);

    //        //子弹射击方向世界角度
    //        float shootRotate = bulletRotate.y;
    //        shootRotate = 90 - shootRotate;//转换模型旋转角度到世界坐标角度
    //        BackPositiveOfAngle(ref shootRotate);//转换负数角度成正数角度
    //        //射击点到人物的世界角度
    //        float middleAngle = Mathf.Atan2(actor.MyMoveInfo.Pos.z - bullet.pos.z, actor.MyMoveInfo.Pos.x - bullet.pos.x) * 180 / Mathf.PI;
    //        BackPositiveOfAngle(ref middleAngle);
    //        //射击点到人物边缘的世界角度
    //        float sideAngle = Mathf.Atan2(RoomActor.ModelRadius, bscDistance) * 180 / Mathf.PI;
    //        BackPositiveOfAngle(ref sideAngle);
    //        float angleMin = (middleAngle - sideAngle) > (middleAngle + sideAngle) ? (middleAngle + sideAngle) : (middleAngle - sideAngle);
    //        float angleMax = (middleAngle - sideAngle) > (middleAngle + sideAngle) ? (middleAngle - sideAngle) : (middleAngle + sideAngle);


    //        //判断待射击人物的夹角(计算射击点到人物边缘的角度)子弹在朝向模型
    //        if (shootRotate > angleMin && shootRotate < angleMax)
    //        {
    //            if (bscDistance <= RoomActor.ShootRadius)//待检测人物的中心点在射击半径上或内
    //            {
    //                isShooted = true;
    //            }
    //            else if (bscDistance < RoomActor.ShootRadius + RoomActor.ModelRadius)//子弹落在2个人物之间,正好是射击待碰撞人物中心点,最短距离
    //            {
    //                //判断子弹落地点是否在待检测人物半径内
    //                if (Vector2.Distance(bulletWorldPos, cP) <= RoomActor.ModelRadius)
    //                {
    //                    isShooted = true;
    //                }
    //            }
    //        }
    //        //射中人物
    //        if (isShooted)
    //        {
    //            Log4Debug("射中人物:" + actor.UniqueID);
    //            TeamType bulletType = BackTeamTypeByUnique(bullet.userIndex);
    //            RoomActorUpdate hit = new RoomActorUpdate() { userIndex = actor.UniqueID, update = (int)bulletType + "" };
    //            byte[] message = SerializeHelper.ConvertToByte(hit.GetSendInfo());
    //            //广播
    //            BoardcastMessage(MessageConvention.shootBullet, message);
    //            return;
    //        }
    //    }
    //    //Log4Debug("子弹落地点:" + bulletWorldPos);
    //    //子弹碰撞方块
    //    foreach (KeyValuePair<int, BoxInfo> item in BoxList)
    //    {
    //        Vector2 boxPos = new Vector2(item.Value.position.x, item.Value.position.z);
    //        Vector2 boxScale = new Vector2(item.Value.scale.x, item.Value.scale.z);

    //        if (
    //            bulletWorldPos.x > boxPos.x - (float)(boxScale.x / 2) &&
    //            bulletWorldPos.x <= boxPos.x + (float)(boxScale.x / 2) &&
    //            bulletWorldPos.y > boxPos.y - (float)(boxScale.y / 2) &&
    //            bulletWorldPos.y <= boxPos.y + (float)(boxScale.y / 2)
    //            )//顶视图看是在方格内的
    //        {
    //            Log4Debug("子弹落点:(" + bulletWorldPos.x + "," + bulletWorldPos.y + ") 射中方块坐标:(" + item.Value.position.x + "," + item.Value.position.z + ")");
    //            //设置色块拥有者
    //            item.Value.ownerIndex = bullet.userIndex;
    //            //广播发送消息
    //            RoomActorUpdate hit = new RoomActorUpdate() { userIndex = bullet.userIndex, update = item.Key + "" };
    //            byte[] message = SerializeHelper.ConvertToByte(hit.GetSendInfo());
    //            //射中地板方块
    //            BoardcastMessage(MessageConvention.updateBox, message);
    //            return;
    //        }
    //    }
    //    //
    //}
    public void UpdateBulletInfo(BulletInfo bulletInfo)
    {
        byte[]       message  = null;
        MessageXieYi xieyi    = null;
        int          boxIndex = -1;

        //
        switch (bulletInfo.shootTag)
        {
        case ShootTag.Box:
            //设置色块拥有者
            lock (BoxList)
            {
                boxIndex = int.Parse(bulletInfo.shootInfo);

                BoxInfo boxInfo = new BoxInfo()
                {
                    ownerIndex = -1, myIndex = boxIndex
                };
                BoxList.AddOrUpdate(boxIndex, boxInfo, (key, oldValue) => boxInfo);

                if (BoxList[boxIndex].ownerIndex < 0)
                {
                    BoxList[boxIndex].ownerIndex = bulletInfo.userIndex;
                    //生成buff
                    BuffInfo buffInfo = new BuffInfo()
                    {
                        ownerIndex = -1, myIndex = BuffIndex
                    };
                    lock (BuffList)
                    {
                        buffInfo.boxIndex = boxIndex;
                        buffInfo.type     = RandomBuffType();//随机一个buff类型
                        BuffList.AddOrUpdate(BuffIndex, buffInfo, (key, oldValue) => buffInfo);
                        BuffIndex++;
                    }
                    Log4Debug("在盒子编号->" + boxIndex + " 掉落Buff,编号->" + buffInfo.myIndex + ",类型->" + buffInfo.type);
                    //保存子弹消息
                    message = SerializeHelper.Serialize <BulletInfo>(bulletInfo);
                    xieyi   = new MessageXieYi((byte)MessageConvention.bulletInfo, 0, message);
                    SetRecondFrame(xieyi.ToBytes());
                    //保存Buff消息
                    message = SerializeHelper.Serialize <BuffInfo>(buffInfo);
                    xieyi   = new MessageXieYi((byte)MessageConvention.createBuff, 0, message);
                    SetRecondFrame(xieyi.ToBytes());
                }
                else    //该色块已被其他人击碎
                {
                    return;
                }
            }
            break;

        case ShootTag.Character:
            //
            int shootedIndex = int.Parse(bulletInfo.shootInfo);
            if (ActorList[shootedIndex].MyTeam == ActorList[bulletInfo.userIndex].MyTeam)
            {
                return;
            }
            if (ActorList[shootedIndex].CurState == RoomActorState.Gaming)
            {
                //增加击杀数
                ActorList[bulletInfo.userIndex].KillCount++;
                if (CurState == RoomActorState.Gaming)
                {
                    message = SerializeHelper.Serialize <List <RoomActor> >(new List <RoomActor>(ActorList.Values));
                    BoardcastMessage(MessageConvention.getRoommateInfo, message);
                }
                //改变被射击者状态
                RoomActorUpdate dead = new RoomActorUpdate()
                {
                    userIndex = shootedIndex,
                    update    = (int)RoomActorState.Dead + ""
                };
                UpdateState(dead);
            }
            else if (ActorList[shootedIndex].CurState == RoomActorState.Invincible)
            {
                Log4Debug("射击者站位:" + bulletInfo.userIndex + " 攻击无敌站位:->" + shootedIndex);
            }
            else
            {
                Log4Debug("射击者站位:" + bulletInfo.userIndex + " 正在鞭尸位置->" + shootedIndex);
            }
            //保存子弹消息
            message = SerializeHelper.Serialize <BulletInfo>(bulletInfo);
            xieyi   = new MessageXieYi((byte)MessageConvention.bulletInfo, 0, message);
            SetRecondFrame(xieyi.ToBytes());
            break;

        case ShootTag.Wall:
            //打中墙的消息就不存了
            break;

        case ShootTag.Buff:
            int buffIndex = int.Parse(bulletInfo.shootInfo);
            //Log4Debug("站位:" + bulletInfo.userIndex + " 请求拾取Buff->" + buffIndex);
            lock (BuffList)
            {
                if (BuffList[buffIndex].ownerIndex < 0)
                {
                    BuffList[buffIndex].ownerIndex = bulletInfo.userIndex;
                    Log4Debug("站位:" + bulletInfo.userIndex + " 拾取了Buff->" + buffIndex);
                }
                else    //该buff已被其他人加成
                {
                    return;
                }
            }
            //保存Buff消息
            message = SerializeHelper.Serialize <BuffInfo>(BuffList[buffIndex]);
            xieyi   = new MessageXieYi((byte)MessageConvention.getBuff, 0, message);
            SetRecondFrame(xieyi.ToBytes());
            break;
        }


        //广播发送消息
        //byte[] message = SerializeHelper.ConvertToByte(bulletInfo));
        //BoardcastMessage(MessageConvention.bulletInfo, message);
    }