Fixed messages
This commit is contained in:
@@ -17,6 +17,7 @@ using VRage.Game;
|
||||
using Sandbox.Engine.Networking;
|
||||
using VRage;
|
||||
using VRage.GameServices;
|
||||
using VRageRender;
|
||||
|
||||
namespace SeamlessClient.Components
|
||||
{
|
||||
@@ -36,8 +37,8 @@ namespace SeamlessClient.Components
|
||||
|
||||
|
||||
patcher.Patch(loadingAction, prefix: new HarmonyMethod(Get(typeof(LoadingScreenComponent), nameof(LoadMultiplayerSession))));
|
||||
patcher.Patch(loadingScreenDraw, prefix: new HarmonyMethod(Get(typeof(LoadingScreenComponent), nameof(DrawInternal))));
|
||||
|
||||
patcher.Patch(loadingScreenDraw, prefix: new HarmonyMethod(Get(typeof(LoadingScreenComponent), nameof(DrawInternal_PRE))));
|
||||
patcher.Patch(loadingScreenDraw, postfix: new HarmonyMethod(Get(typeof(LoadingScreenComponent), nameof(DrawInternal_POST))));
|
||||
|
||||
|
||||
base.Patch(patcher);
|
||||
@@ -112,16 +113,11 @@ namespace SeamlessClient.Components
|
||||
}
|
||||
|
||||
|
||||
private static bool DrawInternal(MyGuiScreenLoading __instance)
|
||||
private static bool DrawInternal_PRE(MyGuiScreenLoading __instance)
|
||||
{
|
||||
//If we dont have a custom loading screen texture, do not do the special crap below
|
||||
|
||||
const string mFont = "LoadingScreen";
|
||||
var mTransitionAlpha = (float)typeof(MyGuiScreenBase).GetField("m_transitionAlpha", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
|
||||
MyGuiManager.DrawString(mFont, "Nexus & SeamlessClient Made by: Casimir", new Vector2(0.95f, 0.95f),
|
||||
MyGuiSandbox.GetDefaultTextScaleWithLanguage() * 1.1f,
|
||||
new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * mTransitionAlpha),
|
||||
MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +125,8 @@ namespace SeamlessClient.Components
|
||||
return true;
|
||||
|
||||
|
||||
|
||||
const string mFont = "LoadingScreen";
|
||||
var mTransitionAlpha = (float)typeof(MyGuiScreenBase).GetField("m_transitionAlpha", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
|
||||
|
||||
var color = new Color(255, 255, 255, 250);
|
||||
color.A = (byte)(color.A * mTransitionAlpha);
|
||||
@@ -155,6 +152,12 @@ namespace SeamlessClient.Components
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if (string.IsNullOrEmpty(m_customTextFromConstructor))
|
||||
{
|
||||
@@ -172,6 +175,14 @@ namespace SeamlessClient.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private static void DrawInternal_POST(MyGuiScreenLoading __instance)
|
||||
{
|
||||
const string mFont = "LoadingScreen";
|
||||
var mTransitionAlpha = (float)typeof(MyGuiScreenBase).GetField("m_transitionAlpha", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
|
||||
MyGuiManager.DrawString(mFont, "Nexus & SeamlessClient Made by: Casimir", new Vector2(0.95f, 0.95f),
|
||||
MyGuiSandbox.GetDefaultTextScaleWithLanguage() * 1.1f,
|
||||
new Color(MyGuiConstants.LOADING_PLEASE_WAIT_COLOR * mTransitionAlpha),
|
||||
MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ namespace SeamlessClient.Messages
|
||||
[ProtoMember(3)] public long IdentityID;
|
||||
[ProtoMember(4)] public ulong SteamID;
|
||||
[ProtoMember(5)] public string PluginVersion = "0";
|
||||
[ProtoMember(6)] public string NexusVersion = "0";
|
||||
[ProtoMember(6)] public string NexusVersion;
|
||||
|
||||
public ClientMessage(string PluginVersion)
|
||||
{
|
||||
@@ -37,6 +37,8 @@ namespace SeamlessClient.Messages
|
||||
|
||||
}
|
||||
|
||||
public ClientMessage() { }
|
||||
|
||||
public TransferData GetTransferData()
|
||||
{
|
||||
return MessageData == null ? default : MessageUtils.Deserialize<TransferData>(MessageData);
|
||||
|
@@ -853,7 +853,6 @@ namespace SeamlessClient.OnlinePlayersWindow
|
||||
{
|
||||
bool result = base.Draw();
|
||||
|
||||
Seamless.TryShow("Draw!");
|
||||
if (m_getPingAndRefresh)
|
||||
{
|
||||
m_getPingAndRefresh = false;
|
||||
|
22
Seamless.cs
22
Seamless.cs
@@ -24,7 +24,7 @@ namespace SeamlessClient
|
||||
public class Seamless : IPlugin
|
||||
{
|
||||
public static Version SeamlessVersion;
|
||||
public static Version NexusVersion;
|
||||
public static Version NexusVersion = new Version(1, 0, 0);
|
||||
private static Harmony SeamlessPatcher;
|
||||
public const ushort SeamlessClientNetId = 2936;
|
||||
|
||||
@@ -33,14 +33,8 @@ namespace SeamlessClient
|
||||
private bool Initilized = false;
|
||||
public static bool isSeamlessServer = false;
|
||||
|
||||
|
||||
|
||||
|
||||
#if DEBUG
|
||||
public static bool isDebug = true;
|
||||
#else
|
||||
public static bool isDebug = false;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
public void Init(object gameInstance)
|
||||
@@ -118,24 +112,26 @@ namespace SeamlessClient
|
||||
private static void MessageHandler(ushort packetID, byte[] data, ulong sender, bool fromServer)
|
||||
{
|
||||
//Ignore anything except dedicated server
|
||||
if (!fromServer || sender != 0)
|
||||
|
||||
Seamless.TryShow($"From Server {fromServer} - {sender}");
|
||||
if (!fromServer || sender == 0)
|
||||
return;
|
||||
|
||||
if (MyAPIGateway.Multiplayer == null || MyAPIGateway.Multiplayer.IsServer) return;
|
||||
if (MyAPIGateway.Session.LocalHumanPlayer == null) return;
|
||||
|
||||
|
||||
ClientMessage msg = MessageUtils.Deserialize<ClientMessage>(data);
|
||||
if (msg == null)
|
||||
return;
|
||||
|
||||
//Get Nexus Version
|
||||
Seamless.TryShow($"NexusVersion {msg.NexusVersion}");
|
||||
if (!string.IsNullOrEmpty(msg.NexusVersion))
|
||||
NexusVersion = Version.Parse(msg.NexusVersion);
|
||||
|
||||
switch (msg.MessageType)
|
||||
{
|
||||
case ClientMessageType.FirstJoin:
|
||||
|
||||
|
||||
Seamless.TryShow("Sending First Join!");
|
||||
ClientMessage response = new ClientMessage(SeamlessVersion.ToString());
|
||||
MyAPIGateway.Multiplayer?.SendMessageToServer(SeamlessClientNetId, MessageUtils.Serialize(response));
|
||||
break;
|
||||
|
Reference in New Issue
Block a user