Exemplo n.º 1
0
        public Score(SceneGame world, Vector2 position, int amount, bool big, int time) : base(world)
        {
            Position = position;
            Big      = big;
            Frame    = new Slider(time);
            Text     = new TextBuilder(float.PositiveInfinity, float.PositiveInfinity, new TextFormatting()
            {
                Bold      = Big,
                GetParams = (pos) => new DialogParams()
                {
                    Color  = Color.White,
                    Border = Color.Black,
                    Scale  = Vector2.One,
                }
            }, new DialogFormattingScore(2, new SubSlider(Frame, 0, 20)));
            Text.StartLine(LineAlignment.Center);
            var scoreText = amount.ToString();

            if (!Big)
            {
                scoreText = Game.ConvertToSmallPixelText(scoreText);
            }
            Text.AppendText(scoreText);
            Text.EndLine();
            Text.EndContainer();
            Text.Finish();
            Text.DefaultDialog.Show();
        }
Exemplo n.º 2
0
 public LabelledUIText(SpriteReference labelSprite, SpriteReference contentSprite, Action <TextBuilder> label, Action <TextBuilder> content) : base(labelSprite, contentSprite, label, null)
 {
     Content = new TextBuilder(float.PositiveInfinity, 16);
     label(Content);
     Content.EndContainer();
     Content.Finish();
     Size = GetSize;
 }
Exemplo n.º 3
0
 public SceneLoading(Game game) : base(game)
 {
     LoadingText = new TextBuilder(float.PositiveInfinity, float.PositiveInfinity);
     LoadingText.StartLine(LineAlignment.Center);
     LoadingText.AppendText("Restarting Game...");
     LoadingText.EndLine();
     LoadingText.EndContainer();
     LoadingText.Finish();
 }
Exemplo n.º 4
0
        public override void Update(GameTime gameTime)
        {
            UpdateTimeModifier();

            CurrentTheme?.Update();
            CurrentGameOver?.Update();

            UpdateProtoEffects();
            UpdateVisualEffects();

            foreach (var timer in Timers)
            {
                timer.Update();
            }
            Timers.RemoveAll(x => x.Slide >= 1);

            UpdateInput();

            var tickables = Manager.Tickable.GetTickables();

            foreach (var tickable in tickables.ToList())
            {
                tickable.Tick(this);
            }

            Vector2 worldPos = Vector2.Transform(new Vector2(InputState.MouseX, InputState.MouseY), Matrix.Invert(WorldTransform));
            int     tileX    = Util.FloorDiv((int)worldPos.X, 16);
            int     tileY    = Util.FloorDiv((int)worldPos.Y, 16);

            TileCursor = new Point(tileX, tileY);
            MenuCursor = Menu.GetMouseOver(InputState.MouseX, InputState.MouseY);
            if (MenuCursor != null)
            {
                TileCursor = null;
            }

            TooltipText = new TextBuilder(float.PositiveInfinity, float.PositiveInfinity);
            if (MenuCursor != null)
            {
                MenuCursor.GenerateTooltip(TooltipText);
            }
            else if (Map != null && TileCursor.HasValue)
            {
                MapTile tile = Map.GetTile(TileCursor.Value.X, TileCursor.Value.Y);
                if (tile != null)
                {
                    tile.AddTooltip(TooltipText);
                }
            }
            TooltipText.EndContainer();
            TooltipText.Finish();
        }
Exemplo n.º 5
0
 public LabelledUI(SpriteReference labelSprite, SpriteReference contentSprite, Action <TextBuilder> label, Func <Point> size)
 {
     ContentSprite = contentSprite;
     LabelSprite   = labelSprite;
     Label         = new TextBuilder(float.PositiveInfinity, 16);
     if (label != null)
     {
         Label.StartLine(LineAlignment.Center);
         label(Label);
         Label.EndLine();
     }
     Label.EndContainer();
     Label.Finish();
     Size = size;
 }
Exemplo n.º 6
0
        private void Init()
        {
            var cursor = SpriteLoader.Instance.AddSprite("content/cursor");

            Text = new TextBuilder(Width, float.MaxValue);
            int index = 0;

            foreach (var action in Actions)
            {
                Text.StartTableRow(Width, new ColumnConfigs(new IColumnWidth[] {
                    new ColumnFixedWidth(16, true),
                    new ColumnFixedWidth(0, false),
                    new ColumnFixedWidth(16, true),
                })
                {
                    Padding = 0
                });
                Text.StartTableCell();
                Text.AppendElement(new TextElementCursor(cursor, 16, 16, () => IsSelected(action)));
                Text.EndTableCell();
                Text.StartTableCell();
                action.Text(Text);
                Text.EndTableCell();
                Text.StartTableCell();

                Text.EndTableCell();
                var row           = Text.EndTableRow();
                var selectionArea = new MenuAreaText(Text, 0, null);
                selectionArea.Add(row);
                SelectionAreas.Add(index, selectionArea);
                index++;
            }
            Text.EndContainer();
            Text.Finish();
            Dirty = false;
        }