chore: update naming game -> simple server

This commit is contained in:
2022-05-14 10:35:17 +04:00
parent 185b5b7ca1
commit 053d5c9383
11 changed files with 121 additions and 27 deletions
-22
View File
@@ -1,22 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Game</RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ragon\Ragon.csproj" />
</ItemGroup>
</Project>
-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" fileName="logs/server-log-${shortdate}.log" layout="[${longdate}][${logger}][${level}] ${message} ${exception:format=ToString}" />
<target name="logconsole" xsi:type="Console" layout="[${date}][${logger}][${level}] ${message} ${exception:format=ToString}"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="logconsole" />
<logger name="*" minlevel="Trace" writeTo="logfile" />
</rules>
</nlog>
-18
View File
@@ -1,18 +0,0 @@
using System;
using Game.Source;
using NetStack.Serialization;
using Ragon.Core;
namespace Game
{
class Program
{
static void Main(string[] args)
{
var bootstrap = new Bootstrap();
bootstrap.Configure(new GameFactory());
Console.Read();
}
}
}
-19
View File
@@ -1,19 +0,0 @@
using NetStack.Serialization;
using Ragon.Common;
namespace Game.Source.Events;
public class TestEvent: IRagonSerializable
{
public string TestData;
public void Serialize(BitBuffer buffer)
{
buffer.AddString(TestData);
}
public void Deserialize(BitBuffer buffer)
{
TestData = buffer.ReadString();
}
}
-20
View File
@@ -1,20 +0,0 @@
using System;
using System.Text;
using Ragon.Core;
namespace Game.Source;
public class GameAuthorizer: AuthorizationManager
{
private Configuration _configuration;
public GameAuthorizer(Configuration configuration)
{
_configuration = configuration;
}
public override bool OnAuthorize(uint peerId, ref ReadOnlySpan<byte> payload)
{
var apiKey = Encoding.UTF8.GetString(payload);
return _configuration.ApiKey == apiKey;
}
}
-17
View File
@@ -1,17 +0,0 @@
using System.Runtime.InteropServices;
using Ragon.Core;
namespace Game.Source
{
public class GameFactory : PluginFactory
{
public string PluginName { get; set; } = "ExamplePlugin";
public PluginBase CreatePlugin(string map)
{
return new ExamplePlugin();
}
public AuthorizationManager CreateManager(Configuration configuration) => new GameAuthorizer(configuration);
}
}