示例#1
0
        public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m)
        {
            UduinoConnection connection = null;

#if UNITY_EDITOR || UNITY_STANDALONE //IF it's on the editor
            if (manager.activeExtentionsMap.ContainsValue(true))
            {
                connection = new UduinoConnection_DesktopSerial();
            }
#elif UNITY_ANDROID //Get the  Android Serial Plugin
            if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidBluetoothLE"))
            {
                connection = new UduinoConnection_AndroidBluetoothLE();
            }
            else if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidSerial"))
            {
                connection = new UduinoConnection_AndroidSerial();
            }
            else
            {
                Log.Error("Uduino for Android is not active ! Activate it in the Inspector Panel.");
            }
#else
#endif

            return(connection);
        }
        public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m)
        {
            UduinoConnection connection = null;

#if UNITY_ANDROID
    #if UNITY_EDITOR //IF it's on the editor
            UduinoExtension u;
            if (manager.AvailableExtensions["UduinoDevice_AndroidSerial"].isActive)
            {
                Log.Info("Uduino for Android Serial is active but you are in the editor. Switching platform.");
            }
            connection = new UduinoConnection_DesktopSerial();
#else //Get the  Android Serial Plugin
            if (UduinoManager.Instance.AvailableExtensions["UduinoDevice_AndroidSerial"].isPresent)
            {
                if (UduinoManager.Instance.AvailableExtensions["UduinoDevice_AndroidSerial"].isActive)
                {
                    connection = new UduinoConnection_AndroidSerial();
                }
                else
                {
                    Log.Error("Uduino for Android Serial is not active ! Activate it in the Inspector Panel");
                }
            }
            else
            {
                Log.Error("Uduino for Android Serial is not present ! Are you sure it's imported in your project ?");
            }
#endif
#else // default
            connection = new UduinoConnection_DesktopSerial();
#endif
            return(connection);
        }
示例#3
0
        public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m)
        {
            UduinoConnection connection = null;

#if UNITY_EDITOR || UNITY_STANDALONE //IF it's on the editor
            if (manager.activeExtentionsMap.ContainsValue(true))
            {
                if (manager.ExtensionIsPresentAndActive("UduinoDevice_DesktopBluetoothLE"))
                {
                    connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_DesktopBluetoothLE") as UduinoConnection;
                }
                else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi"))
                {
                    connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_Wifi") as UduinoConnection;
                }
                else
                {
                    connection = new UduinoConnection_DesktopSerial();
                }
            }
            else
            {
#if UNITY_EDITOR
                Log.Warning("No build platform selected");
                return(null);
#else
                return(connection = new UduinoConnection_DesktopSerial()); // Fix for Build
#endif
            }
#elif UNITY_ANDROID //Get the  Android Serial Plugin
            if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidBluetoothLE"))
            {
                connection = new UduinoConnection_AndroidBluetoothLE();
            }
            else if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidSerial"))
            {
                connection = new UduinoConnection_AndroidSerial();
            }
            else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi"))
            {
                connection = new UduinoConnection_Wifi();
            }
            else
            {
                Log.Error("Uduino for Android is not active ! Activate it in the Inspector Panel.");
            }
#endif
            Log.Debug("Starting Uduino with type: " + connection.GetType());

            return(connection);
        }
示例#4
0
        public static UduinoConnection GetFinder(UduinoManager manager, Platform p, ConnectionMethod m)
        {
            UduinoConnection connection = null;

#if UNITY_EDITOR || UNITY_STANDALONE //IF it's on the editor
            if (manager.activeExtentionsMap.ContainsValue(true))
            {
                if (manager.ExtensionIsPresentAndActive("UduinoDevice_DesktopBluetoothLE"))
                {
                    connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_DesktopBluetoothLE") as UduinoConnection;
                }
                else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi"))
                {
                    connection = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("Uduino.UduinoConnection_Wifi") as UduinoConnection;
                }
                else
                {
                    connection = new UduinoConnection_DesktopSerial();
                }
            }
            else
            {
                return(null);
            }
#elif UNITY_ANDROID //Get the  Android Serial Plugin
            if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidBluetoothLE"))
            {
                connection = new UduinoConnection_AndroidBluetoothLE();
            }
            else if (manager.ExtensionIsPresentAndActive("UduinoDevice_AndroidSerial"))
            {
                connection = new UduinoConnection_AndroidSerial();
            }
            else if (manager.ExtensionIsPresentAndActive("UduinoDevice_Wifi"))
            {
                connection = new UduinoConnection_Wifi();
            }
        }