Esempio n. 1
0
    private void Start()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(this);
        instance    = this;
        unityThread = Thread.CurrentThread.ManagedThreadId;
        service     = new ClientSettingsService();
        ClientSettings settings = service.GetOrMake();

        if (string.IsNullOrEmpty(Config.CloudProxy))
        {
            API = new CloudAPI(new Uri(Config.CloudUrl), Config.SimID);
        }
        else
        {
            API = new CloudAPI(new Uri(Config.CloudUrl), Config.SimID, new Uri(Config.CloudProxy));
        }

#if UNITY_EDITOR
        EditorApplication.playModeStateChanged += HandlePlayMode;
#endif

        if (settings.onlineStatus)
        {
            ConnectionStatusEvent();
        }
    }
Esempio n. 2
0
        private static void Initialize()
        {
            Root = Path.Combine(Application.dataPath, "..");
            PersistentDataPath = Application.persistentDataPath;

            ParseConfigFile();
            if (!Application.isEditor)
            {
                ParseCommandLine();
                CreateLockFile();
            }

            AssetBundle.UnloadAllAssetBundles(false);
            Sensors       = new List <SensorConfig>();
            SensorPrefabs = new List <SensorBase>();

            BridgePlugins.Load();
            LoadBuiltinAssets();
            LoadExternalAssets();
            Sensors = SensorTypes.ListSensorFields(SensorPrefabs);

            DatabaseManager.Init();

            ClientSettingsService csservice = new ClientSettingsService();

            if (string.IsNullOrEmpty(SimID))
            {
                SimID = csservice.GetOrMake().simid;
            }

            csservice.SetSimID(SimID);
        }
Esempio n. 3
0
        private static void Initialize()
        {
            Root = Path.Combine(Application.dataPath, "..");
            PersistentDataPath = Application.persistentDataPath;

            ParseConfigFile();
            if (!Application.isEditor)
            {
                ParseCommandLine();
                CreateLockFile();
            }

            AssetBundle.UnloadAllAssetBundles(false);
            Sensors       = new List <SensorConfig>();
            SensorPrefabs = new List <SensorBase>();
            if (SensorPrefabs.Any(s => s == null))
            {
                Debug.LogError("!!! Null Sensor Prefab Detected - Check RuntimeSettings SensorPrefabs List for missing Sensor Prefab");
#if UNITY_EDITOR
                UnityEditor.EditorApplication.isPlaying = false;
#else
                Application.Quit(1); // return non-zero exit code
#endif
            }

            BridgePlugins.Load();
            LoadBuiltinAssets();
            LoadExternalAssets();
            Sensors = SensorTypes.ListSensorFields(SensorPrefabs);

            DatabaseManager.Init();

            ClientSettingsService csservice = new ClientSettingsService();
            if (string.IsNullOrEmpty(SimID))
            {
                SimID = csservice.GetOrMake().simid;
            }

            csservice.SetSimID(SimID);
        }