public GameSenseClient() { BaseUrl = GameSenseProps.GetServerUrl(); if (BaseUrl != null) { EventUrl = BaseUrl + "/game_event"; m_queue = new LocklessQueue <Message>(256); m_worker = new GameSenseWorker(m_queue, BaseUrl); } }
internal GameSenseWorker(LocklessQueue <Message> queue, string baseUrl) { if (Logging) { Debug.Log("SteelSeries engine started on: " + baseUrl); } m_heartbeatUrl = baseUrl + "/game_heartbeat"; m_queue = queue; m_isRunning = true; m_thread = new Thread(WorkerThread); m_thread.IsBackground = true; m_thread.Start(); }
// Initialization void Awake() { #if (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && !SS_GAMESENSE_DISABLED if (_mInstance == null) { // update the static reference _mInstance = this; } else { // no other instances should exist _logWarning("Another GameSense client script is getting instantiated. Only a single instance should exist at any time"); Destroy(this.gameObject); return; } // need to survive scene loading DontDestroyOnLoad(this.gameObject); // initialize _mSerializer = new FullSerializer.fsSerializer(); _mMsgQueue = new LocklessQueue <QueueMsg>(_MsgQueueSize); _mGameSenseWrk = new System.Threading.Thread(_gamesenseWrk); // check for exceptions _mGameSenseWrkShouldRun = true; _setClientState(ClientState.Probing); try { _mGameSenseWrk.Start(); // add events if the script is attached to GameSenseManager prefab if (gameObject.name.Equals(_GameSenseObjName)) { _addGUIDefinedEvents(); } } catch (System.Exception e) { _logException("Could not start the client thread", e); _setClientState(ClientState.Inactive); } #endif // (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && !SS_GAMESENSE_DISABLED }