Example #1
0
        public void Add_test()
        {
            Text.Text text = new Text.Text();
            text.Add("Sentence");

            Assert.IsTrue(text.Sentences_amount() == 1);
        }
Example #2
0
 protected IntegerToStringStrategy(int value, int divisor, Text.Text parsedValue, IIntegerToStringStrategy nextStrategy)
 {
     _value        = value;
     _divisor      = divisor;
     _parsedValue  = parsedValue;
     _nextStrategy = nextStrategy;
 }
Example #3
0
        public void Remove_whitespaces_test()
        {
            Text.Text text = new Text.Text();
            text.Add("The    test       message");

            text.Remove_whitespaces();
            Assert.AreEqual(text.At_index(0), "The test message");
        }
Example #4
0
        public void Clear_test()
        {
            Text.Text text = new Text.Text();
            text.Add("Sentence");

            text.Clear();
            Assert.IsTrue(text.Sentences_amount() == 0);
        }
Example #5
0
        public void Remove_end_spaces_test()
        {
            Text.Text text = new Text.Text();
            text.Add("Message       ");
            text.Remove_end_spaces();

            Assert.AreEqual(text.At_index(0), "Message");
        }
Example #6
0
 public override void Initialize()
 {
     _style          = Context.UiManager.StyleManager.GetStyle(this);
     _plainRectangle = new PlainRectangle(Context, Size, Color.White);
     _text           = Context.TextManager.Create(_style.Font, _style.FontSize, _textValue, Size, _style.TextColor,
                                                  _style.HorizontalAlignment, _style.VerticalAlignment, _style.Padding);
     _text.Content = _textValue;
 }
Example #7
0
        public void Insert_test()
        {
            Text.Text text = new Text.Text();
            text.Add("Added1");
            text.Add("Added2");

            text.Insert("Inserted", 1);
            Assert.AreEqual(text.At_index(1), "Inserted");
        }
Example #8
0
        public override void Initialize()
        {
            TextInputStyle style = Context.UiManager.StyleManager.GetStyle(this);

            _plainRectangle = new PlainRectangle(Context, Size, Color.BlanchedAlmond);
            _text           = Context.TextManager.Create(style.Font, style.FontSize, _textValue, Size, style.TextColor,
                                                         style.HorizontalAlignment, style.VerticalAlignment, style.Padding);
            _text.Content = _textValue;
        }
Example #9
0
        public MapTooltip(IContext context, GameScreen gameScreen) : base(context, "map_tooltip", new UniRectangle())
        {
            _gameScreen = gameScreen;
            _rectangle  = new TexturedExtensibleRectangle(context, new Vector2I(), context.TextureManager.Create("tooltip.png", "Data/UI/"), 8);
            LabelStyle style = Context.UiManager.StyleManager.GetStyle(this);

            _text = Context.TextManager.Create(style.Font, style.FontSize, "", new Vector2I(400, 600), style.TextColor,
                                               style.HorizontalAlignment, style.VerticalAlignment, style.Padding);
            _delay = .5f;
        }
Example #10
0
        public void Consonant_percentage_test()
        {
            Text.Text text = new Text.Text();
            text.Add("ab");
            text.Add("cu");

            double consonants = text.Consonant_percentage();

            Assert.AreEqual(consonants, 50);
        }
Example #11
0
        public void The_shortest_test()
        {
            Text.Text text = new Text.Text();
            text.Add("message");
            text.Add("message2");
            text.Add("test"); //the shortest

            int result = text.The_shortest();

            Assert.AreEqual(result, 4);
        }
Example #12
0
 public Tooltip(IContext context, string id, Control associatedControl, double delay, string text = null)
     : base(context, id, new UniRectangle())
 {
     _associatedControl = associatedControl;
     _text = context.TextManager.Create("Courrier", 14, "",
         new Vector2I(400, 500), Color.Wheat, HorizontalAlignment.Left, VerticalAlignment.Top, new Padding(8));
     if(text != null)
         _text.Content = text;
     Texture texture = Context.TextureManager.Create("tooltip.png", @"Data/UI/");
     _rectangle = new TexturedExtensibleRectangle(Context, new Vector2I(), texture, 8);
     _delay = delay;
     Visible = false;
 }
Example #13
0
        public Tooltip(IContext context, string id, Control associatedControl, double delay, string text = null)
            : base(context, id, new UniRectangle())
        {
            _associatedControl = associatedControl;
            _text = context.TextManager.Create("Courrier", 14, "",
                                               new Vector2I(400, 500), Color.Wheat, HorizontalAlignment.Left, VerticalAlignment.Top, new Padding(8));
            if (text != null)
            {
                _text.Content = text;
            }
            Texture texture = Context.TextureManager.Create("tooltip.png", @"Data/UI/");

            _rectangle = new TexturedExtensibleRectangle(Context, new Vector2I(), texture, 8);
            _delay     = delay;
            Visible    = false;
        }
Example #14
0
        static void Main(string[] args)
        {
            Text.Text text = new Text.Text();

            text.Add("   sentence  ");
            text.Add("we are    here");

            text.Show();

            text.Remove_end_spaces();
            text.Remove_begin_spaces();
            text.Remove_whitespaces();

            Console.WriteLine("- - - - - - - - - -");

            text.Show();

            Console.ReadKey();
        }
Example #15
0
 private StringStrategy(Text.Text text) => _text = text;
Example #16
0
 public FleetRenderingInfo(IContext context, Fleet fleet, Vector2I size)
 {
     WorldPosition = (Vector3)fleet.Location.Center;
     WorldMatrix = Matrix.RotationY(-(float) (Math.PI/2))*Matrix.Translation(WorldPosition);
     ShipCount = fleet.ShipCount;
     Fleets = new List<Fleet> { fleet };
     if(fleet.Owner.Equals(context.Realm))
         CurrentStatus = Status.Mine;
     else
         CurrentStatus = new List<Status> {Status.Ally, Status.Enemy, Status.Neutral}.RandomItem();
     Text = context.TextManager.Create("Courrier", 14, RandomGenerator.Get(1,2000).ToString(CultureInfo.InvariantCulture),
         new Vector2I(size.X-8, size.Y), Color.Wheat, HorizontalAlignment.Center, VerticalAlignment.Middle, new Padding(2));
 }
Example #17
0
File: Label.cs Project: ndech/Alpha
 public override void Initialize()
 {
     _style = Context.UiManager.StyleManager.GetStyle(this);
     _text  = Context.TextManager.Create(_style.Font, _style.FontSize, _textValue, Size, _style.TextColor,
                                         _style.HorizontalAlignment, _style.VerticalAlignment, _style.Padding);
 }