Ejemplo n.º 1
0
 protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
 {
     return(control.Position.Size);
 }
Ejemplo n.º 2
0
 protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
 {
     RenderText(control.PaddedLeft, control.PaddedTop, control.ActivityIndex, out _, GetText(control, systemContainer, playerFov), control.Color);
 }
Ejemplo n.º 3
0
 public SetIsActionFalseRule(ISystemContainer systemContainer)
 {
 }
Ejemplo n.º 4
0
 public GetBaseStatRule(ISystemContainer systemContainer)
 {
     _playerSystem = systemContainer.PlayerSystem;
     _statSystem   = systemContainer.StatSystem;
     _itemSystem   = systemContainer.ItemSystem;
 }
Ejemplo n.º 5
0
 public override void HandleKeyboard(ISystemContainer systemContainer, KeyCombination keyboard)
 {
 }
Ejemplo n.º 6
0
 public ResolveMeleeAttackAction(ISystemContainer systemContainer) : base(systemContainer)
 {
 }
 public OnAttackProcEnchantmentRule(ISystemContainer systemContainer) : base(systemContainer)
 {
 }
Ejemplo n.º 8
0
 public PrototypeSystem(IEntityEngine engine, IPositionSystem positionSystem, ISystemContainer systemContainer)
 {
     _engine          = engine;
     _positionSystem  = positionSystem;
     _systemContainer = systemContainer;
 }
Ejemplo n.º 9
0
 public ApplyAegisRule(ISystemContainer systemContainer)
 {
     this.systemContainer = systemContainer;
 }
Ejemplo n.º 10
0
 protected virtual IItemGenerator GetItemGenerator(ISystemContainer systemContainer, List <IEntity> itemList)
 {
     return(new RandomItemGenerator(systemContainer, itemList));
 }
Ejemplo n.º 11
0
 public ApplyModifiedDamageRule(ISystemContainer systemContainer)
 {
     EventRuleSystem = systemContainer.EventSystem;
     MessageSystem   = systemContainer.MessageSystem;
 }
Ejemplo n.º 12
0
 protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
 {
     return(new Size(12 * GetSkillsOnBar(systemContainer).Count(), 12));
 }
Ejemplo n.º 13
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var x       = control.Position.X;
            var y       = control.Position.Y;
            var display = control as IDataRogueInfoControl;

            var skillsOnBar = GetSkillsOnBar(systemContainer);

            var previousSkills = 0;

            BLT.Font("");

            foreach (var skill in skillsOnBar)
            {
                if (SkillSelected(skill))
                {
                    RenderSpriteIfSpecified(x + previousSkills * 12, y, spriteManager, "skill_frame_selected", AnimationFrame.Idle0);
                }
                else
                {
                    RenderSpriteIfSpecified(x + previousSkills * 12, y, spriteManager, "skill_frame", AnimationFrame.Idle0);
                }

                var appearance = skill.Get <SpriteAppearance>();

                var skillSpriteBottom = "default_skill_icon";
                var skillSpriteTop    = "";

                if (appearance != null)
                {
                    skillSpriteBottom = appearance.Bottom;
                    skillSpriteTop    = appearance.Top;
                }

                BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
                RenderSpriteIfSpecified(x + previousSkills * 12 + 2, y + 2, spriteManager, skillSpriteBottom, AnimationFrame.Idle0);
                BLTLayers.Set(BLTLayers.UIElementPieces, control.ActivityIndex);
                RenderSpriteIfSpecified(x + previousSkills * 12 + 2, y + 2, spriteManager, skillSpriteTop, AnimationFrame.Idle0);

                previousSkills++;
            }
        }
Ejemplo n.º 14
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as TargetingOverlayControl;
            var targetingActivityData = display.TargetingActivity;
            var targetingSprites      = new Dictionary <TargetingStatus, ISpriteSheet>
            {
                { TargetingStatus.Targetable, spriteManager.Get("targetable") },
                { TargetingStatus.Targeted, spriteManager.Get("current_target") }
            };

            BLTLayers.Set(BLTLayers.MapShade, control.ActivityIndex);
            BLT.Font("");

            var cameraPosition = systemContainer.RendererSystem.CameraPosition;

            var currentMap = systemContainer.MapSystem.MapCollection[cameraPosition.Key];
            var cameraX    = cameraPosition.X;
            var cameraY    = cameraPosition.Y;

            MapCoordinate playerPosition = systemContainer.PositionSystem.CoordinateOf(systemContainer.PlayerSystem.Player);

            var targetableCells = systemContainer.TargetingSystem.TargetableCellsFrom(targetingActivityData.TargetingData, playerPosition);

            var renderWidth  = control.Position.Width / BLTTilesIOSystem.TILE_SPACING;
            var renderHeight = control.Position.Height / BLTTilesIOSystem.TILE_SPACING;

            int offsetX = renderWidth / 2;
            int offsetY = renderHeight / 2;

            var sprites = new TargetingStatus[renderWidth + 2, renderHeight + 2];

            for (int y = 0; y < renderHeight; y++)
            {
                for (int x = 0; x < renderWidth; x++)
                {
                    var lookupX = cameraX - offsetX + x;
                    var lookupY = cameraY - offsetY + y;

                    var currentCell     = new MapCoordinate(currentMap.MapKey, lookupX, lookupY);
                    var targetingStatus = targetingActivityData.GetTargetingStatus(currentCell);

                    if (targetingStatus != TargetingStatus.NotTargeted)
                    {
                        sprites[x + 1, y + 1] = targetingStatus;
                    }
                }
            }

            for (int y = 0; y < renderHeight; y++)
            {
                for (int x = 0; x < renderWidth; x++)
                {
                    var targetingStatus = sprites[x + 1, y + 1];

                    if (targetingStatus != TargetingStatus.NotTargeted)
                    {
                        var renderX = control.Position.Left + x * BLTTilesIOSystem.TILE_SPACING;
                        var renderY = control.Position.Top + y * BLTTilesIOSystem.TILE_SPACING;

                        var aboveConnect = sprites[x + 1, y + 1] == sprites[x + 1, y];
                        var belowConnect = sprites[x + 1, y + 1] == sprites[x + 1, y + 2];
                        var leftConnect  = sprites[x + 1, y + 1] == sprites[x, y + 1];
                        var rightConnect = sprites[x + 1, y + 1] == sprites[x + 2, y + 1];

                        var directions = TileDirections.None;
                        if (aboveConnect)
                        {
                            directions |= TileDirections.Up;
                        }
                        if (belowConnect)
                        {
                            directions |= TileDirections.Down;
                        }
                        if (leftConnect)
                        {
                            directions |= TileDirections.Left;
                        }
                        if (rightConnect)
                        {
                            directions |= TileDirections.Right;
                        }

                        BLT.Put(renderX, renderY, targetingSprites[targetingStatus].Tile(directions));
                    }
                }
            }
        }
Ejemplo n.º 15
0
        public void Apply(IMap map, MapCoordinate mapCoordinate, IEntity currentCell, IEntity alternateCell, ISystemContainer systemContainer)
        {
            Action <IEntity> action = (entityToAdd) => { AddCommandToMap(map, mapCoordinate, entityToAdd, systemContainer); };

            var entities = systemContainer.EntityEngine.AllEntities.Where(e => e.Has <CanAddToMap>() && e.Has <Prototype>());

            var entityCreationActivity = new EntityPickerMenuActivity(systemContainer.ActivitySystem.DefaultPosition, systemContainer.ActivitySystem.DefaultPadding, entities, systemContainer, "Pick an entity to add", action);

            entityCreationActivity.HoverPrefix     = "";
            entityCreationActivity.NoCellHoverText = "(no entity selected)";

            systemContainer.ActivitySystem.Push(entityCreationActivity);
        }
        protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            IDataRogueInfoControl display = control as IDataRogueInfoControl;
            var    x            = control.Position.X;
            string interpolated = DataRogueInfoControl(control, systemContainer, out int y);

            console.Print(x, y, interpolated, display.Color.ToRLColor(), display.BackColor.ToRLColor());
        }
Ejemplo n.º 17
0
        private void AddCommandToMap(IMap map, MapCoordinate mapCoordinate, IEntity entityToAdd, ISystemContainer systemContainer)
        {
            string commandType;
            string parameters;
            bool   paramsIncludeEntityName;

            if (entityToAdd.Has <MapGenerationCommand>())
            {
                var component = entityToAdd.Get <MapGenerationCommand>();
                commandType             = component.Command;
                parameters              = component.Parameters;
                paramsIncludeEntityName = false;
            }
            else
            {
                commandType             = MapGenCommandType.Entity;
                parameters              = null;
                paramsIncludeEntityName = true;
            }

            var entityName = entityToAdd.Get <Prototype>().Name;

            var mapAdd = entityToAdd.Get <CanAddToMap>();

            if (mapAdd.SettableProperty != null)
            {
                Action <string> callback = (settablePropertyValue) =>
                                           CompleteEntityCommand(
                    map,
                    mapCoordinate.ToVector(),
                    commandType,
                    Parameterise(entityName, mapAdd.SettableProperty, settablePropertyValue, parameters, paramsIncludeEntityName));

                var inputBox = new TextInputActivity(systemContainer.ActivitySystem, "Enter a value for property {mapAdd.SettableProperty}:", callback);

                systemContainer.ActivitySystem.Push(inputBox);
            }
            else
            {
                CompleteEntityCommand(map, mapCoordinate.ToVector(), commandType, Parameterise(entityName, null, null, parameters, paramsIncludeEntityName));
            }
        }
        protected override Size GetSizeInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            string interpolated = DataRogueInfoControl(control, systemContainer, out int y);

            return(new Size(interpolated.Length, 1));
        }
Ejemplo n.º 19
0
 public UseRandomSkillBehaviour(ISystemContainer systemContainer)
 {
     _systemContainer = systemContainer;
 }
Ejemplo n.º 20
0
        protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display  = control as ButtonControl;
            var selected = display.IsFocused;
            var x        = display.Position.X;
            var y        = display.Position.Y;
            var text     = display.Text;

            var foreColor = selected ? RLColor.Cyan : RLColor.White;

            console.Set(x, y, foreColor, RLColor.Black, 201);
            console.Set(x, y + 1, foreColor, RLColor.Black, 186);
            console.Set(x, y + 2, foreColor, RLColor.Black, 200);

            console.Set(x + text.Length + 1, y, foreColor, RLColor.Black, 187);
            console.Set(x + text.Length + 1, y + 1, foreColor, RLColor.Black, 186);
            console.Set(x + text.Length + 1, y + 2, foreColor, RLColor.Black, 188);

            for (int i = 0; i < text.Length; i++)
            {
                console.Set(x + i + 1, y, foreColor, RLColor.Black, 205);
                console.Set(x + i + 1, y + 2, foreColor, RLColor.Black, 205);
            }

            console.Print(x + 1, y + 1, text, foreColor, RLColor.Black);

            x += text.Length + 3;
        }
Ejemplo n.º 21
0
 public GetItemAction(ISystemContainer systemContainer) : base(systemContainer)
 {
 }
Ejemplo n.º 22
0
 protected override Size GetSizeInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
 {
     return(new Size((control as ButtonControl).Text.Length + 2, 3));
 }
Ejemplo n.º 23
0
 public override void HandleAction(ISystemContainer systemContainer, ActionEventData action)
 {
     Menu.HandleAction(action);
 }
 public ApplyProcEnchantmentRule(ISystemContainer systemContainer)
 {
     _systemContainer = systemContainer;
 }
Ejemplo n.º 25
0
 protected abstract string GetText(IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov);
Ejemplo n.º 26
0
        protected override void DisplayInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as LineControl;

            for (int i = 0; i < control.Position.Width; i++)
            {
                console.Set(control.Position.Left + i, control.Position.Top, control.Color.ToRLColor(), control.BackColor.ToRLColor(), 196);
            }
        }
Ejemplo n.º 27
0
 protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
 {
     BLT.Font("text");
     return(BLT.Measure(GetText(control, systemContainer, playerFov)));
 }
Ejemplo n.º 28
0
 protected override Size GetSizeInternal(RLConsole console, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
 {
     return(new Size(control.Position.Width, 2));
 }
        protected override void DisplayInternal(RLConsole console, IDataRogueControl display, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var control = display as IDataRogueInfoControl;
            var x       = control.Position.X;
            var y       = control.Position.Y;

            var componentCounterSplits = control.Parameters.Split(',');
            var componentName          = componentCounterSplits[0];
            var counterName            = componentCounterSplits[1];

            var component = control.Entity.Get(componentName);

            FieldInfo[] fields  = component.GetType().GetFields();
            var         field   = fields.Single(f => f.Name == counterName);
            var         counter = (Counter)field.GetValue(component);

            ConsoleRendererHelper.PrintBar(console, x, y, control.Position.Width - 2, counterName, counter, control.BackColor.ToRLColor());
        }
Ejemplo n.º 30
0
 public BranchGeneratorRule(ISystemContainer systemContainer)
 {
     _systemContainer = systemContainer;
 }