Added Base Project
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
using SFML.Graphics;
|
||||
using SFML.System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem.Actors
|
||||
{
|
||||
public enum ResizeMode
|
||||
{
|
||||
Resize,
|
||||
DontResize,
|
||||
CutImage
|
||||
}
|
||||
|
||||
public enum AnchorPoint
|
||||
{
|
||||
topLeft,
|
||||
topMiddle,
|
||||
topRight,
|
||||
bottomLeft,
|
||||
bottomMiddle,
|
||||
bottomRight,
|
||||
LeftMiddle,
|
||||
RightMiddle,
|
||||
Center
|
||||
}
|
||||
|
||||
public enum AnchorMode
|
||||
{
|
||||
stayInValue,
|
||||
stayInRatio,
|
||||
stayInPlace
|
||||
}
|
||||
|
||||
public struct Anchors
|
||||
{
|
||||
public bool top;
|
||||
public bool left;
|
||||
public bool right;
|
||||
public bool bottom;
|
||||
|
||||
AnchorPoint anchorPoint;
|
||||
|
||||
AnchorMode anchorMode;
|
||||
|
||||
|
||||
public Anchors() : this(true, true, false, false, AnchorPoint.Center, AnchorMode.stayInValue) { }
|
||||
|
||||
public Anchors(bool top, bool left, bool right, bool bottom) : this(top, left, right, bottom, AnchorPoint.Center, AnchorMode.stayInValue) { }
|
||||
|
||||
|
||||
public Anchors(bool top, bool left, bool right, bool bottom, AnchorPoint anchorPoint) : this(top, left, right, bottom, anchorPoint, AnchorMode.stayInValue) { }
|
||||
|
||||
public Anchors(bool top, bool left, bool right, bool bottom, AnchorPoint anchorPoint, AnchorMode anchorMode)
|
||||
{
|
||||
this.top = top;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
this.anchorPoint = anchorPoint;
|
||||
this.anchorMode = anchorMode;
|
||||
}
|
||||
}
|
||||
|
||||
public interface I_BaseActor
|
||||
{
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public ResizeMode resizeMode { get; set; }
|
||||
|
||||
public Anchors Anchors { get; set; }
|
||||
|
||||
public Vector2f Position { get; set; }
|
||||
|
||||
public Vector2f Size { get; set; }
|
||||
|
||||
public Vector2f Rotation { get; set; }
|
||||
|
||||
public void render(RenderWindow window);
|
||||
|
||||
public void tick(int timeDifference);
|
||||
|
||||
public void onWindowResize(int width, int height);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem.Actors
|
||||
{
|
||||
public interface I_Clickable : I_BaseActor
|
||||
{
|
||||
public event EventHandler Click;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem.Actors
|
||||
{
|
||||
public interface I_HitboxActor
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem.Actors
|
||||
{
|
||||
public interface I_InteractableActor : I_BaseActor
|
||||
{
|
||||
public bool Interact(I_PlayerActor player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem.Actors
|
||||
{
|
||||
public interface I_PlayerActor : I_BaseActor
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SFML.Net" Version="2.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,33 @@
|
||||
using Firebird2D.SceneSystem.Actors;
|
||||
using SFML.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem
|
||||
{
|
||||
public interface I_Scene
|
||||
{
|
||||
public string Name { get; }
|
||||
|
||||
public I_PlayerActor Player { get; }
|
||||
|
||||
public List<I_InteractableActor> Interactable { get; }
|
||||
|
||||
public List<I_HitboxActor> Hitbox { get; }
|
||||
|
||||
public List<I_Clickable> Clickables{ get; }
|
||||
|
||||
public I_Scene BuildScene();
|
||||
|
||||
public void DestroyScene();
|
||||
|
||||
public void TickScene(int TimeDifference);
|
||||
|
||||
public void RenderScene(RenderWindow window);
|
||||
|
||||
public void addActor(I_BaseActor Actor);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using Firebird2D.SceneSystem.Actors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem
|
||||
{
|
||||
public abstract class SceneGroup
|
||||
{
|
||||
public string? GroupName { get; protected set; }
|
||||
|
||||
public List<I_Scene>? Scenes { get; protected set; }
|
||||
|
||||
public abstract I_Scene SceneChangeAnimation { get; protected set; }
|
||||
|
||||
public abstract void InitializeGroup();
|
||||
|
||||
public abstract I_Scene getStartingScene();
|
||||
|
||||
public I_Scene? Get_Scene(Type type)
|
||||
{
|
||||
if (type != typeof(I_Scene) || Scenes == null) return null;
|
||||
|
||||
return Scenes.FirstOrDefault(instance => instance.GetType() == type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using Firebird2D.Core;
|
||||
using Firebird2D.SceneSystem.Actors;
|
||||
using SFML.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.SceneSystem
|
||||
{
|
||||
public static class SceneManager
|
||||
{
|
||||
//static List<I_Scene> scenes = new List<I_Scene>();
|
||||
|
||||
static string scenesPath = "scenes.dll";
|
||||
|
||||
static Assembly sceneDll = null;
|
||||
|
||||
static MainWindow mainWindow = null;
|
||||
|
||||
static SceneGroup ActiveSceneGroup = null;
|
||||
|
||||
public static void LoadScenes(MainWindow renderWindow)
|
||||
{
|
||||
if (mainWindow == null) return; // todo wenn render window null
|
||||
mainWindow = renderWindow;
|
||||
|
||||
sceneDll = Assembly.Load(scenesPath);
|
||||
|
||||
if (sceneDll == null) return; //Todo wenn scenes nicht geladen werden fehler
|
||||
|
||||
Type? scenesConfig = sceneDll.GetType("Scenes.Config");
|
||||
|
||||
if (scenesConfig == null) return; //Todo wenn die scenes config nicht gefunden wird
|
||||
|
||||
FieldInfo? startSceneGroup = scenesConfig.GetField("startingGroup", BindingFlags.Public | BindingFlags.Static);
|
||||
|
||||
if (startSceneGroup == null) return;// Todo wenn die scenes config nicht gefunden wird
|
||||
|
||||
SceneGroup? startingGroup = startSceneGroup.GetValue(null) as SceneGroup;
|
||||
|
||||
if (startingGroup == null) return;//Todo wenn die scenes config nicht gefunden wird
|
||||
|
||||
LoadSceneGroup(startingGroup, null);
|
||||
|
||||
}
|
||||
|
||||
private static async void LoadSceneGroup(SceneGroup sceneGroup, List<I_BaseActor>? carryOverActors)
|
||||
{
|
||||
if (sceneGroup == null) return; //todoo wenn scene group null
|
||||
|
||||
ActiveSceneGroup = sceneGroup;
|
||||
|
||||
changeScene(sceneGroup.SceneChangeAnimation, carryOverActors);
|
||||
|
||||
// Asynchrone Initialisierung der Szene im Hintergrund
|
||||
await Task.Run(() => sceneGroup.InitializeGroup());
|
||||
}
|
||||
|
||||
public static void changeScene(Type type, List<I_BaseActor> carryOverActors)
|
||||
{
|
||||
if (type != typeof(I_Scene)) return;
|
||||
|
||||
I_Scene? scene = ActiveSceneGroup.Get_Scene(type);
|
||||
|
||||
changeScene(scene,carryOverActors);
|
||||
}
|
||||
|
||||
private static void changeScene(I_Scene? scene, List<I_BaseActor>? carryOverActors)
|
||||
{
|
||||
if (scene == null) return; //todo reaction
|
||||
|
||||
if (mainWindow.ActiveSecene != null)
|
||||
mainWindow.ActiveSecene.DestroyScene();
|
||||
|
||||
if (carryOverActors != null)
|
||||
foreach (I_BaseActor actor in carryOverActors)
|
||||
{
|
||||
scene.addActor(actor);
|
||||
}
|
||||
|
||||
mainWindow.ActiveSecene = scene.BuildScene();
|
||||
}
|
||||
|
||||
public static void changeGroup(SceneGroup nextSceneGroup, List<I_BaseActor> carryOverActors)
|
||||
{
|
||||
LoadSceneGroup(nextSceneGroup, carryOverActors);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Firebird2D.SceneSystem")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Firebird2D.SceneSystem")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Firebird2D.SceneSystem")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Von der MSBuild WriteCodeFragment-Klasse generiert.
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
ffde50b68845d46e7e332ff2939eedd28590d50aebc1c29f5e093979db7d30c9
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = Firebird2D.SceneSystem
|
||||
build_property.ProjectDir = C:\Users\wayan\source\repos\SFML_Test\Firebird2D.SceneSystem\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
@@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
||||
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SceneSystem\\Firebird2D.SceneSystem.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SceneSystem\\Firebird2D.SceneSystem.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SceneSystem\\Firebird2D.SceneSystem.csproj",
|
||||
"projectName": "Firebird2D.SceneSystem",
|
||||
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SceneSystem\\Firebird2D.SceneSystem.csproj",
|
||||
"packagesPath": "C:\\Users\\wayan\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SceneSystem\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\wayan\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\Infrastructure\\Packages": {},
|
||||
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\References": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"SFML.Net": {
|
||||
"target": "Package",
|
||||
"version": "[2.6.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\wayan\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.1</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\wayan\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "Js04aYZdzTI=",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SceneSystem\\Firebird2D.SceneSystem.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\wayan\\.nuget\\packages\\csfml\\2.6.1\\csfml.2.6.1.nupkg.sha512",
|
||||
"C:\\Users\\wayan\\.nuget\\packages\\sfml.audio\\2.6.0\\sfml.audio.2.6.0.nupkg.sha512",
|
||||
"C:\\Users\\wayan\\.nuget\\packages\\sfml.graphics\\2.6.0\\sfml.graphics.2.6.0.nupkg.sha512",
|
||||
"C:\\Users\\wayan\\.nuget\\packages\\sfml.net\\2.6.0\\sfml.net.2.6.0.nupkg.sha512",
|
||||
"C:\\Users\\wayan\\.nuget\\packages\\sfml.system\\2.6.0\\sfml.system.2.6.0.nupkg.sha512",
|
||||
"C:\\Users\\wayan\\.nuget\\packages\\sfml.window\\2.6.0\\sfml.window.2.6.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
Reference in New Issue
Block a user