Beispiel #1
0
 private void InitializeView()
 {
     foreach (IResource resource in _resources)
     {
         if (resource is Map)
         {
             OnMapsChanged?.Invoke(resource as Map);
         }
     }
 }
Beispiel #2
0
        internal bool LoadMap(int id)
        {
            var map = GetResources <Map>().FirstOrDefault(m => m.ID == id);

            if (map != null)
            {
                OnMapsChanged?.Invoke(map);

                return(true);
            }

            return(false);
        }
Beispiel #3
0
        internal void CreateMap(int id, string name, int width, int height)
        {
            var map = new Map()
            {
                ID     = id,
                Name   = name,
                Width  = width,
                Height = height
            };

            _resources.Add(map);
            _configs.Add(map, new MapConfig());

            OnMapsChanged?.Invoke(_resources[_resources.Count - 1] as Map);
        }
Beispiel #4
0
        internal bool LoadMap(string fileName)
        {
            if (File.Exists(fileName))
            {
                var map = Map.ParseFile(fileName);

                if (!HasResource(map))
                {
                    _resources.Add(map);
                    _configs.Add(map, new MapConfig());

                    OnMapsChanged?.Invoke(_resources[_resources.Count - 1] as Map);

                    return(true);
                }
            }

            return(false);
        }