Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="colorSettings">
        /// The color settings data.
        /// </param>
        /// <param name="requirements">
        /// The requirement dictionary.
        /// </param>
        /// <param name="undoRedoManager">
        /// The undo/redo manager.
        /// </param>
        /// <param name="undoableFactory">
        /// A factory for creating undoable actions.
        /// </param>
        /// <param name="alternativeFactory">
        /// An Autofac factory for creating alternative requirements.
        /// </param>
        /// <param name="alwaysDisplayFactory">
        /// An Autofac factory for creating always display dungeon items requirements.
        /// </param>
        /// <param name="dungeon">
        /// The dungeon whose small keys are to be represented.
        /// </param>
        public SmallKeySmallItemVM(
            IColorSettings colorSettings, IRequirementDictionary requirements,
            IUndoRedoManager undoRedoManager, IUndoableFactory undoableFactory,
            AlternativeRequirement.Factory alternativeFactory,
            AlwaysDisplayDungeonItemsRequirement.Factory alwaysDisplayFactory, IDungeon dungeon)
        {
            _colorSettings   = colorSettings;
            _undoRedoManager = undoRedoManager;
            _undoableFactory = undoableFactory;

            _item = dungeon.SmallKeyItem;

            _spacerRequirement = alternativeFactory(new List <IRequirement>
            {
                alwaysDisplayFactory(true),
                requirements[RequirementType.SmallKeyShuffleOn]
            });

            _requirement = dungeon.ID == LocationID.EasternPalace ?
                           requirements[RequirementType.KeyDropShuffleOn] :
                           requirements[RequirementType.NoRequirement];

            HandleClick = ReactiveCommand.Create <PointerReleasedEventArgs>(HandleClickImpl);

            _colorSettings.PropertyChanged     += OnColorsChanged;
            _item.PropertyChanged              += OnItemChanged;
            _requirement.PropertyChanged       += OnRequirementChanged;
            _spacerRequirement.PropertyChanged += OnRequirementChanged;
        }
 public ClassConfigurator SetDungeon(IDungeon dungeon)
 {
     if (dungeon == null)
     {
         throw new ArgumentNullException();
     }
     ReferenceDungeon = dungeon;
     return(this);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dungeon">
        /// The dungeon immutable data.
        /// </param>
        public MutableDungeon(IDungeon dungeon)
        {
            KeyDoorDictionary = new KeyDoorDictionary(this);
            ItemDictionary    = new DungeonItemDictionary(this);
            Nodes             = new DungeonNodeDictionary(this, dungeon);
            _dungeon          = dungeon ?? throw new ArgumentNullException(nameof(dungeon));

            _dungeon.DungeonDataCreated += OnDungeonDataCreated;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns a new mutable dungeon data instance for the specified dungeon.
        /// </summary>
        /// <param name="dungeon">
        /// The dungeon immutable dungeon data parent class.
        /// </param>
        /// <returns>
        /// A new mutable dungeon data instance.
        /// </returns>
        public static IMutableDungeon GetMutableDungeon(IDungeon dungeon)
        {
            if (dungeon == null)
            {
                throw new ArgumentNullException(nameof(dungeon));
            }

            return(new MutableDungeon(dungeon));
        }
Ejemplo n.º 5
0
 public InspectableConfigurator SetDungeon(IDungeon dungeon)
 {
     if (dungeon == null)
     {
         throw new ArgumentNullException();
     }
     ReferenceDungeon = dungeon;
     ConfiguredInspectables.AddRange(ReferenceDungeon.ConfiguredInspectables);
     return(this);
 }
 private void AddRoomsToDungeon(int xSize, int ySize, IDungeon dungeon)
 {
     for (var x = 0; x < xSize; x++)
     {
         for (var y = 0; y < ySize; y++)
         {
             dungeon.AddRoom(_iRoomFactory.CreateWithCoordinates(x, y));
         }
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Returns a new small item control ViewModel instance representing a big key.
 /// </summary>
 /// <param name="dungeon">
 /// The dungeon from which the big key represented.
 /// </param>
 /// <returns>
 /// A new small item control ViewModel instance.
 /// </returns>
 private static SmallItemVM GetBigKeySmallItemControlVM(IDungeon dungeon)
 {
     return(new SmallItemVM(
                "avares://OpenTracker/Assets/Images/Items/bigkey", dungeon.BigKeyItem,
                new AlternativeRequirement(new List <IRequirement>
     {
         new AlwaysDisplayDungeonItemsRequirement(true),
         RequirementDictionary.Instance[RequirementType.BigKeyShuffleOn]
     })));
 }
Ejemplo n.º 8
0
 public DungeonGUIHelper(FormState state, IDungeon dungeon)
 {
     _state = state;
     _state.Player.Stats = new BattleStats();
     _dungeon            = dungeon;
     currentFighter      = 0;
     currentEnemy        = 0;
     battleMembers       = new List <BattleMember>();
     _dh = new DungeonHandlers(state);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Returns a new small item control ViewModel instance representing a big key.
        /// </summary>
        /// <param name="dungeon">
        /// The dungeon from which the big key represented.
        /// </param>
        /// <returns>
        /// A new small item control ViewModel instance.
        /// </returns>
        private BigKeySmallItemVM GetBigKeySmallItemControlVM(IDungeon dungeon)
        {
            IRequirement requirement;
            IRequirement spacerRequirement;

            if (dungeon.ID == LocationID.HyruleCastle)
            {
                requirement = _aggregateFactory(new List <IRequirement>
                {
                    _requirements[RequirementType.KeyDropShuffleOn],
                    _alternativeFactory(new List <IRequirement>
                    {
                        _alwaysDisplayFactory(true),
                        _requirements[RequirementType.BigKeyShuffleOn]
                    })
                });
                spacerRequirement = _alternativeFactory(new List <IRequirement>
                {
                    _aggregateFactory(new List <IRequirement>
                    {
                        _itemsPanelOrientationFactory(Orientation.Vertical),
                        _alternativeFactory(new List <IRequirement>
                        {
                            _alwaysDisplayFactory(true),
                            _requirements[RequirementType.BigKeyShuffleOn]
                        })
                    }),
                    _aggregateFactory(new List <IRequirement>
                    {
                        _requirements[RequirementType.KeyDropShuffleOn],
                        _alternativeFactory(new List <IRequirement>
                        {
                            _alwaysDisplayFactory(true),
                            _requirements[RequirementType.BigKeyShuffleOn]
                        })
                    })
                });
            }
            else
            {
                spacerRequirement = _alternativeFactory(new List <IRequirement>
                {
                    _alwaysDisplayFactory(true),
                    _requirements[RequirementType.BigKeyShuffleOn]
                });
                requirement = _alternativeFactory(new List <IRequirement>
                {
                    _alwaysDisplayFactory(true),
                    _requirements[RequirementType.BigKeyShuffleOn]
                });
            }

            return(_bigKeyFactory(dungeon, requirement, spacerRequirement));
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="count">
 /// A 32-bit signed integer representing the number of keys that must be contained in the
 /// list of locations.
 /// </param>
 /// <param name="smallKeyLocations">
 /// The list of dungeon item IDs that the number of small keys must be contained in.
 /// </param>
 /// <param name="bigKeyInLocations">
 /// AS boolean representing whether the big key is contained in the list of locations.
 /// </param>
 /// <param name="children">
 /// The list of child key layouts, if this layout is possible.
 /// </param>
 /// <param name="dungeon">
 /// The dungeon parent class.
 /// </param>
 /// <param name="requirement">
 /// The requirement for this key layout to be valid.
 /// </param>
 public SmallKeyLayout(
     int count, List <DungeonItemID> smallKeyLocations, bool bigKeyInLocations,
     List <IKeyLayout> children, IDungeon dungeon, IRequirement requirement = null)
 {
     _count             = count;
     _smallKeyLocations = smallKeyLocations ??
                          throw new ArgumentNullException(nameof(smallKeyLocations));
     _bigKeyInLocations = bigKeyInLocations;
     _children          = children ?? throw new ArgumentNullException(nameof(children));
     _dungeon           = dungeon ?? throw new ArgumentNullException(nameof(dungeon));
     _requirement       = requirement ?? RequirementDictionary.Instance[RequirementType.NoRequirement];
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="count">
 /// A 32-bit signed integer representing the number of keys that must be contained in the
 /// list of locations.
 /// </param>
 /// <param name="smallKeyLocations">
 /// The list of dungeon item IDs that the number of small keys must be contained in.
 /// </param>
 /// <param name="bigKeyInLocations">
 /// AS boolean representing whether the big key is contained in the list of locations.
 /// </param>
 /// <param name="children">
 /// The list of child key layouts, if this layout is possible.
 /// </param>
 /// <param name="dungeon">
 /// The dungeon parent class.
 /// </param>
 /// <param name="requirement">
 /// The requirement for this key layout to be valid.
 /// </param>
 public SmallKeyLayout(
     IMode mode, int count, List <DungeonItemID> smallKeyLocations, bool bigKeyInLocations,
     List <IKeyLayout> children, IDungeon dungeon, IRequirement requirement)
 {
     _mode              = mode;
     _count             = count;
     _smallKeyLocations = smallKeyLocations;
     _bigKeyInLocations = bigKeyInLocations;
     _children          = children;
     _dungeon           = dungeon;
     _requirement       = requirement;
 }
Ejemplo n.º 12
0
 public bool LoadDungeon(IDungeon dungeon)
 {
     if (dungeon == null)
     {
         return(false);
     }
     DungeonToConfigure = dungeon;
     ConfiguredDungeon  = new DungeonSkeleton(DungeonToConfigure.DungeonEpoch);
     ConfiguredDungeon.ConfiguredClasses.AddRange(DungeonToConfigure.ConfiguredClasses);
     ConfiguredDungeon.ConfiguredRaces.AddRange(DungeonToConfigure.ConfiguredRaces);
     ConfiguredDungeon.Rooms.AddRange(DungeonToConfigure.Rooms);
     ConfiguredDungeon.Neighborships.AddRange(DungeonToConfigure.Neighborships);
     return(true);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Returns a new small item control ViewModel instance representing a compass.
 /// </summary>
 /// <param name="dungeon">
 /// The dungeon from which the compass represented.
 /// </param>
 /// <returns>
 /// A new small item control ViewModel instance.
 /// </returns>
 private static SmallItemVM GetCompassSmallItemControlVM(IDungeon dungeon)
 {
     return(new SmallItemVM(
                "avares://OpenTracker/Assets/Images/Items/compass", dungeon.CompassItem,
                new AggregateRequirement(new List <IRequirement>
     {
         new DisplayMapsCompassesRequirement(true),
         new AlternativeRequirement(new List <IRequirement>
         {
             new AlwaysDisplayDungeonItemsRequirement(true),
             RequirementDictionary.Instance[RequirementType.CompassShuffleOn]
         })
     })));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Returns a new small item control ViewModel instance representing a map.
 /// </summary>
 /// <param name="dungeon">
 /// The dungeon from which the map represented.
 /// </param>
 /// <returns>
 /// A new small item control ViewModel instance.
 /// </returns>
 private SmallItemVM GetMapSmallItemControlVM(IDungeon dungeon)
 {
     return(_smallItemFactory(
                dungeon.MapItem !,
                _aggregateFactory(new List <IRequirement>
     {
         _displayMapsCompassesFactory(true),
         _alternativeFactory(new List <IRequirement>
         {
             _alwaysDisplayFactory(true),
             _requirements[RequirementType.MapShuffleOn]
         })
     }),
                "avares://OpenTracker/Assets/Images/Items/map"));
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dungeon">
        /// The dungeon immutable data.
        /// </param>
        public MutableDungeon(
            IMode mode, IKeyDoorDictionary.Factory keyDoors, IDungeonNodeDictionary.Factory nodes,
            IDungeonItemDictionary.Factory dungeonItems, IDungeonResult.Factory resultFactory,
            IDungeon dungeon)
        {
            _mode          = mode;
            _dungeon       = dungeon;
            _resultFactory = resultFactory;

            KeyDoors     = keyDoors(this);
            DungeonItems = dungeonItems(this);
            Nodes        = nodes(this);

            _dungeon.DungeonDataCreated += OnDungeonDataCreated;
        }
Ejemplo n.º 16
0
        public override bool TryToStepHere(IDungeon dungeon)
        {
            if (Money > 0)
            {
                Hero.GetHero.Money++;
                Money--;
                if (Money == 0)
                {
                    dungeon.ReplaceToGround(this);
                    DescAction = "This was last coin. This is sad";
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 17
0
        public LoseWrapper(IRoom room, IDungeon dung, Game1 _game) : base(room)
        {
            game    = _game;
            state   = animation_state.DELAY;
            dungeon = dung;

            cycleColors = new Color[] {
                new Color(0, 200, 0, 255),
                new Color(0, 130, 0, 255),
                new Color(0, 60, 0, 255),
                new Color(0, 0, 0, 255)
            };

            updateState(animation_state.DELAY);

            CollisionDetector.Instance.Pause();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="undoRedoManager">
        /// The undo/redo manager.
        /// </param>
        /// <param name="undoableFactory">
        /// A factory for creating undoable actions.
        /// </param>
        /// <param name="dungeon">
        /// The dungeon whose big keys are to be represented.
        /// </param>
        /// <param name="requirement">
        /// The requirement for the control to be visible.
        /// </param>
        /// <param name="spacerRequirement">
        /// The requirement for the control to take reserve space.
        /// </param>
        public BigKeySmallItemVM(
            IUndoRedoManager undoRedoManager, IUndoableFactory undoableFactory, IDungeon dungeon,
            IRequirement requirement, IRequirement spacerRequirement)
        {
            _undoRedoManager = undoRedoManager;
            _undoableFactory = undoableFactory;

            _item = dungeon.BigKeyItem ??
                    throw new ArgumentOutOfRangeException(nameof(dungeon));
            _requirement       = requirement;
            _spacerRequirement = spacerRequirement;

            HandleClick = ReactiveCommand.Create <PointerReleasedEventArgs>(HandleClickImpl);

            _item.PropertyChanged              += OnItemChanged;
            _requirement.PropertyChanged       += OnRequirementChanged;
            _spacerRequirement.PropertyChanged += OnRequirementChanged;
        }
Ejemplo n.º 19
0
        public void Explore()
        {
            var builder = _serviceProvider.GetService <IDungeonBuilder>();

            Console.WriteLine("How many rooms vertical?");
            var xSize = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("How many rooms horizontal?");
            var ySize = Convert.ToInt32(Console.ReadLine());

            builder.SetSize(xSize, ySize);

            Console.WriteLine("Do you want random starting and ending rooms [Y|N]");
            if (Console.ReadKey().Key == ConsoleKey.Y)
            {
                builder
                .SetRandomStartingRoom()
                .SetRandomEndingRoom();
            }
            else
            {
                Console.WriteLine("What is the X of the starting room?");
                var xStart = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("What is the Y of the starting room?");
                var yStart = Convert.ToInt32(Console.ReadLine());
                builder.SetStartingRoom(xStart, yStart);

                Console.WriteLine("What is the X of the ending room?");
                var xEnd = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("What is the Y of the ending room?");
                var yEnd = Convert.ToInt32(Console.ReadLine());
                builder.SetEndingRoom(xEnd, yEnd);
            }

            _dungeon = builder.GetDungeon();


            PlayGame();


            Console.WriteLine("The end");
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dungeon">
        /// The dungeon whose small keys are to be represented.
        /// </param>
        public SmallKeySmallItemVM(IDungeon dungeon)
        {
            _dungeon = dungeon ?? throw new ArgumentNullException(nameof(dungeon));

            if (_dungeon.SmallKeyItem == null)
            {
                throw new ArgumentOutOfRangeException(nameof(dungeon));
            }

            _item        = _dungeon.SmallKeyItem;
            _requirement = new AlternativeRequirement(new List <IRequirement>
            {
                new AlwaysDisplayDungeonItemsRequirement(true),
                RequirementDictionary.Instance[RequirementType.SmallKeyShuffleOn]
            });

            AppSettings.Instance.Colors.PropertyChanged += OnColorsChanged;
            _item.PropertyChanged        += OnItemChanged;
            _requirement.PropertyChanged += OnRequirementChanged;
        }
Ejemplo n.º 21
0
 public override bool TryToStepHere(IDungeon dungeon)
 {
     return(false);
 }
Ejemplo n.º 22
0
 public override bool TryToStepHere(IDungeon dungeon)
 {
     dungeon.ReplaceToGround(this);
     Hero.GetHero.Money++;
     return(true);
 }
Ejemplo n.º 23
0
 public IDungeonBuilder SetSize(int x, int y)
 {
     _dungeon = _dungeonFactory.CreateWithXSizeAndYSize(x, y);
     return(this);
 }
Ejemplo n.º 24
0
 public DungeonBuilder(IDungeonFactory iDungeonFactory)
 {
     _dungeonFactory        = iDungeonFactory;
     _dungeon               = iDungeonFactory.Create();
     _randomNumberGenerator = new Random();
 }
Ejemplo n.º 25
0
 public override bool TryToStepHere(IDungeon dungeon)
 {
     CallAfterStep = dungeon.GoDown;
     return(true);
 }
Ejemplo n.º 26
0
        public WinWrapper(IRoom room, IDungeon dung, Game1 _game) : base(room)
        {
            game        = _game;
            dungeon     = dung;
            cycleColors = new Color[] {
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255),
                new Color(100, 100, 100, 255),
                new Color(255, 255, 255, 255)
            };

            updateState(animation_state.FLASH);

            CollisionDetector.Instance.Pause();
        }
Ejemplo n.º 27
0
 public void AddDungeon(IDungeon dungeon)
 {
     ActiveDungeons.Add(dungeon);
 }
Ejemplo n.º 28
0
 private static Dungeon Convert(IDungeon dungeonMap)
 {
     return new Dungeon(dungeonMap);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Returns a new small item control ViewModel instance representing a small key.
 /// </summary>
 /// <param name="dungeon">
 /// The dungeon from which the small key represented.
 /// </param>
 /// <returns>
 /// A new small item control ViewModel instance.
 /// </returns>
 private static SmallKeySmallItemVM GetSmallKeySmallItemControlVM(IDungeon dungeon)
 {
     return(new SmallKeySmallItemVM(dungeon));
 }
Ejemplo n.º 30
0
 public abstract bool TryToStepHere(IDungeon dungeon);
Ejemplo n.º 31
0
 public void SetDungeon(IDungeon dungeon)
 {
     ReferenceDungeon = dungeon;
 }