protected override void OnUnload() { Alex.InGame = false; new Thread( o => { NetworkProvider.Close(); World.Destroy(); WorldProvider.Dispose(); _playingHud.Unload(); //var threadPool = // ReflectionHelper.GetPrivateStaticPropertyValue<MiNET.Utils.DedicatedThreadPool>( // typeof(MiNetServer), "FastThreadPool"); //threadPool?.Dispose(); //ReflectionHelper.SetPrivateStaticPropertyValue<MiNET.Utils.DedicatedThreadPool>(typeof(MiNetServer), "FastThreadPool", null); RichPresenceProvider.ClearPresence(); }).Start(); //GetService<IEventDispatcher>().UnregisterEvents(_playingHud.Chat); //_playingHud.Chat = }
protected override void Initialize() { Window.Title = $"Alex - {VersionUtils.GetVersion()} - {RenderingEngine}"; // InitCamera(); this.Window.TextInput += Window_TextInput; if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { var currentAdapter = GraphicsAdapter.Adapters.FirstOrDefault(x => x == GraphicsDevice.Adapter); if (currentAdapter != null) { if (currentAdapter.IsProfileSupported(GraphicsProfile.HiDef)) { DeviceManager.GraphicsProfile = GraphicsProfile.HiDef; } } } base.InactiveSleepTime = TimeSpan.Zero; GraphicsDevice.PresentationParameters.MultiSampleCount = 8; DeviceManager.ApplyChanges(); base.Initialize(); RichPresenceProvider.Initialize(); }
protected override void Initialize() { Window.Title = "Alex - " + Version; // InitCamera(); this.Window.TextInput += Window_TextInput; if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { var currentAdapter = GraphicsAdapter.Adapters.FirstOrDefault(x => x == GraphicsDevice.Adapter); if (currentAdapter != null) { if (currentAdapter.IsProfileSupported(GraphicsProfile.HiDef)) { DeviceManager.GraphicsProfile = GraphicsProfile.HiDef; } } } GraphicsDevice.PresentationParameters.MultiSampleCount = 8; DeviceManager.ApplyChanges(); base.Initialize(); RichPresenceProvider.Initialize(); }
protected override void OnUnload() { Alex.InGame = false; World.Destroy(); WorldProvider.Dispose(); NetworkProvider.Close(); _playingHud.Unload(); RichPresenceProvider.ClearPresence(); //GetService<IEventDispatcher>().UnregisterEvents(_playingHud.Chat); //_playingHud.Chat = }
protected override void OnLoad(IRenderArgs args) { Alex.InGame = true; World.SpawnPoint = WorldProvider.GetSpawnPoint(); World.Camera.MoveTo(World.GetSpawnPoint(), Vector3.Zero); RichPresenceProvider.SetPresence(new RichPresence() { State = "Multiplayer", Timestamps = Timestamps.Now, Details = $"Playing on a {Alex.ServerType} server.", Assets = RichPresenceProvider.GetDefaultAssets() }); base.OnLoad(args); }
protected override void Update(GameTime gameTime) { base.Update(gameTime); InputManager.Update(gameTime); GuiManager.Update(gameTime); GameStateManager.Update(gameTime); GuiDebugHelper.Update(gameTime); RichPresenceProvider.Update(); if (!UIThreadQueue.IsEmpty && UIThreadQueue.TryDequeue(out Action a)) { try { a.Invoke(); } catch (Exception ex) { Log.Warn($"Exception on UIThreadQueue: {ex.ToString()}"); } } }