From 746aeba4f2991d95781e15d192a0523b6babdd09 Mon Sep 17 00:00:00 2001 From: GrafDimenzio Date: Sat, 7 Nov 2020 13:07:24 +0100 Subject: [PATCH] =?UTF-8?q?Projektdateien=20hinzuf=C3=BCgen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WaitAndChill.sln | 25 ++++++++ WaitAndChill/Config.cs | 9 +++ WaitAndChill/EventHandlers.cs | 63 +++++++++++++++++++ WaitAndChill/PluginClass.cs | 22 +++++++ WaitAndChill/Properties/AssemblyInfo.cs | 36 +++++++++++ WaitAndChill/WaitAndChill.csproj | 84 +++++++++++++++++++++++++ WaitAndChill/packages.config | 7 +++ 7 files changed, 246 insertions(+) create mode 100644 WaitAndChill.sln create mode 100644 WaitAndChill/Config.cs create mode 100644 WaitAndChill/EventHandlers.cs create mode 100644 WaitAndChill/PluginClass.cs create mode 100644 WaitAndChill/Properties/AssemblyInfo.cs create mode 100644 WaitAndChill/WaitAndChill.csproj create mode 100644 WaitAndChill/packages.config diff --git a/WaitAndChill.sln b/WaitAndChill.sln new file mode 100644 index 0000000..0eb8fdc --- /dev/null +++ b/WaitAndChill.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30406.217 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WaitAndChill", "WaitAndChill\WaitAndChill.csproj", "{098A2189-5B40-425B-A804-46A11F4CF260}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {098A2189-5B40-425B-A804-46A11F4CF260}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {098A2189-5B40-425B-A804-46A11F4CF260}.Debug|Any CPU.Build.0 = Debug|Any CPU + {098A2189-5B40-425B-A804-46A11F4CF260}.Release|Any CPU.ActiveCfg = Release|Any CPU + {098A2189-5B40-425B-A804-46A11F4CF260}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2FA6F3C0-7167-4648-8F1B-47171EA11C04} + EndGlobalSection +EndGlobal diff --git a/WaitAndChill/Config.cs b/WaitAndChill/Config.cs new file mode 100644 index 0000000..a5c1410 --- /dev/null +++ b/WaitAndChill/Config.cs @@ -0,0 +1,9 @@ +using Synapse.Config; + +namespace WaitAndChill +{ + public class Config : AbstractConfigSection + { + public SerializedMapPoint LobbySpawn = new SerializedMapPoint("EZ_Shelter", 0f, 2f, 0f); + } +} diff --git a/WaitAndChill/EventHandlers.cs b/WaitAndChill/EventHandlers.cs new file mode 100644 index 0000000..5655143 --- /dev/null +++ b/WaitAndChill/EventHandlers.cs @@ -0,0 +1,63 @@ +using MEC; +using Synapse; +using Synapse.Api; +using System.Collections.Generic; +using UnityEngine; + +namespace WaitAndChill +{ + public class EventHandlers + { + public EventHandlers() => Server.Get.Events.Round.WaitingForPlayersEvent += OnWaiting; + + private void OnWaiting() + { + GameObject.Find("StartRound").transform.localScale = Vector3.zero; + Timing.RunCoroutine(WaitingForPlayers()); + } + + private IEnumerator WaitingForPlayers() + { + var msg = $"Waiting for more Players!\n%players%/{CustomNetworkManager.slots}\n%status%"; + + foreach (var door in Map.Get.Doors) + door.Locked = true; + + while (!Map.Get.Round.RoundIsActive) + { + NonFacilityCompatibility.currentSceneSettings.constantRespawnPoint = PluginClass.Config.LobbySpawn.Parse().Position; + + var newmsg = msg.Replace("%players%", Server.Get.Players.Count.ToString()); + switch (GameCore.RoundStart.singleton.NetworkTimer) + { + case -2: + newmsg = newmsg.Replace("%status%", ""); + break; + + case -1: + newmsg = newmsg.Replace("%status%", "Round is starting"); + break; + + default: + newmsg = newmsg.Replace("%status%", $"{GameCore.RoundStart.singleton.NetworkTimer} seconds left"); + break; + } + + foreach (var player in Server.Get.Players) + { + if (player.RoleType == RoleType.None && player.Hub.Ready) + player.RoleID = (int)RoleType.Tutorial; + + player.GiveTextHint(newmsg); + } + + NonFacilityCompatibility.currentSceneSettings.constantRespawnPoint = Vector3.zero; + yield return Timing.WaitForOneFrame; + } + + foreach (var door in Map.Get.Doors) + door.Locked = false; + } + + } +} diff --git a/WaitAndChill/PluginClass.cs b/WaitAndChill/PluginClass.cs new file mode 100644 index 0000000..90dcdc2 --- /dev/null +++ b/WaitAndChill/PluginClass.cs @@ -0,0 +1,22 @@ +using Synapse.Api.Plugin; + +namespace WaitAndChill +{ + [PluginInformation( + Name = "WaitAndChill", + Author = "Dimenzio (Original: F4Fridey)", + LoadPriority = int.MinValue, + Description = "A Plugin which spawns player while waiting for Players", + SynapseMajor = SynapseController.SynapseMajor, + SynapseMinor = SynapseController.SynapseMinor, + SynapsePatch = SynapseController.SynapsePatch, + Version = "v.1.0.0" + )] + public class PluginClass : AbstractPlugin + { + [Synapse.Api.Plugin.Config(section = "WaitAndChill")] + public static Config Config; + + public override void Load() => new EventHandlers(); + } +} diff --git a/WaitAndChill/Properties/AssemblyInfo.cs b/WaitAndChill/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4696b29 --- /dev/null +++ b/WaitAndChill/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("WaitAndChill")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WaitAndChill")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("098a2189-5b40-425b-a804-46a11f4cf260")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WaitAndChill/WaitAndChill.csproj b/WaitAndChill/WaitAndChill.csproj new file mode 100644 index 0000000..6337670 --- /dev/null +++ b/WaitAndChill/WaitAndChill.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {098A2189-5B40-425B-A804-46A11F4CF260} + Library + Properties + WaitAndChill + WaitAndChill + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Lib.Harmony.2.0.4\lib\net472\0Harmony.dll + + + ..\packages\SynapseSL.2.0.0\lib\net472\Assembly-CSharp.dll + + + ..\packages\SynapseSL.2.0.0\lib\net472\Assembly-CSharp-firstpass.dll + + + ..\packages\LiteDB.5.0.9\lib\net45\LiteDB.dll + + + ..\packages\SynapseSL.2.0.0\lib\net472\Mirror.dll + + + ..\packages\SynapseSL.2.0.0\lib\net472\Synapse.dll + + + + + + + + + + + + ..\packages\SynapseSL.2.0.0\lib\net472\UnityEngine.dll + + + ..\packages\SynapseSL.2.0.0\lib\net472\UnityEngine.CoreModule.dll + + + ..\packages\SynapseSL.2.0.0\lib\net472\UnityEngine.PhysicsModule.dll + + + ..\packages\YamlDotNet.8.1.2\lib\net45\YamlDotNet.dll + + + + + + + + + + + + + \ No newline at end of file diff --git a/WaitAndChill/packages.config b/WaitAndChill/packages.config new file mode 100644 index 0000000..b0b1e4d --- /dev/null +++ b/WaitAndChill/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file