Пример #1
0
        private void Click_mirrormode(object sender, RoutedEventArgs e)//needs work
        {
            dynamic blueprint = BP.Blueprint;

            if (blueprint.joints == null)
            {
                foreach (dynamic body in blueprint.bodies)
                {
                    foreach (dynamic block in body.childs)
                    {
                        {
                            dynamic realpos = BP.getposandbounds(block);

                            int xaxis = Convert.ToInt32(block.xaxis);
                            int zaxis = Convert.ToInt32(block.zaxis);
                            if (!((xaxis == 1 && zaxis == -2) || (Math.Abs(xaxis) == 1 && Math.Abs(zaxis) == 3) || (xaxis == -1 && zaxis == 2)))
                            {
                                realpos.xaxis = -xaxis;
                                realpos.zaxis = Math.Abs(zaxis) == 1? -zaxis : zaxis;
                            }
                            //Bounds bounds = Blockobject.BoundsByRotation(new Bounds(realpos.bounds),1,3);
                            realpos.pos.x = -Convert.ToInt32(block.pos.x) - ((realpos.pos.x == block.pos.x)? Convert.ToInt32(realpos.bounds.x) :0);
                            //realpos.pos.y = Convert.ToInt32(block.pos.y) - Convert.ToInt32(block.bounds.y);

                            block.pos   = BP.calcbppos(realpos).pos;
                            block.xaxis = BP.calcbppos(realpos).xaxis;
                            block.zaxis = BP.calcbppos(realpos).zaxis;

                            //block.pos.x = -Convert.ToInt32(block.pos.x);
                            //works thus far for blocks, not parts tho

                            /*
                             * if(Math.Abs(Convert.ToInt32(block.zaxis)) == 3 || Math.Abs(Convert.ToInt32(block.zaxis)) == 2)
                             * {
                             *  block.xaxis = -Convert.ToInt32(block.xaxis);
                             * }
                             * if(Math.Abs(Convert.ToInt32(block.zaxis)) == 1)
                             * {
                             *  block.zaxis = -Convert.ToInt32(block.zaxis);
                             * }*/
                            /*block.pos.x = -Convert.ToInt32(block.pos.x);
                            *  if(Convert.ToInt32(block.xaxis) == 1 || Convert.ToInt32(block.xaxis) == -1)
                            *   block.xaxis = -Convert.ToInt32(block.xaxis);
                            *  else
                            *   block.zaxis = -Convert.ToInt32(block.zaxis);*/
                        }
                    }
                }
                BP.setblueprint(blueprint);
                this.RenderBlueprint();
            }
            else
            {
                MessageBox.Show("Mirror mode can't mirror blueprints with joints inside yet!");
            }
            MessageBox.Show("Mirror mode did it's best to mirror things though there may be some parts that didn't turn out great.");
        }