private void OnCurveTypeClick(string curveType) { List <DeviceCurve> curves = new List <DeviceCurve>(); foreach (var d in iotDevices) { DeviceCurve c = d.Curves.Find((p) => { return(p.CurveName == curveType); }); curves.Add(c); } for (int i = 0; i < curveViews.Count; i++) { CurveViewControl ctrl = curveViews[i]; if (i < curves.Count) { ctrl.DeviceCurve = curves[i]; ctrl.DeviceName = iotDevices[i].DeviceName; //dt.TypeName + (i + 1); ctrl.gameObject.SetActive(true); } } for (int i = curves.Count; i < curveViews.Count; i++) { CurveViewControl ctrl = curveViews[i]; ctrl.gameObject.SetActive(false); } foreach (var p in curveButtons) { if (p.CurveType != curveType) { p.IsSelected = false; } else { p.IsSelected = true; } } }
private void LoadIotDevices() { //ugly implementation IotDevice d; d = new IotDevice(IotDeviceTypeEnum.ServoMotor, "传送模块电机"); DeviceCurve c = new DeviceCurve("电流时间曲线", "Videos/curvenormal"); d.Curves.Add(c); c = new DeviceCurve("转速时间曲线", "Videos/curveabnormal"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.ServoMotor, "上压辊电机"); c = new DeviceCurve("电流时间曲线", "Videos/curvenormal"); d.Curves.Add(c); c = new DeviceCurve("转速时间曲线", "Videos/curvenormal"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.ServoMotor, "下压辊电机"); c = new DeviceCurve("电流时间曲线", "Videos/curveabnormal"); d.Curves.Add(c); c = new DeviceCurve("转速时间曲线", "Videos/curvenormal"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.Solenoid, "传送模块电磁阀"); c = new DeviceCurve("I/O时间曲线", "Videos/1recircle"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.Solenoid, "上压辊电磁阀"); c = new DeviceCurve("I/O时间曲线", "Videos/10notrecircle"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.Solenoid, "下压辊电磁阀"); c = new DeviceCurve("I/O时间曲线", "Videos/1recircle"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.Sensor, "传送模块入口传感器"); c = new DeviceCurve("I/O时间曲线", "Videos/10notrecircle"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.Sensor, "传送模块出口传感器"); c = new DeviceCurve("I/O时间曲线", "Videos/1recircle"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.Sensor, "热压模块入口传感器"); c = new DeviceCurve("I/O时间曲线", "Videos/1recircle"); d.Curves.Add(c); iotDevices.Add(d); d = new IotDevice(IotDeviceTypeEnum.Sensor, "热压模块出口传感器"); c = new DeviceCurve("I/O时间曲线", "Videos/10notrecircle"); d.Curves.Add(c); iotDevices.Add(d); }