public void GetDef (string defID) { def = Finder.DefDatabase.Get (defID); if (def == null) { if (defID != "") { Debug.Log ("Invalid defID: " + defID + " provided, reverting to default"); } defID = DefaultID (); def = Finder.DefDatabase.Get (defID); if (def == null) { Debug.Log ("Default def Invalid, could not create Entity: " + defID); } } }
public static void Add (Def def) { String key = def.Name; Def value; DefDictionary.TryGetValue (key, out value); if (value == null) { Debug.Log ("Adding Def " + key); DefDictionary.Add (key, def); } else { Debug.Log ("Def of name " + key + " already exists. Setting to new value."); DefDictionary [key] = def; } }
public Graphic Get (string path, Def def, bool skipCreateNew =false) { object val = null; dictionary.TryGetValue (path, out val); Graphic value = (Graphic)val; if (value == null && !skipCreateNew) { value = new Graphic (def.GetAttribute ("TextureID")); } return value; }