示例#1
0
        public void DrawInGraph()
        {
            if (mesh == null)
            {
                Draw.Rect(PreviewDraw.BackgroundColor); return;
            }

            //height background
            Texture2D heightTex = PreviewManager.heightOutputPreview != null ? PreviewManager.heightOutputPreview.tex : UI.current.textures.GetBlankTexture(0);

            Draw.MatrixPreviewTexture(heightTex, colorize: false, relief: true);

            //preview itself
            if (meshMat == null)
            {
                meshMat = new Material(Shader.Find("MapMagic/ObjectPreview"));
                meshMat = UI.current.textures.GetMaterial("MapMagic/ObjectPreview");
                meshMat.SetColor("_Color", ObjectsPreview.guiGizmoColor);
                meshMat.SetColor("_BackColor", new Color(0, 0, 0, 1));
                meshMat.SetFloat("_Size", 1.01f);
                meshMat.SetFloat("_Flip", 1);
                meshMat.SetFloat("_Offset", 0);
            }

            Draw.Mesh(mesh, meshMat);

            //objects count
            using (Cell.Full)
            {
                Cell.EmptyLine();
                using (Cell.LineStd) Draw.BackgroundRightLabel(count.ToString(), style: UI.current.styles.whiteLabel);
            }
        }
示例#2
0
        public void DrawInGraph()
        {
            if (mesh == null)
            {
                Draw.Rect(PreviewDraw.BackgroundColor); return;
            }

            //height background
            Texture2D heightTex = PreviewManager.heightOutputPreview != null ? PreviewManager.heightOutputPreview.tex : UI.current.textures.GetBlankTexture(0);

            Draw.MatrixPreviewTexture(heightTex, colorize: false, relief: true);

            //preview itself
            if (meshMat == null)
            {
                meshMat = new Material(Shader.Find("MapMagic/ObjectPreview"));
                meshMat = UI.current.textures.GetMaterial("MapMagic/ObjectPreview");
                meshMat.SetColor("_Color", ObjectsPreview.guiGizmoColor);
                meshMat.SetColor("_BackColor", new Color(0, 0, 0, 1));
                meshMat.SetFloat("_Size", 1.01f);
                meshMat.SetFloat("_Flip", 1);
                meshMat.SetFloat("_Offset", 0);
            }

            Draw.Mesh(mesh, meshMat);

            //objects count
            using (Cell.Full)
            {
                Cell.EmptyLine();
                using (Cell.LineStd) Draw.BackgroundRightLabel(count.ToString(), style: UI.current.styles.whiteLabel, rightOffset: 4);
            }

            //use heightmap

            /*using (Cell.Full)
             * {
             *      Cell.EmptyRow();
             *      using (Cell.RowPx(12))
             *      {
             *              Cell.EmptyLinePx(3);
             *              using (Cell.LinePx(12))
             *              {
             *                      Texture2D icon;
             *                      if (relativeHeight) icon = UI.current.textures.GetTexture("DPUI/TexCh/Heightmap");
             *                      else icon = UI.current.textures.GetTexture("DPUI/TexCh/Flat");
             *
             *                      if (Draw.Button(icon, visible:false)) relativeHeight = !relativeHeight;
             *              }
             *              Cell.EmptyLine();
             *      }
             *      Cell.EmptyRowPx(3);
             * }*/
        }