Esempio n. 1
0
        public MapCursor()
            : base(AnimationType.StaticRight)
        {
            character               = null;
            map                     = MapEngine.GetInstance().Map;
            detailsBackground       = IO.LoadSingleTexture("Image/Global/pixel");
            detailsFont             = IO.LoadFont("Data/Global/MapCursorFont");
            detailsBackgroudColor   = Color.White;
            detailsBackgroudColor.A = 130;

            base.Sprites    = IO.LoadSprite(MAP_CURSOR_PATH, 4);
            base.Duration   = 0.9f;
            base.LayerDepth = Constants.LD_INTERFACE_0;
            if (Controller.GetInstance().IsServer)
            {
                base.ColorModifier = Constants.SERVER_COLOR;
            }
            else
            {
                base.ColorModifier = Constants.CLIENT_COLOR;
            }

            base.IsCyclic  = true;
            base.IsVisible = false;
            MapLocation    = new Point(0, 1);
            base.Start();
        }
Esempio n. 2
0
 public SpawnerEngine(MapEngine map)
 {
     this._map = map;
     this.SpawnTimer.Elapsed += new System.Timers.ElapsedEventHandler(SpawnTimer_Elapsed);
     this.SpawnTimer.Enabled  = true;
     this.SpawnTimer.Start();
 }
Esempio n. 3
0
        public static void Load(IEventService eventService, MapEngine map, string mapFilePath)
        {
            var TiledMap = MapLoader.LoadMap(mapFilePath);

            map.TileWidth  = TiledMap.Layers[0].TileWidth;         // width of tile in pixels
            map.TileHeight = TiledMap.Layers[0].TileHeight;        // height of tile

            map.WindowColumns = Screen.Width / map.TileWidth;      // number of columns in window
            map.WindowRows    = Screen.Height / map.TileHeight;    // number of rows in window

            map.Width  = TiledMap.DisplayWidth;                    // width of map in pixels
            map.Height = TiledMap.DisplayHeight;                   // height of map

            map.Columns = TiledMap.Layers[0].LayerWidth;
            map.Rows    = TiledMap.Layers[0].LayerHeight;

            var tilesets = TiledMap.TileSheets;

            // TODO
            // Leaving this here for now
            // At some point we will probably want to load only the textures we need (below) instead of all (current)

            //string[] tilesetNames;
            //if (isMonoGame)
            //    tilesetNames = tilesets.Select(n => n.Image.Source).ToList().ToFileList().Select(n => n.Name).ToArray();
            //else
            //    tilesetNames = tilesets.Select(n => n.Image.Source).ToArray();
            //_tilesetManager.Load(tilesetNames);

            LoadTiles(TiledMap, map);
        }
Esempio n. 4
0
        // Map Selection
        Action GetLoadMapAction(ScreenGameMain mainMenu)
        {
            var engine = new MapEngine(Content);
            var maps   = engine.AvailableEntities(Content).OrderBy(e => e.DisplayName).ToImmutableList();


            Action loadMap = async() =>
            {
                _mousePressed       = true;
                Cursor.CurrentState = CursorState.Normal;

                var selectionScreen = await UpdateContext.Wait(Task.Factory.StartNew(() => new ScreenEntitySelection {
                    Items = maps
                }));

                await mainMenu.Navigation.PushAsync(selectionScreen);

                var map = await selectionScreen.SelectItemAsync();

                _guiVisible = false;

                GameParameters.SetNextMap(map.DisplayName);
                Exit(Result.LoadNext);
            };

            return(loadMap);
        }
Esempio n. 5
0
        private RectangleShape GetFullExtent(float screenWidth, float screenHeight)
        {
            RectangleShape boundingBox = null;

            foreach (Layer layer in ((LayerOverlay)winformsMap1.Overlays[0]).Layers)
            {
                if (layer.HasBoundingBox)
                {
                    if (!layer.IsOpen)
                    {
                        layer.Open();
                    }
                    if (boundingBox == null)
                    {
                        boundingBox = layer.GetBoundingBox();
                    }
                    else
                    {
                        boundingBox.ExpandToInclude(layer.GetBoundingBox());
                    }
                }
            }

            if (boundingBox != null)
            {
                boundingBox = MapEngine.GetDrawingExtent(boundingBox, screenWidth, screenHeight);
            }

            return(boundingBox);
        }
Esempio n. 6
0
 public SpawnerEngine(MapEngine map)
 {
     this._map = map;
     this.SpawnTimer.Elapsed += new System.Timers.ElapsedEventHandler(SpawnTimer_Elapsed);
     this.SpawnTimer.Enabled = true;
     this.SpawnTimer.Start();
 }
Esempio n. 7
0
 //Cannot use override in this case since we need the propagated graphic object
 private void fMap_Paint(object sender, PaintEventArgs e)
 {
     //Render the map directly to the window surface.
     currentEditor.OnBeforePaint(e);
     MapEngine.Render(e.Graphics);
     currentEditor.OnAfterPaint(e);
 }
Esempio n. 8
0
        public void FillOptions()
        {
            if (gameScreen.ActualTurn != null &&
                gameScreen.ActualTurn.PlayerName == Controller.GetInstance().GetLocalPlayer().Name)
            {
                ShowSelectedCharacter();
                bool hasWalked = gameScreen.ActualTurn.HasWalked;

                gameScreen.ActionBox.ClearOptions();
                if (hasWalked)
                {
                    if (MapEngine.GetInstance().GetAttackPositions(gameScreen.SelectedCharacter).Count > 0)
                    {
                        gameScreen.ActionBox.AddOption(GameScreen.ACTIONBOX_ATTACK);
                    }
                    gameScreen.ActionBox.AddOption(GameScreen.ACTIONBOX_FINISH);
                }
                else
                {
                    if (MapEngine.GetInstance().GetAvaiablePositions(gameScreen.SelectedCharacter).Count > 0)
                    {
                        gameScreen.ActionBox.AddOption(GameScreen.ACTIONBOX_WALK);
                    }
                    if (MapEngine.GetInstance().GetAttackPositions(gameScreen.SelectedCharacter).Count > 0)
                    {
                        gameScreen.ActionBox.AddOption(GameScreen.ACTIONBOX_ATTACK);
                    }
                    gameScreen.ActionBox.AddOption(GameScreen.ACTIONBOX_WAIT);
                }
            }
        }
Esempio n. 9
0
 void Awake()
 {
     mapEngine   = FindObjectOfType <MapEngine>();
     audio       = this.GetComponent <AudioSource> ();
     name        = gameObject.name;
     activated   = false;
     deactivated = false;
 }
Esempio n. 10
0
 // Use this for initialization
 void Start()
 {
     player    = FindObjectOfType <Player>();
     cam       = FindObjectOfType <CameraControl>();
     clone     = transform.parent.GetComponentInChildren <ShadowPlayer>();
     mapEngine = FindObjectOfType <MapEngine>();
     canMove   = false;
 }
Esempio n. 11
0
 // Use this for initialization
 void Start()
 {
     player     = FindObjectOfType <Player>();
     cam        = FindObjectOfType <CameraControl>();
     clone      = transform.parent.Find("Clone").gameObject;
     mapEngine  = FindObjectOfType <MapEngine>();
     canMove    = false;
     tether     = false;
     tetherStop = false;
     maxDist    = 12;
 }
Esempio n. 12
0
      public static void BeginEdit(fMap Owner, MapEngine.MapLabel label) {
         fEditLabel editor = new fEditLabel(Owner);
         editor.txtCaption.Text = label.Caption;
         editor.cmdLabelColor.BackColor = label.Color;

         if (editor.ShowDialog(Owner) == DialogResult.OK) {
            label.Caption = editor.txtCaption.Text;
            label.Color = editor.cmdLabelColor.BackColor;
            Owner.Engine.UpdateMap();
         }
      }
Esempio n. 13
0
        public void MoveCharacter(Character character, Point point)
        {
            GameScreen.GetInstance().MapCursor.IsVisible = false;

            Point cameraLocation = new Point((character.MapLocation.X + point.X) / 2,
                                             (character.MapLocation.Y + point.Y) / 2);

            Camera.GetInstance().FocusOn(cameraLocation);

            MapEngine.GetInstance().Move(character, point);
            Camera.GetInstance().Follow(character);
        }
Esempio n. 14
0
        public void Update(MapEngine map)
        {
            if (map.MapMeta.NPCs == null)
            {
                return;
            }

            foreach (var npc in map.MapMeta.NPCs)
            {
                npc.Update(map);
            }
        }
Esempio n. 15
0
 public override void LoadContent()
 {
     AudioManager.PlayMusicSequence(new List <string>()
     {
         "battle", "battle2"
     }, true);
     mapEngine = MapEngine.GetInstance();
     camera    = Camera.GetInstance();
     camera.UpdateLocations = true;
     tileMarks = new TileMark[mapEngine.Map.MapWidth, mapEngine.Map.MapHeight];
     ChangeMode(GameScreenMode.TacticsMode);
 }
Esempio n. 16
0
 void Awake()
 {
     if (MapEngine.instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         MapEngine.instance = this;
         /* OnAwake */
         OnAwake();
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Esempio n. 17
0
        private void HandleCharacterPositionMessage(String address, AbstractMessage message)
        {
            CharacterPositionMessage characterPositionMessage = (CharacterPositionMessage)message;
            Player           oponent = controller.GetPlayer(characterPositionMessage.PlayerName);
            DefaultDirection oponentDefaultDirection;
            AnimationType    oponentDefaultAnimation;

            if (controller.IsServer)
            {
                oponentDefaultDirection = DefaultDirection.Left;
                oponentDefaultAnimation = AnimationType.StaticLeft;

                controller.SupressUpdate();

                foreach (Character character in oponent.GetCharacters())
                {
                    character.ClearAnimatedMovements();
                    character.DefaultDirection = oponentDefaultDirection;
                    character.MapLocation      = characterPositionMessage.CharactersPosition[character.RootName];
                    character.AddAnimatedMovement(oponentDefaultAnimation, character.MapLocation);

                    MapEngine.GetInstance().SetObject(character);
                }

                controller.ReleaseUpdate();
            }
            else
            {
                oponentDefaultDirection = DefaultDirection.Right;
                oponentDefaultAnimation = AnimationType.StaticRight;

                controller.SupressUpdate();

                foreach (String characterName in characterPositionMessage.CharactersPosition.Keys)
                {
                    Character oponentCharacter = Bundle.Characters[characterName];
                    oponentCharacter.ClearAnimatedMovements();
                    oponentCharacter.DefaultDirection = oponentDefaultDirection;
                    oponentCharacter.MapLocation      = characterPositionMessage.CharactersPosition[characterName];
                    oponentCharacter.AddAnimatedMovement(oponentDefaultAnimation, oponentCharacter.MapLocation);
                    oponent.AddCharacter(oponentCharacter);

                    MapEngine.GetInstance().SetObject(oponentCharacter);
                }

                controller.ReleaseUpdate();
            }

            Camera.GetInstance().UpdateLocations = true;
        }
Esempio n. 18
0
 void Start()
 {
     mapEngine       = FindObjectOfType <MapEngine>();
     temple          = FindObjectOfType <Temple>();
     clone           = GameObject.Find("Clone");
     player          = GameObject.Find("Player");
     canMove         = false;
     seenPlayer      = false;
     radius1         = 100;
     radius2         = 30;
     maxCount        = 30;
     counter         = maxCount;
     currentVelocity = clone.transform.GetComponent <Rigidbody2D>().velocity;
 }
Esempio n. 19
0
  // Unity
  // --------------------------------------------------------------------------
	private void Awake () {
    if( instance == null ) {
      instance = this;
    } else  if( instance != this ) {
      Destroy(gameObject);
    }

    DontDestroyOnLoad(gameObject);

    // Find the correct camera size depending on the size of the screen
    // ------------------------------------------------------------------------
    Vector2 targetViewport = new Vector2(320, 480);

    float percentageX = Screen.width/targetViewport.x;
    float percentageY = Screen.height/targetViewport.y;
    float targetSize = 0.0f;
    if( percentageX > percentageY ) {
      targetSize = percentageY;
    } else {
      targetSize = percentageX;
    }
    int floored = Mathf.FloorToInt(targetSize);
    if(floored < 1) {
      floored = 1;
    }

    // Set the camera size and position and find the maxDimension of the map
    // ------------------------------------------------------------------------
    Camera.main.orthographicSize = ((Screen.height/2)/floored)/size;

    maxDimension = new Vector2(((2f * Camera.main.orthographicSize) * Camera.main.aspect), (2f * Camera.main.orthographicSize));
    maxDimension.x = Mathf.Ceil(maxDimension.x);
    maxDimension.y = Mathf.Ceil(maxDimension.y);

    Camera.main.transform.position = new Vector3( (maxDimension.x/2)-0.5f, (maxDimension.y/2)-0.5f, -10 );

    // Load externals data from XML
    // ------------------------------------------------------------------------
    TableMaster.Instance().Load("loots");
    EnemyMaster.Instance().Load("enemies");
    ItemMaster.Instance().Load("items");

    // Gentleman, starts your engine
    // ------------------------------------------------------------------------
    mapEngine = GetComponent<MapEngine>();
    turnEngine = GetComponent<TurnEngine>();
    popupEngine = GetComponent<PopupEngine>();
    messageEngine = GetComponent<MessageEngine>();
	}
Esempio n. 20
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     if (e.X == panMouseOrigin.X && e.Y == panMouseOrigin.Y)
     {
         //selected clicked spawn, or deselect if nothing clicked
         GameSpawn spawn = MapEngine.FindSpawn(e.X, e.Y);
         if (spawn != MapEngine.Game.Selected)
         {
             MapEngine.Game.Selected = spawn;
             this.Invalidate();
         }
     }
     panMode = false;
 }
Esempio n. 21
0
        private DataTable GetDataTable(ShapeFileFeatureLayer newRegion)
        {
            newRegion.Open();
            Collection <Feature> allFeatures = newRegion.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns, 0);

            List <String> allColumnNames = new List <string>();

            if (allFeatures.Count > 0)
            {
                allColumnNames.AddRange(allFeatures[0].ColumnValues.Select(keyValuePair => keyValuePair.Key));
            }

            newRegion.Close();

            return(MapEngine.LoadDataTable(allFeatures, allColumnNames));
        }
Esempio n. 22
0
        public void Draw(MapEngine map)
        {
            if (map.MapMeta.NPCs == null)
            {
                return;
            }

            foreach (var npc in map.MapMeta.NPCs)
            {
                npc.Animation.Y = (int)npc.Direction;

                var pos = npc.Pos - map.Camera;

                _actorManager.Draw(npc.CharSet, npc.Animation.SourceRect, npc.Animation.DrawRect(pos));
            }
        }
Esempio n. 23
0
    public static IEnumerator getMap(GameSceneMain gameScene)
    {
        // TODO: create a common request handler class that all others extend, which has this set.
#if UNITY_EDITOR
        if (EditorApplication.isPlayingOrWillChangePlaymode)
        {
            requestDomain = Constants.LOCAL_HOST;
        }
#endif
        // TODO: Error check the GameState first.
        string query = "/map?player_id=" + GameState.GetCurrentPlayerKey();

        using (UnityWebRequest www = UnityWebRequest.Get(requestDomain + query)) {
            yield return(www.SendWebRequest());

            if (www.isNetworkError)
            {
                // TODO: Make this show an error on the client, or something.
                Debug.LogError(www.error);
            }
            else
            {
                string        rawjson  = www.downloadHandler.text;
                ResponseModel response = JsonUtility.FromJson <ResponseModel>(rawjson);
                if (response.status == ResponseConstants.SUCCESS)
                {
                    // We've gotten a successful response, deserialize the response into a model.
                    GameModel gameModel = JsonUtility.FromJson <GameModel>(response.data);
                    // Populate the GameState with the gameModel.
                    GameState.UpdateGameModel(gameModel);
                    // Tell the Map to update, now that the game state is updated.

                    // Get a handle on the mapObject, and its script
                    GameObject mapObject = GameObject.FindWithTag("Map");
                    MapEngine  mapEngine = mapObject.GetComponent(typeof(MapEngine)) as MapEngine;
                    mapEngine.MarkMapAsOutOfDate();
                }
                else
                {
                    // TODO: If getting the map doesn't work, expose the Error Message to the user.
                    Debug.Log(response.status);
                    Debug.Log(response.data);
                    Debug.Log(response.error);
                }
            }
        }
    }
Esempio n. 24
0
        public void TestMapEngineMultipleLinesWithSameClass()
        {
            var lines = new List <string>()
            {
                "03/22 08:51:06 INFO   :...read_physical_netif: index #0, interface VLINK1 has address 129.1.1.1, ifidx 0 ",
                "03/22 08:51:06 INFO: ...read_physical_netif: index #1, interface TR1 has address 9.37.65.139, ifidx 1",
                "03/22 08:52:06 INFO: ...read_physical_netif: index #1, interface TR1 has address 9.37.65.138, ifidx 1",
                "03/22 08:52:06 INFO: ...read_physical_netif: index #1, interface TR1 has address 9.37.65.139, ifidx 1"
            };
            var mapEngine = new MapEngine(lines);
            var mapped    = mapEngine.Execute();

            Assert.IsNotNull(mapped);
            Assert.AreEqual(mapped.Count(), 2);
            var firstNetwork  = mapped.ElementAt(0).Key;
            var secondNetwork = mapped.ElementAt(1).Key;

            Assert.AreEqual(firstNetwork, "129.1.1");
            Assert.AreEqual(secondNetwork, "9.37.65");
            var firstNetworkComputers  = mapped.ElementAt(0).Value;
            var secondNetworkComputers = mapped.ElementAt(1).Value;

            Assert.AreEqual(firstNetworkComputers.Count(), 1);
            Assert.AreEqual(secondNetworkComputers.Count(), 2);
            var firstNetworkComputer = firstNetworkComputers.ElementAt(0).Key;

            Assert.AreEqual(firstNetworkComputer, "1");
            var secondNetworkComputer139 = secondNetworkComputers.ElementAt(0).Key;

            Assert.AreEqual(secondNetworkComputer139, "139");
            var secondNetworkComputer138 = secondNetworkComputers.ElementAt(1).Key;

            Assert.AreEqual(secondNetworkComputer138, "138");
            var firstNetworkComputerLines = firstNetworkComputers.ElementAt(0).Value;

            Assert.AreEqual(firstNetworkComputerLines.Count(), 1);
            Assert.AreEqual(firstNetworkComputerLines.ElementAt(0), 0);
            var secondNetworkComputer139Lines = secondNetworkComputers.ElementAt(0).Value;

            Assert.AreEqual(secondNetworkComputer139Lines.Count(), 2);
            Assert.AreEqual(secondNetworkComputer139Lines.ElementAt(0), 1);
            Assert.AreEqual(secondNetworkComputer139Lines.ElementAt(1), 3);
            var secondNetworkComputer138Lines = secondNetworkComputers.ElementAt(1).Value;

            Assert.AreEqual(secondNetworkComputer138Lines.Count(), 1);
            Assert.AreEqual(secondNetworkComputer138Lines.ElementAt(0), 2);
        }
Esempio n. 25
0
        public HitScan hitscan(Vector3 start, Vector3 dir, List <Brush> ignoreBrushes)
        {
            if (ignoreBrushes == null)
            {
                ignoreBrushes = new List <Brush>();
            }
            //first check against map geometry first
            dir = Vector3.Normalize(dir);
            Ray     r            = new Ray(start, dir);
            float   closestDist  = float.MaxValue;
            Vector3 closestPoint = Vector3.Zero;
            Face    closestFace  = null;
            bool    foundPoint   = false;

            foreach (Brush brush in core.mapEngine.brushes)
            {
                if (ignoreBrushes.Contains(brush))
                {
                    continue;
                }
                foreach (Face f in brush.faces)
                {
                    Nullable <float> dist = r.Intersects(new Microsoft.Xna.Framework.Plane(f.plane.getNormal(), f.plane.getD()));
                    if (dist != null && (!foundPoint || dist.Value < closestDist))
                    {
                        //find that point
                        Vector3 p = r.Position + r.Direction * dist.Value;
                        if (MapEngine.pointOnFace(p, f))
                        {
                            closestDist  = dist.Value;
                            closestPoint = p;
                            closestFace  = f;
                            foundPoint   = true;
                        }
                    }
                } // for face
            }     // for brush

            //now check players
            if (foundPoint)
            {
                return(new HitScan(closestPoint, r, closestFace));
            }
            return(null);
        }
Esempio n. 26
0
        private void HandleStartGameMessage(string address, AbstractMessage message)
        {
            StartGameMessage startGameMessage = (StartGameMessage)message;

            MapEngine.Initialize(IO.LoadMap("amude"));
            Camera.Initialize(MapEngine.GetInstance().Map);

            DefaultDirection charactersDirection;
            Point            charactersPosition;
            AnimationType    charactersAnimation;

            if (controller.IsServer)
            {
                Camera.GetInstance().FocusOn(new Point(0, MapEngine.GetInstance().Map.Height / 2));
                charactersDirection = DefaultDirection.Right;
                charactersPosition  = new Point(0, (MapEngine.GetInstance().Map.Height / 2) - 3);
                charactersAnimation = AnimationType.StaticRight;
            }
            else
            {
                Camera.GetInstance().FocusOn(new Point(MapEngine.GetInstance().Map.Width, MapEngine.GetInstance().Map.Height / 2));
                charactersDirection = DefaultDirection.Left;
                charactersPosition  = new Point(MapEngine.GetInstance().Map.Width - 1, (MapEngine.GetInstance().Map.Height / 2) - 3);
                charactersAnimation = AnimationType.StaticLeft;
            }

            controller.SupressUpdate();

            foreach (Character character in controller.GetLocalPlayer().GetCharacters())
            {
                character.ClearAnimatedMovements();
                character.DefaultDirection = charactersDirection;
                character.MapLocation      = charactersPosition;
                character.AddAnimatedMovement(charactersAnimation, charactersPosition);

                MapEngine.GetInstance().SetObject(character);
                charactersPosition.Y += 1;
            }

            ScreenManager.GetInstance().RemoveLastScreen();
            ScreenManager.GetInstance().AddScreen(GameScreen.GetInstance());

            controller.ReleaseUpdate();
        }
Esempio n. 27
0
        static void Main(string[] args)
        {
            ConsoleUtils.InitializeConsole("Game");
            Config.ReadConfig();

            MessageReceiver.InitializeMessages();
            MessageHandlerManager <Network.Client> .InitializeHandlers();

            DataManager.InitializeDatas();
            MapEngine.Initialize();

            DatabaseManager.Connect(Config.Database_Host, Config.Database_Username, Config.Database_Password, Config.Database_Name);
            Network.Server.Start();

            while (true)
            {
                Console.ReadLine();
            }
        }
Esempio n. 28
0
        public List <IEffect> CheckTalk(MapEngine map, VectorF pos)
        {
            var npcs = map.MapMeta.NPCs;

            if (npcs == null)
            {
                return(null);
            }

            var effects = new List <IEffect>();

            foreach (var npc in npcs)
            {
                if (Vector.Distance(npc.Pos, pos.ToVector()) < map.TileWidth + map.TileHeight)
                {
                    effects.Add(new DialogEffect(_graphics, _dialogManager, npc.Dialog));
                }
            }

            return(effects);
        }
Esempio n. 29
0
        private static void Main(string[] args)
        {
            ConsoleUtils.InitializeConsole("Game");
            Config.ReadConfig();

            MessageReceiver.InitializeMessages();
            MessageHandlerManager <GameClient> .InitializeHandlers();

            DataManager.InitializeDatas();
            MapEngine.Initialize();

            DatabaseManager.Connect(Config.DatabaseHost, Config.DatabaseUsername, Config.DatabasePassword,
                                    Config.DatabaseName);

            GameServer gameServer = new GameServer();

            while (true)
            {
                Console.ReadLine();
            }
        }
Esempio n. 30
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (panMode)
     {
         MapEngine.ViewLocation = new PointF(
             (float)(panViewOrigin.X - (float)(panMouseOrigin.X - e.X)),
             (float)(panViewOrigin.Y - (float)(panMouseOrigin.Y - e.Y))
             );
     }
     else
     {
         //highlight the hovered spawn
         GameSpawn spawn = MapEngine.FindSpawn(e.X, e.Y);
         if (spawn != MapEngine.Game.Highlighted)
         {
             MapEngine.Game.Highlighted = spawn;
             this.Invalidate();
         }
     }
 }
Esempio n. 31
0
        protected override void DrawCore(GeoCanvas canvas, Collection <SimpleCandidate> labelsInAllLayers)
        {
            GeoImage       miniImage         = new GeoImage(width, height);
            RectangleShape scaledWorldExtent = MapEngine.GetDrawingExtent(canvas.CurrentWorldExtent, width, height);

            scaledWorldExtent.ScaleUp(300);
            GdiPlusGeoCanvas minCanvas = new GdiPlusGeoCanvas();

            minCanvas.BeginDrawing(miniImage, scaledWorldExtent, canvas.MapUnit);
            foreach (Layer layer in layers)
            {
                layer.Draw(minCanvas, labelsInAllLayers);
            }

            minCanvas.DrawArea(RectangleShape.ScaleDown(minCanvas.CurrentWorldExtent, 1), new GeoPen(GeoColor.StandardColors.Gray, 2), DrawingLevel.LevelOne);
            minCanvas.DrawArea(canvas.CurrentWorldExtent, new GeoPen(GeoColor.StandardColors.Black, 2), DrawingLevel.LevelOne);

            minCanvas.EndDrawing();

            ScreenPointF drawingLocation = GetDrawingLocation(canvas, width, height);

            canvas.DrawScreenImageWithoutScaling(miniImage, (drawingLocation.X + width / 2) + 10, (drawingLocation.Y + height / 2) - 10, DrawingLevel.LevelOne, 0, 0, 0);
        }
Esempio n. 32
0
        public static IMapEngine InitMapEngine()
        {
            string testTileTypeName = "TileType1";

            var gameLevel = Substitute.For <IGameLevel>();

            gameLevel.Tiles.Returns(v =>
            {
                return(new List <List <ILevelTile> >()
                {
                    new List <ILevelTile>()
                    {
                        new SimpleLevelTile(testTileTypeName, new List <string>(), new Point(0, 0)),
                        new SimpleLevelTile(testTileTypeName, new List <string>(), new Point(0, 1))
                    }
                });
            });

            gameLevel.TileTypes.Returns(v =>
            {
                return(new Dictionary <string, ILevelTileType>()
                {
                    { testTileTypeName, new SimpleLevelTileType(
                          testTileTypeName,
                          "#000000",
                          TileSolidityType.NotSolid) }
                });
            });


            IMap       map       = new Map(_mapCellSize);
            IMapEngine mapEngine = new MapEngine(map);

            mapEngine.LoadMap(gameLevel);

            return(mapEngine);
        }
Esempio n. 33
0
 private void miSnapToRange_Click(object sender, EventArgs e)
 {
     MapEngine.SnapToRange();
     m_config["Zoom"] = MapEngine.Zoom;
 }
Esempio n. 34
0
 public PlayersMapEngine(MapEngine engine)
 {
     _map = engine;
 }
Esempio n. 35
0
 public PathfindingV2(MapEngine map)
 {
     this.Map = map;
     this.Map.Cells.Values.ToList().ForEach(x => this.Cells.Add(
         new Cell(x.ID, x._map)));
 }