public static void DrawInspectorGUI (MapMagicObject mapMagic) { /*using (Cell.Line) { //Cell.current.margins = new Padding(-2,0); foreach (int num in LayersEditor.DrawLayersEnumerable( mapMagic.locks.Length, onAdd:n => AddLockLayer(mapMagic,n), onRemove:n => RemoveLockLayer(mapMagic,n), onMove:(n1,n2) => MoveLockLayer(mapMagic,n1,n2)) ) { using (Cell.Line) DrawLock(mapMagic.locks[num]); } }*/ using (Cell.Line) { LayersEditor.DrawLayers( mapMagic.locks.Length, onDraw:n => DrawLock(mapMagic.locks[n]), onAdd:n => AddLockLayer(mapMagic,n), onRemove:n => RemoveLockLayer(mapMagic,n), onMove:(n1,n2) => MoveLockLayer(mapMagic,n1,n2)); } }
public static void DrawObjectPrefabs(ref GameObject[] prefabs, bool multiPrefab = true, bool treeIcon = false) { string iconName = !treeIcon ? "DPUI/Icons/TreeDisabled" : "DPUI/Icons/ObjectDisabled"; if (multiPrefab) { using (Cell.LineStd) { GameObject[] prefabsCopy = prefabs; //TODO: Action not taking ref. The layer should have onDraw function as Action<layer,int>, instead of just <int> LayersEditor.DrawLayers(ref prefabs, onDraw: n => DrawObjectPrefabLayer(prefabsCopy, n, iconName)); } } else { if (prefabs.Length != 1) { Array.Resize(ref prefabs, 1); } Cell.EmptyLinePx(4); using (Cell.LineStd) { using (Cell.RowPx(24)) Draw.Icon(UI.current.textures.GetTexture(iconName)); Cell.EmptyRowPx(4); using (Cell.Row) Draw.Field(ref prefabs[0]); Cell.EmptyRowPx(4); } } Cell.EmptyLinePx(2); }
public static void DrawLayeredOverride(Graph graph) /// Drawing override in layers-style (can add, remove or switch) /// For graph defaults { Override ovd = graph.defaults; using (Cell.LinePx(0)) LayersEditor.DrawLayers( ovd.Count, onDraw: n => DrawLayer(ovd, n), onAdd: n => NewOverrideWindow.ShowWindow(ovd, n), onRemove: n => ovd.RemoveAt(n), onMove: (n1, n2) => ovd.Switch(n1, n2)); using (Cell.LinePx(20)) { using (Cell.Row) if (Draw.Button("Add All Exposed")) { graph.defaults.AddAllExposed(graph.exposed, graph); } using (Cell.Row) if (Draw.Button("Remove Unused")) { graph.defaults.RemoveAllUnused(graph.exposed); } } }
private void Awake() { m_editorsMap = IOC.Resolve <IEditorsMap>(); m_editor = IOC.Resolve <IRuntimeEditor>(); m_editor.Object.ComponentAdded += OnComponentAdded; GameObject[] selectedObjects = m_editor.Selection.gameObjects; foreach (GameObject go in m_editor.Selection.gameObjects) { ExposeToEditor exposeToEditor = go.GetComponent <ExposeToEditor>(); if (exposeToEditor.GetType().Name == typeof(MyExposeToEditor).Name) { MyExposeToEditor myExposeToEditor = (MyExposeToEditor)exposeToEditor; if (myExposeToEditor.CanRename) { Header.SetActive(true); } else { Header.SetActive(false); } } } InputName.text = GetObjectName(selectedObjects); InputName.onEndEdit.AddListener(OnEndEditName); m_selectedGameObjects = m_editor.Selection.gameObjects.Select(go => new GameObjectWrapper(go)).ToArray(); IsActiveEditor.Init(m_selectedGameObjects, Strong.PropertyInfo((GameObjectWrapper x) => x.IsActive), string.Empty); m_editor.IsBusy = true; LayersEditor.LoadLayers(layersInfo => { m_editor.IsBusy = false; List <RangeOptions.Option> layers = new List <RangeOptions.Option>(); foreach (LayersInfo.Layer layer in layersInfo.Layers) { if (!string.IsNullOrEmpty(layer.Name)) { layers.Add(new RangeOptions.Option(string.Format("{0}: {1}", layer.Index, layer.Name), layer.Index)); } } LayerEditor.Options = layers.ToArray(); LayerEditor.Init(m_editor.Selection.gameObjects, Strong.PropertyInfo((GameObject x) => x.layer), string.Empty); List <List <Component> > groups = GetComponentGroups(selectedObjects); for (int i = 0; i < groups.Count; ++i) { List <Component> group = groups[i]; CreateComponentEditor(group); } UnityEventHelper.AddListener(EditLayersButton, btn => btn.onClick, OnEditLayersClick); }); }
private void OnEditLayersClick() { LayersEditor.BeginEdit(); }