Beyond_Beyaan.Galaxy.Reconcilate C# (CSharp) Метод

Reconcilate() публичный Метод

public Reconcilate ( EmpireManager empireManager ) : void
empireManager EmpireManager
Результат void
        public void Reconcilate(EmpireManager empireManager)
        {
            foreach (var star in starSystems)
            {
                //Set the empire
                foreach (var planet in star.Planets)
                {
                    if (planet.OwnerID != -1)
                    {
                        planet.Owner = empireManager.GetEmpire(planet.OwnerID);
                        planet.OwnerID = -1; //Clear out the ID
                        planet.Owner.PlanetManager.AddOwnedPlanet(planet);
                        planet.ShipBeingBuilt = planet.Owner.FleetManager.GetShipWithDesignID(planet.ShipBeingBuiltID);
                    }
                }
                star.UpdateOwners();
                if (string.IsNullOrEmpty(star.ExploredByIDs))
                {
                    //No empires explored this star yet.
                    continue;
                }
                string[] exploredBy = star.ExploredByIDs.Split(new[] { ',' });
                foreach (var explored in exploredBy)
                {
                    star.AddEmpireExplored(empireManager.GetEmpire(int.Parse(explored)));
                }
            }
        }

Usage Example

Пример #1
0
        public bool LoadGame(string filename)
        {
            string path = Path.Combine(GameDataSet.FullName, "Saves");

            if (!Directory.Exists(path))
            {
                //No folder exists, impossible to load anything
                return(false);
            }
            try
            {
                XDocument doc  = XDocument.Load(Path.Combine(path, filename));
                XElement  root = doc.Root;
                if (!Galaxy.Load(root, this))
                {
                    return(false);
                }
                if (!EmpireManager.Load(root))
                {
                    return(false);
                }
                Galaxy.Reconcilate(EmpireManager);
                if (_galaxyScreen != null)
                {
                    _galaxyScreen.ResetCamera();
                }
                if (_processingTurnScreen != null)
                {
                    _processingTurnScreen.ResetCamera();
                }
                ChangeToScreen(Screen.Galaxy);
                return(true);
            }
            catch
            {
                return(false);
            }
        }