Exemplo n.º 1
0
    public override void LoadDevice(DeviceData deviceData)
    {
        LampData lampData = (LampData)deviceData;

        DeviceName = lampData.DeviceName;
        Id         = lampData.Id;
        Name       = lampData.Name;
        IsOn       = lampData.IsOn;

        LightColor       = new Color(lampData.LightColor[0], lampData.LightColor[1], lampData.LightColor[2], lampData.LightColor[3]);
        LightBrightness  = lampData.LightBrightness;
        LightTemperature = new Color(lampData.LightTemperature[0], lampData.LightTemperature[1], lampData.LightTemperature[2], lampData.LightTemperature[3]);
    }
Exemplo n.º 2
0
    public DeviceCollectionData(DeviceCollection deviceCollection)
    {
        DeviceDataList = new IDeviceData[deviceCollection.RegisteredDevices.Count];
        for (int i = 0; i < deviceCollection.RegisteredDevices.Count; i++)
        {
            switch (deviceCollection.RegisteredDevices[i].GetType().Name)
            {
            case "Lamp":
                DeviceDataList[i] = new LampData((Lamp)deviceCollection.RegisteredDevices[i]);
                break;

            default:
                Debug.LogError("Unknown Device Type");
                break;
            }
        }

        AllDevicesOff = deviceCollection.AllDevicesOff;
    }