Example #1
0
        public Therapist()
        {
            Transform
            .Create(this)
            .SetPosition(440, 200)
            .SetZ(2)
            .SetAbsolute(true);

            Text
            .Create(this)
            .SetColor(Color.OrangeRed)
            .SetFont(content.fonts.pixeloperator_outline_BMF)
            .SetWidth(300);

            Sprite
            .Create(this)
            .SetImage(content.rooms.office.therapist, 5, 1);

            SpriteTransformAnimation
            .Create(this)
            .SetSetFrameFn(SetFrame);

            SpriteData
            .Create(this)
            .SetOffset(-87, 45);

            Scripts
            .Create(this);
        }
        public new void ToString()
        {
            var text = new ComplexText(Text.Empty);

            Assert.IsTrue(text.ToString() == "");

            text = new ComplexText(Text.Create("a"));
            Assert.IsTrue(text.ToString() == "a");

            text = new ComplexText(Text.Create("ab"));
            Assert.IsTrue(text.ToString() == "ab");

            text = new ComplexText(
                Text.Empty,
                Text.Create("ab"),
                Text.Empty,
                Text.Create("c"),
                Text.Empty,
                Text.Create("def"),
                Text.Empty);

            Assert.IsTrue(text.ToString() == "abcdef");

            text = new ComplexText(
                new ComplexText(Text.Empty),
                new SimpleText("__ab__", 2, 2),
                new ComplexText(Text.Empty),
                new SimpleText("___c___", 3, 1),
                new ComplexText(Text.Empty),
                new SimpleText("_def_", 1, 3),
                new ComplexText(Text.Empty));

            Assert.IsTrue(text.ToString() == "abcdef");
        }
Example #3
0
        public Ryan()
        {
            Transform
            .Create(this)
            .SetPosition(290, 170)
            .SetAbsolute(true);

            Text
            .Create(this)
            .SetColor(Color.White)
            .SetFont(content.fonts.pixeloperator_outline_BMF)
            .SetWidth(300);

            Sprite
            .Create(this)
            .SetImage(content.rooms.office.ryan, 20, 1, 19)
            .SetFrame(FRAMENEUTRAL);

            SpriteTransformAnimation
            .Create(this)
            .SetSetFrameFn(SetFrame);

            SpriteData
            .Create(this)
            .SetOffset(-29, 50);

            Scripts
            .Create(this);

            State     = RyanState.Neutral;
            DrawOrder = PRIORITY;
        }
Example #4
0
        public Menu()
        {
            Enabled = false;
            Visible = false;

            State = DialogMenuState.Closed;

            Text
            .Create(this)
            .SetFont(content.fonts.pixeloperator_BMF)
            .SetWidth(Game.VIRTUAL_WIDTH - 2 * Game.SCREEN_PADDING)
            .SetWordWrap(true)
            .SetAlign(Alignment.Left | Alignment.Bottom)
            .SetColor(new Color(150, 150, 150, 255))
            .SetVisible(false);

            HotspotPersistent
            .Create(this);

            Sprite
            .Create(this)
            .SetRenderStage(RenderStage.PostBloom)
            .SetImage(Sprite.WHITEPIXELIMAGE);

            SpriteData
            .Create(this)
            .SetColor(Color.Black);
        }
Example #5
0
        private void Document_OnUpdate(Document document, bool clear)
        {
            if (clear)
            {
                _frameBuffer?.Clear();
                Pages.Clear();
            }

            var renderOptions = new RenderOptions(DefaultForegroundColor, DefaultBackgroundColor);
            var ctx           = new EntryRenderContext(document, this, renderOptions);

            if (!RawMode)
            {
                foreach (var entry in document.Entries)
                {
                    var result = entry.Evaluate(ctx);
                    if (result.RefreshRequested)
                    {
                        document.Refresh();
                        return;
                    }

                    ctx.RenderPosition += result?.WrittenCharacters ?? 0;
                }
            }
            else
            {
                Text.Create(new Flag[0], document.ToPlainText()).Evaluate(ctx);
            }

            Render();
        }
Example #6
0
        public void NoWordWrapTest()
        {
            var Entity        = new Entity();
            var TextComponent = Text.Create(Entity).SetWidth(100).SetWordWrap(false);

            TextComponent.MeasureStringFn = MeasureString;
            TextComponent.Set("Lorem Ipsum", 0, Vector2.Zero);
            Assert.AreEqual(1, TextComponent.Lines.Count);
        }
Example #7
0
        public void ConstrainTextTest()
        {
            var Entity        = new Entity();
            var Rectangle     = new Rectangle(10, 10, 80, 80);
            var TextComponent = Text.Create(Entity).SetWidth(100).SetConstrain(true).SetConstrainingRectangle(Rectangle);

            TextComponent.MeasureStringFn = MeasureString;
            TextComponent.Set("Lorem Ipsum Dolor Donot asdasda das asdasda sdsa dasdsadsa", 0, Vector2.Zero);
            Assert.AreEqual(50, TextComponent.ConstrainOffset.X);
        }
Example #8
0
        public void TransformReferenceTest()
        {
            var Entity             = new Entity();
            var TransformComponent = Transform.Create(Entity);
            var TextComponent      = Text.Create(Entity);

            TextComponent.Initialize(false);

            Assert.IsNotNull(TextComponent.Transform);
            Assert.AreEqual(TransformComponent, TextComponent.Transform);
        }
Example #9
0
        public void TestShouldConvertTextToString()
        {
            // Given
            var text = Text.Create("Test").GetOrException();

            // When
            string result = text;

            // Then
            Assert.AreEqual(text.ToString(), result);
        }
Example #10
0
        public void TestShouldCreateTimestamp_Option_None()
        {
            // Given
            string str = "  ";

            // When
            var result = Text.Create(str);

            // Then
            Assert.IsTrue(result.IsNone);
        }
Example #11
0
 public void CreateOrUpdate(Text txt)
 {
     if (txt.IsCreated)
     {
         txt.Update();
     }
     else
     {
         txt.Create();
     }
 }
        private static Text setStickyNote(StickyNote sn, bool fromViewer)
        {
            Rect r = AnnotationsMannager.ConvertRect(sn.RectArea());
            Text t = Text.Create(_currentDoc, r);

            if (!fromViewer)
            {
                t.SetContents(sn.Comment());
            }

            return(t);
        }
Example #13
0
        public void TestShouldCreateText_Validate_Invalid()
        {
            // Given
            var    origin = Origin.Create(Guids.One(), nameof(TimestampTests), nameof(TestShouldCreateText_Validate_Valid));
            string str    = "  ";

            // When
            var result = Text.Create(str, origin);

            // Then
            Assert.IsTrue(result.IsInvalid());
        }
Example #14
0
        public void TestShouldCreateText_Option_Some()
        {
            // Given
            string str = "Test";

            // When
            var result = Text.Create(str);

            // Then
            Assert.IsTrue(result.IsSome);
            Assert.AreEqual(str, result.GetOrException().ToString());
        }
Example #15
0
        public void TestShouldCompareNotEquality_NotEqual()
        {
            // Given
            string str  = "Tests";
            var    text = Text.Create("Test").GetOrException();

            // When
            bool result = str != text;

            // Then
            Assert.IsTrue(result);
        }
Example #16
0
        public void SkipWhile()
        {
            var text = Text.Create("");

            Assert.IsTrue(text.SkipWhile(c => c != 'a') == "");

            text = Text.Create("abc");
            Assert.IsTrue(text.SkipWhile(c => c == 'a' || c == 'b' || c == 'c') == "");
            Assert.IsTrue(text.SkipWhile(c => c == 'a' || c == 'b') == "c");
            Assert.IsTrue(text.SkipWhile(c => c == 'a') == "bc");
            Assert.IsTrue(text.SkipWhile(c => c == 'd') == "abc");
        }
Example #17
0
        public void TakeWhile()
        {
            var text = Text.Create("");

            Assert.IsTrue(text.TakeWhile(c => c == 'a') == "");

            text = Text.Create("abc");
            Assert.IsTrue(text.TakeWhile(c => c == 'a' || c == 'b' || c == 'c') == "abc");
            Assert.IsTrue(text.TakeWhile(c => c == 'a' || c == 'b') == "ab");
            Assert.IsTrue(text.TakeWhile(c => c == 'a') == "a");
            Assert.IsTrue(text.TakeWhile(c => c == 'd') == "");
        }
        public void CroundWords_FromText_ShouldReturnWordsCount(string text, int expectedWordsCount)
        {
            // Arrange
            var dateOfCreating = new DateTime(2020, 10, 3);
            var actualText     = Text.Create(text, dateOfCreating);

            // Act
            var actualWordsCount = actualText.CountWords();

            // Assert
            actualWordsCount.Should().Be(expectedWordsCount);
        }
Example #19
0
        public Label()
        {
            Text
            .Create(this)
            .SetFont(content.fonts.pixeloperator_outline_BMF)
            .SetAlign(Alignment.Top)
            .SetWidth(Game.VIRTUAL_WIDTH)
            .SetWordWrap(true);

            Transform
            .Create(this)
            .SetPosition(Game.VIRTUAL_WIDTH / 2, 50);
        }
Example #20
0
        public void CreateText_ShouldCreateTextObject()
        {
            // Arrange
            var expectedTextContent    = "Sample text";
            var expectedDateOfCreating = new DateTime(2020, 10, 3);

            // Act
            var actualText = Text.Create(expectedTextContent, expectedDateOfCreating);

            // Assert
            actualText.Content.Should().Be(expectedTextContent);
            actualText.CreatedAt.Should().Be(expectedDateOfCreating);
        }
Example #21
0
        /// <summary>
        /// Initializes the GuiScrollList with a vertain number of text images.
        /// </summary>
        /// <param name="items">The text items to display.</param>
        /// <param name="width">The width of one text item.</param>
        /// <param name="height">The height of one text item.</param>
        /// <param name="font">The font to use for the text.</param>
        /// <param name="textColor">The color of the text.</param>
        /// <param name="outlineColor">The color of the outline or 0.</param>
        public void InitImages(string[] items, int width, int height, System.Drawing.Font font, int textColor, int outlineColor)
        {
            ITexture2d texture = Text.Create(items, width, height, font, textColor, outlineColor);

            SubTexture[] textures = SubTexture.Create(texture, items.Length, 1);
            images = new Image[textures.Length];
            for (int i = 0; i < textures.Length; i++)
            {
                images[i] = new Image(textures[i]);
            }
            Init(images);
            SetSize(images[0].Size);
        }
Example #22
0
        public void TestShouldCreateText_Validate_Valid()
        {
            // Given
            var    origin = Origin.Create(Guids.One(), nameof(TimestampTests), nameof(TestShouldCreateText_Validate_Valid));
            string str    = "Test";

            // When
            var result = Text.Create(str, origin);

            // Then
            Assert.IsTrue(result.IsValid);
            Assert.AreEqual(str, result.GetOrException().ToString());
        }
Example #23
0
        public ActionTextLabel()
        {
            Text
            .Create(this)
            .SetFont(content.fonts.pixeloperator_BMF)
            .SetAlign(Alignment.Top)
            .SetWidth(Game.VIRTUAL_WIDTH)
            .SetWordWrap(false);

            Transform
            .Create(this)
            .SetZ(InteractionBar.Z + 3)
            .SetPosition(Game.VIRTUAL_WIDTH / 2, 338);
        }
Example #24
0
        public void StartsWith()
        {
            var text = Text.Create("");

            Assert.IsTrue(text.StartsWith(""));
            Assert.IsFalse(text.StartsWith("a"));

            text = Text.Create("abc");
            Assert.IsTrue(text.StartsWith(""));
            Assert.IsTrue(text.StartsWith("a"));
            Assert.IsTrue(text.StartsWith("ab"));
            Assert.IsTrue(text.StartsWith("abc"));
            Assert.IsFalse(text.StartsWith("b"));
            Assert.IsFalse(text.StartsWith("c"));
        }
        public Task <CountWordsViewModel> Handle(CountWordsQuary request, CancellationToken cancellationToken)
        {
            if (request.Content == null)
            {
                throw new BadRequestException("Text is required");
            }

            var text       = Text.Create(request.Content, _dateTimeProvider.Now);
            var wordsCount = text.CountWords();

            var viewModel = new CountWordsViewModel {
                TotalNumber = wordsCount
            };

            return(Task.FromResult(viewModel));
        }
        public static void SeedText(OrionInnovationSqlDbContext context)
        {
            if (context.Set <Text>().Any())
            {
                return; // Db has been seeded;
            }

            var textList = new Text[]
            {
                Text.Create("Sample text from DB by Nikola Bojkovic!", new DateTime(2020, 10, 1)),
                Text.Create("More text from db for testing", new DateTime(2020, 10, 5)),
            };

            context.Set <Text>().AddRange(textList);
            context.SaveChanges();
        }
Example #27
0
        public RyanVoice()
        {
            Transform
            .Create(this)
            .SetPosition(Game.VIRTUAL_WIDTH * 3 / 4 - 120, 150)
            .SetAbsolute(true);

            Text
            .Create(this)
            .SetColor(Color.White)
            .SetFont(content.fonts.pixeloperator_outline_BMF)
            .SetWidth(600);

            Scripts
            .Create(this);
        }
Example #28
0
        public static Result <Product> Create(
            string name,
            string description,
            float price,
            int quantity,
            DateTime expiryDate,
            bool availability)
        {
            var id                = Guid.NewGuid();
            var nameResult        = Name.Create(name);
            var descriptionResult = Text.Create(description);
            var priceResult       = Price.Create(price);


            return(Result.Combine(nameResult, descriptionResult, priceResult)
                   .Map(() => new Product(id, nameResult.Value, descriptionResult.Value, priceResult.Value, quantity, expiryDate, availability)));
        }
Example #29
0
        public void Take()
        {
            var text = Text.Create("");

            Assert.IsTrue(text.Take(0) == "");
            Assert.IsTrue(text.Take(1) == "");
            Assert.IsTrue(text.Take(2) == "");
            AssertThrows(() => text.Take(-1));

            text = Text.Create("abc");
            Assert.IsTrue(text.Take(0) == "");
            Assert.IsTrue(text.Take(1) == "a");
            Assert.IsTrue(text.Take(2) == "ab");
            Assert.IsTrue(text.Take(3) == "abc");
            Assert.IsTrue(text.Take(4) == "abc");
            AssertThrows(() => text.Skip(-1));
        }
Example #30
0
        public void Skip()
        {
            var text = Text.Create("");

            Assert.IsTrue(text.Skip(0) == "");
            Assert.IsTrue(text.Skip(1) == "");
            Assert.IsTrue(text.Skip(2) == "");
            AssertThrows(() => text.Skip(-1));

            text = Text.Create("abc");
            Assert.IsTrue(text.Skip(0) == "abc");
            Assert.IsTrue(text.Skip(1) == "bc");
            Assert.IsTrue(text.Skip(2) == "c");
            Assert.IsTrue(text.Skip(3) == "");
            Assert.IsTrue(text.Skip(4) == "");
            AssertThrows(() => text.Skip(-1));
        }
 public void CreateOrUpdate(Text txt)
 {
     if (txt.IsCreated) txt.Update();
     else txt.Create();
 }