Example #1
0
        public void TextGeneratorTest()
        {
            IGenerator <string> textgen = new TextGenerator();
            var text = (string)textgen.Generate();

            Assert.IsNotNull(text);
        }
Example #2
0
 void Start()
 {
     m_textGenerator = GetComponent <TextGenerator>();
     m_textUnpacker  = GetComponent <TextUnpacker>();
     TextUnpacker.m_definableTerms.Add(new Definable("name", "Ben"));
     m_fancyTextBlocks = TextUnpacker.Unpack(m_text);
     m_textGenerator.Generate(m_fancyTextBlocks[m_textProgress++]);
 }
Example #3
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (m_textGenerator.LettersIdle() && m_textProgress < m_fancyTextBlocks.Count)
         {
             m_textGenerator.ForceStateLetters(FancyTextAnimation.Type.Exit);
             m_textGenerator.RemoveParagraphs();
             m_textGenerator.Generate(m_fancyTextBlocks[m_textProgress++]);
         }
         else
         {
             m_textGenerator.ForceStateLetters(FancyTextAnimation.Type.Idle);
         }
     }
 }
Example #4
0
        protected override void Generate(DependencyPropertyChangedEventArgs args,
                                         Point3DCollection lines)
        {
            lines.Clear();

            txtgen.Font                = Font;
            txtgen.FontSize            = FontSize;
            txtgen.Rounding            = Rounding;
            txtgen.Thickness           = Thickness;
            txtgen.BaselineDirection   = BaselineDirection;
            txtgen.Origin              = Origin;
            txtgen.UpDirection         = UpDirection;
            txtgen.VerticalAlignment   = VerticalAlignment;
            txtgen.HorizontalAlignment = HorizontalAlignment;

            txtgen.Generate(lines, Text);
        }
Example #5
0
        public void GenerateText_ShouldEndWithUnderscore()
        {
            string t = TextGenerator.Generate(20);

            Assert.EndsWith("_", t);
        }
Example #6
0
        public void GenerateText_ShouldBeCorrectLength()
        {
            string t = TextGenerator.Generate(20);

            Assert.Equal(20, t.Length);
        }
Example #7
0
        protected override void Generate(DependencyPropertyChangedEventArgs args,
                                         Point3DCollection lines)
        {
            lines.Clear();

            // X axis.
            lines.Add(new Point3D(-Extent, 0, 0));
            lines.Add(new Point3D(Extent, 0, 0));

            // Y axis.
            lines.Add(new Point3D(0, -Extent, 0));
            lines.Add(new Point3D(0, Extent, 0));

            // Z axis.
            lines.Add(new Point3D(0, 0, -Extent));
            lines.Add(new Point3D(0, 0, Extent));

            for (int i = (int)(-10 * Extent); i <= (int)(10 * Extent); i++)
            {
                double tick = (i % 10 == 0) ? LargeTick : SmallTick;
                double d    = i / 10.0;

                // X axis tick marks.
                lines.Add(new Point3D(d, -tick, 0));
                lines.Add(new Point3D(d, tick, 0));

                // Y axis tick marks.
                lines.Add(new Point3D(-tick, d, 0));
                lines.Add(new Point3D(tick, d, 0));

                // Z axis tick marks.
                lines.Add(new Point3D(0, -tick, d));
                lines.Add(new Point3D(0, tick, d));

                txtgen.Font              = Font;
                txtgen.FontSize          = FontSize;
                txtgen.Thickness         = Thickness;
                txtgen.Rounding          = Rounding;
                txtgen.BaselineDirection = new Vector3D(1, 0, 0);
                txtgen.UpDirection       = new Vector3D(0, 1, 0);

                if (i != 0 && i % 10 == 0)
                {
                    string str       = ((int)d).ToString();
                    bool   isEnd     = (i == (int)(-10 * Extent)) || (i == (int)(10 * Extent));
                    string strPrefix = (i == (int)(-10 * Extent)) ? "-" : "+";

                    // X axis numbers and labels.
                    if (isEnd && Labels != null)
                    {
                        str = strPrefix + Labels.Substring(0, Labels.Length / 3);
                    }

                    if (isEnd || ShowNumbers)
                    {
                        txtgen.Origin = new Point3D(d, -tick * 1.25, 0);
                        txtgen.HorizontalAlignment = HorizontalAlignment.Center;
                        txtgen.VerticalAlignment   = VerticalAlignment.Top;
                        txtgen.Generate(lines, str);
                    }

                    // Y axis numbers and labels.
                    if (isEnd)
                    {
                        str = strPrefix + Labels.Substring(Labels.Length / 3, Labels.Length / 3);
                    }

                    if (isEnd || ShowNumbers)
                    {
                        txtgen.Origin = new Point3D(tick * 1.25, d, 0);
                        txtgen.HorizontalAlignment = HorizontalAlignment.Left;
                        txtgen.VerticalAlignment   = VerticalAlignment.Center;
                        txtgen.Generate(lines, str);
                    }

                    // Want to make Z either viewed from left or right !!!!!!!!!!!!!!!!!!

                    // Z axis numbers and labels.
                    if (isEnd)
                    {
                        str = strPrefix + Labels.Substring(2 * Labels.Length / 3);
                    }

                    if (isEnd || ShowNumbers)
                    {
                        txtgen.Origin              = new Point3D(0, -tick * 1.25, d);
                        txtgen.BaselineDirection   = new Vector3D(0, 0, 1);
                        txtgen.HorizontalAlignment = HorizontalAlignment.Center;
                        txtgen.VerticalAlignment   = VerticalAlignment.Top;
                        txtgen.Generate(lines, str);
                    }
                }
            }
        }
 public void TextGeneratorTest()
 {
     IGenerator<string> textgen = new TextGenerator();
     var text = (string) textgen.Generate();
     Assert.IsNotNull(text);
 }