Example #1
0
    private static Mesh CreateBoxMesh(int width, int height, int depth)
    {
        Mesh mesh = new Mesh();

        KeyValuePair <int, Vector3> a = new KeyValuePair <int, Vector3>(0, new Vector3(0, 0, 0));
        KeyValuePair <int, Vector3> b = new KeyValuePair <int, Vector3>(1, new Vector3(0, 0, depth));
        KeyValuePair <int, Vector3> c = new KeyValuePair <int, Vector3>(2, new Vector3(0, height, 0));
        KeyValuePair <int, Vector3> d = new KeyValuePair <int, Vector3>(3, new Vector3(0, height, depth));
        KeyValuePair <int, Vector3> e = new KeyValuePair <int, Vector3>(4, new Vector3(width, 0, 0));
        KeyValuePair <int, Vector3> f = new KeyValuePair <int, Vector3>(5, new Vector3(width, 0, depth));
        KeyValuePair <int, Vector3> g = new KeyValuePair <int, Vector3>(6, new Vector3(width, height, 0));
        KeyValuePair <int, Vector3> h = new KeyValuePair <int, Vector3>(7, new Vector3(width, height, depth));

        Vector3[] newVertices = new Vector3[]
        { a.Value, b.Value, c.Value, d.Value, e.Value, f.Value, g.Value, h.Value };

        // List of faces, order of vertices in each face must form a simple polygon.
        KeyValuePair <int, Vector3>[][] faces = new KeyValuePair <int, Vector3>[][]
        {
            new KeyValuePair <int, Vector3>[] { a, b, d, c },
            new KeyValuePair <int, Vector3>[] { a, c, g, e },
            new KeyValuePair <int, Vector3>[] { c, d, h, g },
            new KeyValuePair <int, Vector3>[] { a, e, f, b },
            new KeyValuePair <int, Vector3>[] { b, f, h, d },
            new KeyValuePair <int, Vector3>[] { e, g, h, f }
        };

        IEnumerable <int> newTriangles = faces.SelectMany <KeyValuePair <int, Vector3>[], int>(GetFaceTriangles);

        Vector2[] newUV = null;

        mesh.vertices  = newVertices;
        mesh.uv        = newUV;
        mesh.triangles = newTriangles.ToArray();

        return(mesh);
    }
        public void InlineChildrenTest()
        {
            KeyValuePair<string, ExpectedException>[] paddingToSkip = new KeyValuePair<string, ExpectedException>[]
            {
                new KeyValuePair<string, ExpectedException>(string.Empty, null),
                new KeyValuePair<string, ExpectedException>("  \r\n\t", null),
                new KeyValuePair<string, ExpectedException>("<!-- some -->   <?value?>", null),
                new KeyValuePair<string, ExpectedException>("some text", null),
                new KeyValuePair<string, ExpectedException>("<![CDATA[cdata]]>", null),
                new KeyValuePair<string, ExpectedException>("<c:some xmlns:c='c'/>", null),
                // The default namespace is ATOM, so this element is in ATOM namespace and thus rejected.
                new KeyValuePair<string, ExpectedException>("<unknown/>", ODataExpectedExceptions.ODataException("ODataAtomEntryAndFeedDeserializer_UnknownElementInInline", "unknown")),
                new KeyValuePair<string, ExpectedException>("<m:unknown/>", null),
                new KeyValuePair<string, ExpectedException>("<d:unknown/>", null),
            };

            IEnumerable<PayloadReaderTestDescriptor> testDescriptors = paddingToSkip.SelectMany(padding =>
                new[]
                {
                    // Empty m:inline
                    new PayloadReaderTestDescriptor(this.Settings)
                    {
                        PayloadElement = PayloadBuilder.Entity().Property(
                            PayloadBuilder.ExpandedNavigationProperty("NavProp", PayloadBuilder.NullEntity(), "http://odata.org/link").XmlRepresentation(string.Format(CultureInfo.InvariantCulture,
                                "<link rel='http://docs.oasis-open.org/odata/ns/related/NavProp' href='http://odata.org/link' type='application/atom+xml;type=entry'>" +
                                "<m:inline>{0}</m:inline>" +
                                "</link>",
                                padding.Key))
                            ),
                        ExpectedException = padding.Value
                    },
                    // Expanded entry
                    new PayloadReaderTestDescriptor(this.Settings)
                    {
                        PayloadElement = PayloadBuilder.Entity().Property(
                            PayloadBuilder.ExpandedNavigationProperty("NavProp", PayloadBuilder.Entity(), "http://odata.org/link").XmlRepresentation(string.Format(CultureInfo.InvariantCulture,
                                "<link rel='http://docs.oasis-open.org/odata/ns/related/NavProp' href='http://odata.org/link' type='application/atom+xml;type=entry'>" +
                                "<m:inline>{0}" +
                                "<entry/>{0}" +
                                "</m:inline>" +
                                "</link>",
                                padding.Key))
                            ),
                        ExpectedException = padding.Value
                    },
                    // Expanded feed
                    new PayloadReaderTestDescriptor(this.Settings)
                    {
                        PayloadElement = PayloadBuilder.Entity().Property(
                            PayloadBuilder.ExpandedNavigationProperty("NavProp", PayloadBuilder.EntitySet(), "http://odata.org/link").XmlRepresentation(string.Format(CultureInfo.InvariantCulture,
                                "<link rel='http://docs.oasis-open.org/odata/ns/related/NavProp' href='http://odata.org/link' type='application/atom+xml;type=feed'>" +
                                "<m:inline>{0}" +
                                "<feed/>{0}" +
                                "</m:inline>" +
                                "</link>",
                                padding.Key))
                            ),
                        ExpectedException = padding.Value
                    },
                });

            this.CombinatorialEngineProvider.RunCombinations(
                testDescriptors,
                this.ReaderTestConfigurationProvider.AtomFormatConfigurations,
                (testDescriptor, testConfiguration) =>
                {
                    testDescriptor.RunTest(testConfiguration);
                });
        }
Example #3
0
    private void PopulateCredits(Text text, bool startingText = false)
    {
        const int linesPerScreen = 15;

        var sb = new StringBuilder();

        if (startingText)
        {
            sb.AppendLine("Producer");
            sb.AppendLine(BigNameSize + "Blair Knickerbocker" + EndSize);
            sb.AppendLine();

            sb.AppendLine("Directed by");
            sb.AppendLine(BigNameSize + "James Walker" + EndSize);
            sb.AppendLine();

            sb.AppendLine("Sound Direction by");
            sb.AppendLine(BigNameSize + "Katie Tarrant" + EndSize);
            sb.AppendLine();

            sb.AppendLine("Art Direction by");
            sb.AppendLine(BigNameSize + "Rachael Jones" + EndSize);
            sb.AppendLine();
        }
        else
        {
            switch (Random.Range(0, 10))
            {
            case 0:
            case 1:
            case 2:
                //   Job Title
                // Name1   Name2


                sb.AppendLine(BigNameSize + JobTitleGen.GetJobTitlePlural() + EndSize);
                sb.AppendLine();

                var names2 = new KeyValuePair <string, string> [linesPerScreen - 2];
                for (int i = 0; i < names2.Length; i++)
                {
                    names2[i] = new KeyValuePair <string, string>(NameGen.GetName(), NameGen.GetName());
                }

                var maxNameWidth = names2.SelectMany(n => new[] { n.Key, n.Value }).OrderByDescending(n => n.Length).First().Length;

                var format = string.Format("{{0,-{0}}}   {{1,{0}}}", maxNameWidth);

                for (int i = 0; i < names2.Length; i++)
                {
                    sb.AppendLine(string.Format(format, names2[i].Key, names2[i].Value));
                }

                break;


            case 3:
            case 4:
            case 5:
                //   Job Title
                // Name1   Name2
                //   Job Title
                // Name1   Name2

                const int linesPerBlock = 4;

                for (int j = 0; j < 2; j++)
                {
                    sb.AppendLine(BigNameSize + JobTitleGen.GetJobTitlePlural() + EndSize);
                    sb.AppendLine();

                    var names3 = new KeyValuePair <string, string> [linesPerBlock];
                    for (int i = 0; i < linesPerBlock; i++)
                    {
                        names3[i] = new KeyValuePair <string, string>(NameGen.GetName(), NameGen.GetName());
                    }

                    maxNameWidth = names3.SelectMany(n => new[] { n.Key, n.Value }).OrderByDescending(n => n.Length).First().Length;
                    format       = string.Format("{{0,-{0}}}   {{1,{0}}}", maxNameWidth);

                    for (int i = 0; i < names3.Length; i++)
                    {
                        sb.AppendLine(string.Format(format, names3[i].Key, names3[i].Value));
                    }

                    sb.AppendLine();
                }



                break;


            case 6:
            case 7:
            case 8:

                switch (Random.Range(0, 2))
                {
                case 0:
                    sb.AppendLine(LargeSize + "Special Thanks to" + EndSize);
                    break;

                case 1:
                    sb.AppendLine(LargeSize + "Extras" + EndSize);
                    break;
                }
                sb.AppendLine();

                names2 = new KeyValuePair <string, string> [linesPerScreen - 2];
                for (int i = 0; i < names2.Length; i++)
                {
                    names2[i] = new KeyValuePair <string, string>(JobTitleGen.GetJobTitle(), NameGen.GetName());
                }

                maxNameWidth = names2.SelectMany(n => new[] { n.Key, n.Value }).OrderByDescending(n => n.Length).First().Length;
                format       = string.Format("<b>{{0,-{0}}}</b>   {{1,{0}}}", maxNameWidth);

                for (int i = 0; i < names2.Length; i++)
                {
                    sb.AppendLine(string.Format(format, names2[i].Key, names2[i].Value));
                }

                break;

            case 9:

                // Production babies!

                sb.AppendLine(LargeSize + "Production Babies!" + EndSize);
                sb.AppendLine();

                names2 = new KeyValuePair <string, string> [linesPerScreen - 2];
                for (int i = 0; i < names2.Length; i++)
                {
                    names2[i] = new KeyValuePair <string, string>(NameGen.GetName(), NameGen.GetName());
                }

                maxNameWidth = names2.SelectMany(n => new[] { n.Key, n.Value }).OrderByDescending(n => n.Length).First().Length;
                format       = string.Format("{{0,-{0}}}   {{1,{0}}}", maxNameWidth);

                for (int i = 0; i < names2.Length; i++)
                {
                    sb.AppendLine(string.Format(format, names2[i].Key, names2[i].Value));
                }

                break;

            case 10:


                break;
            }
        }

        text.text = sb.ToString();
    }