Пример #1
0
        public void Init(ExportData exportData)
        {
            m_ExportData = exportData;
            if (m_ExportData == null)
            {
                return;
            }
            //TODO:1、读取Area对应的导出配置,如果没有则创建
            //Scene scene = GetOwnerScene();
            //string[] paths = scene.path.Split('/');
            //if (paths != null && paths.Length > 0)
            //{
            //    string ownerSceneFloder = scene.path.Substring(0, scene.path.Length - paths[paths.Length - 1].Length);
            //    string ownerAreaPath = string.Format("{0}{1}", ownerSceneFloder, m_OwnerScene.name);
            //    FileUtility.ExistsDirectoryOrCreate(ownerAreaPath);
            //    AssetDatabase.Refresh();
            //}

            Map map = m_ExportData.m_Map;

            if (map == null || map.gameObject == null)
            {
                return;
            }
            List <AreaSpawner> areaSpawners = m_ExportData.m_AreaSpawners;

            if (areaSpawners == null || areaSpawners.Count < 0)
            {
                return;
            }
            string settingPath = string.Format("{0}/SplitArea_{1}_{2}.asset", map.GetOwnerAreaPath(), map.Uid, areaSpawners[0].m_AreaUid);

            m_EditorSplitAreaSetting = AssetDatabase.LoadAssetAtPath <EditorSplitAreaSetting>(settingPath);
            if (m_EditorSplitAreaSetting == null)
            {
                m_EditorSplitAreaSetting = new EditorSplitAreaSetting();
                AssetDatabase.CreateAsset(m_EditorSplitAreaSetting, settingPath);
                m_EditorSplitAreaSetting = AssetDatabase.LoadAssetAtPath <EditorSplitAreaSetting>(settingPath);
            }
            if (m_EditorSplitAreaSetting == null)
            {
                Debug.LogError("创建区域导出配置失败");
                return;
            }
            m_EditorSplitAreaLayerSettings = m_EditorSplitAreaSetting.m_EditorSplitAreaLayerSettings;
            if (m_EditorSplitAreaLayerSettings == null)
            {
                m_EditorSplitAreaLayerSettings = new List <EditorSplitAreaLayerSetting>();
                m_EditorSplitAreaSetting.m_EditorSplitAreaLayerSettings = m_EditorSplitAreaLayerSettings;
            }
        }
Пример #2
0
        private void InitInfo(Map map, ulong areaUid)
        {
            string settingPath = string.Format("{0}/SplitArea_{1}_{2}.asset", map.GetOwnerAreaPath(), map.Uid, areaUid);

            m_EditorSplitAreaSetting = AssetDatabase.LoadAssetAtPath <EditorSplitAreaSetting>(settingPath);
            if (m_EditorSplitAreaSetting == null)
            {
                m_EditorSplitAreaSetting = new EditorSplitAreaSetting();
                AssetDatabase.CreateAsset(m_EditorSplitAreaSetting, settingPath);
                m_EditorSplitAreaSetting = AssetDatabase.LoadAssetAtPath <EditorSplitAreaSetting>(settingPath);
            }
            if (m_EditorSplitAreaSetting == null)
            {
                Debug.LogError("创建区域导出配置失败");
                return;
            }
            m_EditorSplitAreaLayerSettings = m_EditorSplitAreaSetting.m_EditorSplitAreaLayerSettings;
            if (m_EditorSplitAreaLayerSettings == null)
            {
                m_EditorSplitAreaLayerSettings = new List <EditorSplitAreaLayerSetting>();
                m_EditorSplitAreaSetting.m_EditorSplitAreaLayerSettings = m_EditorSplitAreaLayerSettings;
            }
        }