예제 #1
0
        private static ImmutableHashSet <string> GetWordsFromDictionary()
        {
            var words    = WorldDictionary.GetWordsForCulture("en");
            var wordsArr = words.ToArray();

            return(ImmutableHashSet.Create(StringComparer.OrdinalIgnoreCase, wordsArr));
        }
예제 #2
0
 private Map()
 {
     _layers = new Dictionary <string, Layer>();
     _actors = new WorldDictionary <long, IActor>();
     _actorCollidingObjects = new WorldDictionary <IActor, List <MapObject> >();
     _playerSpawnAreas      = new List <Tuple <Vector, Layer> >();
     _pathFinders           = new Dictionary <Layer, Pathfinder>();
     _mapItems = new List <MapItem>();
 }
예제 #3
0
        public WorldManager(NetHandler netHandler)
        {
            netHandler.AddPacketHandler(PacketType.LOGIN, this.Handle_PlayerLogin);
            netHandler.AddPacketHandler(PacketType.REGISTER, this.Handle_PlayerRegister);
            netHandler.AddPacketHandler(PacketType.PLAYER_MSG, this.Handle_PlayerMessage);
            netHandler.AddPacketHandler(PacketType.QUIT_GAME, this.Handle_QuitGame);
            netHandler.ConnectionLost += Player_Connection_Lost;

            _maps = new WorldDictionary <string, Map>();
        }
예제 #4
0
        public Map(MapDescriptor descriptor)
        {
            _mapDescriptor = descriptor;

            _layers = new Dictionary <string, Layer>();
            _actors = new WorldDictionary <long, IActor <IActorDescriptor> >();
            _actorCollidingObjects = new WorldDictionary <IActor <IActorDescriptor>, List <MapObject> >();
            _playerSpawnAreas      = new List <Tuple <Vector, Layer> >();
            _pathFinders           = new Dictionary <Layer, Pathfinder>();
            _mapItems = new List <MapItem>();

            this.Initalize();
        }
예제 #5
0
        public Map(MapModel <LayerModel <TileModel <SpriteInfo> > > descriptor)
        {
            _actors = new WorldDictionary <string, IActor>();
            _actorCollidingObjects = new WorldDictionary <IActor, List <MapObject> >();
            _playerSpawnAreas      = new List <Tuple <Vector, Layer> >();
            _pathFinders           = new Dictionary <Layer, Pathfinder>();
            _mapItems = new List <MapItem>();

            this.Name         = descriptor.Name;
            this.Bounds       = descriptor.Bounds;
            this.Dimensions   = descriptor.Dimensions;
            this.Dark         = descriptor.Dark;
            this.TilesetPaths = descriptor.TilesetPaths;

            foreach (var layerDesc in descriptor.Layers)
            {
                Layer layer = new Layer(this, layerDesc);

                this.AddLayer(layerDesc.Name, layer);
            }

            // Look for spawnpoints
            foreach (var layer in this.Layers)
            {
                for (int x = 0; x < descriptor.Dimensions.X; x++)
                {
                    for (int y = 0; y < descriptor.Dimensions.Y; y++)
                    {
                        if (layer.GetTile(x, y) != null && layer.GetTile(x, y).Attribute is PlayerSpawnTileAttribute)
                        {
                            this.AddPlayerStartArea(new Vector(x * Settings.TileSize, y * Settings.TileSize), layer);
                        }
                    }
                }
            }
        }
예제 #6
0
        private void PrepareList()
        {
            if (_fullEntities != null && _fullEntities.Count > 0)
            {
                List<Domain.HWGR> _lstHwgr = ClientEnvironment.HWGRService.FindAll();
                List<Domain.WGR> _lstWgr = ClientEnvironment.WGRService.FindAll();
                List<Domain.Store> _lstStore = ClientEnvironment.StoreService.FindAll();
                List<Domain.World> _lstWorld = ClientEnvironment.WorldService.FindAll();
                WorldDictionary wdDiction = new WorldDictionary();
                wdDiction.Refresh();

                Dictionary<long, BaseEntity> _diction = new Dictionary<long, BaseEntity>();

                if (_lstStore != null)
                {
                    foreach (Domain.Store store in _lstStore)
                        _diction[store.ID] = store;
                }

                if (_lstHwgr != null)
                {
                    foreach (Domain.HWGR hwgr in _lstHwgr)
                        _diction[hwgr.ID] = hwgr;
                }
                if (_lstWgr != null)
                {
                    foreach (Domain.WGR wgr in _lstWgr)
                        _diction[wgr.ID] = wgr;
                }

                /*if (_lstWorld != null)
                {
                    foreach (Domain.World world in _lstWorld)
                        _diction[world.ID] = world;
                }*/

                BaseEntity item = null;

                foreach (StoreStructure entity in _fullEntities)
                {
                    if (_diction.TryGetValue(entity.StoreID, out item))
                        entity.StoreName = (item as Domain.Store).Name;
                    if (entity.HWGR_ID.HasValue)
                    {
                        if (_diction.TryGetValue(entity.HWGR_ID.Value, out item))
                        {
                            entity.HWGR_Name = (item as Domain.HWGR).Name;
                            entity.HWGR_Name = String.Format("{0} ({1}-{2})", entity.HWGR_Name, entity.HWGR_BeginTime.Value.ToShortDateString(), entity.HWGR_EndTime.Value.ToShortDateString());
                        }
                    }
                    if (entity.WGR_ID.HasValue)
                    {
                        if (_diction.TryGetValue(entity.WGR_ID.Value , out item))
                        {
                            entity.WGR_Name = (item as Domain.WGR).Name;
                            entity.WGR_Name = String.Format("{0} ({1}-{2})", entity.WGR_Name, entity.WGR_BeginTime.Value.ToShortDateString(), entity.WGR_EndTime.Value.ToShortDateString());
                        }
                    }

                    //if (_diction.TryGetValue(entity.WorldID, out item))
            //                        entity.WorldName = (item as Domain.World).Name;
                    entity.WorldName = wdDiction.GetNameById(entity.WorldID);

                }
            }
        }
예제 #7
0
        private void PrepareList()
        {
            if (_fullEntities != null && _fullEntities.Count > 0)
            {
                List <Domain.HWGR>  _lstHwgr  = ClientEnvironment.HWGRService.FindAll();
                List <Domain.WGR>   _lstWgr   = ClientEnvironment.WGRService.FindAll();
                List <Domain.Store> _lstStore = ClientEnvironment.StoreService.FindAll();
                List <Domain.World> _lstWorld = ClientEnvironment.WorldService.FindAll();
                WorldDictionary     wdDiction = new WorldDictionary();
                wdDiction.Refresh();

                Dictionary <long, BaseEntity> _diction = new Dictionary <long, BaseEntity>();

                if (_lstStore != null)
                {
                    foreach (Domain.Store store in _lstStore)
                    {
                        _diction[store.ID] = store;
                    }
                }

                if (_lstHwgr != null)
                {
                    foreach (Domain.HWGR hwgr in _lstHwgr)
                    {
                        _diction[hwgr.ID] = hwgr;
                    }
                }
                if (_lstWgr != null)
                {
                    foreach (Domain.WGR wgr in _lstWgr)
                    {
                        _diction[wgr.ID] = wgr;
                    }
                }

                /*if (_lstWorld != null)
                 * {
                 *  foreach (Domain.World world in _lstWorld)
                 *      _diction[world.ID] = world;
                 * }*/


                BaseEntity item = null;

                foreach (StoreStructure entity in _fullEntities)
                {
                    if (_diction.TryGetValue(entity.StoreID, out item))
                    {
                        entity.StoreName = (item as Domain.Store).Name;
                    }
                    if (entity.HWGR_ID.HasValue)
                    {
                        if (_diction.TryGetValue(entity.HWGR_ID.Value, out item))
                        {
                            entity.HWGR_Name = (item as Domain.HWGR).Name;
                            entity.HWGR_Name = String.Format("{0} ({1}-{2})", entity.HWGR_Name, entity.HWGR_BeginTime.Value.ToShortDateString(), entity.HWGR_EndTime.Value.ToShortDateString());
                        }
                    }
                    if (entity.WGR_ID.HasValue)
                    {
                        if (_diction.TryGetValue(entity.WGR_ID.Value, out item))
                        {
                            entity.WGR_Name = (item as Domain.WGR).Name;
                            entity.WGR_Name = String.Format("{0} ({1}-{2})", entity.WGR_Name, entity.WGR_BeginTime.Value.ToShortDateString(), entity.WGR_EndTime.Value.ToShortDateString());
                        }
                    }

                    //if (_diction.TryGetValue(entity.WorldID, out item))
//                        entity.WorldName = (item as Domain.World).Name;
                    entity.WorldName = wdDiction.GetNameById(entity.WorldID);
                }
            }
        }