コード例 #1
0
        private void UpdatePhysics()
        {
            if (_physicsFile == null)
            {
                return;
            }

            try {
                var physics = AcSharedPhysics.FromFile(_physicsFile);
                if (physics.PacketId != _previousPacketId)
                {
                    IsPaused = false;

                    _previousPacketId   = physics.PacketId;
                    _previousPacketTime = DateTime.Now;

                    if (Status != AcSharedMemoryStatus.Live)
                    {
                        Status       = AcSharedMemoryStatus.Live;
                        _gameProcess = TryToFindGameProcess();
                        KnownProcess = _gameProcess != null;
                    }

                    var graphics   = AcSharedGraphics.FromFile(_graphicsFile);
                    var staticInfo = AcSharedStaticInfo.FromFile(_staticInfoFile);
                    Shared = new AcShared(physics, graphics, staticInfo);
                }
                else if (_gameProcess?.HasExitedSafe() ?? (DateTime.Now - _previousPacketTime).TotalSeconds > 1d)
                {
                    IsPaused = false;
                    Status   = AcSharedMemoryStatus.Connected;
                    Shared   = null;
                }
                else
                {
                    IsPaused = Shared != null && Shared.Graphics.Status == AcGameStatus.AcPause;
                }
            } catch (Exception ex) {
                Logging.Error(ex);
                Status = AcSharedMemoryStatus.Disabled;
            }
        }
コード例 #2
0
 public AcShared(AcSharedPhysics physics, AcSharedGraphics graphics, AcSharedStaticInfo staticInfo)
 {
     Physics    = physics;
     Graphics   = graphics;
     StaticInfo = staticInfo;
 }
コード例 #3
0
ファイル: AcGameStatus.cs プロジェクト: gro-ove/actools
 public AcShared(AcSharedPhysics physics, AcSharedGraphics graphics, AcSharedStaticInfo staticInfo) {
     Physics = physics;
     Graphics = graphics;
     StaticInfo = staticInfo;
 }