public NfcActConnection(string id, Sensor source, Actuator target, string rightSide, LogicSenActInput.Operatoren condOperator, SensActConnection.commands targetCommand) : base(id, source, target) { this.id = id; this.source = source; this.target = target; this.rightSide = rightSide; this.condOperator = LogicSenActInput.Operatoren.gleich; this.targetCommand = targetCommand; }
public void OnInputClicked(InputClickedEventData eventData) { //Needs: SourceName, TargetName, ActuatorOperation, ConditionOperator, rightSide of Condition as String //SensActConnection.commands targetCommand; SenActFensterName = this.gameObject.transform.parent.name; SenActFenster = this.gameObject.transform.parent.gameObject; this.LineID = SenActFenster.GetComponent <LogicSenActInput>().LineID; this.SourceNamelong = SenActFenster.GetComponent <LogicSenActInput>().SourceName; this.TargetNamelong = SenActFenster.GetComponent <LogicSenActInput>().TargetName; this.condOperator = SenActFenster.GetComponent <LogicSenActInput>().GetOperator(); bool targetOp = SenActFenster.GetComponent <LogicSenActInput>().GetTargetStatus(); if (!targetOp) { targetCommand = SensActConnection.commands.OFF; } else { targetCommand = SensActConnection.commands.ON; } Item source = ItemManager.getInstance().getItem(SourceNamelong); Item target = ItemManager.getInstance().getItem(TargetNamelong); if (source is NfcReader || source is MyoArmband) { this.rightSideString = SenActFenster.GetComponent <LogicSenActInput>().GetSenValueString(); } else { this.rightSide = SenActFenster.GetComponent <LogicSenActInput>().GetSenValue(); } if (source is Sensor && target is Actuator) { if (!ConnectionManager.getInstance().getConnections().ContainsKey(LineID)) { Sensor sSens = (Sensor)source; Actuator tDimmer = (Actuator)target; if (source is NfcReader || source is MyoArmband) { if (source is NfcReader) { NfcReader nfcr = (NfcReader)source; nc = ConnectionCreator.createNfcActConnection(LineID, SourceNamelong, TargetNamelong, rightSideString, condOperator, targetCommand); } else { MyoArmband myoa = (MyoArmband)source; mc = ConnectionCreator.createMyoActConnection(LineID, SourceNamelong, TargetNamelong, rightSideString, condOperator, targetCommand); } } else { c = ConnectionCreator.createSensActConnection(LineID, SourceNamelong, TargetNamelong, rightSide, condOperator, targetCommand); } ConnectionManager.getInstance().startConnection(LineID); } else { if (source is NfcReader || source is MyoArmband) { if (source is NfcReader) { nc = (NfcActConnection)ConnectionManager.getInstance().getConnection(LineID); } else { mc = (MyoActConnection)ConnectionManager.getInstance().getConnection(LineID); } } else { c = (SensActConnection)ConnectionManager.getInstance().getConnection(LineID); } ConnectionManager.getInstance().startConnection(LineID); } } SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); this.transform.localScale = new Vector3(0, 0, 0); }
public static NfcActConnection createNfcActConnection(string id, string idSource, string idTarget, string rightSide, LogicSenActInput.Operatoren condOperator, SensActConnection.commands targetCommand) { NfcActConnection c = null; Item source = ItemManager.getInstance().getItem(idSource); Item target = ItemManager.getInstance().getItem(idTarget); if (source is NfcReader && target is Actuator) { c = new NfcActConnection(id, (NfcReader)source, (Actuator)target, rightSide, condOperator, targetCommand); } if (c != null) { ConnectionManager.getInstance().getConnections().Add(id, c); } return(c); }