예제 #1
0
    public override void OnInspectorGUI()
    {
        this.serializedObject.Update();

        DHT11 controller = (DHT11)target;

        GUI.enabled = false;
        EditorGUILayout.PropertyField(script, true, new GUILayoutOption[0]);
        GUI.enabled = true;
        foldout     = EditorGUILayout.Foldout(foldout, "Sketch Options");
        if (foldout)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(id, new GUIContent("id"));
            EditorGUILayout.PropertyField(pin, new GUIContent("pin"));
            EditorGUI.indentLevel--;
        }

        controller.enableUpdate = EditorGUILayout.Toggle("Enable update", controller.enableUpdate);

        EditorGUILayout.LabelField(string.Format("Humidity: {0:d}", controller.humidity));
        EditorGUILayout.LabelField(string.Format("Temperature: {0:d}", controller.temperature));

        if (Application.isPlaying && controller.enableUpdate)
        {
            EditorUtility.SetDirty(target);
        }

        this.serializedObject.ApplyModifiedProperties();
    }
예제 #2
0
 //Hub Constructor to store data obtained from constructor call in the repositories
 public KitchenHub(IKitchenRepo kitchenRepo, IEnumerable <Daemon> daemons, ILogger <KitchenHub> logger) //, IVentMotorRepo ventMotorRepo)
 {
     _logger      = logger;
     _kitchenRepo = kitchenRepo;
     _kitchen     = (Kitchen)daemons.FirstOrDefault(d => d.CurrentName == nameof(Kitchen));
     _UpperTank   = kitchenRepo.UpperTank;
     _LowerTank   = kitchenRepo.LowerTank;
     _Vent        = kitchenRepo.ChimneyVent;
     _DHT11       = kitchenRepo.Dht11;
 }