예제 #1
0
        public void Paint(IActor actor, IWorldCoordinate coord, string text)
        {
            if (!Enabled)
            {
                return;
            }
            if (Brush == null)
            {
                return;
            }
            if (Radius <= 0)
            {
                return;
            }
            if (ShapePainter == null)
            {
                return;
            }

            var radius = RadiusTransformator != null?RadiusTransformator.TransformRadius(Radius) : Radius;

            var rotation = RotationTransformator != null?RotationTransformator.TransformRotation(Rotation) : Rotation;

            ShapePainter.Paint(coord.X, coord.Y, coord.Z, radius, rotation, Brush, ShadowBrush);
        }
예제 #2
0
파일: SimpleShape.cs 프로젝트: zzy092/npoi
        public void Draw(Graphics2D graphics)
        {
            AffineTransform at = graphics.GetTransform();

            ShapePainter.paint(this, graphics);
            graphics.SetTransform(at);
        }
예제 #3
0
    public void OnSceneGUI()
    {
        Island       island  = GameObject.FindObjectOfType <Island>();
        ShapePainter painter = (ShapePainter)target;
        float        radiusX = island.GetBrushRadius(painter.m_brush.m_brushSizeX);
        float        radiusY = island.GetBrushRadius(painter.m_brush.m_brushSizeY);

        switch (painter.m_brush.m_shape)
        {
        case IslandBrush.IslandBrushShape.Circle:
        {
            Handles.DrawWireDisc(painter.transform.position, Vector3.up, radiusX);
            break;
        }

        case IslandBrush.IslandBrushShape.Square:
        {
            Vector3[] points = new Vector3[5];

            points[0] = painter.transform.position + new Vector3(-radiusX, 0.0f, -radiusY);
            points[1] = painter.transform.position + new Vector3(-radiusX, 0.0f, radiusY);
            points[2] = painter.transform.position + new Vector3(radiusX, 0.0f, radiusY);
            points[3] = painter.transform.position + new Vector3(radiusX, 0.0f, -radiusY);
            points[4] = painter.transform.position + new Vector3(-radiusX, 0.0f, -radiusY);



            Handles.DrawPolyLine(points);
            break;
        }
        }
    }
예제 #4
0
        private void FillShapes(ExcelWorksheet worksheet)
        {
            var shapePainter = new ShapePainter(worksheet, _columnsLookup, _planRows);

            foreach (var shape in _chartData.Objects.Shapes ?? new List <Shape>())
            {
                shapePainter.DrawShape(shape);
            }
        }
예제 #5
0
    public override void OnInspectorGUI()
    {
        ShapePainter painter = (ShapePainter)target;

        painter.m_brush.ShowInspectorGUI();

        GUILayout.Box("", GUILayout.Height(1), GUILayout.Width(Screen.width - 5));

        //   painter.m_heightThreshold   = EditorGUILayout.FloatField("Height Threshold", painter.m_heightThreshold);
        //   painter.m_heightBlend       = EditorGUILayout.FloatField("Height Blend", painter.m_heightBlend);
    }
        public override void ModifyWorldGenTasks(List <GenPass> tasks, ref float totalWeight)
        {
            var   mymod          = (PaintedHillsMod)this.mod;
            float size           = mymod.Config.HueBlobMinimumTileRadius;
            float size_variance  = mymod.Config.HueBlobSizeVariance;
            float shape_variance = mymod.Config.HueBlobShapeVariance;
            int   idx            = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes"));

            if (idx != -1)
            {
                tasks.Insert(idx + 1, new PassLegacy("Painting Hills", delegate(GenerationProgress progress) {
                    progress.Message = "Painting Hills";

                    float chunk_size = 300f * 300f;
                    float chunks     = ((float)Main.maxTilesX * (float)Main.maxTilesY) / chunk_size;
                    chunks          *= mymod.Config.HueBlobQuantityMultiplier;

                    if (mymod.Config.DebugModeInfo)
                    {
                        ErrorLogger.Log("chunks: " + chunks);
                    }

                    for (int i = 0; i < chunks; i++)
                    {
                        int x, y;
                        var huemap  = new HueTileMap();
                        var colorer = new FadingColorer(huemap, Paints.None);
                        Paints hue  = ColorPicker.GetRandomColor();

                        huemap.FindRandomTile(out x, out y);
                        colorer.SetHue(hue);

                        if (mymod.Config.DebugModeInfo)
                        {
                            ErrorLogger.Log("  painting blob (" + (i + 1) + " of " + chunks + "): " + x + ", " + y + " " + ColorPicker.GetName(hue));
                        }

                        ShapePainter.PaintBlob(mymod, colorer, x, y, size, size_variance, shape_variance);

                        progress.Set((float)i / chunks);
                    }
                }));
            }
        }