void DumpTransmitter(ILogicable transmitter) { Debug.Log(String.Format("Dumping transmitter: {0}", transmitter.DisplayName)); foreach (LogicType logicType in Enum.GetValues(typeof(LogicType))) { if (transmitter.CanLogicRead(logicType)) { var value = transmitter.GetLogicValue(logicType); Debug.Log(String.Format("== {0}: {1}", logicType, value)); } } }
public static Dictionary <string, LogicValuePayload> GetLogicValues(ILogicable logicable) { var logicValues = new Dictionary <string, LogicValuePayload>(); foreach (LogicType logicType in Enum.GetValues(typeof(LogicType))) { if (logicable.CanLogicRead(logicType)) { logicValues.Add(logicType.ToString(), LogicableItemUtils.GetLogicValue(logicable, logicType)); } } return(logicValues); }
public JObject GetLogicValues(ILogicable logicable) { var logicValues = new Dictionary <string, double>(); foreach (LogicType logicType in Enum.GetValues(typeof(LogicType))) { if (logicable.CanLogicRead(logicType)) { var value = logicable.GetLogicValue(logicType); logicValues.Add(logicType.ToString(), value); } } return(JObject.FromObject(logicValues)); }
public static Dictionary <int, Dictionary <string, double> > GetSlotValues(ILogicable logicable) { var slots = new Dictionary <int, Dictionary <string, double> >(); for (var i = 0; i < logicable.TotalSlots; i++) { var logicValues = new Dictionary <string, double>(); foreach (LogicSlotType logicType in Enum.GetValues(typeof(LogicSlotType))) { if (logicable.CanLogicRead(logicType, i)) { var value = logicable.GetLogicValue(logicType, i); logicValues.Add(logicType.ToString(), value); } } slots.Add(i, logicValues); } return(slots); }
public static LogicTypes FromILogicable(ILogicable logicable) { var logicTypes = new LogicTypes(); logicTypes.read = new List <string>(); logicTypes.write = new List <string>(); foreach (LogicType logicType in Enum.GetValues(typeof(LogicType))) { if (logicable.CanLogicRead(logicType)) { logicTypes.read.Add(logicType.ToString()); } if (logicable.CanLogicWrite(logicType)) { logicTypes.write.Add(logicType.ToString()); } } return(logicTypes); }