Update README with dynamic image loading instructions
Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com>
This commit is contained in:
parent
fcb67751ab
commit
e6708439a5
1 changed files with 21 additions and 5 deletions
26
README.md
26
README.md
|
|
@ -103,13 +103,29 @@ MemoryGame/
|
|||
|
||||
## Adding New Words/Images
|
||||
|
||||
To add new words and images:
|
||||
The game dynamically loads images from the `wwwroot/images/` folder. To add new words and images:
|
||||
|
||||
1. Add an SVG image to `wwwroot/images/` (name it `[word].svg`)
|
||||
2. Update the `_defaultWords` list in `Services/GameService.cs`:
|
||||
```csharp
|
||||
new() { Word = "newword", ImagePath = "images/newword.svg", CorrectCount = 0, IncorrectCount = 0 }
|
||||
1. **Add your image**: Place an SVG image in `wwwroot/images/` with the English filename (e.g., `apple.svg`, `orange.svg`)
|
||||
2. **Update the manifest**: Add the filename (without extension) to `wwwroot/images-manifest.txt`:
|
||||
```
|
||||
apple
|
||||
orange
|
||||
```
|
||||
3. **Add German translation** (optional): If you want a custom German translation, update the `ConvertToGermanWord` method in `Services/GameService.cs`:
|
||||
```csharp
|
||||
"apple" => "Apfel",
|
||||
"orange" => "Orange",
|
||||
```
|
||||
|
||||
If no translation is provided, the filename will be capitalized and used as-is.
|
||||
|
||||
4. **Regenerate manifest** (alternative): You can automatically regenerate the manifest by running:
|
||||
```bash
|
||||
cd MemoryGame/wwwroot/images
|
||||
ls *.svg | sed 's/\.svg$//' > ../images-manifest.txt
|
||||
```
|
||||
|
||||
The game will automatically load and use the new images in the next session!
|
||||
|
||||
## Browser Compatibility
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue