diff --git a/Barotrauma/BarotraumaClient/Icon.bmp b/Barotrauma/BarotraumaClient/Icon.bmp
new file mode 100644
index 000000000..dedeee273
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Icon.bmp differ
diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj
index 5bfa817fa..9f61fb02c 100644
--- a/Barotrauma/BarotraumaClient/LinuxClient.csproj
+++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj
@@ -31,6 +31,7 @@
true
+ ..\BarotraumaShared\IconBmp.bmp
..\BarotraumaShared\Icon.ico
@@ -103,6 +104,7 @@
PreserveNewest
+
PreserveNewest
@@ -152,13 +154,16 @@
-
+
+
+ PreserveNewest
+
PreserveNewest
@@ -187,6 +192,11 @@
+
+
+ Icon.bmp
+
+
diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj
index 5fbe31943..29dd488d3 100644
--- a/Barotrauma/BarotraumaClient/MacClient.csproj
+++ b/Barotrauma/BarotraumaClient/MacClient.csproj
@@ -103,6 +103,7 @@
PreserveNewest
+
PreserveNewest
@@ -159,6 +160,9 @@
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
index 08da64291..def51c503 100644
--- a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
+++ b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.8.9.5")]
-[assembly: AssemblyFileVersion("0.8.9.5")]
+[assembly: AssemblyVersion("0.8.9.6")]
+[assembly: AssemblyFileVersion("0.8.9.6")]
diff --git a/Barotrauma/BarotraumaClient/Shaders/Content.mgcb b/Barotrauma/BarotraumaClient/Shaders/Content.mgcb
new file mode 100644
index 000000000..cc09bad54
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/Shaders/Content.mgcb
@@ -0,0 +1,57 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:Windows
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#
+
+#begin blurshader.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:blurshader.fx
+
+#begin damageshader.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:damageshader.fx
+
+#begin deformshader.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:deformshader.fx
+
+#begin losshader.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:losshader.fx
+
+#begin postprocess.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:postprocess.fx
+
+#begin watershader.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:watershader.fx
+
+#begin solidcolor.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:solidcolor.fx
+
diff --git a/Barotrauma/BarotraumaClient/Shaders/Content_opengl.mgcb b/Barotrauma/BarotraumaClient/Shaders/Content_opengl.mgcb
new file mode 100644
index 000000000..6606ae7ca
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/Shaders/Content_opengl.mgcb
@@ -0,0 +1,62 @@
+
+#----------------------------- Global Properties ----------------------------#
+
+/outputDir:bin/$(Platform)
+/intermediateDir:obj/$(Platform)
+/platform:DesktopGL
+/config:
+/profile:Reach
+/compress:False
+
+#-------------------------------- References --------------------------------#
+
+
+#---------------------------------- Content ---------------------------------#
+
+#begin blurshader_opengl.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:blurshader_opengl.fx
+
+#begin Content_opengl.mgcb
+/importer:
+/processor:
+/build:Content_opengl.mgcb
+
+#begin damageshader_opengl.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:damageshader_opengl.fx
+
+#begin deformshader_opengl.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:deformshader_opengl.fx
+
+#begin losshader_opengl.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:losshader_opengl.fx
+
+#begin postprocess_opengl.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:postprocess_opengl.fx
+
+#begin solidcolor_opengl.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:solidcolor_opengl.fx
+
+#begin watershader_opengl.fx
+/importer:EffectImporter
+/processor:EffectProcessor
+/processorParam:DebugMode=Auto
+/build:watershader_opengl.fx
+
diff --git a/Barotrauma/BarotraumaClient/Shaders/solidcolor.fx b/Barotrauma/BarotraumaClient/Shaders/solidcolor.fx
new file mode 100644
index 000000000..846f3d2fe
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/Shaders/solidcolor.fx
@@ -0,0 +1,38 @@
+Texture2D xTexture;
+sampler TextureSampler = sampler_state { Texture = ; };
+
+float blurDistance;
+float4 color;
+
+float4 solidColor(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
+{
+ float a = tex2D(TextureSampler, texCoord).a;
+ return color * a;
+}
+
+float4 solidColorBlur(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
+{
+ float sample;
+ sample = tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y + blurDistance)).a;
+ sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y - blurDistance)).a;
+ sample += tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y - blurDistance)).a;
+ sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y + blurDistance)).a;
+ sample = sample * 0.25f;
+
+ return color * sample;
+}
+
+technique SolidColor
+{
+ pass Pass1
+ {
+ PixelShader = compile ps_4_0_level_9_1 solidColor();
+ }
+}
+technique SolidColorBlur
+{
+ pass Pass1
+ {
+ PixelShader = compile ps_4_0_level_9_1 solidColorBlur();
+ }
+}
\ No newline at end of file
diff --git a/Barotrauma/BarotraumaClient/Shaders/solidcolor_opengl.fx b/Barotrauma/BarotraumaClient/Shaders/solidcolor_opengl.fx
new file mode 100644
index 000000000..2c82b0bf3
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/Shaders/solidcolor_opengl.fx
@@ -0,0 +1,38 @@
+Texture xTexture;
+sampler TextureSampler = sampler_state { Texture = ; };
+
+float blurDistance;
+float4 color;
+
+float4 solidColor(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
+{
+ float a = tex2D(TextureSampler, texCoord).a;
+ return color * a;
+}
+
+float4 solidColorBlur(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
+{
+ float sample;
+ sample = tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y + blurDistance)).a;
+ sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y - blurDistance)).a;
+ sample += tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y - blurDistance)).a;
+ sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y + blurDistance)).a;
+ sample = sample * 0.25f;
+
+ return color * sample;
+}
+
+technique SolidColor
+{
+ pass Pass1
+ {
+ PixelShader = compile ps_3_0 solidColor();
+ }
+}
+technique SolidColorBlur
+{
+ pass Pass1
+ {
+ PixelShader = compile ps_3_0 solidColorBlur();
+ }
+}
\ No newline at end of file
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
index 86c88a3e0..fd0af8cf0 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
@@ -242,7 +242,7 @@ namespace Barotrauma
GUI.Style.FocusIndicator.Draw(spriteBatch,
(int)((focusedItemOverlayTimer - 1.0f) * GUI.Style.FocusIndicator.FrameCount * 3.0f),
circlePos,
- Color.Orange * 0.3f,
+ Color.LightBlue * 0.3f,
origin: GUI.Style.FocusIndicator.FrameSize.ToVector2() / 2,
rotate: (float)Timing.TotalTime,
scale: scale);
@@ -274,9 +274,7 @@ namespace Barotrauma
GUI.DrawString(spriteBatch, textPos, coloredText.Text, coloredText.Color * alpha, Color.Black * alpha * 0.7f, 2, GUI.SmallFont);
textPos.Y += 20;
}
- }
-
-
+ }
}
foreach (HUDProgressBar progressBar in character.HUDProgressBars.Values)
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHealth.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHealth.cs
index 4fb00dc00..75ea85fb8 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHealth.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHealth.cs
@@ -544,7 +544,10 @@ namespace Barotrauma
{
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(Vitality / MaxVitality, Color.Red, Color.Orange, Color.Green);
healthBar.HoverColor = healthWindowHealthBar.HoverColor = healthBar.Color * 2.0f;
- healthBar.BarSize = healthWindowHealthBar.BarSize = (Vitality > 0.0f) ? Vitality / MaxVitality : 1.0f - Vitality / MinVitality;
+ healthBar.BarSize = healthWindowHealthBar.BarSize =
+ (Vitality > 0.0f) ?
+ (MaxVitality > 0.0f ? Vitality / MaxVitality : 0.0f) :
+ (Math.Abs(MinVitality) > 0.0f ? 1.0f - Vitality / MinVitality : 0.0f);
if (healthBarPulsateTimer > 0.0f)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs
index 4aac62ef9..54acd801e 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterNetworking.cs
@@ -363,7 +363,7 @@ namespace Barotrauma
character.ID = id;
character.TeamID = (TeamType)teamID;
- if (configPath == HumanConfigFile)
+ if (configPath == HumanConfigFile && character.TeamID != TeamType.FriendlyNPC)
{
CharacterInfo duplicateCharacterInfo = GameMain.GameSession.CrewManager.GetCharacterInfos().FirstOrDefault(c => c.ID == info.ID);
GameMain.GameSession.CrewManager.RemoveCharacterInfo(duplicateCharacterInfo);
diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
index 6345fd8d7..43e6a9938 100644
--- a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
+++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
@@ -436,7 +436,7 @@ namespace Barotrauma
AssignOnExecute("ambientlight", (string[] args) =>
{
- Color color = XMLExtensions.ParseColor(string.Join("", args));
+ Color color = XMLExtensions.ParseColor(string.Join(",", args));
if (Level.Loaded != null)
{
Level.Loaded.GenerationParams.AmbientLightColor = color;
@@ -1060,2559 +1060,6 @@ namespace Barotrauma
}));
#endif
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-#endif
-
- commands.Add(new Command("cleanbuild", "", (string[] args) =>
- {
- GameMain.Config.MusicVolume = 0.5f;
- GameMain.Config.SoundVolume = 0.5f;
- NewMessage("Music and sound volume set to 0.5", Color.Green);
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- }));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
- GameMain.Config.SaveNewPlayerConfig();
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-
- commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
- {
- string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
- string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
-
- string[] lines;
- try
- {
- lines = File.ReadAllLines(sourcePath);
- }
- catch (Exception e)
- {
- ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
- return;
- }
- var doc = XMLExtensions.TryLoadXml(destinationPath);
- int i = 0;
- foreach (XElement element in doc.Root.Elements())
- {
- if (i >= lines.Length)
- {
- ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
- return;
- }
- element.Value = lines[i];
- i++;
- }
- doc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
- return new string[][]
- {
- files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
- files.Where(f => Path.GetExtension(f)==".xml").ToArray()
- };
- }));
-
- commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
- {
- if (args.Length < 2) return;
- string sourcePath = args[0];
- string destinationPath = args[1];
-
- var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
- var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
-
- XElement destinationElement = destinationDoc.Root.Elements().First();
- foreach (XElement element in sourceDoc.Root.Elements())
- {
- if (destinationDoc.Root.Element(element.Name) == null)
- {
- element.Value = "!!!!!!!!!!!!!" + element.Value;
- destinationElement.AddAfterSelf(element);
- }
- XNode nextNode = destinationElement.NextNode;
- while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
- destinationElement = nextNode as XElement;
- }
- destinationDoc.Save(destinationPath);
- },
- () =>
- {
- var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
- return new string[][]
- {
- files,
- files
- };
- }));
-
- commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
- {
- string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
- List lines = new List();
- foreach (MapEntityPrefab me in MapEntityPrefab.List)
- {
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
- }
- File.WriteAllLines(filePath, lines);
- }));
-#if DEBUG
- commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
- {
- if (args.Length != 1) return;
- TextManager.CheckForDuplicates(args[0]);
- }));
-
- commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
- {
- TextManager.WriteToCSV();
- NPCConversation.WriteToCSV();
- }));
-
- commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
- {
- float defaultZoom = Screen.Selected.Cam.DefaultZoom;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
-
- float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
- float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
-
- float minZoom = Screen.Selected.Cam.MinZoom;
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
- float maxZoom = Screen.Selected.Cam.MaxZoom;
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
-
- Screen.Selected.Cam.DefaultZoom = defaultZoom;
- Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
- Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
- Screen.Selected.Cam.MinZoom = minZoom;
- Screen.Selected.Cam.MaxZoom = maxZoom;
- }));
-
- commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
- {
- float distortScaleX = 0.5f, distortScaleY = 0.5f;
- float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
- float blurAmount = 0.0f;
- if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
- if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
- if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
- if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
- if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
- WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
- WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
- WaterRenderer.BlurAmount = blurAmount;
- },
- null, null));
-
-
- commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
- {
- //TODO: maybe do this automatically during loading when possible?
- if (Screen.Selected == GameMain.SubEditorScreen)
- {
- if (!MapEntity.SelectedAny)
- {
- ThrowError("You have to select item(s) first!");
- }
- else
- {
- foreach (var mapEntity in MapEntity.SelectedList)
- {
- if (mapEntity is Item item)
- {
- item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
- (int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
- (int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
- }
- else if (mapEntity is Structure structure)
- {
- if (!structure.ResizeHorizontal)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- (int)structure.Prefab.ScaledSize.X,
- structure.Rect.Height);
- }
- if (!structure.ResizeVertical)
- {
- structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
- structure.Rect.Width,
- (int)structure.Prefab.ScaledSize.Y);
- }
- }
- }
- }
- }
- }, isCheat: false));
-#endif
-
commands.Add(new Command("cleanbuild", "", (string[] args) =>
{
GameMain.Config.MusicVolume = 0.5f;
diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs
index 3f6d853ee..ded8f0896 100644
--- a/Barotrauma/BarotraumaClient/Source/GameMain.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs
@@ -210,12 +210,7 @@ namespace Barotrauma
public void SetWindowMode(WindowMode windowMode)
{
WindowMode = windowMode;
-#if !(OSX)
GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
-#else
- // Force borderless on macOS.
- GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed && Config.WindowMode != WindowMode.Fullscreen;
-#endif
GraphicsDeviceManager.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
Window.IsBorderless = !GraphicsDeviceManager.HardwareModeSwitch;
diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
index a5968ce0f..1ef20b629 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
@@ -61,120 +61,9 @@ namespace Barotrauma
public CrewManager(XElement element, bool isSinglePlayer)
: this(isSinglePlayer)
{
- guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent)
+ foreach (XElement subElement in element.Elements())
{
- CanBeFocused = false
- };
-
- Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale));
-
- crewArea = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), "", Color.Transparent)
- {
- CanBeFocused = false
- };
- toggleCrewButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform)
- { AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
- "", style: "UIToggleButton");
- toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
- {
- toggleCrewAreaOpen = !toggleCrewAreaOpen;
- foreach (GUIComponent child in btn.Children)
- {
- child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
- }
- return true;
- };
-
- characterListBox = new GUIListBox(new RectTransform(new Point(100, (int)(crewArea.Rect.Height - scrollButtonSize.Y * 1.6f)), crewArea.RectTransform, Anchor.CenterLeft), false, Color.Transparent, null)
- {
- //Spacing = (int)(3 * GUI.Scale),
- ScrollBarEnabled = false,
- ScrollBarVisible = false,
- CanBeFocused = false
- };
-
- scrollButtonUp = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.TopLeft, Pivot.TopLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
- {
- Visible = false,
- UserData = -1,
- OnClicked = ScrollCharacterList
- };
- scrollButtonDown = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
- {
- Visible = false,
- UserData = 1,
- OnClicked = ScrollCharacterList
- };
- scrollButtonDown.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipVertically);
-
- if (isSinglePlayer)
- {
- chatBox = new ChatBox(guiFrame, isSinglePlayer: true)
- {
- OnEnterMessage = (textbox, text) =>
- {
- if (Character.Controlled == null) { return true; }
-
- textbox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
-
- if (!string.IsNullOrWhiteSpace(text))
- {
- string msgCommand = ChatMessage.GetChatMessageCommand(text, out string msg);
- AddSinglePlayerChatMessage(
- Character.Controlled.Info.Name,
- msg,
- ((msgCommand == "r" || msgCommand == "radio") && ChatMessage.CanUseRadio(Character.Controlled)) ? ChatMessageType.Radio : ChatMessageType.Default,
- Character.Controlled);
- var headset = GetHeadset(Character.Controlled, true);
- if (headset != null && headset.CanTransmit())
- {
- headset.TransmitSignal(stepsTaken: 0, signal: msg, source: headset.Item, sender: Character.Controlled, sendToChat: false);
- }
- }
- textbox.Deselect();
- textbox.Text = "";
- return true;
- }
- };
-
- chatBox.InputBox.OnTextChanged += chatBox.TypingChatMessage;
- }
-
- var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
- reportButtonFrame = new GUILayoutGroup(new RectTransform(
- new Point((HUDLayoutSettings.CrewArea.Height - (int)((reports.Count - 1) * 5 * GUI.Scale)) / reports.Count, HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform))
- {
- AbsoluteSpacing = (int)(5 * GUI.Scale),
- UserData = "reportbuttons",
- CanBeFocused = false
- };
-
- //report buttons
- foreach (Order order in reports)
- {
- if (!order.TargetAllCharacters || order.SymbolSprite == null) continue;
- var btn = new GUIButton(new RectTransform(new Point(reportButtonFrame.Rect.Width), reportButtonFrame.RectTransform), style: null)
- {
- OnClicked = (GUIButton button, object userData) =>
- {
- if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false;
- SetCharacterOrder(null, order, null, Character.Controlled);
- HumanAIController.PropagateHullSafety(Character.Controlled, Character.Controlled.CurrentHull);
- return true;
- },
- UserData = order,
- ToolTip = order.Name
- };
-
- new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow")
- {
- Color = Color.Red * 0.8f,
- HoverColor = Color.Red * 1.0f,
- PressedColor = Color.Red * 0.6f,
- UserData = "highlighted",
- CanBeFocused = false,
- Visible = false
- };
+ if (subElement.Name.ToString().ToLowerInvariant() != "character") continue;
var characterInfo = new CharacterInfo(subElement);
characterInfos.Add(characterInfo);
@@ -185,20 +74,6 @@ namespace Barotrauma
break;
}
}
-
- screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
-
- prevUIScale = GUI.Scale;
- }
-
-
- #endregion
-
- #region Character list management
-
- public Rectangle GetCharacterListArea()
- {
- return characterListBox.Rect;
}
partial void InitProjectSpecific()
@@ -713,7 +588,7 @@ namespace Barotrauma
characterListBox.BarScroll -= characterListBox.BarScroll % step;
characterListBox.BarScroll += dir * step;
- return radioItem.GetComponent();
+ return false;
}
private IEnumerable