From 2e6af3eb520bc9f77db1b3bd0ba9dec5736cd74f Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Wed, 29 Dec 2021 12:34:48 +0100 Subject: [PATCH] Update template to latest RobustToolbox version. --- RobustTemplateSingleplayer.sln | 63 ----------- RobustToolbox | 2 +- Template.Game/EntryPoint.cs | 115 ++++++++++----------- Template.Game/GameConfigVars.cs | 31 +++--- Template.Game/Input/ContentKeyFunctions.cs | 13 ++- Template.Game/Program.cs | 51 +++++---- Template.Game/Template.Game.csproj | 2 +- Template.Game/TemplateIoC.cs | 11 +- 8 files changed, 109 insertions(+), 179 deletions(-) diff --git a/RobustTemplateSingleplayer.sln b/RobustTemplateSingleplayer.sln index 6458084..c93f1ce 100644 --- a/RobustTemplateSingleplayer.sln +++ b/RobustTemplateSingleplayer.sln @@ -53,16 +53,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Generators", "Robust EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Base", "RobustToolbox\Avalonia.Base\Avalonia.Base.csproj", "{A7C80535-9577-4DE1-9544-A2CC4FB6511C}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Linguini", "Linguini", "{583E0C7C-27ED-4932-8E87-6EDECCFF4D02}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linguini.Bundle", "RobustToolbox\Linguini\Linguini.Bundle\Linguini.Bundle.csproj", "{06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linguini.Shared", "RobustToolbox\Linguini\Linguini.Shared\Linguini.Shared.csproj", "{7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linguini.Syntax", "RobustToolbox\Linguini\Linguini.Syntax\Linguini.Syntax.csproj", "{17C94BF2-150B-46F9-8A02-AAD155F3FAD0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluralRules.Generator", "RobustToolbox\Linguini\PluralRules.Generator\PluralRules.Generator.csproj", "{B8841793-F428-4244-9A91-40C2CF69CA95}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -304,54 +294,6 @@ Global {A7C80535-9577-4DE1-9544-A2CC4FB6511C}.Release|x64.Build.0 = Release|Any CPU {A7C80535-9577-4DE1-9544-A2CC4FB6511C}.Release|x86.ActiveCfg = Release|Any CPU {A7C80535-9577-4DE1-9544-A2CC4FB6511C}.Release|x86.Build.0 = Release|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Debug|x64.ActiveCfg = Debug|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Debug|x64.Build.0 = Debug|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Debug|x86.ActiveCfg = Debug|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Debug|x86.Build.0 = Debug|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Release|Any CPU.Build.0 = Release|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Release|x64.ActiveCfg = Release|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Release|x64.Build.0 = Release|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Release|x86.ActiveCfg = Release|Any CPU - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A}.Release|x86.Build.0 = Release|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Debug|x64.ActiveCfg = Debug|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Debug|x64.Build.0 = Debug|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Debug|x86.ActiveCfg = Debug|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Debug|x86.Build.0 = Debug|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Release|Any CPU.Build.0 = Release|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Release|x64.ActiveCfg = Release|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Release|x64.Build.0 = Release|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Release|x86.ActiveCfg = Release|Any CPU - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D}.Release|x86.Build.0 = Release|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Debug|x64.ActiveCfg = Debug|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Debug|x64.Build.0 = Debug|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Debug|x86.ActiveCfg = Debug|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Debug|x86.Build.0 = Debug|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Release|Any CPU.Build.0 = Release|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Release|x64.ActiveCfg = Release|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Release|x64.Build.0 = Release|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Release|x86.ActiveCfg = Release|Any CPU - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0}.Release|x86.Build.0 = Release|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Debug|x64.ActiveCfg = Debug|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Debug|x64.Build.0 = Debug|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Debug|x86.ActiveCfg = Debug|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Debug|x86.Build.0 = Debug|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Release|Any CPU.Build.0 = Release|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Release|x64.ActiveCfg = Release|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Release|x64.Build.0 = Release|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Release|x86.ActiveCfg = Release|Any CPU - {B8841793-F428-4244-9A91-40C2CF69CA95}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {2A829DE3-FCB2-4FEA-A6F3-B85122C8D11E} = {F5F87A9D-C304-4833-B107-D666317F6931} @@ -377,10 +319,5 @@ Global {D56D47F6-2C26-42D2-BA00-C39824CFAF55} = {F5F87A9D-C304-4833-B107-D666317F6931} {62452255-1DE7-4D37-BB01-A690EC7E3156} = {F5F87A9D-C304-4833-B107-D666317F6931} {A7C80535-9577-4DE1-9544-A2CC4FB6511C} = {F5F87A9D-C304-4833-B107-D666317F6931} - {583E0C7C-27ED-4932-8E87-6EDECCFF4D02} = {F5F87A9D-C304-4833-B107-D666317F6931} - {06A6E3B2-4BBF-4DC9-A557-D5A653D8F80A} = {583E0C7C-27ED-4932-8E87-6EDECCFF4D02} - {7787AC86-8CE7-48A7-A6DA-62DE9BAD279D} = {583E0C7C-27ED-4932-8E87-6EDECCFF4D02} - {17C94BF2-150B-46F9-8A02-AAD155F3FAD0} = {583E0C7C-27ED-4932-8E87-6EDECCFF4D02} - {B8841793-F428-4244-9A91-40C2CF69CA95} = {583E0C7C-27ED-4932-8E87-6EDECCFF4D02} EndGlobalSection EndGlobal diff --git a/RobustToolbox b/RobustToolbox index 4ba5654..e3dc446 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 4ba56542531c4d810556455d2891a3ed82a53f86 +Subproject commit e3dc446e9ea75d6802686397cf19023bd4433e64 diff --git a/Template.Game/EntryPoint.cs b/Template.Game/EntryPoint.cs index fb39811..ef36932 100644 --- a/Template.Game/EntryPoint.cs +++ b/Template.Game/EntryPoint.cs @@ -8,68 +8,65 @@ 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 +namespace Template.Game; + +public class EntryPoint : GameClient { - 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() { - // 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(); + 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().LoadCulture(new CultureInfo(Culture)); - } - - public override void Init() - { - var factory = IoCManager.Resolve(); - - // DEVNOTE: Registers all of your components. - factory.DoAutoRegistrations(); - - TemplateIoC.Register(); - - IoCManager.BuildGraph(); - - factory.GenerateNetIds(); - - // 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().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. - } + // 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().LoadCulture(new CultureInfo(Culture)); } - + public override void Init() + { + var factory = IoCManager.Resolve(); + + // DEVNOTE: Registers all of your components. + factory.DoAutoRegistrations(); + + TemplateIoC.Register(); + + IoCManager.BuildGraph(); + + factory.GenerateNetIds(); + + // 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().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. + } } \ No newline at end of file diff --git a/Template.Game/GameConfigVars.cs b/Template.Game/GameConfigVars.cs index a4e380f..673b15b 100644 --- a/Template.Game/GameConfigVars.cs +++ b/Template.Game/GameConfigVars.cs @@ -1,21 +1,20 @@ 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 - // VariableName = CVarDef.Create("namespace.varname", default_value, CVar.TYPE | CVar.OTHERTYPE) - // ``` - // This is a good spot to store your database config, among other things. +namespace Template.Game; - public static readonly CVarDef - DummyCVarForTemplate = CVarDef.Create("dummy.whydoineedthis", true, CVar.ARCHIVE); - } +// 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 + // 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 + DummyCVarForTemplate = CVarDef.Create("dummy.whydoineedthis", true, CVar.ARCHIVE); } \ No newline at end of file diff --git a/Template.Game/Input/ContentKeyFunctions.cs b/Template.Game/Input/ContentKeyFunctions.cs index 640bbf7..5b124a3 100644 --- a/Template.Game/Input/ContentKeyFunctions.cs +++ b/Template.Game/Input/ContentKeyFunctions.cs @@ -1,11 +1,10 @@ using Robust.Shared.Input; -namespace Template.Game.Input +namespace Template.Game.Input; + +[KeyFunctions] +public static class ContentKeyFunctions { - [KeyFunctions] - public static class ContentKeyFunctions - { - // DEVNOTE: Stick keys you want to be bindable here. - // public static readonly BoundKeyFunction DummyKey = "DummyKey"; - } + // DEVNOTE: Stick keys you want to be bindable here. + // public static readonly BoundKeyFunction DummyKey = "DummyKey"; } \ No newline at end of file diff --git a/Template.Game/Program.cs b/Template.Game/Program.cs index d919722..a84a9a7 100644 --- a/Template.Game/Program.cs +++ b/Template.Game/Program.cs @@ -1,43 +1,42 @@ using Robust.Client; -namespace Template.Game +namespace Template.Game; + +internal static class Program { - internal static class Program + public static void Main(string[] args) { - public static void Main(string[] args) + ContentStart.StartLibrary(args, new GameControllerOptions() { - ContentStart.StartLibrary(args, new GameControllerOptions() - { - // DEVNOTE: Your options here! + // 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, + // 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.", + // 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", + // 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", + // 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, + // 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 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", + // Name of the configuration file in the user's data directory. + ConfigFileName = "config.toml", - //SplashLogo = new ResourcePath("/path/to/splash/logo.png"), + //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"), + // Check "RobustToolbox/Resources/Textures/Logo/icon" for an example window icon set. + //WindowIconSet = new ResourcePath("/path/to/folder/with/window/icon/set"), - // There are a few more options, be sure to check them all! - }); - } + // There are a few more options, be sure to check them all! + }); } } \ No newline at end of file diff --git a/Template.Game/Template.Game.csproj b/Template.Game/Template.Game.csproj index bf2316e..d26ca55 100644 --- a/Template.Game/Template.Game.csproj +++ b/Template.Game/Template.Game.csproj @@ -3,7 +3,7 @@ $(TargetFramework) - 9 + latest false false ..\bin\Template.Game\ diff --git a/Template.Game/TemplateIoC.cs b/Template.Game/TemplateIoC.cs index 6768ee7..5aabc7d 100644 --- a/Template.Game/TemplateIoC.cs +++ b/Template.Game/TemplateIoC.cs @@ -1,10 +1,9 @@ -namespace Template.Game +namespace Template.Game; + +internal static class TemplateIoC { - internal static class TemplateIoC + public static void Register() { - public static void Register() - { - // DEVNOTE: IoCManager registrations for the game go here. - } + // DEVNOTE: IoCManager registrations for the game go here. } } \ No newline at end of file