internal override string onSaving() { if (!Directory.Exists("Assets/Resources/Sensors")) { Directory.CreateDirectory("Assets/Resources/Sensors"); } if (AssetDatabase.LoadAssetAtPath("Assets/Resources/SensorsManager.asset", typeof(SensorsManager)) == null) { AssetDatabase.CreateAsset((SensorsManager)manager, "Assets/Resources/SensorsManager.asset"); } else { EditorUtility.SetDirty((SensorsManager)manager); foreach (AbstractConfiguration conf in ((SensorsManager)manager).getConfigurations()) { SensorConfiguration sensorConf = (SensorConfiguration)conf; if (AssetDatabase.LoadAssetAtPath("Assets/Resources/Sensors/" + sensorConf.configurationName + ".asset", typeof(SensorConfiguration)) == null) { AssetDatabase.CreateAsset(sensorConf, "Assets/Resources/Sensors/" + sensorConf.configurationName + ".asset"); } else { EditorUtility.SetDirty(sensorConf); } } AssetDatabase.SaveAssets(); } return(""); }
public SimpleSensor(SensorConfiguration s) { Debug.Log("configuration " + s); sensorName = s.configurationName; properties = new List <string>(); mappingManager = MappingManager.getInstance(); ReflectionExecutor re = ScriptableObject.CreateInstance <ReflectionExecutor>(); gO = re.GetGameObjectWithName(s.gOName); Debug.Log("game object is " + gO); gOName = s.gOName; cleanDataStructures(); properties.AddRange(s.properties.Distinct()); foreach (StringIntPair p in s.operationPerProperty) { operationPerProperty.Add(p.Key, p.Value); //Debug.Log(p.Key + " " + p.Value); if (p.Value == Operation.SPECIFIC) { foreach (StringStringPair pair2 in s.specificValuePerProperty) { //Debug.Log(pair2.Key + " " + pair2.Value); if (pair2.Key.Equals(p.Key)) { specificValuePerProperty.Add(p.Key, pair2.Value); break; } } } } //UpdateProperties(); }
public void OnBeforeSerialize() { confsToSerialize = new List <SensorConfiguration>(); foreach (AbstractConfiguration conf in sensConfs) { //Debug.Log("before serialization " + ((SensorConfiguration)conf).operationPerProperty.Count); SensorConfiguration sensorConf = (SensorConfiguration)conf; confsToSerialize.Add(sensorConf); } }
internal override void onDeleting(AbstractConfiguration c) { EditorUtility.SetDirty((SensorsManager)manager); AssetDatabase.SaveAssets(); SensorConfiguration sensorConf = (SensorConfiguration)c; if (!(AssetDatabase.LoadAssetAtPath("Assets/Resources/Sensors/" + sensorConf.configurationName + ".asset", typeof(SensorConfiguration)) is null)) { AssetDatabase.DeleteAsset("Assets/Resources/Sensors/" + sensorConf.configurationName + ".asset"); } }
public Dictionary <string, List <string> > mappings; //for each property, there is a template mapping: l[0]=function symbols; l[1]=actual value; l[2]=closing parentheses public AdvancedSensor(SensorConfiguration conf) : base(conf) { advancedConf = new Dictionary <string, SimpleGameObjectsTracker>(); matrixProperties = new Dictionary <string, SimpleSensor[, ]>(); listProperties = new Dictionary <string, List <SimpleSensor> >(); foreach (SimpleGameObjectsTracker st in conf.advancedConf) { ////MyDebugger.MyDebug(st.propertyName+" "+st.objType); advancedConf.Add(st.propertyName, st); if (st.propertyType.Equals("ARRAY2")) { ////MyDebugger.MyDebug("Adding to matrix"); matrixProperties.Add(st.propertyName, null); } else if (st.propertyType.Equals("LIST")) { ////MyDebugger.MyDebug("Adding to list"); listProperties.Add(st.propertyName, new List <SimpleSensor>()); } } mappings = ((ASPAdvancedSensorMapper)MappingManager.getInstance().getMapper(typeof(AdvancedSensor))).getTemplateASPRepresentation(this); }