Beyond_Beyaan.Empire.Load C# (CSharp) Метод

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

public Load ( System.Xml.Linq.XElement empireToLoad, GameMain gameMain ) : void
empireToLoad System.Xml.Linq.XElement
gameMain GameMain
Результат void
        public void Load(XElement empireToLoad, GameMain gameMain)
        {
            empireID = int.Parse(empireToLoad.Attribute("ID").Value);
            empireName = empireToLoad.Attribute("Name").Value;
            EmpireColor = Color.FromArgb(int.Parse(empireToLoad.Attribute("Color").Value));
            EmpireRace = gameMain.RaceManager.GetRace(empireToLoad.Attribute("Race").Value);
            type = bool.Parse(empireToLoad.Attribute("IsHumanPlayer").Value) ? PlayerType.HUMAN : PlayerType.CPU;
            lastSelectedSystem = gameMain.Galaxy.GetStarWithID(int.Parse(empireToLoad.Attribute("SelectedSystem").Value));
            TechnologyManager.Load(empireToLoad, gameMain.MasterTechnologyManager);
            FleetManager.Load(empireToLoad, this, gameMain);
        }

Usage Example

Пример #1
0
        public bool Load(XElement root)
        {
            _empires = new List <Empire>();
            var empires = root.Element("Empires");

            foreach (var empire in empires.Elements())
            {
                var newEmpire = new Empire();
                newEmpire.Load(empire, _gameMain);
                _empires.Add(newEmpire);
            }
            foreach (var empire in _empires)
            {
                empire.SetUpContacts(_empires);
                //TODO: Update all empires' contacts
            }
            SetInitialEmpireTurn();
            return(true);
        }
All Usage Examples Of Beyond_Beyaan.Empire::Load