public void LoadDungeonContent(ContentManager content)
        {
            var enabledRooms = content.Load <int[][]>("DungeonEnabledRooms");
            var enemies      = content.Load <int[][]>("DungeonEnemies");
            var backgrounds  = content.Load <int[][]>("DungeonRoomBackgrounds");
            var rows         = enabledRooms.Length;

            _scenes        = new Scene[rows][];
            _rooms         = new Room[rows][];
            _backgroundIds = new BackgroundId[rows][];
            EnabledRooms   = new bool[rows][];
            UnmappedRooms  = new bool[rows][];
            VisitedRooms   = new bool[rows][];

            for (var row = 0; row < rows; row++)
            {
                var cols = enabledRooms[row].Length;
                _scenes[row]        = new Scene[cols];
                _rooms[row]         = new Room[cols];
                _backgroundIds[row] = new BackgroundId[cols];
                EnabledRooms[row]   = new bool[cols];
                UnmappedRooms[row]  = new bool[cols];
                VisitedRooms[row]   = new bool[cols];

                for (var col = 0; col < cols; col++)
                {
                    EnabledRooms[row][col]  = enabledRooms[row][col] != 0;
                    UnmappedRooms[row][col] = enabledRooms[row][col] == 2;
                    if (enabledRooms[row][col] == 0)
                    {
                        continue;
                    }

                    var enemyId      = -1;
                    var backgroundId = BackgroundId.Default;

                    if (row < enemies.Length && col < enemies[row].Length)
                    {
                        enemyId = enemies[row][col];
                    }

                    if (row < backgrounds.Length && col < backgrounds[row].Length)
                    {
                        backgroundId = (BackgroundId)backgrounds[row][col];
                    }

                    var room = new Room(this, content.Load <int[][]>($"Rooms/{row}-{col}"), enemyId);
                    _rooms[row][col]         = room;
                    _backgroundIds[row][col] = backgroundId;
                }
            }
        }
        private static ISprite Background(BackgroundId backgroundId)
        {
            switch (backgroundId)
            {
            case BackgroundId.Default:
                return(BackgroundSpriteFactory.Instance.CreateDungeonBackground());

            case BackgroundId.Basement:
                return(BackgroundSpriteFactory.Instance.CreateBasementBackground());

            case BackgroundId.OldMan:
                return(BackgroundSpriteFactory.Instance.CreateOldManBackground());

            default:
                return(BackgroundSpriteFactory.Instance.CreateDungeonBackground());
            }
        }
 private void SetBackground(BackgroundId backgroundId)
 {
     _background = new AlphaPassMask(Background(backgroundId), false);
 }
Exemple #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BattleParameterId != 0)
            {
                hash ^= BattleParameterId.GetHashCode();
            }
            if (BattleNameJp.Length != 0)
            {
                hash ^= BattleNameJp.GetHashCode();
            }
            if (U3 != 0)
            {
                hash ^= U3.GetHashCode();
            }
            if (U4 != 0)
            {
                hash ^= U4.GetHashCode();
            }
            if (U5 != 0)
            {
                hash ^= U5.GetHashCode();
            }
            if (U6 != 0)
            {
                hash ^= U6.GetHashCode();
            }
            if (U7 != 0)
            {
                hash ^= U7.GetHashCode();
            }
            if (U8 != 0)
            {
                hash ^= U8.GetHashCode();
            }
            if (U9 != 0)
            {
                hash ^= U9.GetHashCode();
            }
            if (U10 != 0)
            {
                hash ^= U10.GetHashCode();
            }
            if (U11 != 0)
            {
                hash ^= U11.GetHashCode();
            }
            if (U12 != 0)
            {
                hash ^= U12.GetHashCode();
            }
            if (U13 != 0)
            {
                hash ^= U13.GetHashCode();
            }
            if (U14 != 0)
            {
                hash ^= U14.GetHashCode();
            }
            if (U15 != 0)
            {
                hash ^= U15.GetHashCode();
            }
            if (U16 != 0)
            {
                hash ^= U16.GetHashCode();
            }
            if (U17 != 0)
            {
                hash ^= U17.GetHashCode();
            }
            if (NpcUnitId1 != 0)
            {
                hash ^= NpcUnitId1.GetHashCode();
            }
            if (NpcUnitId2 != 0)
            {
                hash ^= NpcUnitId2.GetHashCode();
            }
            if (NpcUnitId3 != 0)
            {
                hash ^= NpcUnitId3.GetHashCode();
            }
            if (BackgroundId != 0)
            {
                hash ^= BackgroundId.GetHashCode();
            }
            if (TrainerNameId.Length != 0)
            {
                hash ^= TrainerNameId.GetHashCode();
            }
            if (U23 != 0)
            {
                hash ^= U23.GetHashCode();
            }
            if (U24 != 0)
            {
                hash ^= U24.GetHashCode();
            }
            if (U25 != 0)
            {
                hash ^= U25.GetHashCode();
            }
            if (U26 != 0)
            {
                hash ^= U26.GetHashCode();
            }
            if (U27 != 0)
            {
                hash ^= U27.GetHashCode();
            }
            if (U28 != 0)
            {
                hash ^= U28.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 public override int GetHashCode()
 {
     return(UserId.GetHashCode() * 37 + BackgroundId.GetHashCode());
 }