internal BaseMotionPlayer(TaPa_XYCyl Owner, string MotionDataPath, string GamePath, string StartOptionsRunArgs, string RuntimeProcess, string StartOptionsInput, AvalibleProtocols MotionDeviceProtocol, string ConnectonString)
        {
            this.Owner = Owner;
            FrameData  = PositionAndTimingDataModel.DataLoadFromFile(MotionDataPath);
            this.MotionDeviceProtocol = MotionDeviceProtocol;
            switch (MotionDeviceProtocol)
            {
            case AvalibleProtocols.ComPort:
                if (MotionHardwareInterface != null)
                {
                    MotionHardwareInterface.Dispose();
                }
                MotionHardwareInterface = JMDM_CylinderPortControlUpdated.ConnectionFactory(ConnectonString);
                break;

            default:
                Owner.PlayBacksEnd.Invoke();
                throw new Exception("Error: not a valid Protocol.");
            }
            this.GamePath            = GamePath;
            this.StartOptionsRunArgs = StartOptionsRunArgs;
            this.StartOptionsInput   = StartOptionsInput;
            this.RuntimeProcess      = RuntimeProcess;
            Start();
        }
 protected override void SetCylinders(MomentaryPositionAndTimingFrameDataModel DataFrame)
 {
     MotionHardwareInterface.SetCylinderHeight(1, DataFrame.C1);
     MotionHardwareInterface.SetCylinderHeight(2, DataFrame.C2);
     MotionHardwareInterface.SetCylinderHeight(3, DataFrame.C3);
     //byte test = 0;
     //MotionHardwareInterface.SetCylinderHeight(1, test);
     //MotionHardwareInterface.SetCylinderHeight(2, test);
     //MotionHardwareInterface.SetCylinderHeight(3, test);
 }
 internal virtual void Start()
 {
     Run        = true;
     ThreadLoop = new Thread(new ThreadStart(
                                 () =>
     {
         GrabHardware();
         lock (LockObj)
         {
             LoopFinished = false;
             if (!StartGame())
             {
                 return;
             }
             FrameTimer = new Stopwatch();
             FrameTimer.Start();
         }
         int PosPointer = 0;
         while (Run)
         {
             while ((ulong)FrameTimer.ElapsedMilliseconds < FrameData[PosPointer].Time)
             {
                 ;
             }
             AnimateFame(FrameData[PosPointer]);
             FrameTimer.Restart();
             PosPointer += 1;
             if (PosPointer % 10 == 0 && GameRunTime.HasExited)
             {
                 Run = false;
             }
             if (PosPointer >= FrameData.Count)
             {
                 Run = false;
             }
         }
         ReleaseHardware();
         lock (LockObj)
             LoopFinished = true;
         if (!GameRunTime.HasExited)
         {
             GameRunTime.Kill();
         }
         if (MotionHardwareInterface != null)
         {
             MotionHardwareInterface.Dispose();
         }
         if (!StopedFromControl)
         {
             Owner.PlayBacksEnd.Invoke();
         }
     }));
     ThreadLoop.IsBackground = true;
     ThreadLoop.Start();
 }
Esempio n. 4
0
 protected override void AnimateFame(MomentaryPositionAndTimingFrameDataModel Data)
 {
     MotionHardwareInterface.SetCylinderHeight(1, Data.C1);
     MotionHardwareInterface.SetCylinderHeight(2, Data.C2);
 }
 protected override void SetCylinders()
 {
     MotionHardwareInterface.SetCylinderHeight(1, (byte)Cylinder1);
     MotionHardwareInterface.SetCylinderHeight(2, (byte)Cylinder2);
 }
 protected override void SetCylinders(MomentaryPositionAndTimingFrameDataModel DataFrame)
 {
     MotionHardwareInterface.SetCylinderHeight(1, DataFrame.C1);
 }
 internal virtual void GrabHardware()
 {
     MotionHardwareInterface.GrabHardware();
 }
 internal virtual void ReleaseHardware()
 {
     MotionHardwareInterface.ReleaseHardware();
 }