Add string resources

This commit is contained in:
drewjcooper
2023-02-05 19:05:23 +11:00
parent 487b7ded98
commit 3c9c04429d
17 changed files with 146 additions and 0 deletions

View File

@@ -0,0 +1 @@
You made that bet once already,dum-dum

View File

@@ -0,0 +1 @@
Number {0}

View File

@@ -0,0 +1 @@
You broke the house!

View File

@@ -0,0 +1,14 @@
------------------------------------------------------------------------Check No. {0}
{1:mmmm d',' yyyy}
Pay to the order of-----{2}-----$ {3}
The Memory Bank of New YORK
The Computer
----------X-----
--------------------------------------------------------------Come back soon!

View File

@@ -0,0 +1 @@
To whom shall I make the check

View File

@@ -0,0 +1 @@
How many bets

View File

@@ -0,0 +1,48 @@
This is the betting layout
(*=RED)
1* 2 3*
4 5* 6
7* 8 9*
10 11 12*
---------------
13 14* 15
16* 17 18*
19* 20 21*
22 23* 24
---------------
25* 26 27*
28 29 30*
31 32* 33
34* 35 36*
---------------
00 0
Types of bets
The numbers 1 to 36 signify a straight bet
on that number.
These pay off 35:1
The 2:1 bets are:
37) 1-12 40) First column
38) 13-24 41) Second column
39) 25-36 42) Third column
The even money bets are:
43) 1-18 46) Odd
44) 19-36 47) Red
45) Even 48) Black
49)0 and 50)00 pay off 35:1
Note: 0 and 00 do not count under any
bets except their own.
When I ask for each bet, type the number
and the amount, separated by a comma.
For example: to bet $500 on Black, type 48,500
when I ask for a bet.
The minimum bet is $5, the maximum is $500.

View File

@@ -0,0 +1 @@
Do you want instructions

View File

@@ -0,0 +1 @@
Oops! you just spent your last dollar!

View File

@@ -0,0 +1 @@
You {0} {1} dollars on bet {2}

View File

@@ -0,0 +1,59 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Games.Common.Randomness;
namespace Roulette.Resources;
internal static class Resource
{
internal static class Streams
{
public static Stream Title => GetStream();
public static Stream Instructions => GetStream();
public static Stream BetAlready => GetStream();
public static Stream Spinning => GetStream();
public static Stream LastDollar => GetStream();
public static Stream BrokeHouse => GetStream();
public static Stream Thanks => GetStream();
}
internal static class Strings
{
public static string Black(int number) => Slot(number);
public static string Red(int number) => Slot(number);
private static string Slot(int number, [CallerMemberName] string? colour = null)
=> string.Format(GetString(), number, colour);
public static string Lose(int amount, int bet) => Outcome(amount, bet);
public static string Win(int amount, int bet) => Outcome(amount, bet);
private static string Outcome(int amount, int bet, [CallerMemberName] string? winlose = null)
=> string.Format(GetString(), winlose, amount, bet);
public static string Totals(int me, int you) => string.Format(GetString(), me, you);
public static string Check(IRandom random, string payee, int amount)
=> string.Format(GetString(), random.Next(100), DateTime.Now, payee, amount);
}
internal static class Prompts
{
public static string Instructions => GetPrompt();
public static string HowManyBets => GetPrompt();
public static string Bet(int number) => string.Format(GetPrompt(), number);
public static string Again => GetPrompt();
public static string Check => GetPrompt();
}
private static string GetPrompt([CallerMemberName] string? name = null) => GetString($"{name}Prompt");
private static string GetString([CallerMemberName] string? name = null)
{
using var stream = GetStream(name);
using var reader = new StreamReader(stream);
return reader.ReadToEnd();
}
private static Stream GetStream([CallerMemberName] string? name = null) =>
Assembly.GetExecutingAssembly().GetManifestResourceStream($"{typeof(Resource).Namespace}.{name}.txt")
?? throw new Exception($"Could not find embedded resource stream '{name}'.");
}

View File

@@ -0,0 +1,2 @@
{0} {1}

View File

@@ -0,0 +1,3 @@
SPINNING

View File

@@ -0,0 +1,3 @@
Thanks for you money.
I'll use it to buy a solid gold roulette WHEEL

View File

@@ -0,0 +1,7 @@
Roulette
Creative Computing Morristown, New Jersey
Welcome to the roulette table

View File

@@ -0,0 +1,2 @@
Totals Me You
{0,-14}{1}