From d34f484ed18c257170f39b2c2c624c3e8cac2978 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Thu, 14 May 2020 23:09:39 -0400 Subject: [PATCH] Add leaderboard submission support --- Leadercraft/Leadercraft.csproj | 852 +++++++++++++---------- Leadercraft/LeadercraftPlugin.cs | 52 +- Leadercraft/Scoring/GameEventHandlers.cs | 20 + Leadercraft/Scoring/GameLoop.cs | 56 ++ Leadercraft/Scoring/State.cs | 87 +++ Leadercraft/Scoring/UploadJob.cs | 83 +++ Leadercraft/Server/CriteriaStruct.cs | 6 +- Leadercraft/Server/KeyStruct.cs | 5 +- Leadercraft/Server/LeadercraftApi.cs | 112 +-- Leadercraft/Server/NewKeyStruct.cs | 4 +- Leadercraft/Server/ResultStruct.cs | 3 + Leadercraft/Server/Tests.cs | 78 ++- Leadercraft/Server/Tools.cs | 15 +- 13 files changed, 946 insertions(+), 427 deletions(-) create mode 100644 Leadercraft/Scoring/GameEventHandlers.cs create mode 100644 Leadercraft/Scoring/GameLoop.cs create mode 100644 Leadercraft/Scoring/State.cs create mode 100644 Leadercraft/Scoring/UploadJob.cs diff --git a/Leadercraft/Leadercraft.csproj b/Leadercraft/Leadercraft.csproj index c138ce7..c4f0ecb 100644 --- a/Leadercraft/Leadercraft.csproj +++ b/Leadercraft/Leadercraft.csproj @@ -20,663 +20,779 @@ ..\ref\Plugins\GamecraftModdingAPI.dll -..\..\ref\Plugins\GamecraftModdingAPI.dll + ..\..\ref\Plugins\GamecraftModdingAPI.dll ..\ref\Gamecraft_Data\Managed\IllusionInjector.dll -..\..\ref\Gamecraft_Data\Managed\IllusionInjector.dll + ..\..\ref\Gamecraft_Data\Managed\IllusionInjector.dll ..\ref\Gamecraft_Data\Managed\IllusionPlugin.dll -..\..\ref\Gamecraft_Data\Managed\IllusionPlugin.dll + ..\..\ref\Gamecraft_Data\Managed\IllusionPlugin.dll + + + ..\ref\Gamecraft_Data\Managed\JWT.dll + ..\..\ref\Gamecraft_Data\Managed\JWT.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.Burst.Unsafe.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Burst.Unsafe.dll + + + ..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll + ..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll + + + ..\ref\Gamecraft_Data\Managed\Rewired_Core.dll + ..\..\ref\Gamecraft_Data\Managed\Rewired_Core.dll + + + ..\ref\Gamecraft_Data\Managed\Rewired_Windows.dll + ..\..\ref\Gamecraft_Data\Managed\Rewired_Windows.dll + + + ..\ref\Gamecraft_Data\Managed\mscorlib.dll + ..\..\ref\Gamecraft_Data\Managed\mscorlib.dll + + + ..\ref\Gamecraft_Data\Managed\Newtonsoft.Json.dll + ..\..\ref\Gamecraft_Data\Managed\Newtonsoft.Json.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.AccessibilityModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.AccessibilityModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.AIModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.AIModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.AndroidJNIModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.AndroidJNIModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.AnimationModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.AnimationModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ARModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ARModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.AssetBundleModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.AssetBundleModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.AudioModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.AudioModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ClothModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ClothModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterInputModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterInputModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterRendererModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterRendererModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.CoreModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.CoreModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.CrashReportingModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.CrashReportingModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.DirectorModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.DirectorModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.DSPGraphModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.DSPGraphModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.GameCenterModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.GameCenterModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.GridModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.GridModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.HotReloadModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.HotReloadModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ImageConversionModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ImageConversionModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.IMGUIModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.IMGUIModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.InputLegacyModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.InputLegacyModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.InputModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.InputModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.JSONSerializeModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.JSONSerializeModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.LocalizationModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.LocalizationModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ParticleSystemModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ParticleSystemModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.PerformanceReportingModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.PerformanceReportingModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.Physics2DModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.Physics2DModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.PhysicsModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.PhysicsModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ProfilerModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ProfilerModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.ScreenCaptureModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.ScreenCaptureModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.SharedInternalsModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.SharedInternalsModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteMaskModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteMaskModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteShapeModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteShapeModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.StreamingModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.StreamingModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.SubstanceModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.SubstanceModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.SubsystemsModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.SubsystemsModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainPhysicsModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainPhysicsModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.TextCoreModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.TextCoreModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.TextRenderingModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.TextRenderingModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.TilemapModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.TilemapModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.TLSModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.TLSModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UIElementsModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UIElementsModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UIModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UIModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UmbraModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UmbraModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UNETModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UNETModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityAnalyticsModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityAnalyticsModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityConnectModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityConnectModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityTestProtocolModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityTestProtocolModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAssetBundleModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAssetBundleModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestTextureModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestTextureModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.VehiclesModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.VehiclesModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.VFXModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.VFXModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.VideoModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.VideoModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.VRModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.VRModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.WindModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.WindModule.dll + + + ..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll ..\ref\Gamecraft_Data\Managed\Analytics.dll -..\..\ref\Gamecraft_Data\Managed\Analytics.dll + ..\..\ref\Gamecraft_Data\Managed\Analytics.dll ..\ref\Gamecraft_Data\Managed\Assembly-CSharp-firstpass.dll -..\..\ref\Gamecraft_Data\Managed\Assembly-CSharp-firstpass.dll + ..\..\ref\Gamecraft_Data\Managed\Assembly-CSharp-firstpass.dll ..\ref\Gamecraft_Data\Managed\Assembly-CSharp.dll -..\..\ref\Gamecraft_Data\Managed\Assembly-CSharp.dll + ..\..\ref\Gamecraft_Data\Managed\Assembly-CSharp.dll ..\ref\Gamecraft_Data\Managed\Authentication.dll -..\..\ref\Gamecraft_Data\Managed\Authentication.dll + ..\..\ref\Gamecraft_Data\Managed\Authentication.dll ..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll -..\..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll + ..\..\ref\Gamecraft_Data\Managed\BlockEntityFactory.dll + + + ..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll + ..\..\ref\Gamecraft_Data\Managed\Blocks.HUDFeedbackBlocks.dll + + + ..\ref\Gamecraft_Data\Managed\ChannelsCommon.dll + ..\..\ref\Gamecraft_Data\Managed\ChannelsCommon.dll + + + ..\ref\Gamecraft_Data\Managed\ClusterToWireConversion.Mock.dll + ..\..\ref\Gamecraft_Data\Managed\ClusterToWireConversion.Mock.dll ..\ref\Gamecraft_Data\Managed\CommandLine.dll -..\..\ref\Gamecraft_Data\Managed\CommandLine.dll + ..\..\ref\Gamecraft_Data\Managed\CommandLine.dll ..\ref\Gamecraft_Data\Managed\DataLoader.dll -..\..\ref\Gamecraft_Data\Managed\DataLoader.dll + ..\..\ref\Gamecraft_Data\Managed\DataLoader.dll ..\ref\Gamecraft_Data\Managed\DDNA.dll -..\..\ref\Gamecraft_Data\Managed\DDNA.dll - - - ..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll -..\..\ref\Gamecraft_Data\Managed\Facepunch.Steamworks.Win64.dll + ..\..\ref\Gamecraft_Data\Managed\DDNA.dll ..\ref\Gamecraft_Data\Managed\FMOD.dll -..\..\ref\Gamecraft_Data\Managed\FMOD.dll + ..\..\ref\Gamecraft_Data\Managed\FMOD.dll ..\ref\Gamecraft_Data\Managed\FullGame.dll -..\..\ref\Gamecraft_Data\Managed\FullGame.dll + ..\..\ref\Gamecraft_Data\Managed\FullGame.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.ConsoleBlock.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.GenericPhysicsBlocks.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.LogicBlock.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.LogicBlock.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.ConsoleBlock.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.GraphicsScreen.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.GraphicsScreen.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.GraphicsScreen.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.HUDFeedbackBlocks.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.HUDFeedbackBlocks.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Tweaks.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Tweaks.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Tweaks.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.Mockup.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.Mockup.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.dll ..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Input.dll -..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Input.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Input.dll + + + ..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll + ..\..\ref\Gamecraft_Data\Managed\Gamecraft.Wires.Mockup.dll ..\ref\Gamecraft_Data\Managed\GameState.dll -..\..\ref\Gamecraft_Data\Managed\GameState.dll + ..\..\ref\Gamecraft_Data\Managed\GameState.dll ..\ref\Gamecraft_Data\Managed\GPUInstancer.dll -..\..\ref\Gamecraft_Data\Managed\GPUInstancer.dll + ..\..\ref\Gamecraft_Data\Managed\GPUInstancer.dll ..\ref\Gamecraft_Data\Managed\Havok.Physics.dll -..\..\ref\Gamecraft_Data\Managed\Havok.Physics.dll + ..\..\ref\Gamecraft_Data\Managed\Havok.Physics.dll ..\ref\Gamecraft_Data\Managed\Havok.Physics.Hybrid.dll -..\..\ref\Gamecraft_Data\Managed\Havok.Physics.Hybrid.dll - - - ..\ref\Gamecraft_Data\Managed\IllusionInjector.dll -..\..\ref\Gamecraft_Data\Managed\IllusionInjector.dll - - - ..\ref\Gamecraft_Data\Managed\IllusionPlugin.dll -..\..\ref\Gamecraft_Data\Managed\IllusionPlugin.dll - - - ..\ref\Gamecraft_Data\Managed\JWT.dll -..\..\ref\Gamecraft_Data\Managed\JWT.dll + ..\..\ref\Gamecraft_Data\Managed\Havok.Physics.Hybrid.dll ..\ref\Gamecraft_Data\Managed\LZ4.dll -..\..\ref\Gamecraft_Data\Managed\LZ4.dll + ..\..\ref\Gamecraft_Data\Managed\LZ4.dll ..\ref\Gamecraft_Data\Managed\MultiplayerNetworking.dll -..\..\ref\Gamecraft_Data\Managed\MultiplayerNetworking.dll + ..\..\ref\Gamecraft_Data\Managed\MultiplayerNetworking.dll ..\ref\Gamecraft_Data\Managed\MultiplayerTest.dll -..\..\ref\Gamecraft_Data\Managed\MultiplayerTest.dll - - - ..\ref\Gamecraft_Data\Managed\Newtonsoft.Json.dll -..\..\ref\Gamecraft_Data\Managed\Newtonsoft.Json.dll + ..\..\ref\Gamecraft_Data\Managed\MultiplayerTest.dll ..\ref\Gamecraft_Data\Managed\RCX.ScreenshotTaker.dll -..\..\ref\Gamecraft_Data\Managed\RCX.ScreenshotTaker.dll - - - ..\ref\Gamecraft_Data\Managed\Rewired_Core.dll -..\..\ref\Gamecraft_Data\Managed\Rewired_Core.dll - - - ..\ref\Gamecraft_Data\Managed\Rewired_Windows.dll -..\..\ref\Gamecraft_Data\Managed\Rewired_Windows.dll + ..\..\ref\Gamecraft_Data\Managed\RCX.ScreenshotTaker.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.AccountPreferences.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.AccountPreferences.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.AccountPreferences.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.Ghost.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.Ghost.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.Ghost.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.Triggers.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.Triggers.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Blocks.Triggers.dll + + + ..\ref\Gamecraft_Data\Managed\RobocraftX.Building.BoxSelect.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Building.BoxSelect.dll + + + ..\ref\Gamecraft_Data\Managed\RobocraftX.Building.Jobs.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Building.Jobs.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Character.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Character.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Character.dll + + + ..\ref\Gamecraft_Data\Managed\RobocraftX.ClusterToWireConversion.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.ClusterToWireConversion.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Common.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Common.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Common.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.ControlsScreen.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.ControlsScreen.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.ControlsScreen.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Crosshair.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Crosshair.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Crosshair.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.FrontEnd.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.FrontEnd.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.FrontEnd.dll + + + ..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.BlockLabel.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.BlockLabel.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.DebugDisplay.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.DebugDisplay.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.DebugDisplay.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.RemoveBlock.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.RemoveBlock.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.RemoveBlock.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.ScaleGhost.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.ScaleGhost.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUI.ScaleGhost.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.GUIs.WorkshopPrefabs.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUIs.WorkshopPrefabs.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.GUIs.WorkshopPrefabs.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Input.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Input.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Input.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.MachineEditor.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.MachineEditor.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.MachineEditor.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.MainGame.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.MainGame.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.MainGame.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.MainSimulation.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.MainSimulation.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.MainSimulation.dll + + + ..\ref\Gamecraft_Data\Managed\RobocraftX.MockCharacter.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.MockCharacter.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.NetworkEntityStream.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.NetworkEntityStream.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Multiplayer.NetworkEntityStream.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.MultiplayerInput.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.MultiplayerInput.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.MultiplayerInput.dll + + + ..\ref\Gamecraft_Data\Managed\Robocraftx.ObjectIdBlocks.dll + ..\..\ref\Gamecraft_Data\Managed\Robocraftx.ObjectIdBlocks.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Party.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Party.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Party.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.PartyGui.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.PartyGui.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.PartyGui.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Physics.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Physics.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Physics.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.PilotSeat.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.PilotSeat.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.PilotSeat.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Player.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Player.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Player.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.Mock.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.Mock.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Rendering.Mock.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.SaveAndLoad.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveAndLoad.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveAndLoad.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.SaveGameDialog.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Serializers.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Serializers.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Serializers.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.Services.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.SignalHandling.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.SignalHandling.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.SignalHandling.dll ..\ref\Gamecraft_Data\Managed\RobocraftX.StateSync.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX.StateSync.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX.StateSync.dll ..\ref\Gamecraft_Data\Managed\RobocraftX_SpawnPoints.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX_SpawnPoints.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX_SpawnPoints.dll ..\ref\Gamecraft_Data\Managed\RobocraftX_TextBlock.dll -..\..\ref\Gamecraft_Data\Managed\RobocraftX_TextBlock.dll + ..\..\ref\Gamecraft_Data\Managed\RobocraftX_TextBlock.dll ..\ref\Gamecraft_Data\Managed\RobocratX.SimulationCompositionRoot.dll -..\..\ref\Gamecraft_Data\Managed\RobocratX.SimulationCompositionRoot.dll + ..\..\ref\Gamecraft_Data\Managed\RobocratX.SimulationCompositionRoot.dll ..\ref\Gamecraft_Data\Managed\StringFormatter.dll -..\..\ref\Gamecraft_Data\Managed\StringFormatter.dll + ..\..\ref\Gamecraft_Data\Managed\StringFormatter.dll - - ..\ref\Gamecraft_Data\Managed\Svelto.Common.dll -..\..\ref\Gamecraft_Data\Managed\Svelto.Common.dll + + ..\ref\Gamecraft_Data\Managed\Svelto.Common_3.dll + ..\..\ref\Gamecraft_Data\Managed\Svelto.Common_3.dll ..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll -..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll + ..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll + + + ..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.Internal.dll + ..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.Internal.dll ..\ref\Gamecraft_Data\Managed\Svelto.ECS.dll -..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.dll + ..\..\ref\Gamecraft_Data\Managed\Svelto.ECS.dll ..\ref\Gamecraft_Data\Managed\Svelto.Services.dll -..\..\ref\Gamecraft_Data\Managed\Svelto.Services.dll + ..\..\ref\Gamecraft_Data\Managed\Svelto.Services.dll ..\ref\Gamecraft_Data\Managed\Svelto.Tasks.dll -..\..\ref\Gamecraft_Data\Managed\Svelto.Tasks.dll + ..\..\ref\Gamecraft_Data\Managed\Svelto.Tasks.dll ..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Addressables.dll ..\ref\Gamecraft_Data\Managed\Unity.Burst.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Burst.dll - - - ..\ref\Gamecraft_Data\Managed\Unity.Burst.Unsafe.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Burst.Unsafe.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Burst.dll ..\ref\Gamecraft_Data\Managed\Unity.Collections.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Collections.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Collections.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Deformations.dll ..\ref\Gamecraft_Data\Managed\Unity.Entities.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Entities.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Entities.dll ..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Entities.Hybrid.dll ..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Jobs.dll ..\ref\Gamecraft_Data\Managed\Unity.Mathematics.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Mathematics.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Mathematics.dll ..\ref\Gamecraft_Data\Managed\Unity.Mathematics.Extensions.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Mathematics.Extensions.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Mathematics.Extensions.dll ..\ref\Gamecraft_Data\Managed\Unity.Mathematics.Extensions.Hybrid.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Mathematics.Extensions.Hybrid.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Mathematics.Extensions.Hybrid.dll ..\ref\Gamecraft_Data\Managed\Unity.Physics.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Physics.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Physics.dll ..\ref\Gamecraft_Data\Managed\Unity.Physics.Hybrid.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Physics.Hybrid.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Physics.Hybrid.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Platforms.Common.dll ..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Postprocessing.Runtime.dll ..\ref\Gamecraft_Data\Managed\Unity.Properties.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Properties.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.Properties.Reflection.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Properties.Reflection.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.Properties.UI.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Properties.UI.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.RenderPipeline.Universal.ShaderLibrary.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipeline.Universal.ShaderLibrary.dll ..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.Runtime.dll -..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.Runtime.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.Runtime.dll ..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.ShaderLibrary.dll -..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.ShaderLibrary.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Core.ShaderLibrary.dll ..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll -..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Universal.Runtime.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Universal.Runtime.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Universal.Shaders.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.RenderPipelines.Universal.Shaders.dll ..\ref\Gamecraft_Data\Managed\Unity.ResourceManager.dll -..\..\ref\Gamecraft_Data\Managed\Unity.ResourceManager.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.ResourceManager.dll ..\ref\Gamecraft_Data\Managed\Unity.Scenes.Hybrid.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Scenes.Hybrid.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Scenes.Hybrid.dll ..\ref\Gamecraft_Data\Managed\Unity.ScriptableBuildPipeline.dll -..\..\ref\Gamecraft_Data\Managed\Unity.ScriptableBuildPipeline.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.ScriptableBuildPipeline.dll + + + ..\ref\Gamecraft_Data\Managed\Unity.Serialization.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Serialization.dll ..\ref\Gamecraft_Data\Managed\Unity.TextMeshPro.dll -..\..\ref\Gamecraft_Data\Managed\Unity.TextMeshPro.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.TextMeshPro.dll ..\ref\Gamecraft_Data\Managed\Unity.Timeline.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Timeline.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Timeline.dll ..\ref\Gamecraft_Data\Managed\Unity.Transforms.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Transforms.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Transforms.dll ..\ref\Gamecraft_Data\Managed\Unity.Transforms.Hybrid.dll -..\..\ref\Gamecraft_Data\Managed\Unity.Transforms.Hybrid.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.AccessibilityModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.AccessibilityModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.AIModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.AIModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.AndroidJNIModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.AndroidJNIModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.AnimationModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.AnimationModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ARModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ARModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.AssetBundleModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.AssetBundleModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.AudioModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.AudioModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ClothModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ClothModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterInputModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterInputModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterRendererModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ClusterRendererModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.CoreModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.CoreModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.CrashReportingModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.CrashReportingModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.DirectorModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.DirectorModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.DSPGraphModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.DSPGraphModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.GameCenterModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.GameCenterModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.GridModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.GridModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.HotReloadModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.HotReloadModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ImageConversionModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ImageConversionModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.IMGUIModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.IMGUIModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.InputLegacyModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.InputLegacyModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.InputModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.InputModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.JSONSerializeModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.JSONSerializeModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.LocalizationModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.LocalizationModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ParticleSystemModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ParticleSystemModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.PerformanceReportingModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.PerformanceReportingModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.Physics2DModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.Physics2DModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.PhysicsModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.PhysicsModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ProfilerModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ProfilerModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.ScreenCaptureModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.ScreenCaptureModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.SharedInternalsModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.SharedInternalsModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteMaskModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteMaskModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteShapeModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.SpriteShapeModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.StreamingModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.StreamingModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.SubstanceModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.SubstanceModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainPhysicsModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.TerrainPhysicsModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.TextCoreModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.TextCoreModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.TextRenderingModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.TextRenderingModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.TilemapModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.TilemapModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.TLSModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.TLSModule.dll + ..\..\ref\Gamecraft_Data\Managed\Unity.Transforms.Hybrid.dll ..\ref\Gamecraft_Data\Managed\UnityEngine.UI.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UI.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UIElementsModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UIElementsModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UIModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UIModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UmbraModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UmbraModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UNETModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UNETModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityAnalyticsModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityAnalyticsModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityConnectModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityConnectModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityTestProtocolModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityTestProtocolModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAssetBundleModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAssetBundleModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestTextureModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestTextureModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.VehiclesModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.VehiclesModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.VFXModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.VFXModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.VideoModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.VideoModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.VRModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.VRModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.WindModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.WindModule.dll - - - ..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll -..\..\ref\Gamecraft_Data\Managed\UnityEngine.XRModule.dll + ..\..\ref\Gamecraft_Data\Managed\UnityEngine.UI.dll ..\ref\Gamecraft_Data\Managed\uREPL.dll -..\..\ref\Gamecraft_Data\Managed\uREPL.dll + ..\..\ref\Gamecraft_Data\Managed\uREPL.dll ..\ref\Gamecraft_Data\Managed\VisualProfiler.dll -..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll + ..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll diff --git a/Leadercraft/LeadercraftPlugin.cs b/Leadercraft/LeadercraftPlugin.cs index 43f991e..5468d0b 100644 --- a/Leadercraft/LeadercraftPlugin.cs +++ b/Leadercraft/LeadercraftPlugin.cs @@ -1,17 +1,50 @@ using System.Reflection; using IllusionPlugin; -using GamecraftModdingAPI; +using GamecraftModdingAPI.Utility; + +using Leadercraft.Server; namespace Leadercraft { public class LeadercraftPlugin : IPlugin // the Illusion Plugin Architecture (IPA) will ignore classes that don't implement IPlugin' { + public static float LoopDelay = 0.1f; + public string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; // mod name public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // mod & assembly version - // called when Gamecraft shuts down + internal static LeadercraftApi Api = null; + + private static string tokenUrl = +#if DEBUG + "http://192.168.122.229:1337/token"; +#else + "https://leadercraft.exmods.org/token"; +#endif + + private static string criteriaUrl = +#if DEBUG + "http://192.168.122.229:7048/criteria"; +#else + "https://board.exmods.org/criteria"; +#endif + public static void BuildApi() + { + if (Api == null) + { + if (!Tools.IsSteamAvailable) + { + Logging.MetaDebugLog("Steam is unavailable :("); + return; + } + Api = new LeadercraftApi(Tools.UserId, tokenUrl, criteriaUrl); + GamecraftModdingAPI.Utility.Logging.MetaDebugLog("Leadercraft API initialized"); + } + } + + // called when Gamecraft shuts down public void OnApplicationQuit() { // Shutdown this mod @@ -29,18 +62,29 @@ namespace Leadercraft // check out the modding API docs here: https://mod.exmods.org/ // Initialize this mod - + GamecraftModdingAPI.Utility.GameEngineManager.AddGameEngine(new Scoring.LeadercraftSimEventHandler()); + GamecraftModdingAPI.Utility.GameEngineManager.AddGameEngine(new Scoring.LeadercraftGameEventHandler()); + GamecraftModdingAPI.Events.EventManager.AddEventHandler(new Scoring.GameLoop()); GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up"); + + // Debug mode + Debug(); } // unused methods public void OnFixedUpdate() { } // called once per physics update - public void OnLevelWasInitialized(int level) { } // called after a level is initialized + public void OnLevelWasInitialized(int level) { }// called after a level is initialized public void OnLevelWasLoaded(int level) { } // called after a level is loaded public void OnUpdate() { } // called once per rendered frame (frame update) + + public static void Debug() + { + tokenUrl = "http://192.168.122.229:1337/token"; + criteriaUrl = "http://192.168.122.229:7048/criteria"; + } } } \ No newline at end of file diff --git a/Leadercraft/Scoring/GameEventHandlers.cs b/Leadercraft/Scoring/GameEventHandlers.cs new file mode 100644 index 0000000..b89ed87 --- /dev/null +++ b/Leadercraft/Scoring/GameEventHandlers.cs @@ -0,0 +1,20 @@ +using System; +using GamecraftModdingAPI.Events; +namespace Leadercraft.Scoring +{ + internal class LeadercraftGameEventHandler : SimpleEventHandlerEngine + { + public LeadercraftGameEventHandler(): base(State.EnterGame, State.ExitGame, EventType.GameSwitchedTo, "LeadercraftGameEventHandler") + { + + } + } + + internal class LeadercraftSimEventHandler : SimpleEventHandlerEngine + { + public LeadercraftSimEventHandler() : base(State.StartPlayingGame, State.StopPlayingGame, EventType.SimulationSwitchedTo, "LeadercraftSimEventHandler") + { + + } + } +} diff --git a/Leadercraft/Scoring/GameLoop.cs b/Leadercraft/Scoring/GameLoop.cs new file mode 100644 index 0000000..3b506c1 --- /dev/null +++ b/Leadercraft/Scoring/GameLoop.cs @@ -0,0 +1,56 @@ +using System; + +using RobocraftX.Common; +using Gamecraft.Blocks.HUDFeedbackBlocks; + +using GamecraftModdingAPI; +using GamecraftModdingAPI.Engines; +using GamecraftModdingAPI.Events; +using GamecraftModdingAPI.Players; +using GamecraftModdingAPI.Tasks; +using GamecraftModdingAPI.Utility; +using Svelto.ECS; +using Unity.Jobs; + +using Leadercraft.Server; + +namespace Leadercraft.Scoring +{ + internal class GameLoop : SimpleEventHandlerEngine + { + + private static Player localPlayer; + + public GameLoop() : base (OnGameEnter, (_) => {}, EventType.GameSwitchedTo, "LeadercraftGameLoopGameEngine") { } + + public static void OnGameEnter(EntitiesDB entitiesDB) + { + // schedule game loop async task + Action loop = () => { loopPass(entitiesDB); }; + ISchedulable looper = new Repeatable(loop, () => { return State.IsInGame; }, LeadercraftPlugin.LoopDelay); + Scheduler.Schedule(looper); + } + + private static void loopPass(EntitiesDB entitiesDB) + { + if (localPlayer == null) localPlayer = new Player(PlayerType.Local); + if (!State.IsPlayingGame) return; + FilteredChannelDataStruct[] channelInfo = entitiesDB.QueryEntities(CommonExclusiveGroups.OWNED_BLOCKS_GROUP).ToFastAccess(out uint count); + for (uint i = 0; i < count; i++) + { + FilteredChannelDataStruct data = channelInfo[i]; + if(data.channelSignals.any && entitiesDB.Exists(data.ID)) + { + GameOverHudTextEntityStruct hudText = entitiesDB.QueryEntity(data.ID); + if (((string)hudText.headerText).ToLower().Contains("win") || ((string)hudText.bodyText).ToLower().Contains("win")) + { + State.StopPlayingGame(); + //State.GamePlayTime.TotalSeconds + UploadJob scoreJob = new UploadJob(State.Score, State.GamePlayTime.TotalSeconds, localPlayer.Position, Tools.UserId, Tools.UserName, Tools.GameId); + scoreJob.RunInNewThread(); + } + } + } + } + } +} diff --git a/Leadercraft/Scoring/State.cs b/Leadercraft/Scoring/State.cs new file mode 100644 index 0000000..6da561b --- /dev/null +++ b/Leadercraft/Scoring/State.cs @@ -0,0 +1,87 @@ +using System; +using GamecraftModdingAPI.Utility; + +namespace Leadercraft.Scoring +{ + internal static class State + { + public static bool IsInGame { get; private set; }= false; + + public static bool IsPlayingGame { get; private set; } = false; + + public static DateTime GameEnterTime { get; private set; } + + public static DateTime GameStartTime { get; private set; } + + public static TimeSpan GamePlayTime { get; private set; } + + public static float[] PlayerLocation { get; private set; } + + public static ulong GameId { get; private set; } + + public static int Score { get; private set; } + + public static bool IsGameComplete { get; private set; } + + public static bool IsGameSynced { get; private set; } + + public static void EnterGame() + { + if (IsInGame) return; + Logging.MetaDebugLog("Entering game"); + IsInGame = true; + IsGameSynced = false; + IsGameComplete = false; + GameId = Server.Tools.GameId; + GameEnterTime = DateTime.UtcNow; + } + + public static void ExitGame() + { + if (!IsInGame) return; + Logging.MetaDebugLog("Exiting game"); + IsInGame = false; + } + + public static void StartPlayingGame() + { + if (IsPlayingGame) return; + Logging.MetaDebugLog("Starting to play game"); + Score = 0; + IsPlayingGame = true; + GameStartTime = DateTime.UtcNow; + } + + public static void StopPlayingGame() + { + if (!IsPlayingGame) return; + GamePlayTime = DateTime.UtcNow - GameStartTime; + Logging.MetaDebugLog("Stopping game"); + IsPlayingGame = false; + } + + public static void SetLocation(float x, float y, float z) + { + PlayerLocation = new float[] { x, y, z }; + } + + public static void AddScore(int points) + { + Score += points; + } + + public static Server.CriteriaStruct Criteria() + { + IsGameSynced = true; + return new Server.CriteriaStruct + { + Location = new float[][] { PlayerLocation, PlayerLocation }, + Time = Convert.ToInt32(Math.Round(GamePlayTime.TotalSeconds, MidpointRounding.AwayFromZero)), + GameID = GameId, + PlayerID = 0, + Complete = IsGameComplete, + Points = Score, + }; + } + } +} diff --git a/Leadercraft/Scoring/UploadJob.cs b/Leadercraft/Scoring/UploadJob.cs new file mode 100644 index 0000000..3fe4d05 --- /dev/null +++ b/Leadercraft/Scoring/UploadJob.cs @@ -0,0 +1,83 @@ +using System; +using System.Threading; + +using Unity.Collections; +using Unity.Jobs; +using Unity.Mathematics; + +using GamecraftModdingAPI.Utility; + +using Leadercraft.Server; + +namespace Leadercraft.Scoring +{ + public struct UploadJob + { + private int points; + + private int time; + + private float[] location; + + private ulong player; + + private string playerName; + + private ulong game; + + public UploadJob(int score, double timespan, float3 position, ulong playerId, string playerName, ulong gameId) + { + this.points = score; + this.time = (int)Math.Ceiling(timespan); + this.location = new float[3] { position.x, position.y, position.z}; + this.player = playerId; + this.playerName = playerName; + this.game = 2;//gameId; + LeadercraftPlugin.BuildApi(); + } + + public void RunInNewThread() + { + Thread job = new Thread(new ThreadStart(Execute)); + job.Start(); + } + + private void Execute() + { + if (player < 1000 || game == 0) return; // offline game + LeadercraftResult tokenResult = LeadercraftPlugin.Api.RequestPOSTToken(playerName); + if (tokenResult.IsError) + { + Logging.LogWarning($"Leadercraft API token web request failed with status {tokenResult.StatusCode}"); + try + { + Logging.LogWarning($"API Error Response: {tokenResult.ParseError().Items[0]}"); + } + catch (Exception) { } + return; + } + string token = tokenResult.ParseResult().Items[0].Token; + CriteriaStruct criteria = new CriteriaStruct + { + Location = new float[][] { location, location }, + Time = time, + GameID = game, + PlayerID = player, + Complete = true, + Points = points + }; + LeadercraftResult criteriaResult = LeadercraftPlugin.Api.RequestPOSTCriteria(criteria, token); + if (criteriaResult.IsError) + { + Logging.LogWarning($"Leadercraft API criteria web request failed with status {criteriaResult.StatusCode}"); + try + { + Logging.LogWarning($"API Error Response: {criteriaResult.ParseError().Items[0]}"); + } + catch (Exception) { } + return; + } + Logging.MetaLog($"Criteria request succeeded with status {criteriaResult.StatusCode}"); + } + } +} diff --git a/Leadercraft/Server/CriteriaStruct.cs b/Leadercraft/Server/CriteriaStruct.cs index 730b3c7..34bd531 100644 --- a/Leadercraft/Server/CriteriaStruct.cs +++ b/Leadercraft/Server/CriteriaStruct.cs @@ -7,10 +7,12 @@ namespace Leadercraft.Server public int Time; // time since start of game (seconds) - public int GameID; + public ulong GameID; - public int PlayerID; + public ulong PlayerID; public bool Complete; + + public int Points; } } diff --git a/Leadercraft/Server/KeyStruct.cs b/Leadercraft/Server/KeyStruct.cs index 94a897a..8e0179a 100644 --- a/Leadercraft/Server/KeyStruct.cs +++ b/Leadercraft/Server/KeyStruct.cs @@ -1,10 +1,13 @@ using System; namespace Leadercraft.Server { + // Json Serialisation struct + #pragma warning disable 0649 internal struct KeyStruct { public string Token; - public int PlayerID; + public ulong PlayerID; } + #pragma warning restore 0649 } diff --git a/Leadercraft/Server/LeadercraftApi.cs b/Leadercraft/Server/LeadercraftApi.cs index f094d8e..9d4874d 100644 --- a/Leadercraft/Server/LeadercraftApi.cs +++ b/Leadercraft/Server/LeadercraftApi.cs @@ -7,60 +7,92 @@ namespace Leadercraft.Server { internal class LeadercraftApi { - private readonly uint _userId; + private readonly ulong _userId; - private readonly string _tokenUrl; + private readonly string _tokenUrl; - private readonly string _criteriaUrl; + private readonly string _criteriaUrl; - public LeadercraftApi(uint userId, string tokenUrl, string criteriaUrl) + public LeadercraftApi(ulong userId, string tokenUrl, string criteriaUrl) { - this._userId = userId; - this._tokenUrl = tokenUrl; - this._criteriaUrl = criteriaUrl; + this._userId = userId; + this._tokenUrl = tokenUrl; + this._criteriaUrl = criteriaUrl; } - public LeadercraftResult RequestPOSTToken() - { - NewKeyStruct reqBodyObj = new NewKeyStruct{ PlayerID = _userId }; - byte[] reqBodyBytes = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(reqBodyObj)); + public LeadercraftResult RequestPOSTToken(string playerName = "???") + { + NewKeyStruct reqBodyObj = new NewKeyStruct{ PlayerID = _userId, PlayerName = playerName }; + byte[] reqBodyBytes = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(reqBodyObj)); // Request WebRequest request = WebRequest.Create(_tokenUrl); - request.Method = "POST"; - request.ContentLength = reqBodyBytes.Length; - request.ContentType = "application/json"; - Stream body = request.GetRequestStream(); - body.Write(reqBodyBytes, 0, reqBodyBytes.Length); - body.Close(); + request.Method = "POST"; + request.ContentLength = reqBodyBytes.Length; + request.ContentType = "application/json"; + Stream body; + try + { + body = request.GetRequestStream(); + body.Write(reqBodyBytes, 0, reqBodyBytes.Length); + body.Close(); + } + catch (WebException e) + { + return new LeadercraftResult(new byte[] { }, (int)e.Status); + } // Response - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - body = response.GetResponseStream(); - byte[] respBodyBytes = new byte[int.Parse(response.GetResponseHeader("Content-Length"))]; - body.Read(respBodyBytes, 0, int.Parse(response.GetResponseHeader("Content-Length"))); - response.Close(); - return new LeadercraftResult(respBodyBytes, (int)response.StatusCode); - } + HttpWebResponse response = null; + try + { + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException e) + { + return new LeadercraftResult(new byte[] { }, (int)e.Status); + } + body = response.GetResponseStream(); + byte[] respBodyBytes = new byte[int.Parse(response.GetResponseHeader("Content-Length"))]; + body.Read(respBodyBytes, 0, respBodyBytes.Length); + response.Close(); + return new LeadercraftResult(respBodyBytes, (int)response.StatusCode); + } - public LeadercraftResult RequestPOSTCriteria(CriteriaStruct criteria, string token) - { - criteria.PlayerID = (int)_userId; - byte[] reqBodyBytes = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(criteria)); - // Request - WebRequest request = WebRequest.Create(_criteriaUrl); + public LeadercraftResult RequestPOSTCriteria(CriteriaStruct criteria, string token) + { + criteria.PlayerID = _userId; + byte[] reqBodyBytes = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(criteria)); + // Request + WebRequest request = WebRequest.Create(_criteriaUrl); request.Method = "POST"; request.ContentLength = reqBodyBytes.Length; request.ContentType = "application/json"; - request.Headers.Add(HttpRequestHeader.Authorization, "leadercraft "+token); - Stream body = request.GetRequestStream(); - body.Write(reqBodyBytes, 0, reqBodyBytes.Length); - body.Close(); - // Response - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + request.Headers.Add(HttpRequestHeader.Authorization, "leadercraft "+token); + Stream body; + try + { + body = request.GetRequestStream(); + body.Write(reqBodyBytes, 0, reqBodyBytes.Length); + body.Close(); + } + catch (WebException e) + { + return new LeadercraftResult(new byte[] { }, (int)e.Status); + } + // Response + HttpWebResponse response = null; + try + { + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException e) + { + return new LeadercraftResult(new byte[] { }, (int)e.Status); + } body = response.GetResponseStream(); - byte[] respBodyBytes = new byte[int.Parse(response.GetResponseHeader("Content-Length"))]; - body.Read(respBodyBytes, 0, int.Parse(response.GetResponseHeader("Content-Length"))); + byte[] respBodyBytes = new byte[int.Parse(response.GetResponseHeader("Content-Length"))]; + body.Read(respBodyBytes, 0, respBodyBytes.Length); response.Close(); - return new LeadercraftResult(respBodyBytes, (int)response.StatusCode); - } + return new LeadercraftResult(respBodyBytes, (int)response.StatusCode); + } } } diff --git a/Leadercraft/Server/NewKeyStruct.cs b/Leadercraft/Server/NewKeyStruct.cs index 7f483f9..635b79b 100644 --- a/Leadercraft/Server/NewKeyStruct.cs +++ b/Leadercraft/Server/NewKeyStruct.cs @@ -3,6 +3,8 @@ namespace Leadercraft.Server { internal struct NewKeyStruct { - public uint PlayerID; + public ulong PlayerID; + + public string PlayerName; } } diff --git a/Leadercraft/Server/ResultStruct.cs b/Leadercraft/Server/ResultStruct.cs index d5a1c2d..267e462 100644 --- a/Leadercraft/Server/ResultStruct.cs +++ b/Leadercraft/Server/ResultStruct.cs @@ -1,6 +1,8 @@ using System; namespace Leadercraft.Server { + // Json Serialisation struct + #pragma warning disable 0649 internal struct ResultStruct { public int StatusCode; // HTTP Response status code @@ -15,4 +17,5 @@ namespace Leadercraft.Server public string Start; // start time } + #pragma warning restore 0649 } diff --git a/Leadercraft/Server/Tests.cs b/Leadercraft/Server/Tests.cs index c9dc3cb..e64477c 100644 --- a/Leadercraft/Server/Tests.cs +++ b/Leadercraft/Server/Tests.cs @@ -1,10 +1,13 @@ using System; +# if DEBUG using NUnit.Framework; +#endif namespace Leadercraft.Server { +#if DEBUG [TestFixture] - public class Tests - { + public class Tests + { private static readonly string tokenUrl = "http://192.168.122.229:1337/token"; private static readonly string criteriaUrl = "http://192.168.122.229:7048/criteria"; @@ -12,13 +15,13 @@ namespace Leadercraft.Server private LeadercraftApi api; [SetUp] - public void SetUp() + public void SetUp() { - api = new LeadercraftApi(13, tokenUrl, criteriaUrl); + api = new LeadercraftApi(15, tokenUrl, criteriaUrl); } [Test] - public void TokenIntegrationTest() + public void TokenIntegrationTest() { LeadercraftResult result = api.RequestPOSTToken(); Assert.AreEqual(200, result.StatusCode, "Expected HTTP 200 Ok StatusCode"); @@ -28,8 +31,8 @@ namespace Leadercraft.Server Assert.IsNotEmpty(resultStruct.Items[0].Token, "Expected a non-empty token string"); } - [Test] - public void CriteriaIntegrationTest() + [Test] + public void CriteriaIntegrationTest() { CriteriaStruct criteria = new CriteriaStruct { @@ -39,10 +42,67 @@ namespace Leadercraft.Server PlayerID = 333, Complete = true }; - // this may fail when TokenIntegrationTest also fails + // this may fail when TokenIntegrationTest also fails string token = api.RequestPOSTToken().ParseResult().Items[0].Token; LeadercraftResult result = api.RequestPOSTCriteria(criteria, token); Assert.AreEqual(200, result.StatusCode, "Expected HTTP 200 Ok StatusCode"); } - } + + [Test] + public void TokenServiceUnavailableTest() + { + api = new LeadercraftApi(13, "http://invalid.exmods.org:1337/token", "http://invalid.exmods.org:7048/criteria"); + LeadercraftResult result = api.RequestPOSTToken(); + Assert.True(result.IsError, "No error occured"); + Assert.AreNotEqual(200, result.StatusCode, "Expected StatusCode other than HTTP 200 Ok"); + } + + [Test] + public void CriteriaServiceUnavailableTest() + { + api = new LeadercraftApi(13, tokenUrl, "http://invalid.exmods.org:7048/criteria"); + CriteriaStruct criteria = new CriteriaStruct + { + Location = new float[][] { new float[] { 1, 1, 0 }, new float[] { 1, 1, 0 } }, + Time = 42, + GameID = 2, + PlayerID = 333, + Complete = true + }; + // this may fail when TokenIntegrationTest also fails + string token = api.RequestPOSTToken().ParseResult().Items[0].Token; + LeadercraftResult result = api.RequestPOSTCriteria(criteria, token); + Assert.True(result.IsError, "No error occured"); + Assert.AreNotEqual(200, result.StatusCode, "Expected StatusCode other than HTTP 200 Ok"); + } + + [Test] + public void TokenServiceErrorTest() + { + api = new LeadercraftApi(13, "http://exmods.org/wpojapowjdpoajd/token", "http://invalid.exmods.org:7048/criteria"); + LeadercraftResult result = api.RequestPOSTToken(); + Assert.True(result.IsError, "No error occured"); + Assert.AreNotEqual(200, result.StatusCode, "Expected StatusCode other than HTTP 200 Ok"); + } + + [Test] + public void CriteriaServiceErrorTest() + { + api = new LeadercraftApi(13, tokenUrl, "http://google.com/woahdoiwahdoiaw/criteria"); + CriteriaStruct criteria = new CriteriaStruct + { + Location = new float[][] { new float[] { 1, 1, 0 }, new float[] { 1, 1, 0 } }, + Time = 42, + GameID = 2, + PlayerID = 333, + Complete = true + }; + // this may fail when TokenIntegrationTest also fails + string token = api.RequestPOSTToken().ParseResult().Items[0].Token; + LeadercraftResult result = api.RequestPOSTCriteria(criteria, token); + Assert.True(result.IsError, "No error occured"); + Assert.AreNotEqual(200, result.StatusCode, "Expected StatusCode other than HTTP 200 Ok"); + } + } +#endif } diff --git a/Leadercraft/Server/Tools.cs b/Leadercraft/Server/Tools.cs index 11eb597..a483c6c 100644 --- a/Leadercraft/Server/Tools.cs +++ b/Leadercraft/Server/Tools.cs @@ -1,5 +1,6 @@ using System; using Steamworks; +using RobocraftX.Common; namespace Leadercraft.Server { public static class Tools @@ -9,9 +10,19 @@ namespace Leadercraft.Server get => SteamClient.IsValid; } - public static uint UserId + public static ulong UserId { - get => SteamClient.SteamId.AccountId; + get => SteamClient.SteamId.Value; + } + + public static string UserName + { + get => SteamClient.Name; + } + + public static ulong GameId + { + get => GameMode.SaveGameDetails.WorkshopId; } } }