Example #1
0
        public ActionResult CreateTm(Transformator transformator)
        {
            var tm = _context.TBL_TRANSFORMERS.Add(transformator);

            _context.SaveChanges();
            return(Ok());
        }
Example #2
0
 public ActionResult Create(DataObject dataobject)
 {
     if (ModelState.IsValid)
     {
         Transformator.ExecuteQuery();
         return(RedirectToAction("Index"));
     }
     return(View(dataobject));
 }
Example #3
0
        //
        // GET: /Object/

        public ViewResult Index()
        {
            if (!fillList)
            {
                dataObjects = Transformator.ExecuteQuery();
                fillList    = true;
            }
            //Integrator.GenerateReport(dataObjects);
            return(View(dataObjects));
        }
Example #4
0
        private void checkRepeatedTrfIsID(Transformator trf, int repetitions)
        {
            List <Transformator> trfList = new List <Transformator>(repetitions);

            for (int i = 0; i < repetitions; i++)
            {
                trfList.Add(trf);
            }
            checkComposedTrfIsID(trfList);
        }
Example #5
0
        public ActionResult EditTm(int id, Transformator transformator)
        {
            var tm = _context.TBL_TRANSFORMERS.Find(id);

            tm.NAME = transformator.NAME;

            _context.SaveChanges();

            return(Ok());
        }
        public void TestDecrement()
        {
            Expression <Func <int, int> > sub_exp = (a) => (a - 1);
            var result_subexp = new Transformator().VisitAndConvert(sub_exp, string.Empty);
            var result        = sub_exp.Compile().Invoke(3);

            Console.WriteLine(sub_exp + " = " + result);
            Assert.IsTrue(result_subexp.Body.ToString().Contains("Decrement"));
            Assert.IsTrue(result == 2);
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        private int getMapSectionIndex(Transformator transformator, float x, float y)
        {
            int posX = (int)(transformator[x] + 0.1f);
            int posY = (int)(transformator[y] + 0.1f);

            posX = Utils.Mathematics.MathUtil.Clamp(posX, 0, currentSectionCount);
            posY = Utils.Mathematics.MathUtil.Clamp(posY, 0, currentSectionCount);

            return(posX + posY * currentSectionCount);
        }
Example #8
0
        static void Main(string[] args)
        {
            int[] arr = { 1, 5, 8, 15 };
            Transformator.Transform(arr, b => b + 5);
            Console.WriteLine(String.Join(" ", arr));
            Console.Read();

            double[] arrD = { 1, 5, 8, 15 };
            Transformator.Transform(arrD, b => Math.Round(b * 1.5));
            Console.WriteLine(String.Join(" ", arrD));
            Console.Read();
        }
        public void TestIncrement()
        {
            Expression <Func <int, int> > add_exp = (a) => (a + 1);
            var result_addexp = new Transformator().VisitAndConvert(add_exp, string.Empty);

            if (result_addexp != null)
            {
                var result = result_addexp.Compile().Invoke(3);
                Console.WriteLine(result_addexp + " = " + result);
                Assert.IsTrue(result_addexp.Body.ToString().Contains("Increment"));
                Assert.IsTrue(result == 4);
            }
        }
Example #10
0
        private void rotateButton_Click(object sender, EventArgs e)
        {
            points = Transformator.RotateFigure(points.ToArray(), new Point((int)rotateCenterX.Value, (int)rotateCenterY.Value), (double)degreesToRotate.Value);
            graphics.Clear(Color.Transparent);
            Pen pen = new Pen(Color.Black, 1);

            for (int i = 0; i < points.Count; i++)
            {
                graphics.DrawEllipse(pen, points[i].X - 5, points[i].Y - 5, 10, 10);
            }
            BezierDrawer.DrawBezier(points.ToArray(), graphics);
            pictureBox.Image = bitmap;
        }
        public void TestTransform()
        {
            Expression <Func <int, int> > add_exp = (a) => (a + 5);
            var result_transform = new Transformator().ChangeParameter(
                add_exp,
                new Dictionary <string, int>()
            {
                { "a", 1 }
            });
            var afterTransformResult = (int)result_transform.Compile().DynamicInvoke(2);

            Console.WriteLine(result_transform.ToString() + " = " + afterTransformResult);
            Assert.IsTrue(result_transform.ToString().ToCharArray()[6] == Convert.ToChar("1"));
            Assert.IsTrue(afterTransformResult == 6);
        }
Example #12
0
        private void scaleButton_Click(object sender, EventArgs e)
        {
            points       = Transformator.ScaleFigure(points.ToArray(), (double)scaleX.Value / 100, (double)scaleX.Value / 100);
            scaleX.Value = 0;
            scaleY.Value = 0;
            graphics.Clear(Color.Transparent);
            Pen pen = new Pen(Color.Black, 1);

            for (int i = 0; i < points.Count; i++)
            {
                graphics.DrawEllipse(pen, points[i].X - 5, points[i].Y - 5, 10, 10);
            }
            BezierDrawer.DrawBezier(points.ToArray(), graphics);
            pictureBox.Image = bitmap;
        }
Example #13
0
        public List <Transformator> getTransformators()
        {
            XmlNode export = configDocument.SelectSingleNode("/QuestDesignerConfiguration/Export");

            List <Transformator> transformators = new List <Transformator>();

            for (int i = 0; i < export.ChildNodes.Count; i++)
            {
                XmlNode transformatorNode = export.ChildNodes.Item(i);

                Transformator transformator = new Transformator(transformatorNode.Attributes["xls"].Value, transformatorNode.Attributes["extension"].Value, transformatorNode.Attributes["name"].Value, transformatorNode.Attributes["description"].Value, transformatorNode.Attributes["exporterClass"].Value, Boolean.Parse(transformatorNode.Attributes["enabled"].Value));
                transformators.Add(transformator);
            }

            return(transformators);
        }
        public List<Transformator> getTransformators()
        {
            XmlNode export = configDocument.SelectSingleNode("/QuestDesignerConfiguration/Export");

            List<Transformator> transformators = new List<Transformator>();

            for (int i = 0; i < export.ChildNodes.Count; i++)
            {
                XmlNode transformatorNode = export.ChildNodes.Item(i);

                Transformator transformator = new Transformator(transformatorNode.Attributes["xls"].Value, transformatorNode.Attributes["extension"].Value, transformatorNode.Attributes["name"].Value, transformatorNode.Attributes["description"].Value, transformatorNode.Attributes["exporterClass"].Value, Boolean.Parse(transformatorNode.Attributes["enabled"].Value));
                transformators.Add(transformator);
            }

            return transformators;
        }
Example #15
0
        private static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                return;
            }

            var dllPath       = args[0];
            var outputDllPath = args[1];

            var transformator = new Transformator();

            transformator.TransformAssembly(dllPath, outputDllPath);

            Console.WriteLine("Done.");
        }
Example #16
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start extracting process...");
            Console.ReadKey();

            try
            {
                Console.WriteLine("Starting integration");
                Console.WriteLine("Extraction started");
                Console.WriteLine("Establishing connection...");
                List <MediatedSchema> mediatedSchemas = Extractor.GetAllFromWeb().ToList();
                Console.WriteLine("Mediated schema objects deserialized");

                Console.WriteLine("Extraction successful");
                Console.WriteLine("Starting transformation...");

                bool differentCurrency, differentDate;
                foreach (var mediated in mediatedSchemas)
                {
                    Validator.ValidateMediatedSchemaObject(mediated, out differentCurrency, out differentDate);
                    if (differentCurrency)
                    {
                        Console.WriteLine("Curriencies are different. Removing data");
                        continue;
                    }
                    if (differentDate)
                    {
                        Console.WriteLine("Dates are different. Removing data");
                        continue;
                    }

                    FinalOutput finalOutput = Transformator.TransformToOutput(mediated);
                    string      serialized  = Serializer.SerializeFinalOutput(finalOutput);
                    File.WriteAllText("../loader/transformed-" + mediated.API.@base + ".json", serialized);
                }

                Console.WriteLine("Transformation completed");
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception occured. Logging details...");
                Logger.LogException("ErrorLogs.log", e);
                Console.WriteLine("Logging finished. Press any key to stop application");
                Console.ReadKey();
            }
        }
        public void TestToCharAndUppercase()
        {
            //Transformer une string en tableau de caractères en majuscule

            //Chaîne en entré
            string entry = "abcde";

            char[] expected = new char[] { 'A', 'B', 'C', 'D', 'E' };

            var transformator = new Transformator {
                Strings = entry
            };

            char[] result = transformator.ToCharAndUppercase();

            Assert.AreEqual(expected, result);
        }
Example #18
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start extracting process...");
            Console.ReadKey();

            try
            {
                Console.WriteLine("Starting integration...");
                MediatedSchema mediated = Extractor.GetOutputFromWeb("EUR");
                Console.WriteLine("Mediated schema object deserialized");

                Console.WriteLine("Extraction successful");
                Console.WriteLine("Starting transformation...");

                bool differentCurrency, differentDate;
                Validator.ValidateMediatedSchemaObject(mediated, out differentCurrency, out differentDate);
                if (differentCurrency)
                {
                    Console.WriteLine("Curriencies are different. Validation failed. Stopping.");
                    Console.ReadKey();
                    return;
                }
                if (differentDate)
                {
                    Console.WriteLine("Dates are different. Validation failed. Stopping.");
                    Console.ReadKey();
                    return;
                }

                FinalOutput finalOutput = Transformator.TransformToOutput(mediated);
                string      serialized  = Serializer.SerializeFinalOutput(finalOutput);
                Console.WriteLine("Transformation completed");

                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception occured. Logging details...");
                Logger.LogException("ErrorLogs.log", e);
                Console.WriteLine("Logging finished. Press any key to stop application");
                Console.ReadKey();
            }
        }
        public void TestMethod()
        {
            var    basePath        = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string sourcePath      = basePath + "\\Samples\\Correct.xml";
            string stylesheetPath  = basePath + "\\Transformation\\Report.xslt";
            string destinationPath = basePath + "\\Samples\\Report.html";

            if (File.Exists(destinationPath))
            {
                File.Delete(destinationPath);
            }

            var transormator = new Transformator(stylesheetPath);

            transormator.Transform(sourcePath, destinationPath);

            var expected = true;
            var actual   = File.Exists(destinationPath);

            Assert.AreEqual(expected, actual, "Report.html file must be created by this test!");
        }
Example #20
0
        /// <summary>
        /// Hozzáad az összes mezõhöz egy random transzformált képpel rendelkezõ mezõt. A mezõ sor és oszlopadata a paraméterben meghatározott
        /// </summary>
        /// <param name="column"></param>
        /// <param name="row"></param>
        private void AddRandomFieldToAllFields(Difficulty difficulty, int column, int row)
        {
            int           randomImage = random.Next(imageList.Count);
            Transformator trf;

            switch (random.Next(5))
            {
            case (0): trf = new Rotate(difficulty, random.Next()); break;

            case (1): trf = new Mirror(difficulty, random.Next()); break;

#if WINDOWS
            case (2): trf = new Blur(difficulty, random.Next()); break;
#endif
            case (3): trf = new ColorTransformation(difficulty, random.Next()); break;

            default: trf = new Transformator(difficulty, random.Next()); break;
            }
            Field field = new Field(imageList[randomImage], randomImage, column, row, true, trf);
            AllFields.Add(field);
        }
        static void Main(string[] args)
        {
            string sourcePath = string.Empty;

            while (!File.Exists(sourcePath))
            {
                Console.WriteLine("Paste path to your xml here:");
                sourcePath = Console.ReadLine();

                if (!File.Exists(sourcePath))
                {
                    Console.WriteLine("There is no such xml!");
                }
            }

            string stylesheetPath = "Transformation/Report.xslt";

            Console.WriteLine("Paste path to your destination here:");
            var destinationPath = Console.ReadLine();

            var transormator = new Transformator(stylesheetPath);

            transormator.Transform(sourcePath, destinationPath);
        }
Example #22
0
 public static Point IndexToLocation(Transformator bitmapInfo, int index)
 {
     return(IndexToLocation(bitmapInfo.Width, index));
 }
Example #23
0
        private async void button_Click(object sender, RoutedEventArgs e)
        {
            if (!Directory.Exists(textBox1.Text))
            {
                MessageBox.Show("Output directory does not exist!", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            if (!IsRunning)
            {
                SaveConfig();
                IsRunning  = true;
                outputPath = textBox1.Text;
                await Task.Run(() =>
                {
                    try
                    {
                        AppendLog("Starting integration");
                        AppendLog("Extraction started");
                        AppendLog("Establishing connection...");
                        var progress = new Progress <string>(value => AppendLog(value));
                        List <MediatedSchema> mediatedSchemas = Extractor.GetAllFromWeb(progress).ToList();
                        AppendLog("Mediated schema objects deserialized");

                        AppendLog("Extraction successful");
                        AppendLog("Starting transformation...");

                        bool differentCurrency, differentDate;
                        foreach (var mediated in mediatedSchemas)
                        {
                            Validator.ValidateMediatedSchemaObject(mediated, out differentCurrency, out differentDate);
                            if (differentCurrency)
                            {
                                AppendLog("Curriencies are different. Removing data");
                                continue;
                            }
                            if (differentDate)
                            {
                                AppendLog("Dates are different. Removing data");
                                continue;
                            }

                            FinalOutput finalOutput = Transformator.TransformToOutput(mediated);
                            string serialized       = Serializer.SerializeFinalOutput(finalOutput);
                            File.WriteAllText(outputPath + "\\transformed-" + mediated.API.@base + ".json", serialized);
                        }

                        AppendLog("Transformation completed");
                        AppendLog("Integration finished successfully");
                    }
                    catch (Exception ex)
                    {
                        AppendLog("Exception occured. Logging details...");
                        Logger.LogException("ErrorLogs.log", ex);
                        AppendLog("Logging finished. Press any key to stop application");
                    }
                    IsRunning = false;
                });
            }
            else
            {
                MessageBox.Show("Process already running! Please wait.", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Example #24
0
        public Field(Image image, int imageNumber, int column, int row, bool available, Transformator trf)
        {
            ImageNumber = imageNumber;
            ColumnIndex = column;
            RowIndex    = row;
            Available   = available;

            /*ImageProperty = new Image
             * {
             *  Name = image.Name,
             *  ImageTexture = trf.transform(image.ImageTexture)
             *
             * };*/
            ImageProperty = image;
        }
Example #25
0
        /// <summary>
        ///
        /// </summary>
        public LinkedList <MoveCommand> Pathfind(Vector from, Vector to)
        {
#if DEBUG
            try
            {
#endif
            //if (isDisposed)
            //    return null;

            float size = (currentSectionCount / 2f) * Map.SectionSize;
            Transformator transformator = new Transformator(-size, size, 0, currentSectionCount);

            int fromIndex = getMapSectionIndex(transformator, from.X, from.Y);
            int toIndex   = getMapSectionIndex(transformator, to.X, to.Y);

            if (fromIndex == toIndex)
            {
                MapSectionRaster raster = rasters[fromIndex];

                Transformator rasterX = new Transformator(raster.MapSection.Left, raster.MapSection.Right, 0, raster.Size);
                Transformator rasterY = new Transformator(raster.MapSection.Top, raster.MapSection.Bottom, 0, raster.Size);

                int x = (int)rasterX[from.X];
                int y = (int)rasterY[from.Y];

                MapSectionRasterTile fromTile = raster.Tiles[x + y * raster.Size];
                fromTile.Status |= MapSectionRasterTileStatus.Start;

                x = (int)rasterX[to.X];
                y = (int)rasterY[to.Y];

                MapSectionRasterTile toTile = raster.Tiles[x + y * raster.Size];
                toTile.Status |= MapSectionRasterTileStatus.Finish;

                PriorityQueue priorityQueue = new PriorityQueue(raster.Tiles.Length);

                priorityQueue.Enqueue(fromTile, 0f);

                MapSectionRasterTile currentTile = null;

                float step = 0f;
                while (priorityQueue.Count > 0)
                {
                    currentTile = priorityQueue.Dequeue();

                    if ((currentTile.Status & MapSectionRasterTileStatus.Finish) == MapSectionRasterTileStatus.Finish)
                    {
                        Console.WriteLine("Found path to the desired tile");
                        break;
                    }

                    // TODO: Check if this part is optimizable since we could maybe do some checks beforehand

                    // Check top tile
                    x = (int)rasterX[currentTile.X];
                    y = (int)rasterY[currentTile.Y - raster.TileSize];

                    if (x >= 0 && x < raster.Size && y >= 0 && y < raster.Size)
                    {
                        MapSectionRasterTile topTile = raster.Tiles[x + y * raster.Size];

                        if ((topTile.Status & MapSectionRasterTileStatus.Blocked) != MapSectionRasterTileStatus.Blocked &&
                            (topTile.Status & MapSectionRasterTileStatus.Checked) != MapSectionRasterTileStatus.Checked)
                        {
                            topTile.ParentX = currentTile.X;
                            topTile.ParentY = currentTile.Y;

                            priorityQueue.Enqueue(topTile, step /*+ 2f * (Math.Abs(topTile.X - toTile.X) + Math.Abs(topTile.Y - toTile.Y))*/);
                        }
                    }

                    // Check right tile
                    x = (int)rasterX[currentTile.X + raster.TileSize];
                    y = (int)rasterY[currentTile.Y];

                    if (x >= 0 && x < raster.Size && y >= 0 && y < raster.Size)
                    {
                        MapSectionRasterTile rightTile = raster.Tiles[x + y * raster.Size];

                        if ((rightTile.Status & MapSectionRasterTileStatus.Blocked) != MapSectionRasterTileStatus.Blocked &&
                            (rightTile.Status & MapSectionRasterTileStatus.Checked) != MapSectionRasterTileStatus.Checked)
                        {
                            rightTile.ParentX = currentTile.X;
                            rightTile.ParentY = currentTile.Y;

                            priorityQueue.Enqueue(rightTile, step /*+ 2f * (Math.Abs(rightTile.X - toTile.X) + Math.Abs(rightTile.Y - toTile.Y))*/);
                        }
                    }

                    // Check bottom tile
                    x = (int)rasterX[currentTile.X];
                    y = (int)rasterY[currentTile.Y + raster.TileSize];

                    if (x >= 0 && x < raster.Size && y >= 0 && y < raster.Size)
                    {
                        MapSectionRasterTile bottomTile = raster.Tiles[x + y * raster.Size];

                        if ((bottomTile.Status & MapSectionRasterTileStatus.Blocked) != MapSectionRasterTileStatus.Blocked &&
                            (bottomTile.Status & MapSectionRasterTileStatus.Checked) != MapSectionRasterTileStatus.Checked)
                        {
                            bottomTile.ParentX = currentTile.X;
                            bottomTile.ParentY = currentTile.Y;

                            priorityQueue.Enqueue(bottomTile, step /*+ 2f * (Math.Abs(bottomTile.X - toTile.X) + Math.Abs(bottomTile.Y - toTile.Y))*/);
                        }
                    }

                    // Check left tile
                    x = (int)rasterX[currentTile.X - raster.TileSize];
                    y = (int)rasterY[currentTile.Y];

                    if (x >= 0 && x < raster.Size && y >= 0 && y < raster.Size)
                    {
                        MapSectionRasterTile leftTile = raster.Tiles[x + y * raster.Size];

                        if ((leftTile.Status & MapSectionRasterTileStatus.Blocked) != MapSectionRasterTileStatus.Blocked &&
                            (leftTile.Status & MapSectionRasterTileStatus.Checked) != MapSectionRasterTileStatus.Checked)
                        {
                            leftTile.ParentX = currentTile.X;
                            leftTile.ParentY = currentTile.Y;

                            priorityQueue.Enqueue(leftTile, step /*+ 2f * (Math.Abs(leftTile.X - toTile.X) + Math.Abs(leftTile.Y - toTile.Y))*/);
                        }
                    }

                    step++;
                }

                LinkedList <MoveCommand> linkedList = new LinkedList <MoveCommand>();
                linkedList.AddFirst(new MoveCommand(to.X, to.Y));

                while ((currentTile.Status & MapSectionRasterTileStatus.Start) != MapSectionRasterTileStatus.Start)
                {
                    //Console.WriteLine("Current tile: (" + currentTile.X + " / " + currentTile.Y + ")");

                    x = (int)rasterX[currentTile.ParentX];
                    y = (int)rasterY[currentTile.ParentY];

                    currentTile = raster.Tiles[x + y * raster.Size];

                    linkedList.AddFirst(new MoveCommand(currentTile.X, currentTile.Y));
                }

                return(linkedList);
            }
            else
            {
                return(new LinkedList <MoveCommand>(new MoveCommand[] { new MoveCommand(to.X, to.Y) }));   // Wut wat is pathfinding Lul
            }
#if DEBUG
        }

        catch (Exception ex)
        {
            Console.WriteLine("MapPathfinder.Pathfind: ");
            Console.WriteLine(ex.Message);
            Console.WriteLine(ex.StackTrace);

            return(null);
        }
#endif
        }
Example #26
0
 public InputParser(Transformator transformator)
 {
     this.transformator = transformator;
 }
Example #27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="windowBounds"></param>
        /// <param name="renderTarget"></param>
        public override void Render(Size2F windowBounds, WindowRenderTarget renderTarget)
        {
            viewCenterX += (destinationViewCenterX - viewCenterX) / 5f;
            viewCenterY += (destinationViewCenterY - viewCenterY) / 5f;

            RectangleF sourceRect;

            Map map = null;
            PlayerShipMapUnit shipUnit = null;

            if (currentShip != null && currentShip.IsAlive && mapManager.TryGetPlayerUnit(currentShip.Universe.Name, currentShip.Name, out map, out shipUnit))
            {
                sourceRect = getSourceRectangleF(shipUnit.Position.X, shipUnit.Position.Y, scale, windowBounds.Width, windowBounds.Height);
            }
            else
            {
                sourceRect = getSourceRectangleF(viewCenterX, viewCenterY, scale, windowBounds.Width, windowBounds.Height);
            }

            X = new Transformator(sourceRect.Left, sourceRect.Right, 0, windowBounds.Width);
            Y = new Transformator(sourceRect.Top, sourceRect.Bottom, 0, windowBounds.Height);

            // TODO: Default Universe muss gesetzt werden falls ein Schiff nicht am Leben ist

            List <MapUnit> unitList;

            if (((map != null && mapManager.TryGetUnits(map, sourceRect, out unitList)) ||
                 mapManager.TryGetUnits(currentShip.Universe.Name, sourceRect, out unitList)) &&
                unitList.Count > 0)
            {
                drawUnits(renderTarget, unitList);

                // TODO: Draw HUD
                //if (shipUnit != null)
                //{
                //    renderTarget.DrawRectangle(
                //        new SharpDX.Mathematics.Interop.RawRectangleF(
                //            windowBounds.Width / 2f - 50f,
                //            windowBounds.Height - 20f,
                //            windowBounds.Width / 2f + 50f,
                //            windowBounds.Height),
                //        Brushes.SolidColorBrushes.White);

                //    renderTarget.FillRectangle(
                //        new SharpDX.Mathematics.Interop.RawRectangleF(
                //            windowBounds.Width / 2f - 49f,
                //            windowBounds.Height - 19f,
                //            (windowBounds.Width / 2f - 49f) + 98f * shipUnit.Energy,
                //            windowBounds.Height - 1f),
                //        Brushes.SolidColorBrushes.Violet);
                //}

                // TODO: Temp Klick Position
                if (currentShip != null && currentShip.IsAlive)
                {
                    Flattiverse.Vector pos = currentShip.DesiredPosition;

                    if (pos != null)
                    {
                        Primitives.Circle.Fill(renderTarget, Brushes.SolidColorBrushes.White, new SharpDX.Vector2(X[pos.X], Y[pos.Y]), 2f);
                    }
                }

                if (showScoreBoard)
                {
                    scoreBoard.Draw(SCOREBOARD_PADDING, SCOREBOARD_PADDING, windowBounds.Width - SCOREBOARD_PADDING * 2f, windowBounds.Height - SCOREBOARD_PADDING * 2f, renderTarget);
                }

                //MapPathfinder mapPathfinder = ship.MapPathfinder;

                //if (mapPathfinder != null)
                //{
                //    MapSectionRaster[] rasters = ship.MapPathfinder.Rasters;

                //    for (int i = 0; i < rasters.Length; i++)
                //    {
                //        MapSectionRasterTile[] tiles = rasters[i].Tiles;

                //        for (int t = 0; t < tiles.Length; t++)
                //        {
                //            var tile = tiles[t];

                //            if ((tile.Status & MapSectionRasterTileStatus.Blocked) == MapSectionRasterTileStatus.Blocked)
                //            {
                //                SharpDX.Mathematics.Interop.RawRectangleF rectangleF = new SharpDX.Mathematics.Interop.RawRectangleF(
                //                X[tile.X - rasters[i].TileSize / 2f],
                //                Y[tile.Y - rasters[i].TileSize / 2f],
                //                X[tile.X + rasters[i].TileSize / 2f],
                //                Y[tile.Y + rasters[i].TileSize / 2f]);

                //                renderTarget.DrawRectangle(rectangleF, Brushes.SolidColorBrushes.White);

                //                renderTarget.DrawRectangle(rectangleF, Brushes.SolidColorBrushes.RedHalfTransparent);
                //            }
                //        }
                //    }
                //}
            }
        }
Example #28
0
 public Pixel(Transformator bitmapInfo, int index, int red, int green, int blue)
     : this(IndexToLocation(bitmapInfo.Width, index), Color.FromArgb(red, green, blue), index, bitmapInfo.Width)
 {
 }
 private static Bitmap Transform(Transformator transformator)
 {
     transformator.Transform();
     transformator.FinalizeChangesInRgbByteArray();
     return(transformator.Bitmap);
 }
Example #30
0
        public Tuple <Board, Double, List <Image>, int, int> Load(List <Image> imageList) //lehet absztrakt ha más platformon nem ilyen
        {
            StreamReader sr = new StreamReader(GameManager.Instance.Content.RootDirectory + "/save.txt");

            string        line;
            int           x;
            int           y;
            int           temp;
            int           rowind       = 0;
            int           colind       = 0;
            Transformator trf          = new Transformator(Difficulty.NORMAL, 0);
            List <Image>  imagesToFind = new List <Image>();
            Image         tempImage    = new Image();


            //kiolvassuk az x és y értékeket
            x = Convert.ToInt16(sr.ReadLine());
            y = Convert.ToInt16(sr.ReadLine());

            //elkészítünk egy boardot. az imagelistet a meghívó függvénynél kell biztosítani
            Board board = new Board(imageList);


            board.X = x;
            board.Y = y;

            //beolvassuk az eltelt másodperceket
            Double time = Convert.ToDouble(sr.ReadLine());



            //beolvassuk a score-t
            int score = Convert.ToInt16(sr.ReadLine());

            //beolvassuk a combo-t
            int combo = Convert.ToInt16(sr.ReadLine());

            //beolvassuk a megkeresendõ képek listájának elemszámát
            int imagesToFindNum = Convert.ToInt16(sr.ReadLine());

            //beolvassuk a megkeresendõ képeket
            for (int i = 0; i < imagesToFindNum; i++)
            {
                //az aktuális kép nevét beolvassuk
                tempImage.Name = sr.ReadLine();

                //a kép neve alapján azonosítjuk a képet
                temp = 0;
                while (tempImage.Name != imageList[temp].Name)
                {
                    temp++;
                }

                //az azonosított kép textúráját az imagelist megfelelõ elemébõl átmásoljuk az aktuális képbe
                tempImage.ImageTexture = imageList[temp].ImageTexture;

                //az aktuálisan felépített képet (név és texture2d) hozzáadjuk a megkeresendõ képek listájához
                imagesToFind.Add(tempImage);
            }

            while ((line = sr.ReadLine()) != null)
            {
                temp = Convert.ToInt16(line);

                //elkészítjük a következõ fieldet
                Field field = new Field(imageList[temp], temp, colind, rowind, true, trf);

                //beállítjuk megfelelõen az oszlop és sorindexeket
                colind++;

                if (colind == y)
                {
                    colind = 0;
                    rowind++;
                }

                //beállítjuk kívülrõl a board allFields nevû listáját
                board.AddToAllFields(field);
            }

            sr.Close();

            var result = Tuple.Create(board, time, imagesToFind, score, combo);

            return(result);
        }
Example #31
0
 public static int LocationToIndex(Transformator bitmapInfo, Point location)
 {
     return(LocationToIndex(bitmapInfo.Width, location));
 }