public BuildingViewModel(AoABuilding building) { // TODO: Complete member initialization this._building = building; foreach (AoAUnit unit in _building.BuildableUnits) _units.Add(new AoAUnitViewModel(unit)); foreach (AoAResearch research in _building.Researches) _res.Add(new AoAResearchViewModel(research)); foreach (AoATurret turret in _building.Turrets) _turrets.Add(new AoATurretViewModel(turret)); }
public Task LoadData(long version) { if (GetUpdateFromDataFolder(version)) { // Load all GameObjects List<AoABuilding> BuildingsList = new List<AoABuilding>(); List<NdfObject> tunites = _EverythingNdfbin.GetClass("TUniteDescriptor").Instances; foreach (NdfObject obj in tunites) { AoAGameObject gobj = new AoAGameObject(); if (gobj.LoadData(obj, _UniteDic, _TechDic, _IconsPack)) { if (gobj.Type == ObjectType.Building) { AoABuilding building = new AoABuilding(gobj); if (building.LoadData(obj, _UniteDic, _TechDic, _IconsPack)) { BuildingsList.Add(building); } } else { } } } Classify(BuildingsList); } else { throw new Exception("Couldn't load game data, check game folder."); } return null; }
public bool LoadData() { List<AoAGameObject> result = new List<AoAGameObject>(); if (GetLastUpdateFromDataFolder()) { // Load all GameObjects List<AoABuilding> BuildingsList = new List<AoABuilding>(); List<NdfObject> tunites = _EverythingNdfbin.GetClass("TUniteDescriptor").Instances; OnLoadingUpdate(this, "loading buildings and units..."); foreach (NdfObject obj in tunites) { AoAGameObject gobj = new AoAGameObject(); if (gobj.LoadData(obj, _UniteDic, _TechDic,_IconsPack)) { if (gobj.Type == ObjectType.Building) { AoABuilding building = new AoABuilding(gobj); if (building.LoadData(obj, _UniteDic, _TechDic, _IconsPack)) { BuildingsList.Add(building); } } else { } } } OnLoadingUpdate(this, "processing buildings..."); Classify(BuildingsList); return true; } else { return false; } }