Ejemplo n.º 1
0
        public void TimingManagerFixedUpdate()
        {
            profiler.Report("KSP", kspTime, kspMemory);
            long profilerStartTime   = profiler.GetCurrentTime;
            long profilerStartMemory = profiler.GetCurrentMemory;

            DarkLog.Update();
            if (modDisabled)
            {
                return;
            }
            dmpModInterface.FixedUpdate();

            if (dmpGame != null)
            {
                foreach (NamedAction fixedUpdateAction in dmpGame.fixedUpdateEvent)
                {
#if !DEBUG
                    try
                    {
#endif
                    long profilerFixedUpdateStartTime   = profiler.GetCurrentTime;
                    long profilerFixedUpdateStartMemory = profiler.GetCurrentMemory;
                    fixedUpdateAction.action();
                    profiler.Report(fixedUpdateAction.name, profilerFixedUpdateStartTime, profilerFixedUpdateStartMemory);
#if !DEBUG
                }
                catch (Exception e)
                {
                    DarkLog.Debug("Threw in FixedUpdate event, exception: " + e);
                    if (dmpGame.networkWorker != null)
                    {
                        if (dmpGame.networkWorker.state != ClientState.RUNNING)
                        {
                            if (dmpGame.networkWorker.state != ClientState.DISCONNECTED)
                            {
                                dmpGame.networkWorker.SendDisconnect("Unhandled error while syncing!");
                            }
                            else
                            {
                                dmpGame.networkWorker.Disconnect("Unhandled error while syncing!");
                            }
                        }
                    }
                }
#endif
                }
            }
            DarkLog.Update();
            profiler.Report("FixedUpdate", profilerStartTime, profilerStartMemory);
            kspTime   = profiler.GetCurrentTime;
            kspMemory = profiler.GetCurrentMemory;
        }
Ejemplo n.º 2
0
Archivo: Main.cs Proyecto: CHazz/DUXDMP
        public void TimingManagerFixedUpdate()
        {
            long startClock = Profiler.DMPReferenceTime.ElapsedTicks;

            if (modDisabled)
            {
                return;
            }

            dmpModInterface.FixedUpdate();

            if (dmpGame != null)
            {
                foreach (Action fixedUpdateAction in dmpGame.fixedUpdateEvent)
                {
#if !DEBUG
                    try
                    {
#endif
                    fixedUpdateAction();
#if !DEBUG
                }
                catch (Exception e)
                {
                    DarkLog.Debug("Threw in FixedUpdate event, exception: " + e);
                    if (dmpGame.networkWorker != null)
                    {
                        if (dmpGame.networkWorker.state != ClientState.RUNNING)
                        {
                            if (dmpGame.networkWorker.state != ClientState.DISCONNECTED)
                            {
                                dmpGame.networkWorker.SendDisconnect("Unhandled error while syncing!");
                            }
                            else
                            {
                                dmpGame.networkWorker.Disconnect("Unhandled error while syncing!");
                            }
                        }
                    }
                }
#endif
                }
            }
            Profiler.fixedUpdateData.ReportTime(startClock);
        }