public override bool TryParse(string path, ref RangeInt cursor, out IWatchContext ctx) { var c = cursor; if (ParserUtils.TryParseScopeSequenceRange(path, ref c, ParserUtils.DelemiterSquareBracket, out var seqIn, out var seqOut)) { if (TryParseIndex(path, seqIn, out ctx)) { cursor = c; return(true); } } ctx = null; return(false); }
public override bool TryParseIndex(string path, RangeInt cursor, out IWatchContext ctx) { if (ParserUtils.TryParseScopeSequenceRange(path, ref cursor, ParserUtils.DelemiterQuote, out var worldNameRangeIn, out var worldNameRangeOut)) { string worldName = path.Substring(worldNameRangeIn); foreach (var w in Entities.World.All) { if (w.Name == worldName) { ctx = new WorldContext(this, $"[\"{worldName}\"]", w, ContextFieldInfo.MakeOperator($"[\"{worldName}\"]")); return(true); } } } ctx = default; return(false); }
public override bool TryParseIndex(string path, RangeInt cursor, out IWatchContext ctx) { if (ParserUtils.TryParseScopeSequenceRange(path, ref cursor, ParserUtils.DelemiterQuote, out var nameRangeIn, out var nameRangeOut)) { string name = path.Substring(nameRangeIn); for (int i = 0; i != UnityEngine.SceneManagement.SceneManager.sceneCount; ++i) { var s = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i); if (s.name == name) { ctx = new SceneContext(this, $"[\"{name}\"]", s, ContextFieldInfo.MakeOperator($"[\"{name}\"]")); return(true); } } } ctx = default; return(false); }
public override bool TryParseIndex(string path, RangeInt cursor, out IWatchContext ctx) { if (ParserUtils.TryParseScopeSequenceRange(path, ref cursor, ParserUtils.DelemiterQuote, out var nameRangeIn, out var nameRangeOut)) { string name = path.Substring(nameRangeIn); foreach (var go in Scene.GetRootGameObjects()) { if (go.name == name) { GameObject go2 = go; ctx = new GameObjectContext(this, $"[\"{name}\"]", go, ContextFieldInfo.MakeOperator($"[\"{name}\"]")); //ctx = new PropertyPathContext<GameObject, GameObject>(this, this, $"[\"{name}\"]", ref go2, null, ContextFieldInfo.MakeOperator($"[\"{name}\"]")); //ctx = new PropertyBagContext<GameObject>(this, $"[\"{name}\"]", ref go2, ContextFieldInfo.MakeOperator($"[\"{name}\"]")); return(true); } } } ctx = default; return(false); }
public override bool TryParse(string path, ref RangeInt cursor, out IWatchContext ctx) { var c = cursor; if (ParserUtils.TryParseScopeSequenceRange(path, ref c, ParserUtils.DelemiterSquareBracket, out var seqIn, out var seqOut)) { if (ParserUtils.TryParseIntAt(path, ref seqIn, out var index)) { var es = World.EntityManager.GetAllEntities(); for (int i = 0; i != es.Length; ++i) { if (es[i].Index == index) { cursor = c; var ctnr = new EntityContainer(World.EntityManager, es[i]); ctx = new PropertyPathContext <EntityContainer, EntityContainer>(this, this, $"[{es[i].Index}]", ctnr, null, ContextFieldInfo.MakeOperator($"[{es[i].Index}]")); return(true); } } } } ctx = null; return(false); }