public static bool SetComponent(PropertyInfo p, object obj, string value, IIDData idData, IGameObjectData gameObjectData, IResFoldersData resFolderData) { if (p.PropertyType.GetGeneration(typeof(Component)) == -1) { return(false); } if (value.IndexOf("id:") == 0) { idData.WaitForID(value.Replace("id:", ""), go => { var c = go.GetComponent(p.PropertyType); if (c != null) { p.SetValue(obj, c, null); } } ); return(true); } object component = ValueGetter.GetComponent(value, p.PropertyType, idData, gameObjectData); if (component == null) { component = ValueGetter.GetResObject(value, p.PropertyType, resFolderData.GetResFolders()); } if (component != null) { p.SetValue(obj, component, null); } return(true); }
public static bool SetGameObject(PropertyInfo p, object obj, string value, IIDData idData, IGameObjectData gameObjectData, IResFoldersData resFoldersData) { if (p.PropertyType != typeof(GameObject)) { return(false); } if (value.IndexOf("id:") == 0) { idData.WaitForID(value.Replace("id:", ""), go => p.SetValue(obj, go, null)); return(true); } var gameObject = ValueGetter.GetGameObject(value, idData, gameObjectData); if (gameObject == null) { gameObject = ValueGetter.GetResObject(value, typeof(GameObject), resFoldersData.GetResFolders()) as GameObject; } if (gameObject != null) { p.SetValue(obj, gameObject, null); } return(true); }
public void WaitForID(string id, Action <GameObject> func) { idData.WaitForID(id, func); }