Beispiel #1
0
        private s3DRudderManager()
        {
#if DEBUG_3DRUDDER
            Debug.Log("init s3DRudderManager");
#endif
            // Init SDK
            Init();

            // Init States
            rudders   = new Rudder[_3DRUDDER_SDK_MAX_DEVICE];
            connected = new bool[_3DRUDDER_SDK_MAX_DEVICE];
            for (uint i = 0; i < rudders.Length; ++i)
            {
                rudders[i]   = new Rudder(i, this);
                connected[i] = false;
            }
#if DEBUG_3DRUDDER
            // Show info
            Debug.LogFormat("SDK version : {0:X4}", GetSDKVersion());
#endif
            // Set events Connected & Disconnected
            Events = new EventRudder();
#if DEBUG_3DRUDDER
            Events.OnConnectEvent    += (portNumber) => Debug.LogFormat("3dRudder {0} connected, firmware : {1:X4}", portNumber, GetVersion(portNumber));
            Events.OnDisconnectEvent += (portNumber) => Debug.LogFormat("3dRudder {0} disconnected, firmware : {1:X4}", portNumber, GetVersion(portNumber));
#endif
            SetEvents(Events);
        }
Beispiel #2
0
 /// <summary>
 /// Set events and start thread
 /// </summary>
 /// <param EventRudder="e"></param>
 private void SetEvents(EventRudder events)
 {
     if (thread == null)
     {
         thread = new Thread(Update);
         thread.Start();
     }
     Events = events;
 }
Beispiel #3
0
 /// <summary>
 /// Clear events and stop thread
 /// </summary>
 private void ClearEvents()
 {
     if (thread != null)
     {
         thread.Abort();
     }
     // dispose Event
     Events.Dispose();
     Events = null;
 }