Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit 65f9f0c

Browse files
Split into UI and Core projects
1 parent ed8386b commit 65f9f0c

85 files changed

Lines changed: 846 additions & 821 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: setup-env
2+
description: Setup Environment
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup .NET
8+
uses: actions/setup-dotnet@v4
9+
with:
10+
dotnet-version: '10.0.x'
11+
12+
- name: Print .NET version and SDKs
13+
shell: bash
14+
run: |
15+
dotnet --version
16+
dotnet --list-sdks

.github/workflows/dotnetcore.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ on:
99
- '*'
1010
workflow_dispatch:
1111

12-
env:
13-
DOTNET_VERSION: '8.0.x'
14-
1512
jobs:
1613
test:
1714
name: Test
@@ -21,10 +18,8 @@ jobs:
2118
- name: Checkout Repo
2219
uses: actions/checkout@v6
2320

24-
- name: Setup .NET
25-
uses: actions/setup-dotnet@v5
26-
with:
27-
dotnet-version: ${{ env.DOTNET_VERSION }}
21+
- name: Setup Environment
22+
uses: ./.github/actions/setup-env
2823

2924
# Test
3025
- name: Unit Tests
@@ -39,10 +34,9 @@ jobs:
3934
# Setup
4035
- name: Checkout repo
4136
uses: actions/checkout@v6
42-
- name: Setup .NET
43-
uses: actions/setup-dotnet@v5
44-
with:
45-
dotnet-version: ${{ env.DOTNET_VERSION }}
37+
38+
- name: Setup Environment
39+
uses: ./.github/actions/setup-env
4640

4741
# Build
4842
- name: Build
@@ -63,10 +57,9 @@ jobs:
6357
# Setup
6458
- name: Checkout repo
6559
uses: actions/checkout@v6
66-
- name: Setup .NET
67-
uses: actions/setup-dotnet@v5
68-
with:
69-
dotnet-version: ${{ env.DOTNET_VERSION }}
60+
61+
- name: Setup Environment
62+
uses: ./.github/actions/setup-env
7063

7164
# Build
7265
- name: Build

BaldersGait.Core/AssemblyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using System.Runtime.CompilerServices;
2+
3+
[assembly: InternalsVisibleTo("BaldersGait.Core.UnitTests")]
4+
[assembly: InternalsVisibleTo("BaldersGait.UI.UnitTests")]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Autofac" Version="9.0.0" />
9+
<PackageReference Include="Serilog" Version="4.3.0" />
10+
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
11+
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
12+
<PackageReference Include="System.Reactive" Version="6.1.0" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
using Autofac;
2-
using BaldersGait.Services;
3-
using BaldersGait.Services.Interface;
2+
using BaldersGait.Core.Services.Interface;
3+
using BaldersGait.Core.Services;
44

5-
namespace BaldersGait;
5+
namespace BaldersGait.Core;
66

77
/// <summary>
88
/// Main module for the game, things get registered with Autofac here.
99
/// </summary>
10-
public class BaldersGaitModule : Module
10+
public class BaldersGaitCoreModule : Module
1111
{
12+
/// <inheritdoc />
1213
protected override void Load(ContainerBuilder builder)
1314
{
1415
//builder.RegisterType<HttpClient>().SingleInstance();
@@ -23,4 +24,4 @@ protected override void Load(ContainerBuilder builder)
2324
builder.RegisterAssemblyTypes(ThisAssembly)
2425
.Where(t => t.Name.EndsWith("ViewModel"));
2526
}
26-
}
27+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Runtime.CompilerServices;
2+
using Serilog;
3+
4+
namespace BaldersGait.Core;
5+
6+
/// <summary>
7+
/// Oh no, an error happened!
8+
/// </summary>
9+
public class BaldersGaitException : Exception
10+
{
11+
/// <summary>
12+
/// Flag for if the error that happened is recoverable from.
13+
/// </summary>
14+
public bool SaveRecoverable { get; init; }
15+
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="BaldersGaitException"/> class.
18+
/// </summary>
19+
/// <param name="message"></param>
20+
/// <param name="saveRecoverable"></param>
21+
/// <param name="thrownBy"></param>
22+
/// <param name="thrownAt"></param>
23+
public BaldersGaitException(string message, bool saveRecoverable, [CallerMemberName] string thrownBy = "", [CallerLineNumber] int thrownAt = 0)
24+
: base(message)
25+
{
26+
SaveRecoverable = saveRecoverable;
27+
28+
Log.Error($"{thrownBy}:{thrownAt}: {message}");
29+
}
30+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace BaldersGait.Core.Consts;
2+
3+
/// <summary>
4+
/// Constants related to the game state
5+
/// </summary>
6+
public class GameStateConsts
7+
{
8+
/// <summary>
9+
/// The max number of V1 upgrades for hair growth
10+
/// </summary>
11+
public const int HairGrowthV1UpgradesMax = 15;
12+
13+
/// <summary>
14+
/// The max number of V1 upgrades for the scaling factor
15+
/// </summary>
16+
public const int ScalingFactorV1UpgradesMax = 8;
17+
18+
/// <summary>
19+
/// The max number of V1 upgrades for max hair length
20+
/// </summary>
21+
public const int MaxHairV1UpgradesMax = 2;
22+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using BaldersGait.Core.Consts;
2+
using BaldersGait.Core.Models.SavedState;
3+
4+
namespace BaldersGait.Core.Models.CalculatedState;
5+
6+
/// <summary>
7+
/// Game state thats calculated at runtime, nothing in here is saved
8+
/// </summary>
9+
public sealed class CalculatedGameState
10+
{
11+
/// <summary>
12+
/// ctor
13+
/// </summary>
14+
/// <param name="savedGameState"></param>
15+
public CalculatedGameState(SavedGameState savedGameState)
16+
{
17+
Update(savedGameState);
18+
}
19+
20+
/// <summary>
21+
/// The base hair per tick before chair scaling modifiers
22+
/// </summary>
23+
public double BaseHairPerTick { get; private set; }
24+
25+
/// <summary>
26+
/// Should money be visible in the UI?
27+
/// </summary>
28+
public bool IsMoneyVisible { get; private set; }
29+
30+
/// <summary>
31+
/// Should the wig shop button be visible in the UI?
32+
/// </summary>
33+
public bool IsWigShopButtonVisible { get; private set; }
34+
35+
/// <summary>
36+
/// Are the hair growth V1 upgrades maxed out?
37+
/// </summary>
38+
public bool IsHairGrowthV1UpgradesMaxed { get; private set; }
39+
40+
/// <summary>
41+
/// Are the scaling factor V1 upgrades maxed out?
42+
/// </summary>
43+
public bool IsScalingFactorV1UpgradesMaxed { get; private set; }
44+
45+
/// <summary>
46+
/// Are the max hair V1 upgrades maxed out?
47+
/// </summary>
48+
public bool IsMaxHairV1UpgradesMaxed { get; private set; }
49+
50+
/// <summary>
51+
/// Updates the calculated state with the current saved game state
52+
/// </summary>
53+
/// <param name="savedGameState"></param>
54+
public void Update(SavedGameState savedGameState)
55+
{
56+
BaseHairPerTick = Math.Round(0.01 * (savedGameState.HairGrowthV1Upgrades + 1), 3); ;
57+
IsMoneyVisible = savedGameState.CompanyPurchased;
58+
IsWigShopButtonVisible = savedGameState.CompanyPurchased;
59+
IsHairGrowthV1UpgradesMaxed = savedGameState.HairGrowthV1Upgrades >= GameStateConsts.HairGrowthV1UpgradesMax;
60+
IsScalingFactorV1UpgradesMaxed = savedGameState.ScalingFactorV1Upgrades >= GameStateConsts.ScalingFactorV1UpgradesMax;
61+
IsMaxHairV1UpgradesMaxed = savedGameState.MaxHairV1Upgrades >= GameStateConsts.MaxHairV1UpgradesMax;
62+
}
63+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace BaldersGait.Core.Models.Enums;
2+
3+
/// <summary>
4+
/// The type of button in the UI
5+
/// </summary>
6+
public enum ButtonTypes
7+
{
8+
/// <summary>
9+
/// Should open a different panel within the application
10+
/// </summary>
11+
Panel,
12+
13+
/// <summary>
14+
/// Should open a link in the users browser
15+
/// </summary>
16+
Link
17+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace BaldersGait.Core.Models.Enums;
4+
5+
/// <summary>
6+
/// There are 8 chairs in the game, each will have its own number, this just makes it easier to refer to them.
7+
/// </summary>
8+
public enum ChairNumbers
9+
{
10+
/// <summary>
11+
/// Some kind of error happened, this is just here for the enum default.
12+
/// </summary>
13+
Unknown = 0,
14+
15+
/// <summary>
16+
/// Chair one
17+
/// </summary>
18+
One = 1,
19+
20+
/// <summary>
21+
/// Chair two
22+
/// </summary>
23+
Two = 2,
24+
25+
/// <summary>
26+
/// Chair three
27+
/// </summary>
28+
Three = 3,
29+
30+
/// <summary>
31+
/// Chair four
32+
/// </summary>
33+
Four = 4,
34+
35+
/// <summary>
36+
/// Chair five
37+
/// </summary>
38+
Five = 5,
39+
40+
/// <summary>
41+
/// Chair six
42+
/// </summary>
43+
Six = 6,
44+
45+
/// <summary>
46+
/// Chair seven
47+
/// </summary>
48+
Seven = 7,
49+
50+
/// <summary>
51+
/// Chair eight
52+
/// </summary>
53+
Eight = 8
54+
}

0 commit comments

Comments
 (0)