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

            Assert.IsTrue(text.Sentences_amount() == 1);
        }
Esempio n. 2
0
 protected IntegerToStringStrategy(int value, int divisor, Text.Text parsedValue, IIntegerToStringStrategy nextStrategy)
 {
     _value        = value;
     _divisor      = divisor;
     _parsedValue  = parsedValue;
     _nextStrategy = nextStrategy;
 }
Esempio n. 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");
        }
Esempio n. 4
0
        public void Clear_test()
        {
            Text.Text text = new Text.Text();
            text.Add("Sentence");

            text.Clear();
            Assert.IsTrue(text.Sentences_amount() == 0);
        }
Esempio n. 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");
        }
Esempio n. 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;
 }
Esempio n. 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");
        }
Esempio n. 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;
        }
Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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;
 }
Esempio n. 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;
        }
Esempio n. 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();
        }
Esempio n. 15
0
 private StringStrategy(Text.Text text) => _text = text;
Esempio n. 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));
 }
Esempio n. 17
0
File: Label.cs Progetto: 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);
 }