コード例 #1
0
ファイル: EditorCore.cs プロジェクト: CryZe/WindEditor2
        public void LoadMapFromDirectory(string folderPath)
        {
            if (string.IsNullOrEmpty(folderPath))
            {
                throw new ArgumentException("You must specify a folder to load from directory!");
            }

            if (LoadedScene != null)
            {
                throw new InvalidOperationException("There is already a map loaded, call UnloadMap() first!");
            }

            MapLoader mapLoader = new MapLoader();
            Map       newMap    = null;

#if DEBUG
            newMap = mapLoader.CreateFromDirectory(m_mainWorld, this, folderPath);
#else
            try
            {
                newMap = mapLoader.CreateFromDirectory(m_mainWorld, this, folderPath);
            }
            catch (Exception ex)
            {
                WLog.Error(LogCategory.EditorCore, null, "Exception while loading map: " + ex.ToString());
            }
#endif

            LoadedScene = newMap;
            GetWorldByName("main").Map = newMap;
        }