예제 #1
0
 public void TestGoQLExamples20()
 {
     var e = new GoQLExecutor("/Environment/**<t:MeshRenderer>");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(8, results.Length);
 }
예제 #2
0
 public void TestGoQLExamples6()
 {
     var e = new GoQLExecutor("Head/");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(11, results.Length);
 }
예제 #3
0
 public void TestGoQLExamples7()
 {
     var e = new GoQLExecutor("Head/[0]");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(2, results.Length);
     Assert.AreEqual("Child (0)", results[0].name);
 }
예제 #4
0
 public void TestGoQLExamples22()
 {
     var e = new GoQLExecutor("/Head*!*Unit");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(1, results.Length);
     Assert.AreEqual("Head", results[0].name);
 }
예제 #5
0
 public void TestGoQLExamples18()
 {
     var e = new GoQLExecutor("Cube/Quad/<t:AudioSource>[-1]");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(1, results.Length);
     Assert.AreEqual("ChildWithAudio (2)", results[0].name);
 }
예제 #6
0
 public void TestGoQLExamples19()
 {
     var e = new GoQLExecutor("<m:Skin>");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(3, results.Length);
     
 }
예제 #7
0
 public void TestGoQLExamples11()
 {
     var e = new GoQLExecutor("Head<t:Collider>");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(1, results.Length);
     Assert.IsTrue(results[0].GetComponent<Collider>() != null);
 }
예제 #8
0
 public void TestGoQLExamples17()
 {
     var e = new GoQLExecutor("<t:Renderer>/*Audio*/[0:3]");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(1, results.Length);
     Assert.AreEqual("GameObject", results[0].name);
 }
예제 #9
0
 public void TestGoQLExamples21()
 {
     var e = new GoQLExecutor("Env*ent");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(2, results.Length);
     Assert.AreEqual("Environment", results[0].name);
     Assert.AreEqual("Environment", results[1].name);
 }
예제 #10
0
 public void TestGoQLExamples15()
 {
     var e = new GoQLExecutor("Quad*/<t:AudioSource>[1]");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(1, results.Length);
     Assert.IsTrue(results[0].GetComponent<AudioSource>() != null);
     
 }
예제 #11
0
 public void TestGoQLExamples13()
 {
     var e = new GoQLExecutor("Head<s:Standard>");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(1, results.Length);
     Assert.IsTrue(results[0].GetComponent<MeshRenderer>() != null);
     Assert.IsTrue(results[0].GetComponent<MeshRenderer>().sharedMaterial.shader.name == "Standard");
 }
예제 #12
0
 public void TestGoQLExamples8()
 {
     var e = new GoQLExecutor("Head/[0,1,5]");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(5, results.Length);
     // Assert.AreEqual("Child (0)", results[0].name);
     // Assert.AreEqual("Child (1)", results[1].name);
     // Assert.AreEqual("Child (5)", results[2].name);
 }
예제 #13
0
 public void TestGoQLExamples16()
 {
     var e = new GoQLExecutor("<t:Transform, t:AudioSource>");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(8, results.Length);
     Assert.IsTrue(results[0].GetComponent<AudioSource>() != null);
     Assert.IsTrue(results[1].GetComponent<AudioSource>() != null);
     Assert.IsTrue(results[2].GetComponent<AudioSource>() != null);
 }
예제 #14
0
 public void TestGoQLExamples10()
 {
     var e = new GoQLExecutor("Head/[3:5]");
     var results = e.Execute();
     Assert.AreEqual(ParseResult.OK, e.parseResult);
     Assert.AreEqual(4, results.Length);
     Assert.AreEqual("Child (3)", results[0].name);
     Assert.AreEqual("Quad 1", results[1].name);
     Assert.AreEqual("Child (4)", results[2].name);
     Assert.AreEqual("Quad 2", results[3].name);
 }
        public static void ExecuteQuery(ISelectionGroup group)
        {
            var executor = new GoQLExecutor();
            var code     = GoQL.Parser.Parse(group.Query, out GoQL.ParseResult parseResult);

            if (parseResult == GoQL.ParseResult.OK)
            {
                executor.Code = group.Query;
                var objects = executor.Execute();
                group.SetMembers(objects);
            }
        }