private void DrawMapElement(Rect rect, int index, bool active, bool focused) { MapElement mapElement = (MapElement)mapElementReorderableList.list[index]; EditorGUI.LabelField(infoRect.GUIAdapt(rect), mapElement.getTargetId()); if (mapElement is ExtElemReference) { var extReference = mapElement as ExtElemReference; // Trasnform manager descriptor selection var avaliableDescriptors = TransformManagerDescriptorFactory.Instance.AvaliableTransformManagers.ToList(); var selected = avaliableDescriptors.FindIndex(d => d.Key == extReference.TransformManagerDescriptor.GetType()); var newSelected = EditorGUI.Popup(typePopupRect.GUIAdapt(rect), selected, avaliableDescriptors.ConvertAll(d => d.Value).ToArray()); if (newSelected != selected) { // In case of change, reinstance a new one extReference.TransformManagerDescriptor = TransformManagerDescriptorFactory.Instance.CreateDescriptor(avaliableDescriptors[newSelected].Key); UpdateMapResources(); } using (new EditorGUI.DisabledScope()) { if (GUI.Button(typeConfigRect.GUIAdapt(rect), "*")) { var o = DrawerParametersMenu.ShowAtPosition(typeConfigRect.GUIAdapt(rect)); DrawerParametersMenu.s_DrawerParametersMenu.ExtElemReference = extReference; if (o) { GUIUtility.ExitGUI(); } } } if (GUI.Button(centerButtonRect.GUIAdapt(rect), "Move")) { movingReference = extReference; } } if (GUI.Button(editButtonRect.GUIAdapt(rect), "Conditions")) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(mapElement.Conditions); } }
private void DrawMapElement(Rect rect, int index, bool active, bool focused) { MapElement mapElement = (MapElement)mapElementReorderableList.list[index]; EditorGUI.LabelField(infoRect.GUIAdapt(rect), mapElement.getTargetId()); //geo.Type = (GMLGeometry.GeometryType)EditorGUI.EnumPopup(typePopupRect.GUIAdapt(rect), geo.Type); var center = map.Center; if (mapElement is GeoReference) { var geoReference = mapElement as GeoReference; var geoElement = Controller.getInstance().getSelectedChapterDataControl().getObjects <GeoElement>().Find(e => e.Id == geoReference.getTargetId()); if (geoElement != null && geoElement.Geometry.Points.Count > 0) { center = geoElement.Geometry.Center; } } else if (mapElement is ExtElemReference) { var extReference = mapElement as ExtElemReference; // Trasnform manager descriptor selection var avaliableDescriptors = TransformManagerDescriptorFactory.Instance.AvaliableTransformManagers.ToList(); var selected = avaliableDescriptors.FindIndex(d => d.Key == extReference.TransformManagerDescriptor.GetType()); var newSelected = EditorGUI.Popup(typePopupRect.GUIAdapt(rect), selected, avaliableDescriptors.ConvertAll(d => d.Value).ToArray()); if (newSelected != selected) { // In case of change, reinstance a new one extReference.TransformManagerDescriptor = TransformManagerDescriptorFactory.Instance.CreateDescriptor(avaliableDescriptors[newSelected].Key); UpdateMapResources(); } using (new EditorGUI.DisabledScope()) { if (GUI.Button(typeConfigRect.GUIAdapt(rect), "*")) { //DrawerParametersMenu.s_SpriteEditor = this; var o = DrawerParametersMenu.ShowAtPosition(typeConfigRect.GUIAdapt(rect)); DrawerParametersMenu.s_DrawerParametersMenu.ExtElemReference = extReference; if (o) { GUIUtility.ExitGUI(); } } } if (GUI.Button(centerButtonRect.GUIAdapt(rect), "Move")) { movingReference = extReference; } } /*if (GUI.Button(centerButtonRect.GUIAdapt(rect), "Center")) * { * map.Center = center; * }*/ /*if (GUI.Button(editButtonRect.GUIAdapt(rect), editing != geo ? "Unlocked" : "Locked")) * { * editing = editing == geo ? null : geo; * }*/ if (GUI.Button(editButtonRect.GUIAdapt(rect), "Conditions")) { ConditionEditorWindow window = (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow)); window.Init(mapElement.Conditions); } }