mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-08 11:24:49 -08:00
Add player input routines
This commit is contained in:
1
53_King/csharp/Resources/GiveRallodsError.txt
Normal file
1
53_King/csharp/Resources/GiveRallodsError.txt
Normal file
@@ -0,0 +1 @@
|
||||
Think again. You've only got {0} rallods in the treasury.
|
||||
1
53_King/csharp/Resources/GiveRallodsPrompt.txt
Normal file
1
53_King/csharp/Resources/GiveRallodsPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many rallods will you distribute among your countrymen
|
||||
1
53_King/csharp/Resources/PlantLandError1.txt
Normal file
1
53_King/csharp/Resources/PlantLandError1.txt
Normal file
@@ -0,0 +1 @@
|
||||
Sorry, but each countryman can only plant 2 sq. miles.
|
||||
1
53_King/csharp/Resources/PlantLandError2.txt
Normal file
1
53_King/csharp/Resources/PlantLandError2.txt
Normal file
@@ -0,0 +1 @@
|
||||
Sorry, but you've only {0} sq. miles of farm land.
|
||||
1
53_King/csharp/Resources/PlantLandError3.txt
Normal file
1
53_King/csharp/Resources/PlantLandError3.txt
Normal file
@@ -0,0 +1 @@
|
||||
Think again, You've only {0} rallods left in the treasury.
|
||||
1
53_King/csharp/Resources/PlantLandPrompt.txt
Normal file
1
53_King/csharp/Resources/PlantLandPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many square miles do you wish to plant
|
||||
1
53_King/csharp/Resources/PollutionError.txt
Normal file
1
53_King/csharp/Resources/PollutionError.txt
Normal file
@@ -0,0 +1 @@
|
||||
Think again. You only have {0} rallods remaining.
|
||||
1
53_King/csharp/Resources/PollutionPrompt.txt
Normal file
1
53_King/csharp/Resources/PollutionPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many rallods do you wish to spend on pollution control
|
||||
@@ -5,11 +5,52 @@ namespace King.Resources;
|
||||
|
||||
internal static class Resource
|
||||
{
|
||||
private static bool _sellLandErrorShown;
|
||||
|
||||
public static Stream Title => GetStream();
|
||||
|
||||
public static string InstructionsPrompt => GetString();
|
||||
public static string InstructionsText(int years) => string.Format(GetString(), years);
|
||||
|
||||
public static string Status(
|
||||
float rallods,
|
||||
float countrymen,
|
||||
float workers,
|
||||
float land,
|
||||
float landValue,
|
||||
float plantingCost)
|
||||
=> string.Format(
|
||||
workers == 0 ? StatusWithWorkers : StatusSansWorkers,
|
||||
rallods,
|
||||
(int)countrymen,
|
||||
(int)workers,
|
||||
(int)land,
|
||||
landValue,
|
||||
plantingCost);
|
||||
|
||||
private static string StatusWithWorkers => GetString();
|
||||
private static string StatusSansWorkers => GetString();
|
||||
|
||||
public static string SellLandPrompt => GetString();
|
||||
public static string SellLandError(float farmLand)
|
||||
{
|
||||
var error = string.Format(GetString(), farmLand, _sellLandErrorShown ? "" : SellLandErrorReason);
|
||||
_sellLandErrorShown = true;
|
||||
return error;
|
||||
}
|
||||
private static string SellLandErrorReason => GetString();
|
||||
|
||||
public static string GiveRallodsPrompt => GetString();
|
||||
public static string GiveRallodsError(float rallods) => string.Format(GetString(), rallods);
|
||||
|
||||
public static string PlantLandPrompt => GetString();
|
||||
public static string PlantLandError1 => GetString();
|
||||
public static string PlantLandError2(float farmLand) => string.Format(GetString(), farmLand);
|
||||
public static string PlantLandError3(float rallods) => string.Format(GetString(), rallods);
|
||||
|
||||
public static string PollutionPrompt => GetString();
|
||||
public static string PollutionError(float rallods) => string.Format(GetString(), rallods);
|
||||
|
||||
public static string SavedYearsPrompt => GetString();
|
||||
public static string SavedYearsError(int years) => string.Format(GetString(), years);
|
||||
public static string SavedTreasuryPrompt => GetString();
|
||||
@@ -17,27 +58,6 @@ internal static class Resource
|
||||
public static string SavedWorkersPrompt => GetString();
|
||||
public static string SavedLandPrompt => GetString();
|
||||
public static string SavedLandError => GetString();
|
||||
|
||||
internal static class Formats
|
||||
{
|
||||
public static string Player => GetString();
|
||||
public static string YouLose => GetString();
|
||||
}
|
||||
|
||||
internal static class Prompts
|
||||
{
|
||||
public static string WantInstructions => GetString();
|
||||
public static string HowManyPlayers => GetString();
|
||||
public static string HowManyRows => GetString();
|
||||
public static string HowManyColumns => GetString();
|
||||
public static string TooManyColumns => GetString();
|
||||
}
|
||||
|
||||
internal static class Strings
|
||||
{
|
||||
public static string TooManyColumns => GetString();
|
||||
public static string TooManyRows => GetString();
|
||||
}
|
||||
|
||||
private static string GetString([CallerMemberName] string? name = null)
|
||||
{
|
||||
|
||||
2
53_King/csharp/Resources/SellLandError.txt
Normal file
2
53_King/csharp/Resources/SellLandError.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
*** Think again. You only have {0} square miles of farm land.
|
||||
{1}
|
||||
4
53_King/csharp/Resources/SellLandErrorReason.txt
Normal file
4
53_King/csharp/Resources/SellLandErrorReason.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
(Foreign industry will only buy farm land because
|
||||
forest land is uneconomical to strip mine due to trees,
|
||||
thicker top soil, etc.)
|
||||
1
53_King/csharp/Resources/SellLandPrompt.txt
Normal file
1
53_King/csharp/Resources/SellLandPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many square miles do you wish to sell to industry
|
||||
6
53_King/csharp/Resources/StatusSansWorkers.txt
Normal file
6
53_King/csharp/Resources/StatusSansWorkers.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
You now have {0} rallods in the treasury.
|
||||
{1} countrymen, and {3} sq. miles of land.
|
||||
This year industry will buy land for {4} rallods per square mile.
|
||||
Land currently costs {5} rallods per square mile to plant.
|
||||
|
||||
6
53_King/csharp/Resources/StatusWithWorkers.txt
Normal file
6
53_King/csharp/Resources/StatusWithWorkers.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
You now have {0} rallods in the treasury.
|
||||
{1} countrymen, {2} foreign workers and {3} sq. miles of land.
|
||||
This year industry will buy land for {4} rallods per square mile.
|
||||
Land currently costs {5} rallods per square mile to plant.
|
||||
|
||||
Reference in New Issue
Block a user