Skip to content
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

🚧Add manual test project #24

Merged
merged 25 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b199131
Start work for issue #23
CalvinWilkinson Aug 10, 2023
08bdf93
chore: add new empty project for manual testing
CalvinWilkinson Aug 14, 2023
5f59384
refactor: remove the IDisposable generic constraint
CalvinWilkinson Aug 10, 2023
7a92f3a
refactor: perform simple improvements
CalvinWilkinson Aug 10, 2023
9e97f08
refactor: change name of method parameter
CalvinWilkinson Aug 10, 2023
334d01a
refactor: change PointF type to Vector2
CalvinWilkinson Aug 10, 2023
fa4f61b
cleanup: remove unused methods and usings
CalvinWilkinson Aug 10, 2023
d6493eb
refactor: improve code in behavior update method
CalvinWilkinson Aug 10, 2023
40c67b0
refactor: improve names and comments for easing behavior
CalvinWilkinson Aug 14, 2023
431b390
chore: added engine update skip if no pools exist
CalvinWilkinson Aug 10, 2023
bfc44ca
deps: update and add nuget packages
CalvinWilkinson Aug 14, 2023
b521b64
cleanup: cleanup code
CalvinWilkinson Aug 14, 2023
ee3698c
chore: add proj refererence, content, and stylecop config
CalvinWilkinson Aug 14, 2023
f5240a5
chore: create scene to demo vertical movement
CalvinWilkinson Aug 14, 2023
d3908fa
chore: create a texture loader
CalvinWilkinson Aug 14, 2023
6dba75b
chore? create scene to demo horizontal movement
CalvinWilkinson Aug 14, 2023
edc80cc
chore: create scene to demo color transition
CalvinWilkinson Aug 14, 2023
ebf6141
chore: create scene to demo angles
CalvinWilkinson Aug 14, 2023
83f16fd
chore: create main window to load scenes
CalvinWilkinson Aug 14, 2023
183ad4b
ci: update build status check to build new project
CalvinWilkinson Aug 14, 2023
ce44b2e
ci: update reusable workflow versions
CalvinWilkinson Aug 14, 2023
34639ee
ci: rename and improve workflow due to v12.0.0
CalvinWilkinson Aug 14, 2023
27d9079
deps: add fluent assertions analyzer project
CalvinWilkinson Aug 14, 2023
c0c37c7
refactor: simple cleanup
CalvinWilkinson Aug 14, 2023
e9a8cf8
ci: set default shell for workflow
CalvinWilkinson Aug 14, 2023
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
21 changes: 0 additions & 21 deletions .github/workflows/add-new-issue-to-project.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/add-new-item-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 🤖Add New Issue To Project


on:
issues:
types: opened
pull_request:
types: opened
branches: [main, preview]


jobs:
item_number:
name: Get Item Number
runs-on: ubuntu-latest
outputs:
item-number: ${{ steps.get-item-number.outputs.item-number }}
steps:
- name: Get Item Number
id: get-item-number
run: |
$eventName = "${{ github.event_name }}";
$itemNumber = $eventName -eq "issues" ? "${{ github.event.issue.number }}" : "${{ github.event.pull_request.number }}";
$itemType = $eventName -eq "issues" ? "issue" : "pull request";

Write-Host "::notice::Invoked by $itemType '$itemNumber'";

"item-number=$itemNumber" >> $env:GITHUB_OUTPUT;


add_new_issue_to_project:
name: Add New Issue
needs: item_number
uses: KinsonDigital/Infrastructure/.github/workflows/[email protected]
with:
org-name: "${{ vars.ORGANIZATION_NAME }}"
org-project-name: "${{ vars.ORG_PROJECT_NAME }}"
repo-name: "${{ vars.PROJECT_NAME }}"
item-number: "${{ needs.item_number.outputs.item-number }}"
secrets:
cicd-pat: ${{ secrets.CICD_TOKEN }}
27 changes: 25 additions & 2 deletions .github/workflows/build-status-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,39 @@ name: ✅Build Status Check
run-name: ✅Build Status Check (${{ github.base_ref }} branch)


defaults:
run:
shell: pwsh


on:
pull_request:
branches: [main, preview]


jobs:
build_status_check:
build_main_project:
name: ${{ vars.PROJECT_NAME }} Build Status Check
uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v11.0.0
uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v12.0.0
with:
project-name: "${{ vars.PROJECT_NAME }}"
build-config: Debug
net-sdk-version: "${{ vars.NET_SDK_VERSION }}"


build_testing_app:
name: ${{ vars.PROJECT_NAME }} Build Status Check
uses: KinsonDigital/Infrastructure/.github/workflows/[email protected]
with:
project-name: "${{ vars.PROJECT_NAME }}Testing"
build-config: Debug
net-sdk-version: "${{ vars.NET_SDK_VERSION }}"


build_status_check:
name: ${{ vars.PROJECT_NAME }} Build Status Check
needs: [build_main_project, build_testing_app]
runs-on: ubuntu-latest
steps:
- name: Print Success Message
run: Write-Host "Build Status Check Passed!"
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
prepare_release:
name: Prepare ${{ inputs.release-type }} Release Of ${{ vars.PROJECT_NAME }}
needs: print_validate_workflow
uses: KinsonDigital/Infrastructure/.github/workflows/prepare-release.yml@v11.0.0
uses: KinsonDigital/Infrastructure/.github/workflows/prepare-release.yml@v12.0.0
with:
project-name: "${{ vars.PROJECT_NAME }}"
release-type: "${{ inputs.release-type }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run_release:
name: Performing ${{ inputs.release-type }} Release of ${{ vars.PROJECT_NAME }} (${{ inputs.release-type == 'Production' && 'Release' || 'Debug' }})
needs: determine_release_notes_path
uses: KinsonDigital/Infrastructure/.github/workflows/dotnet-lib-release.yml@v11.0.0
uses: KinsonDigital/Infrastructure/.github/workflows/dotnet-lib-release.yml@v12.0.0
with:
project-name: "${{ vars.PROJECT_NAME}}"
release-type: "${{ inputs.release-type }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test-status-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
run_tests:
name: ${{ vars.PROJECT_NAME }} Test Status Check
uses: KinsonDigital/Infrastructure/.github/workflows/run-csharp-tests.yml@v11.0.0
uses: KinsonDigital/Infrastructure/.github/workflows/run-csharp-tests.yml@v12.0.0
with:
project-name: "${{ vars.PROJECT_NAME }}Tests"
build-config: Debug
Expand Down
20 changes: 20 additions & 0 deletions .run/PlazmaTesting.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="PlazmaTesting" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Testing/PlazmaTesting/bin/Debug/net7.0/PlazmaTesting.exe" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Testing/PlazmaTesting/bin/Debug/net7.0" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="1" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/Testing/PlazmaTesting/PlazmaTesting.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net7.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
7 changes: 7 additions & 0 deletions Plazma.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlazmaTests", "Testing\PlazmaTests\PlazmaTests.csproj", "{AF6A9738-F676-408A-B1B9-E7F43631BC08}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlazmaTesting", "Testing\PlazmaTesting\PlazmaTesting.csproj", "{D2B0088E-5452-48FE-B804-FA985A114635}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -48,13 +50,18 @@ Global
{AF6A9738-F676-408A-B1B9-E7F43631BC08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF6A9738-F676-408A-B1B9-E7F43631BC08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF6A9738-F676-408A-B1B9-E7F43631BC08}.Release|Any CPU.Build.0 = Release|Any CPU
{D2B0088E-5452-48FE-B804-FA985A114635}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2B0088E-5452-48FE-B804-FA985A114635}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2B0088E-5452-48FE-B804-FA985A114635}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2B0088E-5452-48FE-B804-FA985A114635}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8518113E-D0C3-4E63-8F2E-542EB6D1CCE9} = {67F82AED-1502-4803-855A-CDB26DC685B4}
{AF6A9738-F676-408A-B1B9-E7F43631BC08} = {E204672C-F241-4BB7-AAE4-5147BC5B4FF5}
{D2B0088E-5452-48FE-B804-FA985A114635} = {E204672C-F241-4BB7-AAE4-5147BC5B4FF5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4E6732B6-A610-43DA-A1D7-1EC8EE1E6273}
Expand Down
12 changes: 6 additions & 6 deletions Plazma/Behaviors/BehaviorFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ namespace Plazma.Behaviors;
public class BehaviorFactory : IBehaviorFactory
{
/// <summary>
/// Creates all of the behaviors using the given <paramref name="randomizerService"/>.
/// Creates all of the behaviors using the given <paramref name="randomService"/>.
/// </summary>
/// <param name="settings">The list of settings used to create each behavior.</param>
/// <param name="randomizerService">The random used to randomly generate values.</param>
/// <param name="randomService">The random used to randomly generate values.</param>
/// <returns>A list of behaviors.</returns>
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="settings"/> parameter is null.</exception>
public IBehavior[] CreateBehaviors(BehaviorSettings[] settings, IRandomizerService randomizerService)
public IBehavior[] CreateBehaviors(BehaviorSettings[] settings, IRandomizerService randomService)
{
ArgumentNullException.ThrowIfNull(settings);
ArgumentNullException.ThrowIfNull(randomizerService);
ArgumentNullException.ThrowIfNull(randomService);

var behaviors = new List<IBehavior>();

Expand All @@ -34,13 +34,13 @@ public IBehavior[] CreateBehaviors(BehaviorSettings[] settings, IRandomizerServi
switch (setting)
{
case EasingRandomBehaviorSettings easingRandomBehaviorSettings:
behaviors.Add(new EasingRandomBehavior(easingRandomBehaviorSettings, randomizerService));
behaviors.Add(new EasingRandomBehavior(easingRandomBehaviorSettings, randomService));
break;
case ColorTransitionBehaviorSettings clrTransitionBehaviorSettings:
behaviors.Add(new ColorTransitionBehavior(clrTransitionBehaviorSettings));
break;
case RandomChoiceBehaviorSettings randomChoiceBehaviorSettings:
behaviors.Add(new RandomColorBehavior(randomChoiceBehaviorSettings, randomizerService));
behaviors.Add(new RandomColorBehavior(randomChoiceBehaviorSettings, randomService));
break;
default:
throw new Exception($"Unknown behavior settings of type '{setting.GetType().Name}'.");
Expand Down
39 changes: 19 additions & 20 deletions Plazma/Behaviors/EasingRandomBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,33 @@ public EasingRandomBehavior(EasingRandomBehaviorSettings settings, IRandomizerSe
/// <param name="timeElapsed">The amount of time that has elapsed for this update of the behavior.</param>
public override void Update(TimeSpan timeElapsed)
{
switch (this.settings.EasingFunctionType)
// TODO: Using 'ToString()' for the value provides tons of allocations and is not ideal. Need to change how this works.
Value = this.settings.EasingFunctionType switch
{
case EasingFunction.EaseOutBounce:
Value = EasingFunctions.EaseOutBounce(ElapsedTime, Start, Change, LifeTime).ToString(CultureInfo.InvariantCulture);
break;
case EasingFunction.EaseIn:
Value = EasingFunctions.EaseInQuad(ElapsedTime, Start, Change, LifeTime).ToString(CultureInfo.InvariantCulture);
break;
}
EasingFunction.EaseOutBounce => EasingFunctions.EaseOutBounce(ElapsedTime, Start, Change, LifeTime)
.ToString(CultureInfo.InvariantCulture),
EasingFunction.EaseIn => EasingFunctions.EaseInQuad(ElapsedTime, Start, Change, LifeTime).ToString(CultureInfo.InvariantCulture),
_ => Value
};

if (!(this.settings.UpdateStartMin is null))
if (this.settings.UpdateRandomStartMin is not null)
{
this.settings.StartMin = this.settings.UpdateStartMin.Invoke();
this.settings.RandomStartMin = this.settings.UpdateRandomStartMin?.Invoke() ?? 0f;
}

if (!(this.settings.UpdateStartMax is null))
if (this.settings.UpdateRandomStartMax is not null)
{
this.settings.StartMax = this.settings.UpdateStartMax.Invoke();
this.settings.RandomStartMax = this.settings.UpdateRandomStartMax?.Invoke() ?? 0f;
}

if (!(this.settings.UpdateChangeMin is null))
if (this.settings.UpdateRandomChangeMin is not null)
{
this.settings.ChangeMin = this.settings.UpdateChangeMin.Invoke();
this.settings.RandomChangeMin = this.settings.UpdateRandomChangeMin?.Invoke() ?? 0f;
}

if (!(this.settings.UpdateChangeMax is null))
if (this.settings.UpdateRandomChangeMax is not null)
{
this.settings.ChangeMax = this.settings.UpdateChangeMax.Invoke();
this.settings.RandomChangeMax = this.settings.UpdateRandomChangeMax?.Invoke() ?? 0f;
}

base.Update(timeElapsed);
Expand All @@ -94,8 +93,8 @@ public override void Reset()
/// </summary>
private void ApplyRandomization()
{
Start = this.randomizer.GetValue(this.settings.StartMin, this.settings.StartMax);
Change = this.randomizer.GetValue(this.settings.ChangeMin, this.settings.ChangeMax);
LifeTime = this.randomizer.GetValue(this.settings.TotalTimeMin, this.settings.TotalTimeMax);
Start = this.randomizer.GetValue(this.settings.RandomStartMin, this.settings.RandomStartMax);
Change = this.randomizer.GetValue(this.settings.RandomChangeMin, this.settings.RandomChangeMax);
LifeTime = this.randomizer.GetValue(this.settings.LifeTimeMinMilliseconds, this.settings.LifeTimeMaxMilliseconds);
}
}
}
32 changes: 18 additions & 14 deletions Plazma/Behaviors/EasingRandomBehaviorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,62 @@ public class EasingRandomBehaviorSettings : BehaviorSettings, IEasingCapable
/// <summary>
/// Gets or sets the minimum starting value used in randomization.
/// </summary>
public float StartMin { get; set; }
public float RandomStartMin { get; set; }

/// <summary>
/// Gets or sets the maximum starting value used in randomization.
/// </summary>
public float StartMax { get; set; }
public float RandomStartMax { get; set; }

/// <summary>
/// Gets or sets a delegate that when invoked updates the <see cref="StartMin"/> value.
/// Gets or sets a delegate that will set the <see cref="RandomStartMin"/> value.
/// </summary>
public Func<float>? UpdateStartMin { get; set; }
/// <remarks>This is invoked during the behavior update process.</remarks>
public Func<float>? UpdateRandomStartMin { get; set; }

/// <summary>
/// Gets or sets a delegate that when invoked updates the <see cref="StartMax"/> value.
/// Gets or sets a delegate that will set the <see cref="RandomStartMax"/> value.
/// </summary>
public Func<float>? UpdateStartMax { get; set; }
/// <remarks>This is invoked during the behavior update process.</remarks>
public Func<float>? UpdateRandomStartMax { get; set; }

/// <summary>
/// Gets or sets a delegate that when invoked updates the <see cref="ChangeMin"/> value.
/// Gets or sets a delegate that will set the <see cref="RandomChangeMin"/> value.
/// </summary>
public Func<float>? UpdateChangeMin { get; set; }
/// <remarks>This is invoked during the behavior update process.</remarks>
public Func<float>? UpdateRandomChangeMin { get; set; }

/// <summary>
/// Gets or sets a delegate that when invoked updates the <see cref="ChangeMax"/> value.
/// Gets or sets a delegate that will set the <see cref="RandomChangeMax"/> value.
/// </summary>
public Func<float>? UpdateChangeMax { get; set; }
/// <remarks>This is invoked during the behavior update process.</remarks>
public Func<float>? UpdateRandomChangeMax { get; set; }

/// <summary>
/// Gets or sets the minimum amount of change used in randomization.
/// </summary>
/// <remarks>
/// Use positive values to increase and negative values to decrease.
/// </remarks>
public float ChangeMin { get; set; }
public float RandomChangeMin { get; set; }

/// <summary>
/// Gets or sets the maximum amount of change used in randomization.
/// </summary>
/// <remarks>
/// Use positive values to increase and negative values to decrease.
/// </remarks>
public float ChangeMax { get; set; }
public float RandomChangeMax { get; set; }

/// <summary>
/// Gets or sets the minimum total amount of time in milliseconds to complete the behavior.
/// </summary>
/// <remarks>A value less then or equal to 0 will result in the behavior not working.</remarks>
public float TotalTimeMin { get; set; }
public float LifeTimeMinMilliseconds { get; set; } // TODO: Needs to be required somehow

/// <summary>
/// Gets or sets the maximum total amount of time in milliseconds to complete the behavior.
/// </summary>
/// <remarks>A value less then or equal to 0 will result in the behavior not working.</remarks>
public float TotalTimeMax { get; set; }
public float LifeTimeMaxMilliseconds { get; set; } // TODO: Needs to be required somehow
}
2 changes: 1 addition & 1 deletion Plazma/Behaviors/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ public enum EasingFunction
/// Ease in easing function.
/// </summary>
EaseIn,
}
}
4 changes: 2 additions & 2 deletions Plazma/Behaviors/RandomColorBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="RandomColorBehavior.cs" company="KinsonDigital">
// <copyright file="RandomColorBehavior.cs" company="KinsonDigital">
// Copyright (c) KinsonDigital. All rights reserved.
// </copyright>

Expand Down Expand Up @@ -61,4 +61,4 @@ public override void Reset()
this.isColorChosen = false;
base.Reset();
}
}
}
Loading
Loading