예제 #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="gamingMapuid"></param>
        /// <param name="mapId"></param>
        /// <param name="mapName"></param>
        /// <param name="mapType"></param>
        /// <param name="areaSpawners"></param>
        public void Init(uint gamingMapuid, uint mapId, string mapName, GamingMapType mapType, List <AreaSpawner> areaSpawners)
        {
            m_Uid     = gamingMapuid;
            m_MapId   = mapId;
            m_MapName = mapName;
            m_Type    = mapType;
            string areaTemplete = "";
            GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();

            if (gamingSetting != null)
            {
                areaTemplete = gamingSetting.m_GamingAreaTemplete;
            }
            GameObject areaTempleteAsset = AssetDatabase.LoadAssetAtPath <GameObject>(areaTemplete);

            if (areaTempleteAsset == null)
            {
                Debug.LogError("GamingMap Area 模板未设置");
                return;
            }

            if (areaSpawners != null && areaSpawners.Count > 0)
            {
                m_GamingAreaList = new List <GamingMapArea>();
                for (int iArea = 0; iArea < areaSpawners.Count; iArea++)
                {
                    AreaSpawner areaSpawner = areaSpawners[iArea];
                    CreateGamingArea(areaSpawner);
                }
            }
            SaveScene();
        }
예제 #2
0
        private static void CreateMapEditorSetting()
        {
            GamingMapEditorSetting setting = GetGamingMapEditorSetting();

            if (!setting)
            {
                string path = AssetDatabase.GetAssetOrScenePath(Selection.activeObject);
                string directory;
                if (Directory.Exists(path))
                {
                    directory = path;
                }
                else
                {
                    if (File.Exists(path))
                    {
                        directory = path.Substring(0, path.LastIndexOf('/'));
                    }

                    else
                    {
                        directory = "Assets";
                    }
                }

                setting = CreateGamingMapEditorSetting(directory);
            }

            if (setting)
            {
                Selection.activeObject = setting;
            }
        }
예제 #3
0
        private void OnEndExport()
        {
            GameObject.DestroyImmediate(gameObject);
            GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();

            MapEditorUtility.OpenFolder(MapEditorUtility.GetFullPath(gamingSetting.m_ConfigPath));
        }
예제 #4
0
        private void OnEnable()
        {
            if (m_GamingMapList == null)
            {
                m_GamingMapList = new List <string>();
            }
            m_GamingMapList.Clear();
            GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();

            if (gamingSetting != null)
            {
                m_GamingMapPath = gamingSetting.m_GamingMapPath;
            }
            string [] GamingList = AssetDatabase.FindAssets("t:Scene", new string[] { m_GamingMapPath });
            if (GamingList != null && GamingList.Length > 0)
            {
                for (int iGame = 0; iGame < GamingList.Length; iGame++)
                {
                    string gamingPath = GamingList[iGame];
                    string assetPath  = AssetDatabase.GUIDToAssetPath(GamingList[iGame]);
                    if (assetPath.Contains("Area"))
                    {
                        continue;
                    }
                    m_GamingMapList.Add(assetPath);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// 获取所有的GamingMap路径
        /// </summary>
        /// <returns></returns>
        public static List <string> GetGamingMapScenePath()
        {
            List <string>          m_GamingMapList = new List <string>();
            string                 m_GamingMapPath = "";
            GamingMapEditorSetting gamingSetting   = GamingMapEditorUtility.GetGamingMapEditorSetting();

            if (gamingSetting != null)
            {
                m_GamingMapPath = gamingSetting.m_GamingMapPath;
            }
            string[] GamingList = AssetDatabase.FindAssets("t:Scene", new string[] { m_GamingMapPath });
            if (GamingList != null && GamingList.Length > 0)
            {
                for (int iGame = 0; iGame < GamingList.Length; iGame++)
                {
                    string gamingPath = GamingList[iGame];
                    string assetPath  = AssetDatabase.GUIDToAssetPath(GamingList[iGame]);
                    if (assetPath.Contains("Area"))
                    {
                        continue;
                    }
                    m_GamingMapList.Add(assetPath);
                }
            }
            return(m_GamingMapList);
        }
예제 #6
0
 /// <summary>
 /// 载入GamingMapEdtior配置
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 private static bool LoadGamingMapEditorSetting(string path)
 {
     UnityEngine.Object settingObject = AssetDatabase.LoadAssetAtPath(path, typeof(GamingMapEditorSetting));
     if (settingObject &&
         settingObject is GamingMapEditorSetting)
     {
         m_GamingMapEditorSetting = settingObject as GamingMapEditorSetting;
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #7
0
		/// <summary>
		/// 初始化
		/// </summary>
		public void Init()
		{
            m_GamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();
            m_MapSetting = MapEditorUtility.GetMapEditorSetting();
            m_SelectIndex = -1;
			m_GuiStyle = new GUIStyle();
			m_GuiStyle.fontSize = 20;
			m_GuiStyle.fontStyle = FontStyle.BoldAndItalic;
			m_GuiContentArray = new GUIContent[] { new GUIContent("创建地图配置"), new GUIContent("打开地图配置列表"),new GUIContent("创建地图") };

			m_GamingMapPath = m_GamingSetting.m_GamingMapPath;
			m_GamingMapTemplete = m_GamingSetting.m_GamingMapTemplete;
			m_GamingAreaTemplete = m_GamingSetting.m_GamingAreaTemplete;
			m_ConfigPath = m_GamingSetting.m_ConfigPath;
			m_JsonPath = m_GamingSetting.m_JsonPath;
			m_CreatureTempletePath = m_GamingSetting.m_CreatureTempletePath;
			m_LocationTempletePath = m_GamingSetting.m_LocationTempletePath;
            m_LeapTempletePath = m_GamingSetting.m_LeapTempletePath;
            m_TriggerTempletePath = m_GamingSetting.m_TriggerTempletePath;
            m_MaxShipPath = m_GamingSetting.m_MaxShipPath;
            m_StarMapPath = m_GamingSetting.m_StarMapPath;
            m_SpacecraftPropertyPath = m_GamingSetting.m_SpacecraftPropertyPath;

            m_MapTempletePath = m_MapSetting.m_MapTempletePath;
            m_TreasurePrefabSavePath = m_MapSetting.m_TreasurePrefabSavePath;
            m_MapSavePath = m_MapSetting.m_MapSavePath;
			m_AreaSpawnerTempletePath = m_MapSetting.m_AreaSpawnerTempletePath;
            m_ColliderSavePath = m_MapSetting.m_ColliderSavePath;
            m_ColliderSavePathCopy = m_MapSetting.m_ColliderSavePathCopy;
            m_MineralPrefabSavePath = m_MapSetting.m_MineralPrefabSavePath;
            /*m_GamingMapPath = PlayerPrefsUtility.GetString(Constants.GAMINGMAP_SAVE_PATH);
			m_GamingMapTemplete = PlayerPrefsUtility.GetString(Constants.GAMINGMAP_TEMPLETE_PATH);
			m_GamingAreaTemplete = PlayerPrefsUtility.GetString(Constants.GAMINGAREA_TEMPLETE_PATH);
			m_ConfigPath = PlayerPrefsUtility.GetString(Constants.CONFIG_PATH);
			m_JsonPath = PlayerPrefsUtility.GetString(Constants.SAVEJSON_PATH);

			m_CreatureTempletePath = PlayerPrefsUtility.GetString(Constants.CREATURE_TEMPLETE_PATH);
			m_LocationTempletePath = PlayerPrefsUtility.GetString(Constants.LOCATION_TEMPLETE_PATH);

			m_MapTempletePath = PlayerPrefsUtility.GetString(Constants.MAP_TEMPLETE_PATH);
			m_MapSavePath = PlayerPrefsUtility.GetString(Constants.MAP_SAVE_PATH);
			m_AreaSpawnerTempletePath = PlayerPrefsUtility.GetString(Constants.AREASPAWNER_TEMPLETE_PATH);*/
        }
예제 #8
0
        /// <summary>
        /// 创建GameArea
        /// </summary>
        /// <param name="areaSpawner"></param>
        private void CreateGamingArea(AreaSpawner areaSpawner)
        {
            string areaTemplete = "";
            GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();

            if (gamingSetting != null)
            {
                areaTemplete = gamingSetting.m_GamingAreaTemplete;
            }
            GameObject areaTempleteAsset = AssetDatabase.LoadAssetAtPath <GameObject>(areaTemplete);
            GameObject obj = Instantiate(areaTempleteAsset);

            obj.name = string.Format("Area_{0}", areaSpawner.GetAreaId());
            obj.transform.SetParent(transform);
            GamingMapArea area = obj.GetComponent <GamingMapArea>();

            if (area == null)
            {
                area = obj.AddComponent <GamingMapArea>();
            }
            area.Init(areaSpawner, this);
            m_GamingAreaList.Add(area);
        }
예제 #9
0
        public void LoadGamingMapArea(AreaSpawner areaSpawner, bool closeOtherArea = true)
        {
            if (areaSpawner == null)
            {
                return;
            }
            string m_AreaScenePath = string.Format("{0}/GamingMapArea_{1}_{2}.unity", GetOwnerAreaPath(), m_Uid, areaSpawner.GetAreaId());

            if (string.IsNullOrEmpty(m_AreaScenePath))
            {
                Debug.LogError("m_AreaScenePath == null");
                return;
            }

            GamingMapArea[] areaArray = UnityEngine.Object.FindObjectsOfType <GamingMapArea>();
            if (areaArray != null && areaArray.Length > 0)
            {
                for (int iArea = 0; iArea < areaArray.Length; iArea++)
                {
                    GamingMapArea area = areaArray[iArea];
                    if (area != null && area.m_AreaId == areaSpawner.GetAreaId())
                    {
                        //Debug.LogError(string.Format("{0}Area已导入", area.m_AreaId));
                        return;
                    }
                }
            }
            if (closeOtherArea)
            {
                SaveOtherGamingArea();
            }
            string areaScenePath = m_AreaScenePath.Replace("Assets", Application.dataPath);
            Scene  areaScene;

            if (!File.Exists(areaScenePath))
            {
                string gamingAreaPath = "";
                GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();
                if (gamingSetting != null)
                {
                    gamingAreaPath = gamingSetting.m_GamingAreaTemplete;
                }
                areaScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive);
                GameObject    areaTempleteAsset = AssetDatabase.LoadAssetAtPath <GameObject>(gamingAreaPath);
                GameObject    gamingArea        = GameObject.Instantiate(areaTempleteAsset);
                GamingMapArea mapArea           = gamingArea.GetComponent <GamingMapArea>();
                mapArea.Init(areaSpawner, this);
                EditorSceneManager.MoveGameObjectToScene(gamingArea, areaScene);
                EditorSceneManager.SaveScene(areaScene, m_AreaScenePath);
                EditorSceneManager.CloseScene(areaScene, true);
                AssetDatabase.Refresh();
            }

            areaScene = EditorSceneManager.OpenScene(m_AreaScenePath, OpenSceneMode.Additive);
            if (areaScene != null)
            {
                GamingMapArea mapArea  = null;
                GameObject[]  rootObjs = areaScene.GetRootGameObjects();
                if (rootObjs != null && rootObjs.Length > 0)
                {
                    for (int rIndex = 0; rIndex < rootObjs.Length; rIndex++)
                    {
                        mapArea = rootObjs[rIndex].GetComponent <GamingMapArea>();
                        if (mapArea != null)
                        {
                            break;
                        }
                    }
                }
                if (mapArea != null)
                {
                    EditorSceneManager.MoveGameObjectToScene(mapArea.gameObject, GetOwnerScene());
                    mapArea.transform.SetParent(transform);
                }
                EditorSceneManager.CloseScene(areaScene, true);
            }
        }
예제 #10
0
		private void OnGUI()
		{
            m_GamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();
            m_MapSetting = MapEditorUtility.GetMapEditorSetting();
            GUILayout.BeginVertical();
			m_SelectIndex = GUILayout.SelectionGrid(m_SelectIndex, m_GuiContentArray,2,GUILayout.Height(100));
			OnClickGrid(m_SelectIndex);
			GUILayout.BeginVertical("box");
			EditorGUILayout.LabelField("GamingMap设置:", m_GuiStyle);
			GUILayout.Space(5);
			GUILayout.BeginHorizontal("box");
			
			EditorGUILayout.LabelField("GamingMap保存路径:", m_GamingMapPath);
			//GUILayout.FlexibleSpace();
			if (GUILayout.Button("选择"))
			{
				m_GamingMapPath = MapEditorUtility.OpenFloderPanel();
				m_GamingMapPath = MapEditorUtility.GetRelativePath(m_GamingMapPath);
				m_GamingSetting.m_GamingMapPath = m_GamingMapPath;
				//PlayerPrefsUtility.SetString(Constants.GAMINGMAP_SAVE_PATH, m_GamingMapPath);
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("GamingMap模板:", m_GamingMapTemplete);
			if (GUILayout.Button("选择"))
			{
				m_GamingMapTemplete = MapEditorUtility.OpenFilePanel("", "unity");
				m_GamingMapTemplete = MapEditorUtility.GetRelativePath(m_GamingMapTemplete);
				m_GamingSetting.m_GamingMapTemplete = m_GamingMapTemplete;
				//PlayerPrefsUtility.SetString(Constants.GAMINGMAP_TEMPLETE_PATH, m_GamingMapTemplete);
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("GamingMapArea模板",m_GamingAreaTemplete);
			if(GUILayout.Button("选择"))
			{
				m_GamingAreaTemplete = MapEditorUtility.OpenFilePanel("", "prefab");
				m_GamingAreaTemplete = MapEditorUtility.GetRelativePath(m_GamingAreaTemplete);
				m_GamingSetting.m_GamingAreaTemplete = m_GamingAreaTemplete;
				//PlayerPrefsUtility.SetString(Constants.GAMINGAREA_TEMPLETE_PATH, m_GamingAreaTemplete);
			}
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("配置表路径", m_ConfigPath);
			if (GUILayout.Button("选择"))
			{
				m_ConfigPath = MapEditorUtility.OpenFloderPanel("");
				m_ConfigPath = MapEditorUtility.GetRelativePath(m_ConfigPath);
				m_GamingSetting.m_ConfigPath = m_ConfigPath;
				//PlayerPrefsUtility.SetString(Constants.CONFIG_PATH, m_ConfigPath);
			}
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("Json保存路径", m_JsonPath);
			if (GUILayout.Button("选择"))
			{
				m_JsonPath = MapEditorUtility.OpenFloderPanel("");
				m_JsonPath = MapEditorUtility.GetRelativePath(m_JsonPath);
				m_GamingSetting.m_JsonPath = m_JsonPath;
				//PlayerPrefsUtility.SetString(Constants.SAVEJSON_PATH, m_JsonPath);
			}
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("Creature模板", m_CreatureTempletePath);
			if (GUILayout.Button("选择"))
			{
				m_CreatureTempletePath = MapEditorUtility.OpenFilePanel("","prefab");
				m_CreatureTempletePath = MapEditorUtility.GetRelativePath(m_CreatureTempletePath);
				m_GamingSetting.m_CreatureTempletePath = m_CreatureTempletePath;
				//PlayerPrefsUtility.SetString(Constants.CREATURE_TEMPLETE_PATH, m_CreatureTempletePath);
			}
			GUILayout.EndHorizontal();


			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("Location模板", m_LocationTempletePath);
			if (GUILayout.Button("选择"))
			{
				m_LocationTempletePath = MapEditorUtility.OpenFilePanel("", "prefab");
				m_LocationTempletePath = MapEditorUtility.GetRelativePath(m_LocationTempletePath);
				m_GamingSetting.m_LocationTempletePath = m_LocationTempletePath;
			}
			GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("Leap模板", m_LeapTempletePath);
            if (GUILayout.Button("选择"))
            {
                m_LeapTempletePath = MapEditorUtility.OpenFilePanel("", "prefab");
                m_LeapTempletePath = MapEditorUtility.GetRelativePath(m_LeapTempletePath);
                m_GamingSetting.m_LeapTempletePath = m_LeapTempletePath;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("Trigger模板", m_TriggerTempletePath);
            if (GUILayout.Button("选择"))
            {
                m_TriggerTempletePath = MapEditorUtility.OpenFilePanel("", "prefab");
                m_TriggerTempletePath = MapEditorUtility.GetRelativePath(m_TriggerTempletePath);
                m_GamingSetting.m_TriggerTempletePath = m_TriggerTempletePath;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("最大战舰", m_MaxShipPath);
            if (GUILayout.Button("选择"))
            {
                m_MaxShipPath = MapEditorUtility.OpenFilePanel("", "prefab");
                m_MaxShipPath = MapEditorUtility.GetRelativePath(m_MaxShipPath);
                m_GamingSetting.m_MaxShipPath = m_MaxShipPath;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("星图保存路径", m_StarMapPath);
            if (GUILayout.Button("选择"))
            {
                m_StarMapPath = MapEditorUtility.OpenFloderPanel("");
                m_StarMapPath = MapEditorUtility.GetRelativePath(m_StarMapPath);
                m_GamingSetting.m_StarMapPath = m_StarMapPath;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("战舰属性保存路径", m_SpacecraftPropertyPath);
            if (GUILayout.Button("选择"))
            {
                m_SpacecraftPropertyPath = MapEditorUtility.OpenFloderPanel("");
                m_SpacecraftPropertyPath = MapEditorUtility.GetRelativePath(m_SpacecraftPropertyPath);
                m_GamingSetting.m_SpacecraftPropertyPath = m_SpacecraftPropertyPath;
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
			GUILayout.Space(20);
			//Map的相关配置
			GUILayout.BeginVertical("box");
			EditorGUILayout.LabelField("Map设置:", m_GuiStyle);
			GUILayout.Space(5);
			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("地图模板路径", m_MapTempletePath);
			if (GUILayout.Button("选择"))
			{
				m_MapTempletePath = MapEditorUtility.OpenFilePanel("", "unity");
				m_MapTempletePath = MapEditorUtility.GetRelativePath(m_MapTempletePath);
				m_MapSetting.m_MapTempletePath = m_MapTempletePath;
				//PlayerPrefsUtility.SetString(Constants.MAP_TEMPLETE_PATH, m_MapTempletePath);
			}
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("地图保存路径:", m_MapSavePath);
			if (GUILayout.Button("选择"))
			{
				m_MapSavePath = MapEditorUtility.OpenFloderPanel();
				m_MapSavePath = MapEditorUtility.GetRelativePath(m_MapSavePath);
				m_MapSetting.m_MapSavePath = m_MapSavePath;
				//PlayerPrefsUtility.SetString(Constants.MAP_SAVE_PATH, m_MapSavePath);
			}
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal("box");
			EditorGUILayout.LabelField("AreaSpawner模板路径:", m_AreaSpawnerTempletePath);
			if (GUILayout.Button("选择"))
			{
				m_AreaSpawnerTempletePath = MapEditorUtility.OpenFilePanel("", "prefab");
				m_AreaSpawnerTempletePath = MapEditorUtility.GetRelativePath(m_AreaSpawnerTempletePath);
				m_MapSetting.m_AreaSpawnerTempletePath = m_AreaSpawnerTempletePath;
			}
			GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("碰撞体保存路径:", m_ColliderSavePath);
            if (GUILayout.Button("选择"))
            {
                m_ColliderSavePath = MapEditorUtility.OpenFloderPanel("");
                m_ColliderSavePath = MapEditorUtility.GetRelativePath(m_ColliderSavePath);
                m_MapSetting.m_ColliderSavePath = m_ColliderSavePath;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("碰撞体备份保存路径:", m_ColliderSavePathCopy);
            if (GUILayout.Button("选择"))
            {
                m_ColliderSavePathCopy = MapEditorUtility.OpenFloderPanel("");
                m_ColliderSavePathCopy = MapEditorUtility.GetRelativePath(m_ColliderSavePathCopy);
                m_MapSetting.m_ColliderSavePathCopy = m_ColliderSavePathCopy;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("寻宝预设保存路径:", m_TreasurePrefabSavePath);
            if (GUILayout.Button("选择"))
            {
                m_TreasurePrefabSavePath = MapEditorUtility.OpenFloderPanel("");
                m_TreasurePrefabSavePath = MapEditorUtility.GetRelativePath(m_TreasurePrefabSavePath);
                m_MapSetting.m_TreasurePrefabSavePath = m_TreasurePrefabSavePath;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("挖矿预设保存路径:", m_MineralPrefabSavePath);
            if (GUILayout.Button("选择"))
            {
                m_MineralPrefabSavePath = MapEditorUtility.OpenFloderPanel("");
                m_MineralPrefabSavePath = MapEditorUtility.GetRelativePath(m_MineralPrefabSavePath);
                m_MapSetting.m_MineralPrefabSavePath = m_MineralPrefabSavePath;
            }
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
			GUILayout.EndVertical();
            EditorUtility.SetDirty(m_MapSetting);
            EditorUtility.SetDirty(m_GamingSetting);
        }
예제 #11
0
        private void OnGUI()
        {
            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("关联地图Scene:", m_RelationScene);
            if (m_HasSelect)
            {
                if (GUILayout.Button("收起", GUILayout.Width(100)))
                {
                    m_HasSelect = false;
                }
                GUILayout.EndHorizontal();
                m_VerticalPos = GUILayout.BeginScrollView(m_VerticalPos);
                GUILayout.BeginVertical("box");
                if (m_RelationSceneList != null && m_RelationSceneList.Count > 0)
                {
                    for (int iRelation = 0; iRelation < m_RelationSceneList.Count; iRelation++)
                    {
                        string[] splitPath = m_RelationSceneList[iRelation].Split('/');
                        if (splitPath != null && splitPath.Length > 0)
                        {
                            string showPath = splitPath[splitPath.Length - 1];
                            if (!string.IsNullOrEmpty(showPath))
                            {
                                showPath = showPath.Replace(".unity", "");
                                if (GUILayout.Button(showPath))
                                {
                                    m_RelationScene = m_RelationSceneList[iRelation];
                                    m_HasSelect     = false;
                                }
                            }
                        }
                    }
                }
                else
                {
                    GUILayout.Label("未找到关联的Scene");
                }
                GUILayout.EndVertical();
                GUILayout.EndScrollView();
            }
            else
            {
                if (GUILayout.Button("选择", GUILayout.Width(100)))
                {
                    m_HasSelect = true;
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.BeginVertical("box");
            m_GamingMapId   = EditorGUILayout.TextField("GamingMap Id:", m_GamingMapId);
            m_GamingMapName = EditorGUILayout.TextField("名称:", m_GamingMapName);
            //m_GamingMapType = (GamingMapType)EditorGUILayout.EnumPopup("类型:", m_GamingMapType);
            m_SelectTypeIndex = EditorGUILayout.Popup(new GUIContent("类型:"), m_SelectTypeIndex, EditorGamingMapData.GAMINGMAPTYPE_NAME);
            m_GamingMapType   = (GamingMapType)m_SelectTypeIndex;
            if (GUILayout.Button("创建"))
            {
                if (m_RelationScene == null)
                {
                    EditorUtility.DisplayDialog("提示", "请选择关联地图Scene", "确定");
                    return;
                }

                uint mapId;
                if (!uint.TryParse(m_GamingMapId, out mapId))
                {
                    EditorUtility.DisplayDialog("提示", "GamingMap id格式错误", "确定");
                    return;
                }
                if (string.IsNullOrEmpty(m_GamingMapName))
                {
                    EditorUtility.DisplayDialog("提示", "名称不能为空", "确定");
                    return;
                }
                string mapPath = "";
                GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting();
                if (gamingSetting != null)
                {
                    mapPath = string.Format("{0}/GamingMap_{1}.unity", MapEditorUtility.GetFullPath(gamingSetting.m_GamingMapPath), mapId);
                }
                if (File.Exists(mapPath))
                {
                    EditorUtility.DisplayDialog("提示", "该GamingMap已存在", "确定");
                    return;
                }
                List <Scene> openScenes = new List <Scene>();
                for (int iScene = 0; iScene < EditorSceneManager.sceneCount; iScene++)
                {
                    Scene sceneTmp = EditorSceneManager.GetSceneAt(iScene);
                    openScenes.Add(sceneTmp);
                }

                SaveOpenScene();
                //打开对应的map 找到mapid 创建Gamingmap 初始化GamingMap和Area
                Scene        scene = EditorSceneManager.OpenScene(m_RelationScene, OpenSceneMode.Additive);
                Map          map   = null;
                GameObject[] objs  = scene.GetRootGameObjects();
                if (objs != null && objs.Length > 0)
                {
                    for (int iObj = 0; iObj < objs.Length; iObj++)
                    {
                        map = objs[iObj].GetComponent <Map>();
                        if (map != null)
                        {
                            break;
                        }
                    }
                }

                //string gamingPath = PlayerPrefsUtility.GetString(Constants.GAMINGMAP_TEMPLETE_PATH);
                string gamingPath = "";
                if (gamingSetting != null)
                {
                    gamingPath  = MapEditorUtility.GetFullPath(gamingSetting.m_GamingMapTemplete);
                    gamingPath += "/";
                }
                FileUtil.CopyFileOrDirectory(gamingPath, mapPath);
                AssetDatabase.ImportAsset(mapPath);
                Scene        exportScene = EditorSceneManager.OpenScene(mapPath, OpenSceneMode.Additive);
                GameObject[] exportObjs  = exportScene.GetRootGameObjects();
                if (exportObjs != null && exportObjs.Length > 0)
                {
                    for (int iExport = 0; iExport < exportObjs.Length; iExport++)
                    {
                        GamingMap gamingMap = exportObjs[iExport].GetComponent <GamingMap>();
                        if (gamingMap != null)
                        {
                            gamingMap.Init(mapId, map.Uid, m_GamingMapName, m_GamingMapType, map.GetAreaSpawnerList());
                            break;
                        }
                    }
                }
                SceneManager.SetActiveScene(exportScene);
                EditorSceneManager.SaveScene(exportScene);
                EditorSceneManager.CloseScene(scene, true);

                if (openScenes != null && openScenes.Count > 0)
                {
                    for (int iOpen = 0; iOpen < openScenes.Count; iOpen++)
                    {
                        Scene openScene = openScenes[iOpen];
                        EditorSceneManager.SaveScene(openScene);
                        EditorSceneManager.CloseScene(openScene, true);
                    }
                }
            }
            GUILayout.EndVertical();
        }