コード例 #1
0
        public void LoadTileData()
        {
            SongTileData levelData = SaveBinarySongDataSystem.LoadTileDataFromResource(currentLevelData.songData.storeID);

            if (levelData != null)
            {
                if (levelData.songDataModel.version == currentLevelData.songData.version)
                {
                    listTilesData                            = levelData.titledata;
                    ticksPerTile                             = levelData.songDataModel.tickPerTile;
                    this.currentLevelData.BPM                = levelData.BPM;
                    this.currentLevelData.denominator        = denominator = levelData.denominator;
                    this.currentLevelData.tickPerQuarterNote = levelData.tickPerQuarterNote;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Load up the level, and start the game as needed
        /// </summary>
        /// <returns></returns>
        IEnumerator <float> C_StartGame()
        {
            ChangeState(UIState.Downloading);
            //a little time to calm down
            yield return(Timing.WaitForSeconds(0.1f));

            //try to read local song files first
            SongTileData tileData = SaveBinarySongDataSystem.LoadTileDataFromResource(levelData.songData.storeID);

            if (tileData == null)
            {
                //if there is no local song, download new file from the internet
                yield return(0);

                //Debug.Log("Trying to download from the Internet");
                levelLoader.DownLoadAndCacheSongData(levelData.songData);
            }
            else
            {
                //if local song persist, check its version with data from store data
                if (tileData.songDataModel.version != levelData.songData.version)
                {
                    //if the version is not alike, download from the internet
                    yield return(0);

                    levelLoader.DownLoadAndCacheSongData(levelData.songData);
                }
                else
                {
                    Resources.UnloadUnusedAssets();
                    yield return(Timing.WaitForSeconds(0.25f));

                    //if local version is the latest, load it up and run the game
                    gamelogic.Initialize();
                    yield return(0);

                    gamelogic.SetLevelData(levelData);
                    yield return(0);

                    gamelogic.SetTilesData(tileData);
                    yield return(0);

                    StartNewGame();
                }
            }
        }