Skip to content

Demos #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/BlazorUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

ConfigureLogging(builder);
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));

var baseAddress = new Uri(builder.HostEnvironment.BaseAddress);

Expand All @@ -23,15 +23,6 @@
builder.Services.AddHttpClient<IGameManifestRepository, LocalGameManifestRepository>(
client => client.BaseAddress = baseAddress);

builder.Services.AddSingleton<ISaveGameRepository, LocalStorageSaveGameRepository>();
//builder.Services.AddSaveGameRepository();
builder.Services.AddSaveGameRepository();

await builder.Build().RunAsync();

// TODO inline
static void ConfigureLogging(
WebAssemblyHostBuilder builder,
string section = "Logging")
{
builder.Logging.AddConfiguration(builder.Configuration.GetSection(section));
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/BlazorUI/wwwroot/games/disk001/game.csx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Item cheesegrater = AddItem(nameof(cheesegrater), builder => builder
.Named("cheese grater")
.CanBeUsedWithOtherObject()
.When.Use(with =>
{
protagonist.RemoveFromInventory(blockOfCheese);
protagonist.AddToInventory(gratedCheese);
}));

Item blockOfCheese = AddItem(nameof(blockOfCheese), builder => builder
.Named("block of cheese")
.CanBeUsedWithOtherObject()
.When.Use(with => cheesegrater.ActionHandlers.HandleUse(blockOfCheese)));

Item gratedCheese = AddItem(nameof(gratedCheese), builder => builder
.Named("grated cheese"));

Actor protagonist = AddActor(nameof(protagonist));

Room emptyRoom = AddRoom(nameof(emptyRoom), builder => builder
.WithWalkboxArea(
new Point(0, 0),
new Point(1, 0),
new Point(1, 1)));

OnGameStart(() =>
{
protagonist.AddToInventory(cheesegrater);
protagonist.AddToInventory(blockOfCheese);

SetProtagonist(protagonist);

ChangeRoom(emptyRoom);
});
109 changes: 5 additions & 104 deletions src/BlazorUI/wwwroot/games/disk001/game.yaml
Original file line number Diff line number Diff line change
@@ -1,109 +1,10 @@
metadata:
id: bodysnatchers
name: Return of the Body Snatchers
id: demo1
name: "Demo 1: Cheese Quest"
spec:
atlasses:
default:
textureUrl: assets/sprites.png
atlasUrl: assets/sprites.json
sprites:
al:
animations:
talk:
framePrefix: al/talk/
frameStart: 1
frameEnd: 4
frameZeroPadding: 4
frameRate: 9
walkLeft:
framePrefix: al/walk/left/
frameStart: 1
frameEnd: 6
frameZeroPadding: 4
frameRate: 9
walkRight:
framePrefix: al/walk/right/
frameStart: 1
frameEnd: 6
frameZeroPadding: 4
frameRate: 9
carl:
animations:
talk:
framePrefix: carl/talk/
frameStart: 1
frameEnd: 4
frameZeroPadding: 4
frameRate: 9
cooker:
animations:
smoke:
framePrefix: cooker/smoke/
frameStart: 1
frameEnd: 3
frameZeroPadding: 4
frameRate: 6
guy:
animations:
talk:
framePrefix: guy/talk/
frameStart: 1
frameEnd: 6
frameZeroPadding: 4
frameRate: 9
walkLeft:
framePrefix: guy/walk/left/
frameStart: 1
frameEnd: 6
frameZeroPadding: 4
frameRate: 9
walkRight:
framePrefix: guy/walk/right/
frameStart: 1
frameEnd: 6
frameZeroPadding: 4
frameRate: 9
ian:
animations:
talk:
framePrefix: ian/talk/
frameStart: 1
frameEnd: 4
frameZeroPadding: 4
frameRate: 9
walkLeft:
framePrefix: ian/walk/left/
frameStart: 1
frameEnd: 6
frameZeroPadding: 4
frameRate: 9
walkRight:
framePrefix: ian/walk/right/
frameStart: 1
frameEnd: 6
frameZeroPadding: 4
frameRate: 9
richard:
animations:
talk:
framePrefix: richard/talk/
frameStart: 1
frameEnd: 4
frameZeroPadding: 4
frameRate: 9
narrator:
frames:
transparent: transparent
ship-computer:
frames:
transparent: transparent
textureUrl: sprites.png
atlasUrl: sprites.json
scripts:
- scripts/actors.csx
- scripts/items.csx
- scripts/rooms.csx
- scripts/start.csx
- scripts/dialogues/al.csx
- scripts/dialogues/ian.csx
- scripts/dialogues/knock-knock.csx
- scripts/dialogues/richard.csx
inventorySpritesFolder: assets/inventory
- game.csx
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions src/BlazorUI/wwwroot/games/disk001/sprites.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"frames": {
"default": {
"frame": {
"h": 5,
"w": 5,
"x": 0,
"y": 0
},
"rotated": false,
"spriteSourceSize": {
"h": 5,
"w": 5,
"x": 0,
"y": 0
},
"sourceSize": {
"h": 5,
"w": 5
},
"trimmed": false
}
},
"meta": {
"image": "sprites.png"
}
}
Binary file added src/BlazorUI/wwwroot/games/disk001/sprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/BlazorUI/wwwroot/games/disk002/game.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
metadata:
id: demo2
name: "Demo 2: Stuck in a park"
spec:
atlasses:
default:
textureUrl: assets/sprites.png
atlasUrl: assets/sprites.json
scripts:
- scripts/start.csx
inventorySpritesFolder: assets/inventory
22 changes: 22 additions & 0 deletions src/BlazorUI/wwwroot/games/disk002/scripts/start.csx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Actor guy = AddActor("guy", builder => builder
.Untouchable());

Item newspaper = AddItem(nameof(newspaper), builder => builder
.Named("old newspaper")
.Untouchable());

Room park = AddRoom("park", room => room
.WithWalkboxArea(
new Point(0, 0),
new Point(1, 0),
new Point(1, 1)));

OnGameStart(() =>
{
park.Place(guy, 600, 430);
park.Place(newspaper, 410, 420);

SetProtagonist(guy);

ChangeRoom(park);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading