Initial commit.

This commit is contained in:
Vera Aguilera Puerto 2021-04-23 20:48:00 +02:00
commit 9ca3fc37b1
15 changed files with 1015 additions and 0 deletions

View file

@ -0,0 +1,73 @@
using System.Globalization;
using Robust.Client;
using Robust.Shared.ContentPack;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Timing;
// DEVNOTE: You can change the namespace and project name to whatever you want!
// Just make sure to consistently use a prefix across your different projects.
namespace Template.Game
{
public class EntryPoint : GameClient
{
// See line 35. Controls the default game culture and language.
// Robust calls this culture, but you might find it more fitting to call it the game
// language. Robust doesn't support changing this mid-game. Load your config file early
// if you want that.
private const string Culture = "en-US";
public override void PreInit()
{
base.PreInit();
// Default to en-US.
// DEVNOTE: If you want your game to be multi-regional at runtime, you'll need to
// do something more complicated here.
IoCManager.Resolve<ILocalizationManager>().LoadCulture(new CultureInfo(Culture));
}
public override void Init()
{
var factory = IoCManager.Resolve<IComponentFactory>();
// DEVNOTE: Registers all of your components.
factory.DoAutoRegistrations();
TemplateIoC.Register();
IoCManager.BuildGraph();
// DEVNOTE: This is generally where you'll be setting up the IoCManager further, like the tile manager.
}
public override void PostInit()
{
base.PostInit();
// DEVNOTE: Further setup..
// DEVNOTE: This starts the singleplayer mode,
// which means you can start creating entities, spawning things...
// If you want to have a main menu to start the game from instead, use the StateManager.
IoCManager.Resolve<IBaseClient>().StartSinglePlayer();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
// DEVNOTE: You'll want to do a proper shutdown here.
}
public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
{
base.Update(level, frameEventArgs);
// DEVNOTE: Game update loop goes here. Usually you'll want some independent GameTicker.
}
}
}

View file

@ -0,0 +1,21 @@
using Robust.Shared;
using Robust.Shared.Configuration;
namespace Template.Game
{
// DEVNOTE: This is the same as SS14's CCVars. Except it's not named CCVars as that name is
// hot garbage.
[CVarDefs]
public sealed class GameConfigVars: CVars
{
// Declare persistent game config variables here.
// ```
// public static readonly CVarDef<SerializableType>
// VariableName = CVarDef.Create("namespace.varname", default_value, CVar.TYPE | CVar.OTHERTYPE)
// ```
// This is a good spot to store your database config, among other things.
public static readonly CVarDef<bool>
DummyCVarForTemplate = CVarDef.Create("dummy.whydoineedthis", true, CVar.ARCHIVE);
}
}

View file

@ -0,0 +1,11 @@
using Robust.Shared.Input;
namespace Template.Game.Input
{
[KeyFunctions]
public static class ContentKeyFunctions
{
// DEVNOTE: Stick keys you want to be bindable here.
// public static readonly BoundKeyFunction DummyKey = "DummyKey";
}
}

38
Template.Game/Program.cs Normal file
View file

@ -0,0 +1,38 @@
using Robust.Client;
namespace Template.Game
{
internal static class Program
{
public static void Main(string[] args)
{
ContentStart.StartLibrary(args, new GameControllerOptions()
{
// DEVNOTE: Your options here!
// We disable sandboxing given we're using RobustToolbox as a library, and we won't be on the hub.
Sandboxing = false,
// Projects with this prefix will be loaded by the engine.
ContentModulePrefix = "Template.",
// Name of the folder where the game will be built in. Also check Template.Game.csproj:9!
ContentBuildDirectory = "Template.Game",
// Default window name. This can also be changed on runtime with the IClyde service.
DefaultWindowTitle = "RobustToolbox Template Game",
// This template is singleplayer-only, so we disable connecting to a server from program arguments.
DisableCommandLineConnect = true,
// Name of the folder where the user's data (config, etc) will be stored.
UserDataDirectoryName = "Template Game",
// Name of the configuration file in the user's data directory.
ConfigFileName = "config.toml",
// There are a few more options, be sure to check them all!
});
}
}
}

View file

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
<LangVersion>9</LangVersion>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>..\bin\Template.Game\</OutputPath> <!-- This is important for gamepack mounting purposes. -->
<OutputType Condition="'$(FullRelease)' != 'True'">Exe</OutputType>
<RootNamespace>Template.Game</RootNamespace>
</PropertyGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RobustToolbox\Lidgren.Network\Lidgren.Network.csproj" />
<ProjectReference Include="..\RobustToolbox\Robust.Shared.Maths\Robust.Shared.Maths.csproj" />
<ProjectReference Include="..\RobustToolbox\Robust.Shared\Robust.Shared.csproj" />
<ProjectReference Include="..\RobustToolbox\Robust.Client\Robust.Client.csproj" />
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.Engine.targets" />
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
</Project>

View file

@ -0,0 +1,10 @@
namespace Template.Game
{
internal static class TemplateIoC
{
public static void Register()
{
// DEVNOTE: IoCManager registrations for the game go here.
}
}
}

15
Template.Game/app.config Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.86.0.518" newVersion="0.86.0.518" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>