示例#1
0
        public static void rendermap(Arg arg)
        {
            float @float = arg.GetFloat(0, 1f);
            int   imageWidth;
            int   imageHeight;
            Color background;

            byte[] array = MapImageRenderer.Render(out imageWidth, out imageHeight, out background, @float, false);
            if (array == null)
            {
                arg.ReplyWith("Failed to render the map (is a map loaded now?)");
                return;
            }
            string fullPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, $"map_{global::World.Size}_{global::World.Seed}.png"));

            File.WriteAllBytes(fullPath, array);
            arg.ReplyWith("Saved map render to: " + fullPath);
        }
示例#2
0
 private static void RenderToCache()
 {
     _imageData = null;
     _width     = 0;
     _height    = 0;
     try
     {
         Color background;
         _imageData  = MapImageRenderer.Render(out _width, out _height, out background);
         _background = "#" + ColorUtility.ToHtmlStringRGB(background);
     }
     catch (Exception arg)
     {
         Debug.LogError($"Exception thrown when rendering map for the app: {arg}");
     }
     if (_imageData == null)
     {
         Debug.LogError("Map image is null! App users will not be able to see the map.");
     }
 }