Skip to content

Commit

Permalink
B19 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Lanilor committed Aug 28, 2018
1 parent e9a3164 commit b52d5ba
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 12 deletions.
4 changes: 2 additions & 2 deletions About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Progress Renderer</name>
<author>Lanilor</author>
<url>https://github.com/Lanilor/Progress-Renderer</url>
<targetVersion>1.0.0</targetVersion>
<targetVersion>0.19.0</targetVersion>
<description>
&lt;size=20&gt;Progress Renderer (scheduled map renderings)&lt;/size&gt;

Expand All @@ -14,6 +14,6 @@ You can choose an interval from once a quadrum to hourly. Rendered images will b
Place special corner marker designators to limit the area of what should be rendered. You can limit this to your base and even just simply extend it later if you base grows larger than planned.

Based on the idea of Map Renderer by WIT (https://github.com/AaronCRobinson/MapRenderer)
(Everything coded from scratch to work scheduled and with 1.0, which has the nice side effect of now being more performant and flexible.)
(Everything coded from scratch to work scheduled and with B19/1.0, which has the nice side effect of now being more performant and flexible.)
</description>
</ModMetaData>
Binary file modified Assemblies/ProgressRenderer.dll
Binary file not shown.
13 changes: 10 additions & 3 deletions Languages/English/Keyed/All.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
<EveryHour>Every hour</EveryHour>

<!-- Messages -->
<LPR_MessageCornerMarkerAmount>There now are {0} corner markers on this map.</LPR_MessageCornerMarkerAmount>
<LPR_MessageCornerMarkerAmount>There are now {0} corner markers on this map.</LPR_MessageCornerMarkerAmount>
<LPR_MessageCornerMarkerTooLess>Rendering needs 2 markers to limit the rendered area. Now the full map will be rendered.</LPR_MessageCornerMarkerTooLess>
<LPR_MessageCornerMarkerTooMany>Rendering will create and use a virtual rect around all markers. You may want to remove unnecessary ones.</LPR_MessageCornerMarkerTooMany>
<LPR_MessageCornerMarkerCorrect>Rendering will limit to the enclosed area.</LPR_MessageCornerMarkerCorrect>
<LPR_MessageCornerMarkersRect>Enclosing rect size is {0}x{1} cells.</LPR_MessageCornerMarkersRect>
<LPR_MessageCornerMarkersRectRatio>Aspect ratio is {0}.</LPR_MessageCornerMarkersRectRatio>
<LPR_MessageCornerMarkersRectRatioDefined>Aspect ratio is {0} ({1}).</LPR_MessageCornerMarkersRectRatioDefined>
<LPR_MessageCornerMarkesRectHeightTooLow>Height is too low. This will result in incorrect renderings. More than 20 cells height are recommended.</LPR_MessageCornerMarkesRectHeightTooLow>

<!-- Designation -->
Expand All @@ -26,8 +28,13 @@
<LPR_SettingsCategory>Progress Renderer</LPR_SettingsCategory>
<LPR_SettingsEnabledLabel>Enabled</LPR_SettingsEnabledLabel>
<LPR_SettingsEnabledDescription>When enabled, this mod takes automatic renderings of current maps while playing and uses the settings below. You can temporary disable this here so you don't have to remove the mod each time.</LPR_SettingsEnabledDescription>
<LPR_SettingsShowMessageBoxLabel>Show message box</LPR_SettingsShowMessageBoxLabel>
<LPR_SettingsShowMessageBoxDescription>Show a message box on screen when the game is rendering the map. Deactivate this to only get a standard text message. (Useful when you just render a small area in a short interval and the message window interrupts playing.) (The message box is always deactivated when a multithreaded encoding method is selected.)</LPR_SettingsShowMessageBoxDescription>
<!--<LPR_SettingsShowMessageBoxLabel>Show message box</LPR_SettingsShowMessageBoxLabel>
<LPR_SettingsShowMessageBoxDescription>Show a message box on screen when the game is rendering the map. Deactivate this to only get a standard text message. (Useful when you just render a small area in a short interval and the message window interrupts playing.) (The message box is always deactivated when a multithreaded encoding method is selected.)</LPR_SettingsShowMessageBoxDescription>-->
<LPR_SettingsRenderFeedbackLabel>Render feedback</LPR_SettingsRenderFeedbackLabel>
<!--<LPR_SettingsRenderFeedbackDescription>Choose what kind of (visible) feedback you want to get when rendering starts.</LPR_SettingsRenderFeedbackDescription>-->
<LPR_RenderFeedback_None>None</LPR_RenderFeedback_None>
<LPR_RenderFeedback_Message>Message (in the top-left corner)</LPR_RenderFeedback_Message>
<LPR_RenderFeedback_Window>Window popup (like during autosave)</LPR_RenderFeedback_Window>
<LPR_SettingsRenderSettingsLabel>Render settings</LPR_SettingsRenderSettingsLabel>
<LPR_SettingsRenderSettingsDescription>Configure some optional graphical elements that should be included in the rendered images. The map will always be rendered while some temporary parts like your current selection, targeters or ui text and the mounse cursor are never included.</LPR_SettingsRenderSettingsDescription>
<LPR_SettingsRenderDesignationsLabel>Designations</LPR_SettingsRenderDesignationsLabel>
Expand Down
21 changes: 21 additions & 0 deletions Source/Designator/Designator_CornerMarker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,28 @@ private void DesignateSingleCellFeedback()
endZ += 1;
int distX = endX - startX;
int distZ = endZ - startZ;
string ratio = ((float)distX / distZ).ToString("0.###");
string messageRect = "LPR_MessageCornerMarkersRect".Translate(new object[] { distX, distZ });
if (distX * 3 == distZ * 4)
{
messageRect += " " + "LPR_MessageCornerMarkersRectRatioDefined".Translate(new object[] { ratio, "4:3" });
}
else if (distX * 2 == distZ * 3)
{
messageRect += " " + "LPR_MessageCornerMarkersRectRatioDefined".Translate(new object[] { ratio, "3:2" });
}
else if (distX * 10 == distZ * 16)
{
messageRect += " " + "LPR_MessageCornerMarkersRectRatioDefined".Translate(new object[] { ratio, "16:10" });
}
else if (distX * 9 == distZ * 16)
{
messageRect += " " + "LPR_MessageCornerMarkersRectRatioDefined".Translate(new object[] { ratio, "16:9" });
}
else
{
messageRect += " " + "LPR_MessageCornerMarkersRectRatio".Translate(new object[] { ratio });
}
if (distZ <= 20)
{
messageRect += " " + "LPR_MessageCornerMarkesRectHeightTooLow".Translate();
Expand Down
13 changes: 13 additions & 0 deletions Source/Enum/RenderFeedback.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace ProgressRenderer
{

public enum RenderFeedback
{
None,
Message,
Window
};

}
4 changes: 2 additions & 2 deletions Source/MapComponents/MapComponent_RenderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public override void MapComponentTick()
return;
}
// Show message window or print message
if (PRModSettings.showMessageBox && PRModSettings.encoding != "jpg_fluxthreaded")
if (PRModSettings.renderFeedback == RenderFeedback.Window && PRModSettings.encoding != "jpg_fluxthreaded")
{
messageBox = new SmallMessageBox("LPR_Rendering".Translate());
Find.WindowStack.Add(messageBox);
}
else
else if (PRModSettings.renderFeedback == RenderFeedback.Message)
{
Messages.Message("LPR_Rendering".Translate(), MessageTypeDefOf.CautionInput, false);
}
Expand Down
33 changes: 28 additions & 5 deletions Source/Mod/PRModSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class PRModSettings : ModSettings
public static string[] SupportedEncodings = { "png_unity", "jpg_unity", "jpg_fluxthreaded" };

private static bool DefaultEnabled = true;
private static bool DefaultShowMessageBox = true;
private static RenderFeedback DefaultRenderFeedback = RenderFeedback.Window;
private static bool DefaultRenderDesignations = false;
private static bool DefaultRenderThingIcons = false;
private static bool DefaultRenderGameConditions = true;
Expand All @@ -28,7 +28,7 @@ public class PRModSettings : ModSettings
private static FileNamePattern DefaultFileNamePattern = FileNamePattern.DateTime;

public static bool enabled = DefaultEnabled;
public static bool showMessageBox = DefaultShowMessageBox;
public static RenderFeedback renderFeedback = DefaultRenderFeedback;
public static bool renderDesignations = DefaultRenderDesignations;
public static bool renderThingIcons = DefaultRenderThingIcons;
public static bool renderGameConditions = DefaultRenderGameConditions;
Expand Down Expand Up @@ -61,7 +61,30 @@ public void DoWindowContents(Rect rect)

ls.CheckboxLabeled("LPR_SettingsEnabledLabel".Translate(), ref enabled, "LPR_SettingsEnabledDescription".Translate());
ls.Gap(GapHeight);
ls.CheckboxLabeled("LPR_SettingsShowMessageBoxLabel".Translate(), ref showMessageBox, "LPR_SettingsShowMessageBoxDescription".Translate());

// Backup original values
TextAnchor backupAnchor = Text.Anchor;
Text.Anchor = TextAnchor.MiddleLeft;
if (ls.ButtonTextLabeled("LPR_SettingsRenderFeedbackLabel".Translate(), ("LPR_RenderFeedback_" + renderFeedback).Translate()))
{
List<FloatMenuOption> menuEntries = new List<FloatMenuOption>();
menuEntries.Add(new FloatMenuOption(("LPR_RenderFeedback_" + RenderFeedback.None).Translate(), delegate
{
renderFeedback = RenderFeedback.None;
}));
menuEntries.Add(new FloatMenuOption(("LPR_RenderFeedback_" + RenderFeedback.Message).Translate(), delegate
{
renderFeedback = RenderFeedback.Message;
}));
menuEntries.Add(new FloatMenuOption(("LPR_RenderFeedback_" + RenderFeedback.Window).Translate(), delegate
{
renderFeedback = RenderFeedback.Window;
}));
Find.WindowStack.Add(new FloatMenu(menuEntries));
}
// Restore original values
Text.Anchor = backupAnchor;

ls.GapGapLine(GapHeight);

ls.CheckboxGroupLabeled("LPR_SettingsRenderSettingsLabel".Translate(), "LPR_SettingsRenderSettingsDescription".Translate(), "LPR_SettingsRenderDesignationsLabel".Translate(), ref renderDesignations, "LPR_SettingsRenderDesignationsDescription".Translate(), "LPR_SettingsRenderThingIconsLabel".Translate(), ref renderThingIcons, "LPR_SettingsRenderThingIconsDescription".Translate());
Expand All @@ -76,7 +99,7 @@ public void DoWindowContents(Rect rect)
ls.GapGapLine(GapHeight);

// Backup original values
TextAnchor backupAnchor = Text.Anchor;
backupAnchor = Text.Anchor;
Text.Anchor = TextAnchor.MiddleLeft;
if (ls.ButtonTextLabeled("LPR_SettingsEncodingLabel".Translate(), ("LPR_ImgEncoding_" + encoding).Translate()))
{
Expand Down Expand Up @@ -138,7 +161,7 @@ public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref enabled, "enabled", DefaultEnabled);
Scribe_Values.Look(ref showMessageBox, "showMessageBox", DefaultShowMessageBox);
Scribe_Values.Look(ref renderFeedback, "renderFeedback", DefaultRenderFeedback);
Scribe_Values.Look(ref renderDesignations, "renderDesignations", DefaultRenderDesignations);
Scribe_Values.Look(ref renderThingIcons, "renderThingIcons", DefaultRenderThingIcons);
Scribe_Values.Look(ref renderGameConditions, "renderGameConditions", DefaultRenderGameConditions);
Expand Down

0 comments on commit b52d5ba

Please sign in to comment.