public void SetListenner(string id, IIMUEventDelegate imu, IButtonEventDelegate button) { if (string.IsNullOrEmpty(id)) { return; } if (imu != null) { if (sensorEventDict.ContainsKey(id)) { sensorEventDict[id] = imu; // update } else { sensorEventDict.Add(id, imu); // new } } if (button != null) { if (buttonEventDict.ContainsKey(id)) { buttonEventDict[id] = button; // update } else { buttonEventDict.Add(id, button); // new } } }
public void AddListenner(string id, IIMUEventDelegate imu, IButtonEventDelegate button) { if (string.IsNullOrEmpty(id)) { return; } if (!sensorEventDict.ContainsKey(id) && imu != null) { sensorEventDict.Add(id, imu); } if (!buttonEventDict.ContainsKey(id) && button != null) { buttonEventDict.Add(id, button); } }