Skip to content

Commit

Permalink
Moved property constants to naming utils
Browse files Browse the repository at this point in the history
  • Loading branch information
8vogt committed Mar 22, 2021
1 parent aea5d7e commit 8c1cfa5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,11 @@ private string GetBeltName(int beltIndex)
{
string namingScheme = MySettings.Static.Settings.BeltNameFormat;

string name = namingScheme.SetProperty("ObjectNumber", beltIndex + 1)
.SetProperty("ObjectNumberGreek", MyNamingUtils.GREEK_LETTERS[beltIndex % MyNamingUtils.GREEK_LETTERS.Length])
.SetProperty("ObjectNumberRoman", MyNamingUtils.ConvertNumberToRoman(beltIndex + 1))
.SetProperty("ObjectLetterLower", (char)('a' + (beltIndex % 26)))
.SetProperty("ObjectLetterUpper", (char)('A' + (beltIndex % 26)));
string name = namingScheme.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER, beltIndex + 1)
.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER_GREEK, MyNamingUtils.GREEK_LETTERS[beltIndex % MyNamingUtils.GREEK_LETTERS.Length])
.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER_ROMAN, MyNamingUtils.ConvertNumberToRoman(beltIndex + 1))
.SetProperty(MyNamingUtils.PROP_OBJ_LETTER_LOWER, (char)('a' + (beltIndex % 26)))
.SetProperty(MyNamingUtils.PROP_OBJ_LETTER_UPPER, (char)('A' + (beltIndex % 26)));

return name;
}
Expand Down
35 changes: 13 additions & 22 deletions SEWorldGenPlugin/Generator/MyStarSystemGenerator.Naming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ namespace SEWorldGenPlugin.Generator
{
public partial class MyStarSystemGenerator
{
public static readonly string PROP_OBJ_NUMBER = "ObjectNumber";
public static readonly string PROP_OBJ_NUMBER_GREEK = "ObjectNumberGreek";
public static readonly string PROP_OBJ_NUMBER_ROMAN = "ObjectNumberRoman";
public static readonly string PROP_OBJ_LETTER_LOWER = "ObjectLetterLower";
public static readonly string PROP_OBJ_LETTER_UPPER = "ObjectLetterUpper";
public static readonly string PROP_OBJ_ID = "ObjectId";
public static readonly string PROP_OBJ_PARENT = "ParentName";


/// <summary>
/// Generates a name for the planet based on the naming scheme
/// defined in the global settings file
Expand All @@ -24,12 +15,12 @@ private string GetPlanetName(int planetIndex, string subtypeId)
{
string namingScheme = MySettings.Static.Settings.PlanetNameFormat;

string name = namingScheme.SetProperty(PROP_OBJ_NUMBER, planetIndex + 1)
.SetProperty(PROP_OBJ_NUMBER_GREEK, MyNamingUtils.GREEK_LETTERS[planetIndex % MyNamingUtils.GREEK_LETTERS.Length])
.SetProperty(PROP_OBJ_NUMBER_ROMAN, MyNamingUtils.ConvertNumberToRoman(planetIndex + 1))
.SetProperty(PROP_OBJ_LETTER_LOWER, (char)('a' + (planetIndex % 26)))
.SetProperty(PROP_OBJ_LETTER_UPPER, (char)('A' + (planetIndex % 26)))
.SetProperty(PROP_OBJ_ID, subtypeId);
string name = namingScheme.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER, planetIndex + 1)
.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER_GREEK, MyNamingUtils.GREEK_LETTERS[planetIndex % MyNamingUtils.GREEK_LETTERS.Length])
.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER_ROMAN, MyNamingUtils.ConvertNumberToRoman(planetIndex + 1))
.SetProperty(MyNamingUtils.PROP_OBJ_LETTER_LOWER, (char)('a' + (planetIndex % 26)))
.SetProperty(MyNamingUtils.PROP_OBJ_LETTER_UPPER, (char)('A' + (planetIndex % 26)))
.SetProperty(MyNamingUtils.PROP_OBJ_ID, subtypeId);

return name;
}
Expand All @@ -46,13 +37,13 @@ private string GetMoonName(int moonIndex, string subtypeId, string parentPlanetN
{
string namingScheme = MySettings.Static.Settings.MoonNameFormat;

string name = namingScheme.SetProperty(PROP_OBJ_NUMBER, moonIndex + 1)
.SetProperty(PROP_OBJ_NUMBER_GREEK, MyNamingUtils.GREEK_LETTERS[moonIndex % MyNamingUtils.GREEK_LETTERS.Length])
.SetProperty(PROP_OBJ_NUMBER_ROMAN, MyNamingUtils.ConvertNumberToRoman(moonIndex + 1))
.SetProperty(PROP_OBJ_LETTER_LOWER, (char)('a' + (moonIndex % 26)))
.SetProperty(PROP_OBJ_LETTER_UPPER, (char)('A' + (moonIndex % 26)))
.SetProperty(PROP_OBJ_ID, subtypeId)
.SetProperty(PROP_OBJ_PARENT, parentPlanetName);
string name = namingScheme.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER, moonIndex + 1)
.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER_GREEK, MyNamingUtils.GREEK_LETTERS[moonIndex % MyNamingUtils.GREEK_LETTERS.Length])
.SetProperty(MyNamingUtils.PROP_OBJ_NUMBER_ROMAN, MyNamingUtils.ConvertNumberToRoman(moonIndex + 1))
.SetProperty(MyNamingUtils.PROP_OBJ_LETTER_LOWER, (char)('a' + (moonIndex % 26)))
.SetProperty(MyNamingUtils.PROP_OBJ_LETTER_UPPER, (char)('A' + (moonIndex % 26)))
.SetProperty(MyNamingUtils.PROP_OBJ_ID, subtypeId)
.SetProperty(MyNamingUtils.PROP_OBJ_PARENT, parentPlanetName);

return name;
}
Expand Down
9 changes: 9 additions & 0 deletions SEWorldGenPlugin/Utilities/MyNamingUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ public class MyNamingUtils
/// </summary>
public static readonly string[] GREEK_LETTERS = new string[] { "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "My", "Ny", "Xi", "Omikron", "Pi", "Rho", "Sigma", "Tau", "Ypsilon", "Phi", "Chi", "Psi", "Omega" };

//Property names for naming
public static readonly string PROP_OBJ_NUMBER = "ObjectNumber";
public static readonly string PROP_OBJ_NUMBER_GREEK = "ObjectNumberGreek";
public static readonly string PROP_OBJ_NUMBER_ROMAN = "ObjectNumberRoman";
public static readonly string PROP_OBJ_LETTER_LOWER = "ObjectLetterLower";
public static readonly string PROP_OBJ_LETTER_UPPER = "ObjectLetterUpper";
public static readonly string PROP_OBJ_ID = "ObjectId";
public static readonly string PROP_OBJ_PARENT = "ParentName";

/// <summary>
/// Converts an integer to roman numerals
/// </summary>
Expand Down

0 comments on commit 8c1cfa5

Please sign in to comment.