Skip to content

Commit

Permalink
Tesing maui (#23)
Browse files Browse the repository at this point in the history
* asd

added maui template and UI project

Working maui

working on gestures

map controls are showing up

asd

almost works

added release only projects into a filter

imported missing usings

template fox

* Fixed static tile implementation
  • Loading branch information
joshika39 authored Dec 9, 2023
1 parent aaf6b93 commit 3e93ea5
Show file tree
Hide file tree
Showing 137 changed files with 3,133 additions and 134 deletions.
60 changes: 2 additions & 58 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,11 @@ on:
- 'v*'

jobs:
build:
name: Build
env:
BUILD_CONFIG: 'Debug'
SOLUTION: 'GameFramework.sln'
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: recursive
- name: 'Get Version'
id: get_version
uses: battila7/get-version-action@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarQube scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Install dotCover Global
shell: powershell
run: |
dotnet tool install --global JetBrains.dotCover.GlobalTool
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: powershell
run: |
Write-Output ${{ steps.get_version.outputs.version-without-v }}
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ secrets.PROJECT_KEY }}" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /v:"${{ steps.get_version.outputs.version-without-v }}"
dotnet build $env:SOLUTION --configuration $env:BUILD_CONFIG
dotnet dotcover test $env:SOLUTION --dcReportType=HTML --dotCoverFilters="-:*Tests;-:testhost"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
deploy:
name: 'Build, Test & Deploy'
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'GameFramework.sln'
SOLUTION: 'GameFramework.Release.slnf'
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -71,14 +19,10 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: 'Get Version'
id: get_version
uses: battila7/get-version-action@v2

- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x

- name: Setup MSBuild.exe
uses: microsoft/[email protected]
Expand Down
1 change: 1 addition & 0 deletions GameFramework.Impl/GameFramework.Impl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<InternalsVisibleTo Include="GameFramework.Unit.Tests" />
<InternalsVisibleTo Include="GameFramework.ManualTests.Desktop.WPF" />
<InternalsVisibleTo Include="GameFramework.ManualTests.Forms" />
<InternalsVisibleTo Include="GameFramework.Maui.Tests" />
<InternalsVisibleTo Include="joshika39.GameFramework.UI.WPF" />
</ItemGroup>

Expand Down
15 changes: 13 additions & 2 deletions GameFramework.Impl/Tiles/Interactable/AInteractableTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
using GameFramework.Core.Position;
using GameFramework.Objects;
using GameFramework.Objects.Interactable;
using GameFramework.Visuals.Tiles;
using GameFramework.Visuals.Views;

namespace GameFramework.Impl.Tiles.Interactable
{
public abstract class AInteractableTile : IInteractableObject2D
public abstract class AInteractableTile : IInteractableObject2D, IViewLoadedSubscriber
{
public Guid Id { get; }
public IMovingObjectView View { get; }
Expand All @@ -23,10 +24,20 @@ protected AInteractableTile(IPosition2D position, IConfigurationService2D config
View = view ?? throw new ArgumentNullException(nameof(view));
ConfigurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService));
IsObstacle = isObstacle;
View.Attach(this);
}

public abstract void Step(IObject2D staticObject);
public abstract void Delete();
public abstract void Dispose();

public virtual void Dispose()
{
View.Dispose();
}

public virtual void OnLoaded()
{
View.UpdatePosition(Position);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override void SteppedOn(IInteractableObject2D interactableObject2D)

public override void Step(IObject2D staticObject)
{

View.UpdatePosition(Position);
}

public override void Delete()
Expand Down
4 changes: 1 addition & 3 deletions GameFramework.Impl/Tiles/Static/GeneralStaticTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public GeneralStaticTile(IPosition2D position, IConfigurationService2D configura
}

public override void SteppedOn(IInteractableObject2D interactableObject2D)
{

}
{ }
}
}
12 changes: 12 additions & 0 deletions GameFramework.Release.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"solution": {
"path": "GameFramework.sln",
"projects": [
"GameFramework.Impl\\GameFramework.Impl.csproj",
"GameFramework.UI.Forms\\GameFramework.UI.Forms.csproj",
"GameFramework.UI.Maui\\GameFramework.UI.Maui.csproj",
"GameFramework.UI.WPF\\GameFramework.UI.WPF.csproj",
"GameFramework\\GameFramework.csproj"
]
}
}
1 change: 0 additions & 1 deletion GameFramework.Templates/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"author": "joshika39",
"classifications": [
"Android",
"Linux",
"Windows",
"Desktop"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BoardTemplate.Maui"
x:Class="BoardTemplate.Maui.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace BoardTemplate.Maui
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="BoardTemplate.Maui.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BoardTemplate.Maui"
Shell.FlyoutBehavior="Disabled">

<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace BoardTemplate.Maui;

public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>BoardTemplate.Maui</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Display name -->
<ApplicationTitle>BoardTemplate.Maui</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.boardtemplate.maui</ApplicationId>
<ApplicationIdGuid>58F2B91D-F68D-4A6C-BA82-74A6671B6DE6</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4"/>

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128"/>

<!-- Images -->
<MauiImage Include="Resources\Images\*"/>
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208"/>

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*"/>

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0"/>
</ItemGroup>

<ItemGroup>
<Compile Update="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>

<ItemGroup>
<MauiXaml Update="Views\MainPage.xaml">
<SubType>Designer</SubType>
</MauiXaml>
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="Views\MainPage.xaml" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\GameFramework.Impl\GameFramework.Impl.csproj" />
<ProjectReference Include="..\..\..\..\GameFramework.UI.Maui\GameFramework.UI.Maui.csproj" />
<ProjectReference Include="..\..\..\..\GameFramework\GameFramework.csproj" />
<ProjectReference Include="..\..\..\..\_Tests\GameFramework.Maui.Tests\GameFramework.Maui.Tests.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BoardTemplate.Maui.MainPage">

<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">

<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />

<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />

<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />

<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />

</VerticalStackLayout>
</ScrollView>

</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace BoardTemplate.Maui;

public partial class MainPage : ContentPage
{
int count = 0;

public MainPage()
{
InitializeComponent();
}

private void OnCounterClicked(object sender, EventArgs e)
{
count++;

if (count == 1)
CounterBtn.Text = $"Clicked {count} time";
else
CounterBtn.Text = $"Clicked {count} times";

SemanticScreenReader.Announce(CounterBtn.Text);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.Extensions.Logging;

namespace BoardTemplate.Maui;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

#if DEBUG
builder.Logging.AddDebug();
#endif

return builder.Build();
}
}
Loading

0 comments on commit 3e93ea5

Please sign in to comment.