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);
        }
示例#2
0
		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));
			}
		}
示例#3
0
        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);
                    }
            }
        }