示例#1
0
        public MapChangeArgs(MapData map, HexPoint updatedTile)
        {
            _map = map;

            _updatedTiles = new List<HexPoint>();
            _updatedTiles.Add(updatedTile);
        }
示例#2
0
 public Continent(MapData map, string name, short id)
     : base(map)
     
 {
     _map = map;
     _id = id;
     _name = name;
 }
        public override void Execute(INotification note)
        {
            try
            {
                _map = new MapData();
                _map.Create(note.Body as GameStartupSettings);

                _map.ProgressNotificationChanged += _map_ProgressNotificationChanged;

                GameFacade.getInstance().SendNotification(GameNotification.CreateMapSuccess, _map);
            }
            catch (Exception ex)
            {
                GameFacade.getInstance().SendNotification(GameNotification.Exception, ex);
            }
        }
        public static void Run(Civ5Map civ5map)
        {
            MapData map = new MapData();

            try
            {
                map.Extension = MainApplication.Instance.Content.Load<MapExtension>("Content/MapsExtension/" + civ5map.FileName);
                
            }
            catch { }

            map.InitFromCiv5Map(civ5map);

            //if (map.Extension != null)
            //    map.ApplyRivers();

            GameFacade.getInstance().SendNotification(GameNotification.LoadMapSuccess, map);
        }
        private int Match(TileMatchPattern pattern, MapData map, MapCell cell)
        {
            int result;
            bool reset = false;

            if (map != null && cell != null && map.IsValid(cell.Point))
            {
                result = CalcScore(pattern.TerrainName, cell) * 8;

                if (result > 0)
                {
                    int i = 0;
                    foreach (HexDirection dir in HexDirection.All)
                    {
                        HexPoint pt = cell.Point;
                        pt = pt.Neighbor(dir);

                        if (map.IsValid(pt)) // on map board, calc score 0-3
                        {
                            int score = CalcScore(pattern.TerrainNameAdjacent[i], map[pt]);

                            if (score == 0)
                                reset = true;
                            else
                                result += score;
                        }
                        else if (pattern.TerrainNameAdjacent[i] == "*" || pattern.TerrainNameAdjacent[i] == "IsOcean") // not at map board but *
                            result += 1;
                        else // no match at all
                            reset = true;

                        i++;
                    }
                }
            }
            else
                return -1;

            return (reset) ? 0 : result;
        }
 public MapControllingArgs(MapData map, HexPoint point, int controller)
 {
     _map = map;
     _tile = point;
     _controller = controller;
 }
 public MapSpottingArgs(MapData map, HexPoint point, bool spotting)
 {
     _map = map;
     _tile = point;
     _spotting = spotting;
 }
示例#8
0
        public MapChangeArgs(MapData map, List<HexPoint> updatedTiles)
        {
            _map = map;

            _updatedTiles = updatedTiles;
        }
示例#9
0
        public MapChangeArgs(MapData map)
        {
            _map = map;

            _updatedTiles = new List<HexPoint>();
        }
示例#10
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="map"></param>
 public Pathfinder(MapData map)
 {
     this.map = map;
 }
示例#11
0
        public MapData Clone()
        {
            MapData clone = new MapData();

            clone.Name = Name;
            clone.Init(Width, Height);

            clone._tiles = _tiles.Clone() as MapCell[];

            return clone;
        }
        public TileMatchPattern Match(MapData map, MapCell cell)
        {
            TileMatchPattern match = null;
            int bestScore = int.MinValue;

            foreach (TileMatchPattern pattern in _pattern)
            {
                int score = Match(pattern, map, cell);

                if (score > bestScore)
                {
                    bestScore = score;
                    match = pattern;
                }
            }

            if (match == null)
                throw new Exception("No default TileMatchPattern found!");

            match.Score = bestScore;

            return match;
        }