initial commit
This commit is contained in:
36
Platforms/Desktop/.config/dotnet-tools.json
Normal file
36
Platforms/Desktop/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-mgcb": {
|
||||
"version": "3.8.2.1105",
|
||||
"commands": [
|
||||
"mgcb"
|
||||
]
|
||||
},
|
||||
"dotnet-mgcb-editor": {
|
||||
"version": "3.8.2.1105",
|
||||
"commands": [
|
||||
"mgcb-editor"
|
||||
]
|
||||
},
|
||||
"dotnet-mgcb-editor-linux": {
|
||||
"version": "3.8.2.1105",
|
||||
"commands": [
|
||||
"mgcb-editor-linux"
|
||||
]
|
||||
},
|
||||
"dotnet-mgcb-editor-windows": {
|
||||
"version": "3.8.2.1105",
|
||||
"commands": [
|
||||
"mgcb-editor-windows"
|
||||
]
|
||||
},
|
||||
"dotnet-mgcb-editor-mac": {
|
||||
"version": "3.8.2.1105",
|
||||
"commands": [
|
||||
"mgcb-editor-mac"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
91
Platforms/Desktop/Desktop.csproj
Normal file
91
Platforms/Desktop/Desktop.csproj
Normal file
@@ -0,0 +1,91 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RollForward>Major</RollForward>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
<TieredCompilation>false</TieredCompilation>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>MyUniverse.Platforms.Desktop</RootNamespace>
|
||||
<AssemblyName>MyUniverse</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Icon.ico" />
|
||||
<None Remove="Icon.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Icon.ico">
|
||||
<LogicalName>Icon.ico</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Icon.bmp">
|
||||
<LogicalName>Icon.bmp</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.2.1105" />
|
||||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.2.1105" />
|
||||
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../Engine/Engine.Integration/Engine.Integration.LiteNetLib/Engine.Integration.LiteNetLib.csproj" />
|
||||
<ProjectReference Include="../../Shared/Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MonoGameContentReference Include="../../Shared/Content/Content.mgcb">
|
||||
<Link>Content/Content.mgcb</Link>
|
||||
</MonoGameContentReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../Shared/Shared.csproj" />
|
||||
<ProjectReference Include="../../Engine/Engine.Integration/Engine.Integration.Yaml/Engine.Integration.Yaml.csproj" />
|
||||
</ItemGroup>
|
||||
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
|
||||
<Message Text="Restoring dotnet tools" Importance="High" />
|
||||
<Exec Command="dotnet tool restore" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
<BeautySharedRuntimeMode>False</BeautySharedRuntimeMode>
|
||||
<!-- beauty into sub-directory, default is libs, quote with "" if contains space -->
|
||||
<BeautyLibsDir Condition="$(BeautySharedRuntimeMode) == 'True'">../Libraries</BeautyLibsDir>
|
||||
<BeautyLibsDir Condition="$(BeautySharedRuntimeMode) != 'True'">./Libraries</BeautyLibsDir>
|
||||
<!-- dlls that you don't want to be moved or can not be moved -->
|
||||
<!-- <BeautyExcludes>dll1.dll;lib*;...</BeautyExcludes> -->
|
||||
<BeautyExcludes>SDL2.dll</BeautyExcludes>
|
||||
<!-- dlls that end users never needed, so hide them -->
|
||||
<BeautyHiddens>hostfxr;hostpolicy;*.deps.json;*.runtimeconfig*.json</BeautyHiddens>
|
||||
<!-- set to True if you want to disable -->
|
||||
<DisableBeauty>False</DisableBeauty>
|
||||
<!-- set to False if you want to beauty on build -->
|
||||
<BeautyOnPublishOnly>False</BeautyOnPublishOnly>
|
||||
<!-- DO NOT TOUCH THIS OPTION -->
|
||||
<BeautyNoRuntimeInfo>False</BeautyNoRuntimeInfo>
|
||||
<!-- valid values: auto|with|without -->
|
||||
<BeautyNBLoaderVerPolicy>auto</BeautyNBLoaderVerPolicy>
|
||||
<!-- set to True if you want to allow 3rd debuggers(like dnSpy) debugs the app -->
|
||||
<BeautyEnableDebugging>False</BeautyEnableDebugging>
|
||||
<!-- the patch can reduce the file count -->
|
||||
<!-- set to False if you want to disable -->
|
||||
<!-- SCD Mode Feature Only -->
|
||||
<BeautyUsePatch>True</BeautyUsePatch>
|
||||
<!-- App Entry Dll = BeautyDir + BeautyAppHostDir + BeautyAppHostEntry -->
|
||||
<!-- see https://github.com/nulastudio/NetBeauty2#customize-apphost for more details -->
|
||||
<!-- relative path based on AppHostDir -->
|
||||
<!-- .NET Core Non Single-File Only -->
|
||||
<!-- <BeautyAppHostEntry>bin/MyApp.dll</BeautyAppHostEntry> -->
|
||||
<!-- relative path based on BeautyDir -->
|
||||
<!-- .NET Core Non Single-File Only -->
|
||||
<!-- <BeautyAppHostDir>..</BeautyAppHostDir> -->
|
||||
<!-- <BeautyAfterTasks></BeautyAfterTasks> -->
|
||||
<!-- valid values: Error|Detail|Info -->
|
||||
<BeautyLogLevel>Info</BeautyLogLevel>
|
||||
<!-- set to a repo mirror if you have troble in connecting github -->
|
||||
<!-- <BeautyGitCDN>https://gitee.com/liesauer/HostFXRPatcher</BeautyGitCDN> -->
|
||||
<!-- <BeautyGitTree>master</BeautyGitTree> -->
|
||||
</PropertyGroup>
|
||||
</Project>
|
BIN
Platforms/Desktop/Icon.bmp
Normal file
BIN
Platforms/Desktop/Icon.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 KiB |
BIN
Platforms/Desktop/Icon.ico
Normal file
BIN
Platforms/Desktop/Icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
BIN
Platforms/Desktop/Icon.png
Normal file
BIN
Platforms/Desktop/Icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
44
Platforms/Desktop/Program.cs
Normal file
44
Platforms/Desktop/Program.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
using Engine.Core;
|
||||
using Engine.Core.Debug;
|
||||
using Engine.Core.Serialization;
|
||||
using Engine.Integration.MonoGame;
|
||||
using Engine.Serializers.Yaml;
|
||||
using Engine.Systems.Network;
|
||||
|
||||
Universe universe = new();
|
||||
|
||||
ISerializer serializer = new YamlSerializer();
|
||||
|
||||
ILogger logger = new FileLogger($"Logs/{DateTime.UtcNow:yyyy-MM-dd_HH-mm-ss-ffffff}.log");
|
||||
|
||||
#if DEBUG
|
||||
logger = new LoggerWrapper(logger, new ConsoleLogger());
|
||||
#endif
|
||||
|
||||
universe.InstantiateUniverseObject().SetUniverseObject("Logger")
|
||||
.BehaviourController.AddBehaviour<LoggerContainer>().Logger = ILogger.Shared = logger;
|
||||
|
||||
universe.InstantiateUniverseObject().SetUniverseObject("Desktop Inputs")
|
||||
.BehaviourController.AddBehaviour<KeyboardInputs>();
|
||||
|
||||
universe.InstantiateUniverseObject().SetUniverseObject("Visual Managers")
|
||||
.BehaviourController.AddBehaviour<DrawManager>()
|
||||
.BehaviourController.AddBehaviour<LoadContentManager>();
|
||||
|
||||
/* For Networking
|
||||
LiteNetLibClient client = universe.InstantiateUniverseObject().SetUniverseObject("Client").BehaviourController.AddBehaviour<LiteNetLibClient>();
|
||||
client.BehaviourController.AddBehaviour<NetworkManager>();
|
||||
universe.OnPreUpdate.AddOneTimeListener((_, _) => client.Connect("localhost", 8888));
|
||||
*/
|
||||
|
||||
MyUniverse.Shared.UniverseSource.ApplyUniverse(universe);
|
||||
|
||||
using MonoGameWindow monoGameWindow = new(universe);
|
||||
|
||||
monoGameWindow.Graphics.GraphicsProfile = GraphicsProfile.HiDef;
|
||||
|
||||
monoGameWindow.Run();
|
43
Platforms/Desktop/app.manifest
Normal file
43
Platforms/Desktop/app.manifest
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="Desktop"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on and is
|
||||
is designed to work with. Uncomment the appropriate elements and Windows will
|
||||
automatically selected the most compatible environment. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
||||
</assembly>
|
131
Platforms/Desktop/icon.svg
Normal file
131
Platforms/Desktop/icon.svg
Normal file
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="100mm"
|
||||
height="100mm"
|
||||
viewBox="0 0 100 100"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="icon.svg"
|
||||
inkscape:export-filename="Icon.png"
|
||||
inkscape:export-xdpi="65.024002"
|
||||
inkscape:export-ydpi="65.024002"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.76791526"
|
||||
inkscape:cx="-14.975611"
|
||||
inkscape:cy="272.16545"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1008"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="36"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs2">
|
||||
<inkscape:path-effect
|
||||
effect="taper_stroke"
|
||||
id="path-effect1965"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
stroke_width="14.57"
|
||||
attach_start="0.99999"
|
||||
end_offset="1e-07"
|
||||
start_smoothing="0"
|
||||
end_smoothing="0"
|
||||
jointype="extrapolated"
|
||||
start_shape="center"
|
||||
end_shape="center"
|
||||
miter_limit="1000.5" />
|
||||
<inkscape:path-effect
|
||||
effect="join_type"
|
||||
id="path-effect1959"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
linecap_type="square"
|
||||
line_width="0.26458299"
|
||||
linejoin_type="extrp_arc"
|
||||
miter_limit="100"
|
||||
attempt_force_join="true" />
|
||||
<inkscape:path-effect
|
||||
effect="powerstroke"
|
||||
id="path-effect1957"
|
||||
is_visible="true"
|
||||
lpeversion="1"
|
||||
offset_points="0.2,0.1322915 | 1,0.1322915 | 1.8,0.1322915"
|
||||
not_jump="false"
|
||||
sort_points="true"
|
||||
interpolator_type="Linear"
|
||||
interpolator_beta="1"
|
||||
start_linecap_type="zerowidth"
|
||||
linejoin_type="miter"
|
||||
miter_limit="11100"
|
||||
scale_width="20"
|
||||
end_linecap_type="butt" />
|
||||
<inkscape:path-effect
|
||||
effect="fill_between_many"
|
||||
method="bsplinespiro"
|
||||
linkedpaths="#path1175,0,1"
|
||||
id="path-effect1961"
|
||||
is_visible="true"
|
||||
lpeversion="0"
|
||||
join="true"
|
||||
close="true"
|
||||
autoreverse="true" />
|
||||
<inkscape:path-effect
|
||||
effect="fill_between_many"
|
||||
method="bsplinespiro"
|
||||
linkedpaths="#path1175,0,1"
|
||||
id="path-effect1967"
|
||||
is_visible="true"
|
||||
lpeversion="0"
|
||||
join="true"
|
||||
close="true"
|
||||
autoreverse="true" />
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:#25202c;fill-opacity:1;stroke:none;stroke-width:0.264583;stroke-linecap:square;stroke-linejoin:bevel;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect4712"
|
||||
width="100"
|
||||
height="100"
|
||||
x="0"
|
||||
y="0"
|
||||
ry="24.342688" />
|
||||
<circle
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.296213;stroke-linecap:square;stroke-linejoin:bevel;paint-order:fill markers stroke"
|
||||
id="path234"
|
||||
cx="32.183838"
|
||||
cy="37.277283"
|
||||
r="11.198684" />
|
||||
<rect
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.296213;stroke-linecap:square;stroke-linejoin:bevel;paint-order:fill markers stroke"
|
||||
id="rect1054"
|
||||
width="19.398724"
|
||||
height="71.576004"
|
||||
x="59.616123"
|
||||
y="14.211996" />
|
||||
<path
|
||||
id="path1175"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.31583;stroke-linecap:square;stroke-linejoin:bevel;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
d="m 45.710924,37.909235 c -0.08308,1.7843 -0.506133,3.552079 -1.278577,5.16464 -1.067261,2.404981 -2.906892,4.366553 -5.129349,5.714834 l 10.696654,4.40096 -13.418115,24.765056 21.254461,-19.595787 c 5.44e-4,-4.297076 -4.96e-4,-8.593943 5.78e-4,-12.891057 z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.2 KiB |
40
Platforms/Server/Endpoints.cs
Normal file
40
Platforms/Server/Endpoints.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
using Engine.Core;
|
||||
using Engine.Systems.Network;
|
||||
|
||||
namespace Server;
|
||||
|
||||
public class Endpoints : Behaviour, IFirstFrameUpdate
|
||||
{
|
||||
private INetworkCommunicatorServer? server = null!;
|
||||
|
||||
public Endpoints()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder();
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
app.MapGet("/stats", GetStats);
|
||||
|
||||
app.Run($"http://0.0.0.0:{Environment.GetEnvironmentVariable("PORT") ?? "8888"}");
|
||||
});
|
||||
}
|
||||
|
||||
private IResult GetStats() => Results.Json(new { Count = server?.Connections.Count ?? 0 });
|
||||
|
||||
public void FirstActiveFrame() => server = Universe.FindRequiredBehaviour<INetworkCommunicatorServer>();
|
||||
protected override void OnExitedUniverse(IUniverse universe) => server = null;
|
||||
}
|
35
Platforms/Server/Program.cs
Normal file
35
Platforms/Server/Program.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
using Engine.Core;
|
||||
using Engine.Core.Debug;
|
||||
using Engine.Systems.Network;
|
||||
|
||||
Universe universe = new();
|
||||
|
||||
FileLogger fileLogger = new($"Logs/{DateTime.UtcNow:yyyy-MM-dd_HH-mm-ss-ffffff}.log");
|
||||
universe.InstantiateUniverseObject().SetUniverseObject("Logger").BehaviourController
|
||||
.AddBehaviour<LoggerContainer>().Logger = ILogger.Shared = new LoggerWrapper(fileLogger, new ConsoleLogger());
|
||||
|
||||
LiteNetLibServer server = universe.InstantiateUniverseObject().SetUniverseObject("Server").BehaviourController.AddBehaviour<LiteNetLibServer>();
|
||||
server.BehaviourController.AddBehaviour<NetworkManager>();
|
||||
universe.OnPreUpdate.AddOneTimeListener((_, _) => server.Start(8888, 2));
|
||||
|
||||
MyUniverse.Shared.UniverseSource.ApplyUniverse(universe);
|
||||
|
||||
DateTime lastRun = DateTime.UtcNow;
|
||||
TimeSpan interval = new(0, 0, 0, 0, 16);
|
||||
TimeSpan timeSinceStart = new(0);
|
||||
|
||||
universe.Initialize();
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (lastRun + interval <= DateTime.UtcNow)
|
||||
{
|
||||
lastRun += interval;
|
||||
timeSinceStart += interval;
|
||||
universe.Update(new(timeSinceStart, interval));
|
||||
}
|
||||
Thread.Sleep(1);
|
||||
}
|
23
Platforms/Server/Server.csproj
Normal file
23
Platforms/Server/Server.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>MyUniverse.Platforms.Server</RootNamespace>
|
||||
<AssemblyName>MyUniverse</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../Engine/Engine.Integration/Engine.Integration.LiteNetLib/Engine.Integration.LiteNetLib.csproj" />
|
||||
<ProjectReference Include="../../Shared/Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.3.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="10.0.0-preview.5.25277.114" />
|
||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.2.1105" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Reference in New Issue
Block a user