Ejemplo n.º 1
0
        private void LoaderLoad(object sender, DoWorkEventArgs doWorkEventArgs)
        {
            GnomanEmpire.Instance.LoadGame(File.Name);
            if (File.Directory != null)
            {
                File.CopyTo(Path.Combine(File.Directory.FullName, Path.GetFileNameWithoutExtension(File.Name)) + ".backup", true);
            }

            UpdateGame();

            foreach (var profession in GnomanEmpire.Instance.Fortress.Professions)
            {
                Professions.Add(profession);
            }

            LoadGnomes();

            EnemyFactions = GnomanEmpire.Instance.World.AIDirector.Factions.Where(
                x => x.Value.IsHostile(GnomanEmpire.Instance.World.AIDirector.PlayerFaction.ID)).Select(x => x.Value);

            GnomanEmpire.Instance.EntityManager.Entities
            .Where(x => x.Value.TypeID() == (int)GameEntityType.Character)
            .Select(x => x.Value)
            .Cast <Character>()
            .Where(x => EnemyFactions.Any(y => y.ID == x.FactionID))
            .Select(x => new EnemyRow(x))
            .ToList()
            .ForEach(Enemies.Add);

            var axes = GnomanEmpire.Instance.EntityManager.Entities
                       .Where(x => x.Value.TypeID() == (int)GameEntityType.Item)
                       .Select(x => x.Value)
                       .Cast <Item>()
                       .Where(x => x.ItemID == ItemID.FellingAxe.ToString())
                       .ToList();

            axes.ToList();
            itemCreator = new ItemCreator();
        }
Ejemplo n.º 2
0
        private void LoaderLoad(object sender, DoWorkEventArgs doWorkEventArgs)
        {
            GnomanEmpire.Instance.LoadGame(File.Name);
            if (File.Directory != null)
                File.CopyTo(Path.Combine(File.Directory.FullName, Path.GetFileNameWithoutExtension(File.Name)) + ".backup", true);

            UpdateGame();

            foreach (var profession in GnomanEmpire.Instance.Fortress.Professions)
            {
                Professions.Add(profession);
            }

            LoadGnomes();

            EnemyFactions = GnomanEmpire.Instance.World.AIDirector.Factions.Where(
                x => x.Value.IsHostile(GnomanEmpire.Instance.World.AIDirector.PlayerFaction.ID)).Select(x => x.Value);

            GnomanEmpire.Instance.EntityManager.Entities
                .Where(x => x.Value.TypeID() == (int)GameEntityType.Character)
                .Select(x => x.Value)
                .Cast<Character>()
                .Where(x => EnemyFactions.Any(y => y.ID == x.FactionID))
                .Select(x => new EnemyRow(x))
                .ToList()
                .ForEach(Enemies.Add);

            var axes = GnomanEmpire.Instance.EntityManager.Entities
                .Where(x => x.Value.TypeID() == (int)GameEntityType.Item)
                .Select(x => x.Value)
                .Cast<Item>()
                .Where(x => x.ItemID == ItemID.FellingAxe.ToString())
                .ToList();

            axes.ToList();
            itemCreator = new ItemCreator();
        }