Beispiel #1
0
        public HistoryLog(SpriteFont font, int width, AssetManager assetManager)
        {
            _font         = font;
            _width        = width;
            _assetManager = assetManager;

            _childrenPlaceholder          = AddChild(new VerticalLayout());
            _childrenPlaceholder.Position = _textOffset;
            _childrenPlaceholder.Renderer = new SpriteRenderer(_assetManager[AssetManager.HistoryLogBg]);
            _childrenPlaceholder.Padding  = new Vector4(35, 20, 20, 20);

            for (int i = 0; i < MaxHistorySize; i++)
            {
                var entry = new HistoryLogEntry(-1, TeamColor.Red, UctAction.NullAction(), null, null, null, null,
                                                assetManager);
                _log.Add(entry);
                _childrenPlaceholder.AddChild(entry);
            }
        }
Beispiel #2
0
        public void Log(TeamColor currentTeam, UctAction action, CachedMob mob, CachedMob target,
                        AbilityInfo abilityInfo, int?moveCost)
        {
            GameManager.CurrentSynchronizationContext.Post(_ => {
                var entry = new HistoryLogEntry(ActionCount++,
                                                currentTeam,
                                                action,
                                                mob,
                                                target,
                                                abilityInfo,
                                                moveCost,
                                                _assetManager);

                _log.Add(entry);
                _childrenPlaceholder.AddChild(entry);

                if (_log.Count > MaxHistorySize)
                {
                    _log.RemoveAt(0);
                    _childrenPlaceholder.Children.RemoveAt(0);
                }
            }, null);
        }