public override void Sift(VObjectDictionaryWrap Source, string Filter, bool Contains, bool Exclude, List <int> MatchingIndices, List <VObject> Output) { VObjectDictionary Content = Source.Content as VObjectDictionary; if (Contains) { foreach (string k in Content.Objects.Keys) { if (k.Contains(Filter) ^ Exclude) { MatchingIndices.Add(this.CurrentAbsIndex); Output.Add(Content.Objects[k]); } } } else { foreach (string k in Content.Objects.Keys) { if ((k == Filter) ^ Exclude) { MatchingIndices.Add(this.CurrentAbsIndex); Output.Add(Content.Objects[k]); } } } }
public override void AddVObject(VObjectDictionaryWrap Parent, VObject Source) { VObjectDictionary Content = Parent.Content as VObjectDictionary; if (Source is VObjectCollectionWrap) { VObjectCollection Child = Source.Content as VObjectCollection; if (!Content.Objects.ContainsKey(Child.Name)) { if (FNotExistObjMan[this.CurrParent] == ManageNotExisting.Create) { Content.Objects.Add(Child.Name, (VObjectCollectionWrap)Source); } } else { if (FExistObjMan[this.CurrParent] == ManageExistingObject.Overwrite) { Content.Objects[Child.Name].Dispose(); Content.Objects[Child.Name] = (VObjectCollectionWrap)Source; } if (FExistObjMan[this.CurrParent] == ManageExistingObject.Extend) { VObjectCollection ColSource = Content.Objects[Child.Name].Content as VObjectCollection; VObjectCollection CurrSource = Source.Content as VObjectCollection; foreach (KeyValuePair <string, VObject> kvp in CurrSource.Children) { if (ColSource.Children.ContainsKey(kvp.Key)) { if (FExistKeyMan[this.CurrParent][this.CurrSource] == ManageExistingKey.Overwrite) { ColSource[kvp.Key].Dispose(); ColSource[kvp.Key] = kvp.Value; } } else { if (FNotExistKeyMan[this.CurrParent][this.CurrSource] == ManageNotExisting.Create) { ColSource.Add(kvp.Key, kvp.Value); } } } } } if (FResetAge[this.CurrParent]) { VObjectCollection CurrSource = Source.Content as VObjectCollection; CurrSource.Age.Restart(); } } }
public override Spread <VObject> ToSpread(VObjectDictionaryWrap Source) { Spread <VObject> Out = new Spread <VObject>(); VObjectDictionary Content = Source.Content as VObjectDictionary; Out.SliceCount = 0; foreach (KeyValuePair <string, VObjectCollectionWrap> kvp in Content.Objects) { Out.Add(kvp.Value); } return(Out); }
public override void RemoveVObject(VObjectDictionaryWrap Parent) { VObjectDictionary Content = Parent.Content as VObjectDictionary; if (FMatch[this.CurrParent][this.CurrChild]) { Content.RemoveObject(FName[this.CurrParent][this.CurrChild]); } else { foreach (string k in Content.Objects.Keys) { if (k.Contains(FName[this.CurrParent][this.CurrChild])) { Content.RemoveObject(k); } } } }
VObjectDictionaryNode() { Everything = new VObjectDictionary(); EverythingWrap = new VObjectDictionaryWrap(Everything); }
public void Evaluate(int SpreadMax) { VObjectDictionary vd = FInput[0].Content as VObjectDictionary; #region clearpoints ObjectsUnderPoint.Clear(); int ii = 0; foreach (Vector2D v in FTouchPoints) { if (!ObjectsUnderPoint.ContainsKey(FTouchID[ii])) { ObjectsUnderPoint.Add(FTouchID[ii], new List <VObjectCollection>()); } ii++; } #endregion clearpoints GUIObjects.Clear(); FGUIElements.SliceCount = 0; FGUIObjects.SliceCount = 0; #region hittest foreach (object o in vd.VPath(FVPath[0], FVPathSep[0])) { var guiobjectw = o as VObjectCollectionWrap; var guiobject = guiobjectw.Content as VObjectCollection; var guiew = guiobject["GUIElement"]; if (guiew != null) { var guie = guiew.Content as VObjectCollection; if (guie.Children.ContainsKey("BaseData")) { var basedata = guie["BaseData"].Content as PrimitiveObject; bool enabled = (bool)basedata["Enabled"][0]; if (enabled) { FGUIElements.Add(guiew as VObjectCollectionWrap); FGUIObjects.Add(guiobjectw); if (!guie.Children.ContainsKey("Geometry")) { VOOGQuad quadgeom = new VOOGQuad(); VOOGGeometryWrap qgw = new VOOGGeometryWrap(quadgeom); guie.Add("Geometry", qgw); } VOOGGeometry geom = guie["Geometry"].Content as VOOGGeometry; geom.Hits.Clear(); basedata["TouchID"].Objects.Clear(); basedata["Tap"][0] = false; List <Vector2D> pointlist = new List <Vector2D>(); foreach (Vector2D v in FTouchPoints) { pointlist.Add(new Vector2D(v)); } geom.HitTest((Matrix4x4)basedata["Transform"][0], pointlist); foreach (int id in geom.Hits) { ObjectsUnderPoint[FTouchID[id]].Add(guiobject); } } } } } #endregion hittest #region depthtest foreach (KeyValuePair <int, List <VObjectCollection> > kvp in ObjectsUnderPoint) { VObjectCollection currobj; if (kvp.Value.Count == 0) { continue; } if (kvp.Value.Count > 1) { List <Tuple <VObjectCollection, double> > UnsortedDepth = new List <Tuple <VObjectCollection, double> >(); foreach (VObjectCollection obj in kvp.Value) { ObjectTypePair TrIn = (ObjectTypePair)obj.VPath("\"GUIElement\".\"BaseData\".\"Transform\"", ".")[0]; Matrix4x4 mtrx = (Matrix4x4)TrIn[0]; UnsortedDepth.Add(new Tuple <VObjectCollection, double>(obj, mtrx.m43)); } List <Tuple <VObjectCollection, double> > SortedDepth = UnsortedDepth.OrderBy(t => t.Item2).ToList(); currobj = SortedDepth[0].Item1; } else { currobj = kvp.Value[0]; } PrimitiveObjectWrap basedataw = (PrimitiveObjectWrap)currobj.VPath("\"GUIElement\".\"BaseData\"", ".")[0]; PrimitiveObject basedata = basedataw.Content as PrimitiveObject; VOOGGeometryWrap geomw = (VOOGGeometryWrap)currobj.VPath("\"GUIElement\".\"Geometry\"", ".")[0]; VOOGGeometry geom = geomw.Content as VOOGGeometry; //FFocus[0] = vd.Objects[currobj.Name]; basedata["Tap"][0] = true; basedata["TouchID"].Objects.Add(kvp.Key); } #endregion depthtest }