Added Mod Loading & Unloading
This commit is contained in:
@@ -108,7 +108,7 @@ namespace SeamlessClientPlugin
|
||||
|
||||
|
||||
public static string Version = "1.3.04";
|
||||
public static bool Debug = false;
|
||||
public static bool Debug = true;
|
||||
private static bool Initilized = false;
|
||||
|
||||
|
||||
|
@@ -91,11 +91,12 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
if (!DownloadSuccess)
|
||||
return;
|
||||
|
||||
/*
|
||||
MySession.Static.ScriptManager.LoadData();
|
||||
MyDefinitionManager.Static.LoadData(TargetServerMods);
|
||||
MyLocalCache.PreloadLocalInventoryConfig();
|
||||
SeamlessClient.TryShow("Finished transfering!");
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@@ -10,8 +10,10 @@ using Sandbox.Game.Multiplayer;
|
||||
using Sandbox.Game.SessionComponents;
|
||||
using Sandbox.Game.World;
|
||||
using Sandbox.Game.World.Generator;
|
||||
using Sandbox.Graphics.GUI;
|
||||
using Sandbox.ModAPI;
|
||||
using SeamlessClientPlugin.Utilities;
|
||||
using SpaceEngineers.Game.GUI;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -134,11 +136,11 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
string text = ((!string.IsNullOrEmpty(TargetWorld.Checkpoint.CustomSkybox)) ? TargetWorld.Checkpoint.CustomSkybox : MySector.EnvironmentDefinition.EnvironmentTexture);
|
||||
MyRenderProxy.PreloadTextures(new string[1] { text }, TextureType.CubeMap);
|
||||
MySession.Static.LoadDataComponents();
|
||||
MySession.Static.LoadObjectBuildersComponents(TargetWorld.Checkpoint.SessionComponents);
|
||||
// MySession.Static.LoadObjectBuildersComponents(TargetWorld.Checkpoint.SessionComponents);
|
||||
|
||||
|
||||
MethodInfo A = typeof(MySession).GetMethod("LoadGameDefinition", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
A.Invoke(MySession.Static, new object[] { TargetWorld.Checkpoint });
|
||||
//MethodInfo A = typeof(MySession).GetMethod("LoadGameDefinition", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
// A.Invoke(MySession.Static, new object[] { TargetWorld.Checkpoint });
|
||||
|
||||
|
||||
|
||||
@@ -426,6 +428,10 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
MyMultiplayer.Static.ReplicationLayer.Dispose();
|
||||
MyMultiplayer.Static.Dispose();
|
||||
MyMultiplayer.Static = null;
|
||||
|
||||
//Close any respawn screens that are open
|
||||
MyGuiScreenMedicals.Close();
|
||||
|
||||
}
|
||||
|
||||
private void RemoveOldEntities()
|
||||
|
@@ -121,13 +121,16 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
MethodInfo LoadingScreenDraw = GetMethod(typeof(MyGuiScreenLoading), "DrawInternal", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Patcher.Patch(LoadingScreenDraw, prefix: new HarmonyMethod(GetPatchMethod(nameof(DrawInternal))));
|
||||
Patcher.Patch(OnJoin, postfix: new HarmonyMethod(GetPatchMethod(nameof(OnUserJoined))));
|
||||
Patcher.Patch(LoadingAction, prefix: new HarmonyMethod(GetPatchMethod(nameof(LoadMultiplayerSession))));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -152,8 +155,8 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
private static bool LoadMultiplayerSession(MyObjectBuilder_World world, MyMultiplayerBase multiplayerSession)
|
||||
{
|
||||
|
||||
if (SeamlessClient.IsSwitching)
|
||||
return true;
|
||||
//
|
||||
|
||||
|
||||
|
||||
MyLog.Default.WriteLine("LoadSession() - Start");
|
||||
@@ -164,6 +167,9 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
||||
return false;
|
||||
}
|
||||
|
||||
MyLog.Default.WriteLine("Seamless Downloading mods!");
|
||||
|
||||
|
||||
|
||||
MyWorkshop.DownloadModsAsync(world.Checkpoint.Mods, delegate (bool success)
|
||||
{
|
||||
|
Reference in New Issue
Block a user