public static void LoadFromDisk()
    {
        if (!_hasLoaded)
        {
            _hasLoaded = true;
            PersistentDiskData diskData = DiskDataHandler.Load <PersistentDiskData>(DATA_PATH);
            if (diskData.DataSaved)
            {
                _bossLockStatuses = diskData.BossLockStatuses;
                _bossUnlocksNeedingNotification = diskData.BossUnlocksNeedingNotification;
                guaranteeAllBossesPresent();
            }
            else
            {
                getInitialBossLockData();
            }

            _levelsBeatenByNumPlayers = diskData.LevelsBeatenByNumPlayers;
            _bossesBeaten             = diskData.BossesBeaten;
            _timesBeat4CornerBosses   = diskData.TimesBeat4CornerBosses;
            _timesAcceptedMaster      = diskData.TimesAcceptedMaster;
            _timesRefusedMaster       = diskData.TimesRefusedMaster;
            _timesDefeatedMaster      = diskData.TimesDefeatedMaster;
            _timesClearedMap          = diskData.TimesClearedMap;
            _highScoreSinglePlayer    = diskData.HighScoreSinglePlayer;
            _highScoreCoop            = diskData.HighScoreCoop;

            if (_levelsBeatenByNumPlayers == null)
            {
                _levelsBeatenByNumPlayers = new int[DynamicData.MAX_PLAYERS];
            }
        }
    }
Exemple #2
0
    public static void LoadFromDisk(bool force = false)
    {
        if (!_hasLoaded || force)
        {
            _hasLoaded = true;
            ProgressDiskData diskData = DiskDataHandler.Load <ProgressDiskData>(DATA_PATH);
            if (diskData.DataSaved)
            {
                _completedTiles = diskData.CompletedTiles;
                if (diskData.HaveUsedMostRecentTile)
                {
                    _mostRecentTile = diskData.MostRecentTile;
                }
                _mostPlayersUsed     = diskData.MostPlayersUsed;
                _weaponSlotsByPlayer = diskData.WeaponSlotsByPlayer;
                if (_weaponSlotsByPlayer == null)
                {
                    _weaponSlotsByPlayer = new Dictionary <int, SlotWrapper[]>();
                }

                _currentBosses = diskData.CurrentBosses;
                if (_currentBosses != null && _currentBosses.Length < 4)
                {
                    _currentBosses = null;
                }

                _playerPoints = diskData.PlayerPoints;
                if (_playerPoints != null && _playerPoints.Length < DynamicData.MAX_PLAYERS)
                {
                    _playerPoints = null;
                }

                _playerHealth = diskData.PlayerHealth;
                if (_playerHealth != null && _playerHealth.Length < DynamicData.MAX_PLAYERS)
                {
                    _playerHealth = null;
                }

                _minibossTiles = diskData.MinibossTiles;
            }
            else
            {
                setStartingMinibosses();
            }
        }
    }