protected override void UnloadData() { MyAPIGateway.Multiplayer.UnregisterMessageHandler(ConnectionHelper.ConnectionId, _messageHandler); TimerRegistry.Close(); // close things here base.UnloadData(); }
public override void UpdateBeforeSimulation() { // init clients if (!_isInitialized && MyAPIGateway.Session != null && MyAPIGateway.Session.Player != null) { if (!MyAPIGateway.Session.OnlineMode.Equals(MyOnlineModeEnum.OFFLINE) && MyAPIGateway.Multiplayer.IsServer && !MyAPIGateway.Utilities.IsDedicated) { // init hosts InitServer(); } InitClient(); } // init servers if (!_isInitialized && MyAPIGateway.Utilities != null && MyAPIGateway.Multiplayer != null && MyAPIGateway.Session != null && MyAPIGateway.Utilities.IsDedicated && MyAPIGateway.Multiplayer.IsServer) { InitServer(); } TimerRegistry.Update(); base.UpdateBeforeSimulation(); }
public void Close() { TimerRegistry.Remove(this); Timer.Close(); }
private void Init() { Timer.Elapsed += Timer_Elapsed; TimerRegistry.Add(this); }