Example #1
0
 public override void UpdatingStopped()
 {
     base.UpdatingStopped();
     Log.Entered();
     ComponentSession.RaiseSessionEventImmediately(ComponentEventNames.UpdatingStopped);
     IsUpdatingStopped = true;
 }
Example #2
0
        public Session()
        {
            // Only load if the steam version has been loaded too.
            var steamComponent = ReflectionHelper.FindModSessionComponent("GardenConquest", 450540708, "Steam", "GC.Notify");

            if (steamComponent == null)
            {
                return;
            }

            Log.Log("GC steam component found, loading mod.");

            Log.Trace("Registering session components");
            ComponentSession.RegisterComponentGroup((int)Groups.Sessions);
            //UpdateManager.RegisterSessionComponent(new ServerTestSession());

            Log.Trace("Registering entity components");
            //UpdateManager.RegisterEntityComponent(
            //    ((e) => { return new EnforcedGrid(e); }),
            //    typeof(MyObjectBuilder_CubeGrid),
            //    RunLocation.Server);
            //UpdateManager.RegisterEntityComponent(
            //	((e) => {
            //		return LootCrate.IsLootCrate(e) ?
            //			new LootCrate(e) :
            //			null;
            //	}),
            //	typeof(MyObjectBuilder_CubeGrid),
            //	RunLocation.Server);

            // Tell the steam code we've loaded successfully.
            ReflectionHelper.SetInstanceField(steamComponent, "PluginLoaded", true);
        }
Example #3
0
        private void SessionClosed()
        {
            Log.Entered();
            ComponentSession.Close();

            // Send close event to ComponentSession dependencies
            Profiler.Close();
            Logger.Close();

            MyAPIGateway.Entities.OnCloseAll -= SessionClosed;
            SessionClosedAttached             = false;
        }
Example #4
0
        public override void UpdateAfterSimulation()
        {
            base.UpdateAfterSimulation();

            if (IsUpdatingStopped)
            {
                UpdatingResumed();
            }

            if (!SessionClosedAttached && MyAPIGateway.Entities != null)
            {
                Log.Trace("Attaching SessionClosed");
                MyAPIGateway.Entities.OnCloseAll += SessionClosed;
                SessionClosedAttached             = true;
            }

            ComponentSession.Update();
        }
Example #5
0
 private void UpdatingResumed()
 {
     Log.Entered();
     ComponentSession.RaiseSessionEvent(ComponentEventNames.UpdatingResumed);
     IsUpdatingStopped = false;
 }
Example #6
0
 public override void SaveData()
 {
     base.SaveData();
     Log.Entered();
     ComponentSession.RaiseSessionEventImmediately(ComponentEventNames.SessionSave);
 }
Example #7
0
 public MySession() : base()
 {
     Log.Entered();
     ComponentSession.Open();
 }