Exemple #1
0
        /// <summary>
        /// Converts an individual stage ID (number in RAM) into a set of tags which categorize the individual stage.
        /// </summary>
        /// <param name="stageId">The stage ID for the individual stage.</param>
        /// <returns>A list of individual tags for a stage.</returns>
        public static StageTag CategorizeStage(int stageId)
        {
            // Set default tag.
            StageTag stageTag = 0;

            // Exclusive Stages
            if (stageId == (int)StageId.TestLevel || stageId == (int)StageId.RailCanyonChaotix)
            {
                stageTag |= StageTag.Exclusive;
            }

            // Battle Stages
            if (IsBetween(stageId, (int)StageId.EggHawk, (int)StageId.MetalOverlord) ||
                IsBetween(stageId, (int)StageId.CityTopBattle, (int)StageId.TurtleShellBattle))
            {
                stageTag |= StageTag.Battle;
            }

            // Tutorial Stage
            if (stageId == (int)StageId.SeaGate)
            {
                stageTag |= StageTag.Tutorial;
            }

            // Bobsled Stage
            if (IsBetween(stageId, (int)StageId.SeasideCourse, (int)StageId.CasinoCourse))
            {
                stageTag |= StageTag.Bobsled;
            }

            // Bonus Stage
            if (IsBetween(stageId, (int)StageId.BonusStage1, (int)StageId.BonusStage7))
            {
                stageTag |= StageTag.Bonus;
            }

            // Two Player
            if (IsBetween(stageId, (int)StageId.SeasideHill2P, (int)StageId.EggFleetExpert) ||
                IsBetween(stageId, (int)StageId.SeasideCourse, (int)StageId.CasinoCourse) ||
                IsBetween(stageId, (int)StageId.SpecialStageMultiplayer1, (int)StageId.SpecialStageMultiplayer3))
            {
                stageTag |= StageTag.TwoPlayer;
            }

            // Special Stage
            if (IsBetween(stageId, (int)StageId.EmeraldChallenge1, (int)StageId.EmeraldChallenge7) ||
                IsBetween(stageId, (int)StageId.SpecialStageMultiplayer1, (int)StageId.SpecialStageMultiplayer3))
            {
                stageTag |= StageTag.Special;
            }

            return(stageTag);
        }
        public override void LoadStageInfo(string stagePath, EStageLevel stageLevel)
        {
            using (StreamReader sr = new StreamReader(stagePath, Encoding.GetEncoding("gb18030")))
            {
                char[] invalidFlag = { ':' };
                char[] trimStart   = { ' ', '\t' };
                char[] trimEnd     = { ' ', '\r', '\n', '\t' };
                Dictionary <int, string> roundNote = new Dictionary <int, string>();

                string stringLine = null;
                while ((stringLine = sr.ReadLine()) != null)
                {
                    if (stringLine != "")
                    {
                        if (!m_bInvalidFlag && ContainsFlag(stringLine, invalidFlag))
                        {
                            m_bInvalidFlag = true;
                        }

                        stringLine.TrimEnd(trimEnd);
                        stringLine.TrimStart(trimStart);

                        if (BeginWithFlag(stringLine, '#'))
                        {
                            StageTag tag = AnalyseTag(ref stringLine, '#');
                            if (tag == StageTag.Round)
                            {
                                stringLine = stringLine.Replace(" ", "");
                                string strHead = "";
                                string strNote = "";
                                SeparateString(stringLine, ':', ref strHead, ref strNote);
                                NodeHeadList.Add(strHead);

                                int nHead = Convert.ToInt32(strHead);
                                if (!roundNote.ContainsKey(nHead))
                                {
                                    roundNote.Add(nHead, strNote);
                                }
                                else
                                {
                                    DebugLog.Write("CRhythmStageInfo LoadStageInfo Error: Round NO is duplicate " + strHead, LogLevel.ERROR);
                                }
                            }
                            else if (tag == StageTag.PatEnd)
                            {
                                AnalysisRoundNote(roundNote);
                                roundNote.Clear();
                            }
                        }
                        else if (BeginWithFlag(stringLine, '@'))
                        {
                            stringLine = stringLine.Replace(" ", "");
                            string strHead  = "";
                            string strBegin = "";
                            string strEnd   = "";
                            SeparateString(stringLine, ':', ref strHead, ref strBegin, ref strEnd);

                            int nBegin = Convert.ToInt32(strBegin);
                            int nEnd   = Convert.ToInt32(strEnd);
                            if (nBegin > 0 && nBegin < nEnd)
                            {
                                CRhythmShowTime showTime = new CRhythmShowTime();
                                showTime.BeginTime = nBegin;
                                showTime.EndTime   = nEnd;
                                ShowTimeList.Add(showTime);
                            }
                        }
                        else
                        {
                            string key   = "";
                            string value = "";
                            SeparateString(stringLine, ':', ref key, ref value);

                            key = key.ToUpper();
                            SetMatchValue(key, value);
                        }
                    }
                }

                sr.Close();
            }
        }
Exemple #3
0
    public override void LoadStageInfo(byte[] stageInfo)
    {
        //SetMatchValue();

        //return;

        using (MemoryStream memStream = new MemoryStream(stageInfo))
        {
            using (StreamReader sr = new StreamReader(memStream, CommonFunc.GetCharsetEncoding()))
            {
                char[]        trimStart = { ' ', '\t' };
                char[]        trimEnd   = { ' ', '\r', '\n', '\t' };
                List <string> roundNote = new List <string>();

                string stringLine = null;
                while ((stringLine = sr.ReadLine()) != null)
                {
                    if (stringLine != "")
                    {
                        stringLine.TrimEnd(trimEnd);
                        stringLine.TrimStart(trimStart);

                        if (BeginWithFlag(stringLine, '#'))
                        {
                            StageTag tag = AnalyseTag(ref stringLine, '#');
                            if (tag == StageTag.Round)
                            {
                                stringLine = stringLine.Replace(" ", "");
                                string strHead = "";
                                string strNote = "";
                                SeparateString(stringLine, ':', ref strHead, ref strNote);
                                roundNote.Add(strNote);
                            }
                            else if (tag == StageTag.PatEnd)
                            {
                                AnalysisRoundNote(roundNote);
                                roundNote.Clear();
                            }
                        }
                        else if (BeginWithFlag(stringLine, '@'))
                        {
                            //Show time
                            stringLine = stringLine.Replace(" ", "");
                            string strHead  = "";
                            string strBegin = "";
                            string strEnd   = "";
                            SeparateString(stringLine, ':', ref strHead, ref strBegin, ref strEnd);

                            int nBegin = Convert.ToInt32(strBegin);
                            int nEnd   = Convert.ToInt32(strEnd);
                            if (nBegin > 0 && nBegin < nEnd)
                            {
                                CTaiguShowTime showTime = new CTaiguShowTime();
                                showTime.BeginTime = nBegin;
                                showTime.EndTime   = nEnd;
                                ShowTimeList.Add(showTime);
                            }
                        }
                        else
                        {
                            string key   = "";
                            string value = "";
                            SeparateString(stringLine, ':', ref key, ref value);

                            key = key.ToUpper();
                            SetMatchValue(key, value);
                        }
                    }
                }
                sr.Close();
            }
            memStream.Close();
        }
    }