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();
        }
Ejemplo n.º 3
0
 public void Close()
 {
     TimerRegistry.Remove(this);
     Timer.Close();
 }
Ejemplo n.º 4
0
        private void Init()
        {
            Timer.Elapsed += Timer_Elapsed;

            TimerRegistry.Add(this);
        }