public void Init(EditorTeleport[] teleports, GamingMapArea area) { m_GamingMapArea = area; m_EditorTeleport = teleports; GetTeleportList(); GetTeleportShowNames(); //m_SelectLocation = new Dictionary<int, int>(); m_SelectLocation = new List<TeleportInfo>(); if (m_EditorTeleport != null && m_EditorTeleport.Length > 0) { for (int iTeleport = 0; m_EditorTeleport != null && iTeleport < m_EditorTeleport.Length; iTeleport++) { EditorChanel[] chanelList = m_EditorTeleport[iTeleport].chanelList; if (chanelList != null && chanelList.Length > 0) { for (int iChanel = 0; iChanel < chanelList.Length; iChanel++) { EditorChanel chanel = chanelList[iChanel]; TeleportChanelVO chanelVO = ConfigVO<TeleportChanelVO>.Instance.GetData(chanel.chanelId); if (chanelVO != null) { EditorLocation[] locations = GamingMap.GetEditorLocations(chanelVO.EndGamingMap, chanelVO.EndGamingMapArea); if (locations != null && locations.Length > 0) { List<EditorLocation> locationList = new List<EditorLocation>(); for (int iLocation = 0; iLocation < locations.Length; iLocation++) { EditorLocation location = locations[iLocation]; if (location.locationType == (int)LocationType.TeleportIn) { locationList.Add(location); } } for (int iLocation = 0; iLocation < locationList.Count; iLocation++) { if (locationList[iLocation].locationId == chanel.eLocation) { m_SelectLocation.Add(new TeleportInfo(chanel.chanelId, iLocation)); break; } } } } } } } } }
public override void OnInspectorGUI() { EditorGUI.indentLevel = 0; GUILayout.BeginVertical("box"); if (m_Teleports != null && m_Teleports.Count > 0) { for (int iTeleport = 0; iTeleport < m_Teleports.Count; iTeleport++) { m_ShowTeleportPoup[iTeleport] = EditorGUILayout.Foldout(m_ShowTeleportPoup[iTeleport], m_ShowTeleportNames[iTeleport]); if (m_ShowTeleportPoup[iTeleport]) { EditorGUI.indentLevel = 1; int[] chanelList = m_Teleports[iTeleport].ChanelList; if (chanelList != null && chanelList.Length > 0) { GUILayout.BeginVertical("box"); if (m_Target.m_SelectLocation == null) { m_Target.m_SelectLocation = new List <TeleportRoot.TeleportInfo>(); } for (int iChanel = 0; iChanel < chanelList.Length; iChanel++) { GUILayout.BeginVertical("box"); TeleportChanelVO chanelVO = ConfigVO <TeleportChanelVO> .Instance.GetData(chanelList[iChanel]); if (chanelVO != null) { TeleportRoot.TeleportInfo info = m_Target.GetTeleportInfo(chanelVO.ID); if (info == null) { info = new TeleportRoot.TeleportInfo(chanelVO.ID, -1); m_Target.m_SelectLocation.Add(info); } EditorGUILayout.LabelField("通道ID", chanelList[iChanel].ToString()); EditorGamingMap gamingMap = EditorGamingMapData.LoadGamingMapFromJson(chanelVO.EndGamingMap); if (gamingMap != null) { EditorGUILayout.LabelField("终点地图", gamingMap.gamingmapName); EditorArea area = gamingMap.GetAreaByAreaId(chanelVO.EndGamingMapArea); if (area != null) { EditorGUILayout.LabelField("终点区域", area.areaName); } } EditorLocation[] locations = GamingMap.GetEditorLocations(chanelVO.EndGamingMap, chanelVO.EndGamingMapArea); if (locations != null && locations.Length > 0) { string[] m_LocationIdArray = null; List <string> locationIds = new List <string>(); for (int iLocation = 0; iLocation < locations.Length; iLocation++) { EditorLocation location = locations[iLocation]; if (location.locationType == (int)LocationType.TeleportIn) { string locationStr = string.Format("{0}_{1}", locations[iLocation].locationName, locations[iLocation].locationId); locationIds.Add(locationStr); } } m_LocationIdArray = locationIds.ToArray(); info.m_SelectIndex = EditorGUILayout.Popup("Location ID", info.m_SelectIndex, m_LocationIdArray); } } GUILayout.EndVertical(); } GUILayout.EndVertical(); } } } } GUILayout.EndVertical(); }