Exemplo n.º 1
0
        /// <summary>
        /// Subscribes to the DungeonDataCreated event on the IDungeon interface.
        /// </summary>
        /// <param name="sender">
        /// The sending object of the event.
        /// </param>
        /// <param name="e">
        /// The arguments of the DungeonDataCreated event.
        /// </param>
        private void OnDungeonDataCreated(object sender, IMutableDungeon e)
        {
            if (e == this)
            {
                foreach (KeyDoorID smallKeyDoor in _dungeon.SmallKeyDoors)
                {
                    SmallKeyDoors.Add(smallKeyDoor, KeyDoorDictionary[smallKeyDoor]);
                }

                foreach (KeyDoorID bigKeyDoor in _dungeon.BigKeyDoors)
                {
                    BigKeyDoors.Add(bigKeyDoor, KeyDoorDictionary[bigKeyDoor]);
                }

                foreach (DungeonItemID item in _dungeon.Items)
                {
                    Items.Add(item, ItemDictionary[item]);
                }

                foreach (DungeonItemID boss in _dungeon.Bosses)
                {
                    BossItems.Add(ItemDictionary[boss]);
                }

                foreach (DungeonNodeID node in _dungeon.Nodes)
                {
                    _ = Nodes[node];
                }

                _dungeon.DungeonDataCreated -= OnDungeonDataCreated;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Subscribes to the DungeonDataCreated event on the IDungeon interface.
        /// </summary>
        /// <param name="sender">
        /// The sending object of the event.
        /// </param>
        /// <param name="e">
        /// The arguments of the DungeonDataCreated event.
        /// </param>
        private void OnDungeonDataCreated(object?sender, IMutableDungeon e)
        {
            if (e == this)
            {
                foreach (var smallKeyDoor in _dungeon.SmallKeyDoors)
                {
                    SmallKeyDoors.Add(smallKeyDoor, KeyDoors[smallKeyDoor]);
                }

                foreach (var bigKeyDoor in _dungeon.BigKeyDoors)
                {
                    BigKeyDoors.Add(bigKeyDoor, KeyDoors[bigKeyDoor]);
                }

                foreach (var item in _dungeon.DungeonItems)
                {
                    Items.Add(item, DungeonItems[item]);
                }

                foreach (var boss in _dungeon.Bosses)
                {
                    Bosses.Add(DungeonItems[boss]);
                }

                foreach (var smallKeyDrop in _dungeon.SmallKeyDrops)
                {
                    SmallKeyDrops.Add(smallKeyDrop, DungeonItems[smallKeyDrop]);
                }

                foreach (var bigKeyDrop in _dungeon.BigKeyDrops)
                {
                    BigKeyDrops.Add(bigKeyDrop, DungeonItems[bigKeyDrop]);
                }

                foreach (var node in _dungeon.Nodes)
                {
                    _ = Nodes[node];
                }

                _dungeon.DungeonDataCreated -= OnDungeonDataCreated;
            }
        }