Update template to latest RobustToolbox version.

- Converts template to use file-scoped namespaces.
- Add manifest.yml and comments for it.
This commit is contained in:
Vera Aguilera Puerto 2021-12-29 12:21:56 +01:00
parent b417f4355e
commit 729c2a6206
18 changed files with 197 additions and 272 deletions

View file

@ -1,12 +1,11 @@
using Robust.Shared.IoC;
namespace Content.Client
namespace Content.Client;
internal static class ClientContentIoC
{
internal static class ClientContentIoC
public static void Register()
{
public static void Register()
{
// DEVNOTE: IoCManager registrations for the client go here and only here.
}
// DEVNOTE: IoCManager registrations for the client go here and only here.
}
}

View file

@ -3,7 +3,7 @@
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
<LangVersion>9</LangVersion>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>..\bin\Content.Client\</OutputPath>

View file

@ -6,70 +6,67 @@ using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
// DEVNOTE: Games that want to be on the hub are FORCED use the "Content." prefix for assemblies they want to load.
namespace Content.Client
// DEVNOTE: Games that want to be on the hub can change their namespace prefix in the "manifest.yml" file.
namespace Content.Client;
public class EntryPoint : GameClient
{
public class EntryPoint : GameClient
public override void Init()
{
public override void Init()
var factory = IoCManager.Resolve<IComponentFactory>();
var prototypes = IoCManager.Resolve<IPrototypeManager>();
factory.DoAutoRegistrations();
foreach (var ignoreName in IgnoredComponents.List)
{
var factory = IoCManager.Resolve<IComponentFactory>();
var prototypes = IoCManager.Resolve<IPrototypeManager>();
factory.DoAutoRegistrations();
foreach (var ignoreName in IgnoredComponents.List)
{
factory.RegisterIgnore(ignoreName);
}
foreach (var ignoreName in IgnoredPrototypes.List)
{
prototypes.RegisterIgnore(ignoreName);
}
ClientContentIoC.Register();
IoCManager.BuildGraph();
factory.GenerateNetIds();
// DEVNOTE: This is generally where you'll be setting up the IoCManager further.
factory.RegisterIgnore(ignoreName);
}
public override void PostInit()
foreach (var ignoreName in IgnoredPrototypes.List)
{
base.PostInit();
// DEVNOTE: The line below will disable lighting, so you can see in-game sprites without the need for lights
//IoCManager.Resolve<ILightManager>().Enabled = false;
// DEVNOTE: Further setup...
var client = IoCManager.Resolve<IBaseClient>();
// DEVNOTE: You might want a main menu to connect to a server, or start a singleplayer game.
// Be sure to check out StateManager for this! Below you'll find examples to start a game.
// If you want to connect to a server...
// client.ConnectToServer("ip-goes-here", 1212);
// Optionally, singleplayer also works!
// client.StartSinglePlayer();
prototypes.RegisterIgnore(ignoreName);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
// DEVNOTE: You might want to do a proper shutdown here.
}
ClientContentIoC.Register();
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.
}
IoCManager.BuildGraph();
factory.GenerateNetIds();
// DEVNOTE: This is generally where you'll be setting up the IoCManager further.
}
public override void PostInit()
{
base.PostInit();
// DEVNOTE: The line below will disable lighting, so you can see in-game sprites without the need for lights
//IoCManager.Resolve<ILightManager>().Enabled = false;
// DEVNOTE: Further setup...
var client = IoCManager.Resolve<IBaseClient>();
// DEVNOTE: You might want a main menu to connect to a server, or start a singleplayer game.
// Be sure to check out StateManager for this! Below you'll find examples to start a game.
// If you want to connect to a server...
// client.ConnectToServer("ip-goes-here", 1212);
// Optionally, singleplayer also works!
// client.StartSinglePlayer();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
// DEVNOTE: You might 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

@ -1,9 +1,8 @@
namespace Content.Client
namespace Content.Client;
public static class IgnoredComponents
{
public static class IgnoredComponents
{
public static string[] List => new string[] {
// Stick components you want ignored here.
};
}
public static string[] List => new string[] {
// Stick components you want ignored here.
};
}

View file

@ -1,9 +1,8 @@
namespace Content.Client
namespace Content.Client;
public static class IgnoredPrototypes
{
public static class IgnoredPrototypes
{
public static string[] List => new string[] {
// Stick prototypes you want ignored here.
};
}
public static string[] List => new string[] {
// Stick prototypes you want ignored here.
};
}

View file

@ -1,27 +1,26 @@
using Robust.Client;
using Robust.Shared.Utility;
namespace Content.Client
namespace Content.Client;
internal static class Program
{
internal static class Program
public static void Main(string[] args)
{
public static void Main(string[] args)
{
ContentStart.Start(args);
ContentStart.Start(args);
/*
// DEVNOTE: If you want to use RobustToolbox as a library, use the method below instead.
// Keep in mind, this will make your game ineligible from appearing on the SS14 hub, specially if you
// disable sandboxing.
ContentStart.StartLibrary(args, new GameControllerOptions()
{
// DEVNOTE: Your options here.
Sandboxing = false,
SplashLogo = new ResourcePath("/path/to/splash/logo.png"),
// Check "RobustToolbox/Resources/Textures/Logo/icon" for an example window icon set.
WindowIconSet = new ResourcePath("/path/to/folder/with/window/icon/set"),
DefaultWindowTitle = "Robust Template"
});*/
}
/*
// DEVNOTE: If you want to use RobustToolbox as a library, use the method below instead.
// Keep in mind, this will make your game ineligible from appearing on the SS14 hub, specially if you
// disable sandboxing.
ContentStart.StartLibrary(args, new GameControllerOptions()
{
// DEVNOTE: Your options here.
Sandboxing = false,
SplashLogo = new ResourcePath("/path/to/splash/logo.png"),
// Check "RobustToolbox/Resources/Textures/Logo/icon" for an example window icon set.
WindowIconSet = new ResourcePath("/path/to/folder/with/window/icon/set"),
DefaultWindowTitle = "Robust Template"
});*/
}
}