示例#1
0
            public TextRenderer(LWF lwf, TextContext context) : base(lwf)
            {
                m_context      = context;
                m_matrix       = new Matrix4x4();
                m_renderMatrix = new Matrix4x4();
                m_colorMult    = new UnityEngine.Color();
#if LWF_USE_ADDITIONALCOLOR
                m_colorAdd = new UnityEngine.Color();
#endif
                if (m_context.systemFontRenderer != null)
                {
                    ISystemFontRenderer.Parameter p =
                        context.systemFontRendererParameter;
                    float scale = lwf.scaleByStage;
                    m_context.systemFontRenderer.Init(
                        p.mSize * scale,
                        p.mWidth * scale,
                        p.mHeight * scale,
                        p.mStyle,
                        p.mAlign,
                        p.mVerticalAlign,
                        p.mLineSpacing * scale,
                        p.mLetterSpacing * scale,
                        p.mLeftMargin * scale,
                        p.mRightMargin * scale);
                }
            }
示例#2
0
            public void UseTextWithMovie(string fullPath)
            {
                if (m_movieTables == null)
                {
                    m_movieTables = new Dictionary <string, TextContextTable>();
                }

                TextContextTable table;

                if (!m_movieTables.TryGetValue(fullPath, out table))
                {
                    table = new TextContextTable(m_data.texts.Length);
                    m_movieTables[fullPath] = table;
                }

                for (int i = 0; i < m_data.texts.Length; ++i)
                {
                    Format.Text text = m_data.texts[i];
                    if (text.nameStringId != -1)
                    {
                        TextContext context =
                            new TextContext(this, gameObject, m_data, text);
                        table.contexts[i] = context;
                        string             textName = m_data.strings[text.nameStringId];
                        List <TextContext> contexts;
                        if (!table.map.TryGetValue(textName, out contexts))
                        {
                            table.map[textName] = new List <TextContext>();
                        }
                        table.map[textName].Add(context);
                    }
                }
            }
示例#3
0
        //Ürün adı güncelleme
        public JsonResult UpdateProductInfo(string productName, string beforeProductName)
        {
            if (string.IsNullOrWhiteSpace(productName))
            {
                productName = null;
            }

            try
            {
                using (var db = new TextContext())
                {
                    var result = db.Products.SingleOrDefault(b => b.ProductName == beforeProductName);

                    if (result != null)
                    {
                        result.ProductName = productName;
                        db.SaveChanges();
                    }
                }
                return(Json(new
                {
                    success = true,
                    message = "Ürün Adı Güncellendi!"
                },
                            JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)

            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
示例#4
0
        //Ürünü silme
        public JsonResult DeleteProduct(string product)
        {
            if (string.IsNullOrWhiteSpace(product))
            {
                product = null;
            }
            try
            {
                using (var dbContext = new TextContext())
                {
                    var rmvRec = dbContext.Products.FirstOrDefault(x => x.ProductName == product);
                    dbContext.Products.Remove(rmvRec);
                    dbContext.SaveChanges();
                }

                return(Json(new
                {
                    success = true,
                    message = product + " Ürünü Silindi!"
                },
                            JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
示例#5
0
            public TextRenderer(LWF lwf, TextContext context) : base(lwf)
            {
                m_context      = context;
                m_matrix       = new Matrix4x4();
                m_renderMatrix = new Matrix4x4();
                m_colorMult    = new UnityEngine.Color();
#if LWF_USE_ADDITIONALCOLOR
                m_colorAdd = new UnityEngine.Color();
#endif
                if (m_context != null && m_context.systemFontRenderer != null)
                {
                    ISystemFontRenderer.Parameter p =
                        context.systemFontRendererParameter;
                    float scale = lwf.scaleByStage;
                    m_context.systemFontRenderer.Init(
                        p.mSize * scale,
                        p.mWidth * scale,
                        p.mHeight * scale,
                        p.mStyle,
                        p.mAlign,
                        p.mVerticalAlign,
                        p.mLineSpacing * scale,
                        p.mLetterSpacing * scale,
                        p.mLeftMargin * scale,
                        p.mRightMargin * scale);
                }

                CombinedMeshRenderer.Factory factory =
                    lwf.rendererFactory as CombinedMeshRenderer.Factory;
                if (factory != null)
                {
                    m_shouldBeOnTop = true;
                    m_zOffset       = Mathf.Abs(factory.zRate);
                }
            }
示例#6
0
        public static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");
            var config = builder.Build();


            var dbBuilder = new DbContextOptionsBuilder <TextContext>();

            dbBuilder.UseSqlite("Data Source=" + config["ConnectionStrings:SQLiteTextDb"]);
            dbName = config["ConnectionStrings:SQLiteTextDb"];
            var textContext = new TextContext(dbBuilder.Options);

            JobStorage.Current = new SQLiteStorage(config["ConnectionStrings:SQLiteHangfire"]);

            // Create DB with test data.
            CreateDbWithTestData(textContext);

            // Split Texts after seeding.
            //BackgroundTasks.SplitNewTexts(textContext);

            // Create Background Task for new texts.
            Task.Factory.StartNew(() =>
            {
                Log.SeqLog.WriteNewLogMessage("Createing background job Split new texts.");
                //BackgroundJob.Enqueue(
                //        () => BackgroundTasks.SplitNewTexts(config["ConnectionStrings:SQLiteTextDb"]));
                RecurringJob.AddOrUpdate(
                    () => BackgroundTasks.SplitNewTexts(config["ConnectionStrings:SQLiteTextDb"]),
                    Cron.MinuteInterval(5));
            });

            BuildWebHost(args).Run();
        }
示例#7
0
        public static void CreateDbWithTestData(TextContext context)
        {
            // Create empty db.
            CreateEmptyDb(context);

            // Insert test data.
            SeedTestData(context);
        }
 public HomeController(ILogger <HomeController> log, IStringLocalizer <HomeController> localizer, IRepository repository, TextContext context)
 {
     _log            = log;
     this.context    = context;
     this.localizer  = localizer;
     this.repository = repository;
     this.dbManager  = new DbManager(context);
 }
示例#9
0
 protected void CreateTextContexts()
 {
     m_textContexts = new TextContext[data.texts.Length];
     for (int i = 0; i < data.texts.Length; ++i)
     {
         m_textContexts[i] = new TextContext(this, data, data.texts[i]);
     }
 }
示例#10
0
 public TextMeshRenderer(LWF lwf, TextContext context) : base(lwf, context)
 {
     m_mesh         = new Mesh();
     m_matrix       = new Matrix4x4();
     m_renderMatrix = new Matrix4x4();
     m_colorMult    = new UnityEngine.Color();
     m_colorAdd     = new UnityEngine.Color();
     m_color        = new Color32();
 }
示例#11
0
        /// <summary>
        /// Outputs the context of a message in the console
        /// </summary>
        /// <param name="input">The input raising the message</param>
        /// <param name="position">The position within the input</param>
        protected void OutputContext(Text input, TextPosition position)
        {
            TextContext context = input.GetContext(position);

            Console.Write('\t');
            Console.WriteLine(context.Content);
            Console.Write('\t');
            Console.WriteLine(context.Pointer);
        }
示例#12
0
	public TextMeshRenderer(LWF lwf, TextContext context) : base(lwf, context)
	{
		m_mesh = new Mesh();
		m_matrix = new Matrix4x4();
		m_renderMatrix = new Matrix4x4();
		m_colorMult = new UnityEngine.Color();
		m_colorAdd = new UnityEngine.Color();
		m_color = new Color32();
	}
示例#13
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;

            // Text context to store string and font info to be sent as parameter to Canvas methods
            TextContext context = new TextContext();

            context.fontStyle = FontStyle.Regular;
            context.nfontSize = 40;

            context.ptDraw = new Point(0, 5);

            string szFontFile = "..\\..\\..\\CommonFonts\\Airbus Special.TTF";

            PrivateFontCollection fontcollection = new PrivateFontCollection();

            fontcollection.AddFontFile(szFontFile);
            if (fontcollection.Families.Count() > 0)
            {
                context.fontFamily = fontcollection.Families[0];
            }

            string text     = "PENTHOUSE";
            int    x_offset = 0;

            for (int i = 0; i < text.Length; ++i)
            {
                string str = "";
                str            += text[i];
                context.pszText = str;

                Matrix mat = new Matrix();
                mat.Rotate(-10.0f, MatrixOrder.Append);
                mat.Scale(0.75f, 1.0f, MatrixOrder.Append);
                DrawChar(x_offset, new Rectangle(0, 0, ClientSize.Width, ClientSize.Height), context, e.Graphics, mat);

                if (i == 2)
                {
                    x_offset += 42;
                }
                else if (i >= 4 && i <= 6)
                {
                    x_offset += 42;
                }
                else if (i == 7)
                {
                    x_offset += 37;
                }
                else
                {
                    x_offset += 39;
                }

                x_offset -= 8;
            }
        }
        public void Draw(TextContext ctx)
        {
            if (String.IsNullOrEmpty(ctx.RenderText))
            {
                return;
            }

            // We need to update the camera.
            this.UpdateView(ctx);

#pragma warning disable CS8604 // Possible null reference argument.
            // Prevented because of the null or empty check at the top.
            var font = this.GetFont(ctx.FontName);
#pragma warning restore CS8604 // Possible null reference argument.
            var text = new Text(ctx.RenderText, font)
            {
                CharacterSize    = (uint)(int)ctx.FontSize,
                FillColor        = ctx.FontColor,
                OutlineThickness = ctx.BorderThickness,
                OutlineColor     = ctx.BorderColor,
                Position         = ctx.RenderPosition
            };
            if (ctx.Alignment != null)
            {
                var offset = new Vector2f();

#pragma warning disable CS8602 // Dereference of a possibly null reference.
                // Prevented because of the null or empty check at the top.
                var bound = text.GetLocalBounds();
#pragma warning restore CS8602 // Dereference of a possibly null reference.

                switch (ctx.Alignment.HorizontalAlignment)
                {
                case HorizontalAlignment.Center:
                    offset.X += (ctx.Alignment.Size.X / 2) - (bound.Width / 2);
                    break;

                case HorizontalAlignment.Right:
                    offset.X += ctx.Alignment.Size.X - bound.Width;
                    break;
                }
                switch (ctx.Alignment.VerticalAlignment)
                {
                case VerticalAlignment.Middle:
                    offset.Y += (ctx.Alignment.Size.Y / 2) - (ctx.FontSize.Value / 2);
                    break;

                case VerticalAlignment.Bottom:
                    offset.Y += ctx.Alignment.Size.Y - ctx.FontSize.Value;
                    break;
                }
                text.Position += offset;
            }

            this._buffer.Draw(text);
        }
        public string GetTranslation(string name, Plural plural, TextContext context, out string?searchedLocation, out bool resourceNotFound)
        {
            resourceNotFound = !TryGetTranslation(name, plural, context, out searchedLocation, out var value);
            if (resourceNotFound)
            {
                _logger.TranslationNotAvailable(name, CurrentCulture, searchedLocation);
                value = NullStringLocalizer.Instance.GetTranslation(name, plural, context, out var _, out var _);
            }

            return(value !);
        }
示例#16
0
        public static void CreateEmptyDb(TextContext context)
        {
            // Löscht die DB falls schon vorhanden.
            context.Database.EnsureDeleted();
            Log.SeqLog.WriteNewLogMessage("Database '{dbName}' deleted!", dbName);


            // Legt die DB an.
            context.Database.EnsureCreated();
            Log.SeqLog.WriteNewLogMessage("Database '{dbName}' created!", dbName);
        }
示例#17
0
        protected virtual bool TryGetTranslation(string name, Plural plural, TextContext context, out string value)
        {
            value = plural.Id == null || plural.Count == 1 ? name : plural.Id;

            if (!Options.Value.ReturnOnlyKeyIfNotFound)
            {
                value = $"{context.Id}.{value}";
            }

            return(true);
        }
        public void ShouldAssertObjectNameAsSpecifiedInNameAttribute()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Library>(new StringWriter(builder));

            var query = from libary in context
                        select libary;

            query.Count();

            Assert.AreEqual(Expected(), Source(builder));
        }
示例#19
0
        public void ShouldAssertSimpleSelect()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = from book in context
                        select book;

            query.Count();

            Assert.AreEqual(Expected(), Source(builder));
        }
示例#20
0
        public void ShouldAssertSimpleWhereThatHasMethodCall()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = from book in context
                        where book.Author == GetAuthor(1)
                        select book;

            query.Count();

            Assert.AreEqual(Expected(), Source(builder));
        }
        public void ShouldAssertPropertyNameAsSpeficiedInNameAttribute()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Library>(new StringWriter(builder));

            var query = from libary in context
                        where libary.Id == 2
                        select libary;

            query.Count();

            Assert.AreEqual(ReadExpected(), ReadSource(builder));
        }
示例#22
0
        public void ShouldAssertOrderByDescending()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = from book in context
                        orderby book.Author descending
                        select book;

            query.Count();

            Assert.AreEqual(Expected(), Source(builder));
        }
示例#23
0
        public void ShouldAssertSimpleWhereClause()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = from book in context
                        where book.Id == 1
                        select book;

            query.Count();

            Assert.AreEqual(ReadExpected(), ReadSource(builder));
        }
示例#24
0
        public void ShouldAssertSimpleOrderBySelect()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = from book in context
                        orderby book.Author
                        select book;

            query.Count();

            Assert.AreEqual(ReadExpected(), ReadSource(builder));
        }
示例#25
0
        public static void SplitNewTexts(string db)
        {
            var dbBuilder = new DbContextOptionsBuilder <TextContext>();

            dbBuilder.UseSqlite("Data Source=" + db);
            var textContext = new TextContext(dbBuilder.Options);
            IEnumerable <Text> textToProcess = textContext.Texts.Where(t => t.Processed == false);

            foreach (Text text in textToProcess)
            {
                //SeqLog.WriteNewLogMessage("{ID} - {Title} - {Processed}", text.ID, text.Title, text.Processed);

                // SplitSentece ist noch verbesserungswürdig.
                List <string> splitSentences = SplitSentences(text.Data);

                for (int i = 0; i < splitSentences.Count; i++)
                {
                    Sentence newSentence = new Sentence()
                    {
                        Data = splitSentences[i], TextID = text.ID, SentenceID = i
                    };

                    // Every sentence has a previous sentence, except the first one.
                    if (i > 0)
                    {
                        newSentence.PreviousID = i - 1;
                    }
                    else
                    {
                        newSentence.IsFirst = true;
                    }

                    // Every sentence has a next sentence, except the last one.
                    if (i + 1 < splitSentences.Count)
                    {
                        newSentence.NextID = i + 1;
                    }
                    else
                    {
                        newSentence.IsLast = true;
                    }

                    textContext.Add <Sentence>(newSentence);
                }

                text.Processed = true;
                SeqLog.WriteNewLogMessage("Text with Id:{ID} was splitted into senteces.", text.ID);
            }

            textContext.SaveChanges();
        }
示例#26
0
        //Kategori ekleniyor.
        public JsonResult SetProductCategoryList(string category)
        {
            if (string.IsNullOrWhiteSpace(category))
            {
                category = null;
            }

            try
            {
                TextContext db    = new TextContext();
                var         getId = db.Categories
                                    .OrderByDescending(p => p.id)
                                    .FirstOrDefault();

                List <Category> categories = new List <Category>()
                {
                    new Category()
                    {
                        CategoryName = category
                    }
                };

                foreach (var item in categories)
                {
                    if (getId.CategoryId == 0)
                    {
                        item.CategoryId = 0;
                    }
                    else
                    {
                        item.CategoryId = getId.CategoryId + 1;
                    }

                    db.Categories.Add(item);
                }
                db.SaveChanges();


                return(Json(new
                {
                    success = true,
                    message = "Kategori Başarıyla Eklendi!"
                },
                            JsonRequestBehavior.AllowGet));
            }

            catch (Exception ex)
            {
                return(null);
            }
        }
示例#27
0
 public ScrollingTextMessage(string message, float x, float y, RGBA color)
 {
     this._message = new TextContext(message, "default.ttf")
     {
         RenderPosition = Vector.Create(x, y),
         FontColor      = color,
         Alignment      = new TextAlignment()
         {
             HorizontalAlignment = HorizontalAlignment.Center,
             VerticalAlignment   = VerticalAlignment.Middle,
             Size = Vector.Create(0, 0)
         }
     };
 }
示例#28
0
        public IList <Test> GetTests()
        {
            var context = new TextContext();

            if (context.Tests.Count() == 0)
            {
                context.Tests.Add(new Test()
                {
                    Name = "test1"
                });
                var res = context.SaveChanges();
            }
            return(context.Tests.ToList());
        }
示例#29
0
        protected override bool TryGetTranslation(string name, Plural plural, TextContext context, out string value)
        {
            var key = new POKey(name, plural.Id, context.Id);

            if (!TryGetTranslationCore(key, plural.Count, out string translation))
            {
                Logger.LogTrace("No translation for key {0}.", POStringLocalizer.FormatKey(key));

                base.TryGetTranslation(name, plural, context, out value);
                return(false);
            }

            value = translation;
            return(true);
        }
示例#30
0
        bool TryGetTranslation(string name, Plural plural, TextContext context, out string value)
        {
            var key = new POKey(name, plural.Id, context.Id);

            if (!TryGetTranslation(key, plural.Count, out string translation))
            {
                _logger.LogTrace("No translation for key {KEY}.", POStringLocalizer.FormatKey(key));

                TryGetTranslationFallback(name, plural, context, out value);
                return(false);
            }

            value = translation;
            return(true);
        }
示例#31
0
        /// <summary>
        /// Gets the serialized expected AST
        /// </summary>
        /// <returns>The expected AST, or null if an error occurred</returns>
        private static ASTNode?GetExpectedAST()
        {
            string             expectedText   = File.ReadAllText("expected.txt", Encoding.UTF8);
            ExpectedTreeParser expectedParser = new ExpectedTreeParser(new ExpectedTreeLexer(expectedText));
            ParseResult        result         = expectedParser.Parse();

            foreach (ParseError error in result.Errors)
            {
                Console.WriteLine(error);
                TextContext context = result.Input.GetContext(error.Position);
                Console.WriteLine(context.Content);
                Console.WriteLine(context.Pointer);
            }
            return(result.Errors.Count > 0 ? new ASTNode?() : (result.Root));
        }
示例#32
0
        // Draw Faked Beveled effect
        public MainWindow()
        {
            InitializeComponent();

            WriteableBitmap canvas = TextDesignerWpf.CanvasHelper.GenImage((int)(image1.Width), (int)(image1.Height));

            // Text context to store string and font info to be sent as parameter to Canvas methods
            TextContext context = new TextContext();

            // Load a font from resource
            //===============================
            FontFamily fontFamily = new FontFamily(new Uri("pack://application:,,,/resources/"), "./#Segoe Print");

            context.fontFamily = fontFamily;
            context.fontStyle  = FontStyles.Normal;
            context.fontWeight = FontWeights.Regular;
            context.nfontSize  = 38;

            context.pszText = "Love Like Magic";
            context.ptDraw  = new Point(0, 0);

            // Draw the main outline
            //==========================================================
            ITextStrategy mainOutline = TextDesignerWpf.CanvasHelper.TextOutline(Color.FromRgb(235, 10, 230), Color.FromRgb(235, 10, 230), 4);

            TextDesignerWpf.CanvasHelper.DrawTextImage(mainOutline, ref canvas, new Point(4, 4), context);

            // Draw the small bright outline shifted (-2, -2)
            //==========================================================
            ITextStrategy mainBright = TextDesignerWpf.CanvasHelper.TextOutline(Color.FromRgb(252, 173, 250), Color.FromRgb(252, 173, 250), 2);

            TextDesignerWpf.CanvasHelper.DrawTextImage(mainBright, ref canvas, new Point(2, 2), context);

            // Draw the small dark outline shifted (+2, +2)
            //==========================================================
            ITextStrategy mainDark = TextDesignerWpf.CanvasHelper.TextOutline(Color.FromRgb(126, 5, 123), Color.FromRgb(126, 5, 123), 2);

            TextDesignerWpf.CanvasHelper.DrawTextImage(mainDark, ref canvas, new Point(6, 6), context);

            // Draw the smallest outline (color same as main outline)
            //==========================================================
            ITextStrategy mainInner = TextDesignerWpf.CanvasHelper.TextOutline(Color.FromRgb(235, 10, 230), Color.FromRgb(235, 10, 230), 2);

            TextDesignerWpf.CanvasHelper.DrawTextImage(mainInner, ref canvas, new Point(4, 4), context);

            // Finally blit the rendered canvas onto the window by assigning the canvas to the image control
            image1.Source = canvas;
        }
示例#33
0
        /// <summary>
        /// Raises an error on an unexepcted token
        /// </summary>
        /// <param name="stem">The size of the generation's stem</param>
        private void OnUnexpectedToken(int stem)
        {
            // build the list of expected terminals
            List <Symbol> expected = new List <Symbol>();
            GSSGeneration genData  = gss.GetGeneration();

            for (int i = 0; i != genData.Count; i++)
            {
                LRExpected expectedOnHead = parserAutomaton.GetExpected(gss.GetRepresentedState(i + genData.Start), lexer.Terminals);
                // register the terminals for shift actions
                foreach (Symbol terminal in expectedOnHead.Shifts)
                {
                    if (!expected.Contains(terminal))
                    {
                        expected.Add(terminal);
                    }
                }
                if (i < stem)
                {
                    // the state was in the stem, also look for reductions
                    foreach (Symbol terminal in expectedOnHead.Reductions)
                    {
                        if (!expected.Contains(terminal) && CheckIsExpected(i + genData.Start, terminal))
                        {
                            expected.Add(terminal);
                        }
                    }
                }
            }
            // register the error
            UnexpectedTokenError error = new UnexpectedTokenError(lexer.tokens[nextToken.Index], new ROList <Symbol>(expected));

            allErrors.Add(error);
#if !NETSTANDARD1_0
            if (ModeDebug)
            {
                Console.WriteLine("==== RNGLR parsing error:");
                Console.Write("\t");
                Console.WriteLine(error);
                TextContext context = lexer.Input.GetContext(error.Position);
                Console.Write("\t");
                Console.WriteLine(context.Content);
                Console.Write("\t");
                Console.WriteLine(context.Pointer);
                gss.Print();
            }
#endif
        }
示例#34
0
 public DebugOverlay() : base(ID)
 {
     this._background = new SolidRectangleContext(new RGBA(0, 0, 0, 150))
     {
         RenderSize = ServiceProvider.Canvas.GetResolution(),
         UseUIView  = true
     };
     this._information = new TextContext("", "default.ttf")
     {
         FontSize        = 16,
         BorderColor     = RGBA.Black,
         BorderThickness = 2,
         FontColor       = RGBA.White,
         UseUIView       = true
     };
 }
 public DebugOverlay() : base(ID)
 {
     this._background = new SolidRectangleContext(new RGBA(0, 0, 0, 150))
     {
         RenderSize = Vector.Create(GameWindow.RESOLUTION_WIDTH, GameWindow.RESOLUTION_HEIGHT),
         UseUIView  = true
     };
     this._information = new TextContext("", "default.ttf")
     {
         FontSize        = 16,
         BorderColor     = RGBA.Black,
         BorderThickness = 2,
         FontColor       = RGBA.White,
         UseUIView       = true
     };
 }
示例#36
0
    public TextContext text()
    {
        TextContext _localctx = new TextContext(Context, State);

        EnterRule(_localctx, 6, RULE_text);
        int _la;

        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 23;
                ErrorHandler.Sync(this);
                _la = TokenStream.LA(1);
                do
                {
                    {
                        {
                            State = 22;
                            _la   = TokenStream.LA(1);
                            if (!(_la == WORD || _la == WHITESPACE))
                            {
                                ErrorHandler.RecoverInline(this);
                            }
                            else
                            {
                                ErrorHandler.ReportMatch(this);
                                Consume();
                            }
                        }
                    }
                    State = 25;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                } while (_la == WORD || _la == WHITESPACE);
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
示例#37
0
        public PlayerOverlay(Player player) : base("")
        {
            this._player = player;

            this._border = new TextureContext("TotalOverlay.png")
            {
                RenderPosition = GetPosition(),
                RenderSize     = Vector.Create(width, height),
                UseUIView      = true,
                RenderColor    = RGBA.Red
            };
            this._healthbar = new TextureContext("healthbar.png")
            {
                RenderPosition = GetPosition(),
                RenderSize     = new ScalingVector(
                    Vector.Create(width, height),
                    Vector.Create(player.Health.GetPureRatio(), 1)),
                UseUIView         = true,
                SourceTextureRect = new IntRect(0, 0, new ScalingInt(6, player.Health.GetRatio()), 320)
            };
            this._icon = new TextureContext("Icon-1.png")
            {
                RenderPosition = GetPosition(),
                RenderSize     = Vector.Create(width, height),
                UseUIView      = true,
            };
            this._healthPercentage = new TextContext("100%", "default.ttf")
            {
                RenderPosition  = GetPosition(),
                FontSize        = 24,
                BorderColor     = RGBA.Black,
                BorderThickness = 2,
                FontColor       = RGBA.White,
                Alignment       = new TextAlignment()
                {
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Top,
                    Size = Vector.Create(width, height)
                },
                UseUIView = true
            };

            NumOverlays++;

            this._buffCount = new TextContext[(int)BuffTypes.COUNT];
        }
示例#38
0
        public string getClass(string text)
        {
            //    var a = ma.createSentence(inputText);
            var context = new TextContext();

            text = text.Replace("\"", "");
            text = text.Replace("'", "");
            text = text.Replace("`", "");
            text = text.Replace("'", "");
            string res = null;

            foreach (var s in text.Split(' '))
            {
                switch (s)
                {
                case "י":
                case "'י":
                case "יוד":
                case "שישית":
                case "שישיסט":
                case "שישיסטית":
                    res = "י";
                    break;

                case "יא":
                case "י\"א":
                case "יא'":
                case "'יא":
                case "שביעית":
                case "שביעיסט":
                case "שביעיסטית":
                    res = "יא";
                    break;

                case "יב":
                case "י\"ב":
                case "יב'":
                case "'יב":
                case "שמינית":
                    res = "יב";
                    break;
                }
            }

            return(res);
        }
示例#39
0
            protected void CreateTextContexts(Data data)
            {
                m_data = data;
                m_defaultTable = new TextContextTable(m_data.texts.Length);

                for (int i = 0; i < m_data.texts.Length; ++i) {
                Format.Text text = m_data.texts[i];
                if (text.nameStringId != -1) {
                TextContext context =
                    new TextContext(this, gameObject, m_data, text);
                m_defaultTable.contexts[i] = context;
                string textName = m_data.strings[text.nameStringId];
                List<TextContext> contexts;
                if (!m_defaultTable.map.TryGetValue(textName, out contexts))
                    m_defaultTable.map[textName] = new List<TextContext>();
                m_defaultTable.map[textName].Add(context);
                }
                }
            }
示例#40
0
 public TextRenderer(LWF lwf, TextContext context)
     : base(lwf)
 {
     m_context = context;
     m_matrix = new Matrix4x4();
     m_renderMatrix = new Matrix4x4();
     m_colorMult = new UnityEngine.Color();
     #if LWF_USE_ADDITIONALCOLOR
     m_colorAdd = new UnityEngine.Color();
     #endif
     if (m_context != null && m_context.systemFontRenderer != null) {
     ISystemFontRenderer.Parameter p =
     context.systemFontRendererParameter;
     float scale = lwf.scaleByStage;
     m_context.systemFontRenderer.Init(
     p.mSize * scale,
     p.mWidth * scale,
     p.mHeight * scale,
     p.mStyle,
     p.mAlign,
     p.mVerticalAlign,
     p.mLineSpacing * scale,
     p.mLetterSpacing * scale,
     p.mLeftMargin * scale,
     p.mRightMargin * scale);
     }
 }
示例#41
0
            public TextRenderer(LWF lwf, TextContext context)
                : base(lwf)
            {
                m_context = context;
                m_matrix = new Matrix4x4();
                m_renderMatrix = new Matrix4x4();
                m_colorMult = new UnityEngine.Color();
                #if LWF_USE_ADDITIONALCOLOR
                m_colorAdd = new UnityEngine.Color();
                #endif
                if (m_context != null && m_context.systemFontRenderer != null) {
                ISystemFontRenderer.Parameter p =
                context.systemFontRendererParameter;
                float scale = lwf.scaleByStage;
                m_context.systemFontRenderer.Init(
                p.mSize * scale,
                p.mWidth * scale,
                p.mHeight * scale,
                p.mStyle,
                p.mAlign,
                p.mVerticalAlign,
                p.mLineSpacing * scale,
                p.mLetterSpacing * scale,
                p.mLeftMargin * scale,
                p.mRightMargin * scale);
                }

                CombinedMeshRenderer.Factory factory =
                lwf.rendererFactory as CombinedMeshRenderer.Factory;
                if (factory != null) {
                m_shouldBeOnTop = true;
                m_zOffset = Mathf.Abs(factory.zRate);
                }
            }
	public TextContext text() {
		TextContext _localctx = new TextContext(Context, State);
		EnterRule(_localctx, 298, RULE_text);
		try {
			int _alt;
			EnterOuterAlt(_localctx, 1);
			{
			State = 2410;
			ErrorHandler.Sync(this);
			_alt = Interpreter.AdaptivePredict(TokenStream,162,Context);
			while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber ) {
				if ( _alt==1 ) {
					{
					State = 2408;
					switch ( Interpreter.AdaptivePredict(TokenStream,161,Context) ) {
					case 1:
						{
						State = 2404; tsafe_char();
						}
						break;
					case 2:
						{
						State = 2405; Match(COL);
						}
						break;
					case 3:
						{
						State = 2406; Match(DQUOTE);
						}
						break;
					case 4:
						{
						State = 2407; Match(ESCAPED_CHAR);
						}
						break;
					}
					} 
				}
				State = 2412;
				ErrorHandler.Sync(this);
				_alt = Interpreter.AdaptivePredict(TokenStream,162,Context);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
示例#43
0
        public void ShouldConcatMultipleWhereCallsWithLogicalAnd()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = context.Where(x => x.Id == 1).Where(x => x.Author == "Scott");

            query.FirstOrDefault();

            Assert.AreEqual(Expected(), Source(builder));
        }
示例#44
0
        public void ShouldAssertWhereWithNestedLeftAndRightLogicaExpression()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = from book in context
                        where (book.Id == 10 && book.Author == "Plarosi") || (book.Id == 1 && book.Author == "Charlie")
                        select book;

            query.Count();

            Assert.AreEqual(Expected(), Source(builder));
        }
	public UnityTextRenderer(LWF lwf, int objectId) : base(lwf)
	{
		Factory factory = lwf.rendererFactory as Factory;
		m_context = new TextContext(
			factory, factory.gameObject, lwf.data, objectId);
		m_matrix = new Matrix4x4();
		m_renderMatrix = new Matrix4x4();
		m_colorMult = new UnityEngine.Color();
		m_colorAdd = new UnityEngine.Color();
		if (m_context != null && m_context.systemFontRenderer != null) {
			ISystemFontRenderer.Parameter p =
				m_context.systemFontRendererParameter;
			float scale = lwf.scaleByStage;
			m_context.systemFontRenderer.Init(
				p.mSize * scale,
				p.mWidth * scale,
				p.mHeight * scale,
				p.mStyle,
				p.mAlign,
				p.mVerticalAlign,
				p.mLineSpacing * scale,
				p.mLetterSpacing * scale,
				p.mLeftMargin * scale,
				p.mRightMargin * scale);
		}

		CombinedMeshRenderer.Factory c =
			lwf.rendererFactory as CombinedMeshRenderer.Factory;
		if (c != null) {
			m_shouldBeOnTop = true;
			m_zOffset = Mathf.Abs(c.zRate);
		}
	}
示例#46
0
            public void UseTextWithMovie(string fullPath)
            {
                if (m_movieTables == null)
                m_movieTables = new Dictionary<string, TextContextTable>();

                TextContextTable table;
                if (!m_movieTables.TryGetValue(fullPath, out table)) {
                table = new TextContextTable(m_data.texts.Length);
                m_movieTables[fullPath] = table;
                }

                for (int i = 0; i < m_data.texts.Length; ++i) {
                Format.Text text = m_data.texts[i];
                if (text.nameStringId != -1) {
                TextContext context =
                    new TextContext(this, gameObject, m_data, text);
                table.contexts[i] = context;
                string textName = m_data.strings[text.nameStringId];
                List<TextContext> contexts;
                if (!table.map.TryGetValue(textName, out contexts))
                    table.map[textName] = new List<TextContext>();
                table.map[textName].Add(context);
                }
                }
            }
示例#47
0
	protected void CreateTextContexts()
	{
		m_textContexts = new TextContext[data.texts.Length];
		for (int i = 0; i < data.texts.Length; ++i)
			m_textContexts[i] = new TextContext(this, data, data.texts[i]);
	}
示例#48
0
	public UnityTextRenderer(LWF lwf, TextContext context) : base(lwf)
	{
		m_context = context;
		m_textGenerator = new TextGenerator();
		m_empty = true;
	}
示例#49
0
        public void ShouldJoinWhereUsingAndWhenNextCallHavingLogicalExpr()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = context
                .Where(x => x.ISBN == "111")
                .Where(x => x.Id == 1 || x.Author == "Scott" || x.IsAvailable);

            query.FirstOrDefault();

            Assert.AreEqual(Expected(), Source(builder));
        }
示例#50
0
        public void ShouldAssertSimpleWhereWithLogicalExpression()
        {
            var builder = new StringBuilder();
            var context = new TextContext<Book>(new StringWriter(builder));

            var query = from book in context
                        where book.Id == 1 && book.Author == "Charlie"
                        select book;

            query.Count();

            Assert.AreEqual(Expected(), Source(builder));
        }
	public TextContext text() {
		TextContext _localctx = new TextContext(Context, State);
		EnterRule(_localctx, 0, RULE_text);
		try {
			EnterOuterAlt(_localctx, 1);
			{
			State = 14; header();
			State = 15; Match(T__0);
			State = 16; proof();
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}