private void _addGUIDefinedEvents() { if (GameName == null || GameDisplayName == null || Events == null) { _logWarning("Incomplete game registration form"); _setClientState(ClientState.Inactive); return; } RegisterGame(GameName, GameDisplayName, IconColor); // TODO need to throttle this so we do not overflow the queue // temporarily mitigated by increasing the queue size foreach (Bind_Event be in Events) { QueueMsg msg; if (be.handlers == null || be.handlers.Length == 0) { // if no handlers provided, we will at least register these events with SSE msg = new QueueMsgRegisterEvent(); msg.data = new Register_Event(GameName, be.eventName, be.minValue, be.maxValue, be.iconId); } else { // bind events with defualt handlers be.game = GameName; msg = new QueueMsgBindEvent(); msg.data = be; } _mMsgQueue.PEnqueue(msg); } }
/// <summary> /// Defines an event and registers it with the GameSense Server. /// </summary> /// <param name="eventName">Event name. Valid characters are limited to uppercase A-Z, the digits 0-9, hyphen, and underscore</param> /// <remarks> /// You should call this function if you do not want specify default behavior for events but rather want it exposed in SteelSeries Engine for the user to customize. /// If you wish to specify default behavior (handlers), use <see cref="GSClient.BindEvent"/> instead /// </remarks> /// <param name="minValue">Minimum value</param> /// <param name="maxValue">Maximum value</param> /// <param name="iconId">Identifies an icon that will be show in SteelSeries Engine for this event</param> public void RegisterEvent(string eventName, System.Int32 minValue, System.Int32 maxValue, EventIconId iconId) { #if (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && !SS_GAMESENSE_DISABLED if (!_isClientActive()) { return; } QueueMsgRegisterEvent msg = new QueueMsgRegisterEvent(); msg.data = new Register_Event(GameName.ToUpper(), eventName.ToUpper(), minValue, maxValue, iconId); _mMsgQueue.PEnqueue(msg); #endif // (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && !SS_GAMESENSE_DISABLED }