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

public Load ( System.Xml.Linq.XElement root, GameMain gameMain ) : bool
root System.Xml.Linq.XElement
gameMain GameMain
Результат bool
Пример #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);
            }
        }