Clear() public method

clears all buildings and their objects
public Clear ( ) : void
return void
Beispiel #1
0
 public static void OnLoad()
 {
     foreach (RenderableBuilding b in Buildings.Values)
     {
         b.Dispose();
     }
     Buildings.Clear();
     foreach (RenderablePlot p in Plots.Values)
     {
         p.Dispose();
     }
     Plots.Clear();
     foreach (Plot p in Haswell.Controller.City.Grid)
     {
         if (p.Building != null)
         {
             if (p.Building is Road)
             {
                 Buildings[p.Building] = new RenderableRoad((Road)p.Building);
             }
             else
             {
                 Buildings[p.Building] = new RenderableBuilding(p.Building);
             }
         }
         Plots[p] = new RenderablePlot(p);
         Plots[p].Create(SceneMgr, cityNode);
     }
     GameConsole.ActiveInstance.WriteLine("Game Loaded.");
     GuiMgr.AddInfoPopup("Game Loaded.");
 }
Beispiel #2
0
    public void UpdateMap(GameData gameData)
    {
        if (PositionHasBeenSet)
        {
            Characters.Clear();
            Buildings.Clear();

            for (int i = 0; i < gameData.Sprites.Count(); i++)
            {
                if (gameData.Sprites[i].MiniMapTexture != null)
                {
                    Vector2 miniMapPos = new Vector2(gameData.Sprites[i].Bounds.X, gameData.Sprites[i].Bounds.Y);
                    miniMapPos  = miniMapPos * Ratio;                                                                                                                                                                 //Scale the position down to the minimap size
                    miniMapPos += PositionUpperLeft;                                                                                                                                                                  //Move the position to the correct location of the screen
                    miniMapPos -= new Vector2((gameData.Sprites[i].MiniMapTexture.Width * gameData.Sprites[i].MiniMapScale) / 2, (gameData.Sprites[i].MiniMapTexture.Height * gameData.Sprites[i].MiniMapScale) / 2); //Move the position to upperleft corner. The SpriteBase holds the position of the center

                    if (gameData.Sprites[i].IsMovable)
                    {
                        Characters.Add(new MinimapObject()
                        {
                            Texture = gameData.Sprites[i].MiniMapTexture, Color = gameData.Sprites[i].Color, Position = miniMapPos, Scale = gameData.Sprites[i].MiniMapScale, Opacity = gameData.Sprites[i].MiniMapOpacity
                        });
                    }
                    else
                    {
                        Buildings.Add(new MinimapObject()
                        {
                            Texture = gameData.Sprites[i].MiniMapTexture, Color = gameData.Sprites[i].Color, Position = miniMapPos, Scale = gameData.Sprites[i].MiniMapScale, Opacity = gameData.Sprites[i].MiniMapOpacity
                        });
                    }
                }
            }
        }
    }
Beispiel #3
0
 internal static void Reset()
 {
     Initalized = false;
     Buildings.Clear();
     Followers.Clear();
     AvailableMissions.Clear();
     CompletedMissionIds.Clear();
 }
Beispiel #4
0
 public virtual void sortBuildingList()
 {
     BIMBuilding[] arrayOfBIMBuilding = (BIMBuilding[])Buildings.ToArray();
     Arrays.sort(arrayOfBIMBuilding, new ComparatorAnonymousInnerClass(this));
     Buildings.Clear();
     foreach (BIMBuilding bIMBuilding in arrayOfBIMBuilding)
     {
         bIMBuilding.sortStoreys();
         Buildings.Add(bIMBuilding);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Removes all light objects.
 /// </summary>
 public void Clear()
 {
     WaterPlanes.Clear();
     Objects.Clear();
     NPCs.Clear();
     Buildings.Clear();
     Sounds.Clear();
     Effects.Clear();
     Animations.Clear();
     MonsterSpawns.Clear();
     WarpPoints.Clear();
     CollisionObjects.Clear();
     EventObjects.Clear();
 }
Beispiel #6
0
        public static void ClearDictionaries()
        {
            States.Clear();
            Continents.Clear();
            PopTypes.Clear();
            Goods.Clear();
            CountryTags.Clear();
            Religions.Clear();
            Cultures.Clear();
            CultureGroups.Clear();
            Ideologies.Clear();
            Buildings.Clear();
            PolicyGroups.Clear();
            SubPolicies.Clear();
            Schools.Clear();
            Techs.Clear();
            Inventions.Clear();
            Units.Clear();
            Governments.Clear();
            Crimes.Clear();
            EventModifiers.Clear();
            NationalValues.Clear();
            Terrain.Clear();

            States         = null;
            Continents     = null;
            PopTypes       = null;
            Goods          = null;
            CountryTags    = null;
            Religions      = null;
            Cultures       = null;
            CultureGroups  = null;
            Ideologies     = null;
            Buildings      = null;
            PolicyGroups   = null;
            SubPolicies    = null;
            Schools        = null;
            Techs          = null;
            Inventions     = null;
            Units          = null;
            Governments    = null;
            Crimes         = null;
            EventModifiers = null;
            NationalValues = null;
            Terrain        = null;
        }
Beispiel #7
0
    public void UpdateMap(GameData gameData, Rectangle viewPortSize)
    {
        if (PositionHasBeenSet)
        {
            ViewPort = new Rectangle((int)(viewPortSize.X * Ratio.X + PositionUpperLeft.X), (int)(viewPortSize.Y * Ratio.Y + PositionUpperLeft.Y), (int)(viewPortSize.Width * Ratio.X), (int)(viewPortSize.Height * Ratio.Y));

            int viewPortThickness = 1;
            ViewPortLeft   = new Rectangle(ViewPort.X - viewPortThickness, ViewPort.Y - viewPortThickness, viewPortThickness, ViewPort.Height + (viewPortThickness * 2));
            ViewPortRight  = new Rectangle(ViewPort.Right + viewPortThickness, ViewPort.Y - viewPortThickness, viewPortThickness, ViewPort.Height + (viewPortThickness * 2));
            ViewPortTop    = new Rectangle(ViewPort.X - viewPortThickness, ViewPort.Y - viewPortThickness, ViewPort.Width + (viewPortThickness * 2), viewPortThickness);
            ViewPortBottom = new Rectangle(ViewPort.X - viewPortThickness, ViewPort.Y + ViewPort.Height + viewPortThickness, ViewPort.Width + (viewPortThickness * 2), viewPortThickness);

            Characters.Clear();
            Buildings.Clear();

            for (int i = 0; i < gameData.Sprites.Count(); i++)
            {
                if (gameData.Sprites[i].MiniMapTexture != null)
                {
                    Vector2 miniMapPos = new Vector2(gameData.Sprites[i].Bounds.X, gameData.Sprites[i].Bounds.Y);
                    miniMapPos  = miniMapPos * Ratio;                                                                                                                                                                 //Scale the position down to the minimap size
                    miniMapPos += PositionUpperLeft;                                                                                                                                                                  //Move the position to the correct location of the screen
                    miniMapPos -= new Vector2((gameData.Sprites[i].MiniMapTexture.Width * gameData.Sprites[i].MiniMapScale) / 2, (gameData.Sprites[i].MiniMapTexture.Height * gameData.Sprites[i].MiniMapScale) / 2); //Move the position to upperleft corner. The SpriteBase holds the position of the center

                    if (gameData.Sprites[i].IsMovable)
                    {
                        Characters.Add(new MinimapObject()
                        {
                            Texture = gameData.Sprites[i].MiniMapTexture, Color = gameData.Sprites[i].Color, Position = miniMapPos, Scale = gameData.Sprites[i].MiniMapScale, Opacity = gameData.Sprites[i].MiniMapOpacity
                        });
                    }
                    else
                    {
                        Buildings.Add(new MinimapObject()
                        {
                            Texture = gameData.Sprites[i].MiniMapTexture, Color = gameData.Sprites[i].Color, Position = miniMapPos, Scale = gameData.Sprites[i].MiniMapScale, Opacity = gameData.Sprites[i].MiniMapOpacity
                        });
                    }
                }
            }
        }
    }
Beispiel #8
0
        private async Task GetBuildings(bool forceCloud = false)
        {
            using (var dlg = this.Dialogs.Loading("Progress (No Cancel)"))
            {
                Buildings.Clear();

                try
                {
                    var result = await _buildingsService.GetAllBuildings(EstateId, forceCloud);

                    if (!result.Success)
                    {
                        Dialogs.Toast(result.Message);
                        return;
                    }

                    var buildings = result.ResultObject as IEnumerable <BuildingRow>;

                    if (buildings != null && buildings.Any())
                    {
                        Buildings.AddRange(buildings);
                    }
                }
                catch (ServiceAuthenticationException e)
                {
                    var result = await TryToLogin();

                    if (!result)
                    {
                        await NavigationService.NavigateToAsync <LoginViewModel>();
                    }
                    else
                    {
                        await GetBuildings(forceCloud);
                    }
                }
                catch (Exception e)
                {
                    await ShowErrorAlert(e.Message);
                }
            }
        }
    private void ClearExistingObjects()
    {
        for (int i = 0; i < Trees.Count; i++)
        {
            if (Trees.Count != 0)
            {
                Destroy(Trees[i].gameObject);
            }
        }
        for (int i = 0; i < Buildings.Count; i++)
        {
            if (Buildings.Count != 0)
            {
                Destroy(Buildings[i].gameObject);
            }
        }

        Buildings.Clear();
        Trees.Clear();
    }
Beispiel #10
0
        public void ReadXml(XmlReader r)
        {
            r.MoveToContent();
            r.ReadStartElement();

            // Info
            _villageDate = Convert.ToDateTime(r.GetAttribute(0), CultureInfo.InvariantCulture);
            r.ReadStartElement();
            _loyalty     = Convert.ToSingle(r.GetAttribute(0), CultureInfo.InvariantCulture);
            _loyaltyDate = Convert.ToDateTime(r.GetAttribute(1), CultureInfo.InvariantCulture);
            r.ReadStartElement();

            // Comments
            if (r.IsStartElement("Comments"))
            {
                if (!r.IsEmptyElement)
                {
                    Village.SetComments(r.ReadElementString("Comments"));
                }
                else
                {
                    r.Read();
                }
            }

            // resources
            DateTime?tempDate;

            Resources.ReadXml(r, out tempDate);
            if (tempDate.HasValue)
            {
                ResourcesDate = tempDate.Value;
            }

            // defense
            if (r.HasAttributes)
            {
                DefenseDate = Convert.ToDateTime(r.GetAttribute(0), CultureInfo.InvariantCulture);
            }

            r.Read();
            if (r.IsStartElement("Unit"))
            {
                while (r.IsStartElement("Unit"))
                {
                    string typeDesc = r.GetAttribute(0);
                    if (Enum.IsDefined(typeof(UnitTypes), typeDesc))
                    {
                        var type = (UnitTypes)Enum.Parse(typeof(UnitTypes), typeDesc);
                        Defense.OwnTroops[type]     = Convert.ToInt32(r.GetAttribute("OwnTroops"));
                        Defense.OutTroops[type]     = Convert.ToInt32(r.GetAttribute("OutTroops"));
                        Defense.OtherDefenses[type] = Convert.ToInt32(r.GetAttribute("OtherDefenses"));
                    }
                    r.Read();
                }
                r.ReadEndElement();
            }

            // buildings
            Buildings.Clear();
            if (r.HasAttributes)
            {
                BuildingsDate = Convert.ToDateTime(r.GetAttribute(0), CultureInfo.InvariantCulture);
            }

            r.Read();
            if (r.IsStartElement("Building"))
            {
                while (r.IsStartElement("Building"))
                {
                    string typeDesc = r.GetAttribute(0);
                    if (Enum.IsDefined(typeof(BuildingTypes), typeDesc))
                    {
                        var type  = (BuildingTypes)Enum.Parse(typeof(BuildingTypes), typeDesc);
                        int level = Convert.ToInt32(r.GetAttribute(1));
                        Buildings[type] = level;
                    }
                    r.Read();
                }
                r.ReadEndElement();
            }

            r.ReadEndElement();
            // Info
        }
Beispiel #11
0
 public async Task ExecuteBuildingsCommand(int facilityId)
 {
     Buildings.Clear();
     Buildings = await DataStore.GetBuildingsAsync(facilityId);
 }