void onSwitchEvent(CurvySplineMoveEventArgs e) { OnSwitch.Invoke(e); if (e.Cancel) { mSwitchEventArgs = null; } }
public void Switch() { Value ^= true; if (Value) { bgColor = new Color(200, 255, 200); } else { bgColor = new Color(255, 200, 200); } Recalculate(); OnSwitch?.Invoke(this, Value); }
private void Update() { Horizontal = Input.GetAxis("Horizontal"); if (Input.GetButtonDown("Jump")) { OnJump?.Invoke(); } if (Input.GetButtonDown("Switch")) { OnSwitch?.Invoke(); } }
public MiHome(string gatewayPassword = null, string gatewaySid = null) { _gatewaySid = gatewaySid; _commandsToActions = new Dictionary <ResponseCommandType, Action <ResponseCommand> > { { ResponseCommandType.GetIdListAck, DiscoverGatewayAndDevices }, { ResponseCommandType.ReadAck, ProcessReadAck }, { ResponseCommandType.Report, ProcessReport }, { ResponseCommandType.Hearbeat, ProcessHeartbeat }, }; _deviceEvents = new Dictionary <Type, Action <MiHomeDevice> > { { typeof(AqaraCubeSensor), x => OnAqaraCubeSensor?.Invoke(this, x as AqaraCubeSensor) }, { typeof(AqaraMotionSensor), x => OnAqaraMotionSensor?.Invoke(this, x as AqaraMotionSensor) }, { typeof(AqaraOpenCloseSensor), x => OnAqaraOpenCloseSensor?.Invoke(this, x as AqaraOpenCloseSensor) }, { typeof(DoorWindowSensor), x => OnDoorWindowSensor?.Invoke(this, x as DoorWindowSensor) }, { typeof(MotionSensor), x => OnMotionSensor?.Invoke(this, x as MotionSensor) }, { typeof(SmokeSensor), x => OnSmokeSensor?.Invoke(this, x as SmokeSensor) }, { typeof(SocketPlug), x => OnSocketPlug?.Invoke(this, x as SocketPlug) }, { typeof(Switch), x => OnSwitch?.Invoke(this, x as Switch) }, { typeof(ThSensor), x => OnThSensor?.Invoke(this, x as ThSensor) }, { typeof(WaterLeakSensor), x => OnWaterLeakSensor?.Invoke(this, x as WaterLeakSensor) }, { typeof(WeatherSensor), x => OnWeatherSensor?.Invoke(this, x as WeatherSensor) }, { typeof(WiredDualWallSwitch), x => OnWiredDualWallSwitch?.Invoke(this, x as WiredDualWallSwitch) }, { typeof(WirelessDualWallSwitch), x => OnWirelessDualWallSwitch?.Invoke(this, x as WirelessDualWallSwitch) }, }; _transport = new UdpTransport(gatewayPassword); _miHomeDeviceFactory = new MiHomeDeviceFactory(_transport); _receiveTask = Task.Run(() => StartReceivingMessagesAsync(_cts.Token), _cts.Token); _transport.SendCommand(new DiscoverGatewayCommand()); }
public void Switch(Mode.Config config) { OnSwitch?.Invoke(config); }