コード例 #1
0
ファイル: CMusicInfoManager.cs プロジェクト: happylays/tbb2
        public bool LoadStage(XQFileStream file)
        {
            DestroyStage();
            if (file != null && file.IsOpen())
            {
                UInt16 usNumber = 0;
                file.ReadUShort(ref usNumber);

                for (UInt16 i = 0; i < usNumber; i++)
                {
                    CMusicStage musicstage = new CMusicStage();
                    musicstage.Load(ref file);
                    RegistMusicStage(musicstage);
                }
                return(true);
            }
            return(false);
        }
コード例 #2
0
ファイル: CMusicInfoManager.cs プロジェクト: happylays/tbb2
        void RegistMusicStage(CMusicStage stageInfo)
        {
            if (stageInfo != null && stageInfo.m_nMusicID > 0)
            {
                if (m_StageMap.Contains(stageInfo.m_nModeID))
                {
                    Hashtable levelMap = (Hashtable)m_StageMap[stageInfo.m_nModeID];
                    if (levelMap != null)
                    {
                        if (levelMap.Contains(stageInfo.m_nLevel))
                        {
                            Hashtable musicMap = (Hashtable)levelMap[stageInfo.m_nLevel];
                            if (musicMap != null)
                            {
                                if (musicMap.Contains(stageInfo.m_nMusicID))
                                {
                                    //Debug.Log( "Same music in music stage, music id:" + stageInfo.m_nMusicID );
                                }
                                else
                                {
                                    musicMap.Add(stageInfo.m_nMusicID, stageInfo.m_InfoEX);
                                }
                            }
                        }
                        else
                        {
                            Hashtable musicMap = new Hashtable();
                            musicMap.Add(stageInfo.m_nMusicID, stageInfo.m_InfoEX);

                            levelMap.Add(stageInfo.m_nLevel, musicMap);
                        }
                    }
                }
                else
                {
                    Hashtable musicMap = new Hashtable();
                    musicMap.Add(stageInfo.m_nMusicID, stageInfo.m_InfoEX);

                    Hashtable levelMap = new Hashtable();
                    levelMap.Add(stageInfo.m_nLevel, musicMap);

                    m_StageMap.Add(stageInfo.m_nModeID, levelMap);
                }

                //把所有歌曲都加入到随机模式的列表中
                byte tempSongMode = (byte)SongMode.None;
                if (m_StageMap.Contains(tempSongMode))
                {
                    Hashtable tempLeveMap = (Hashtable)m_StageMap[tempSongMode];
                    if (tempLeveMap != null)
                    {
                        if (tempLeveMap.Contains(stageInfo.m_nLevel))
                        {
                            Hashtable tempMusicMap = (Hashtable)tempLeveMap[stageInfo.m_nLevel];
                            if (tempMusicMap != null)
                            {
                                if (tempMusicMap.Contains(stageInfo.m_nMusicID))
                                {
                                    //Debug.Log( "Same music in music stage, music id:" + stageInfo.m_nMusicID );
                                }
                                else
                                {
                                    tempMusicMap.Add(stageInfo.m_nMusicID, stageInfo.m_InfoEX);
                                }
                            }
                        }
                        else
                        {
                            Hashtable tempMusicMap = new Hashtable();
                            tempMusicMap.Add(stageInfo.m_nMusicID, stageInfo.m_InfoEX);

                            tempLeveMap.Add(stageInfo.m_nLevel, tempMusicMap);
                        }
                    }
                }
                else
                {
                    Hashtable musicMap = new Hashtable();
                    musicMap.Add(stageInfo.m_nMusicID, stageInfo.m_InfoEX);

                    Hashtable tempLeveMap = new Hashtable();
                    tempLeveMap.Add(stageInfo.m_nLevel, musicMap);

                    m_StageMap.Add(tempSongMode, tempLeveMap);
                }
            }
        }