Exemple #1
0
    public bool LoadCsv(string strContent)
    {
        if (strContent.Length == 0)
        {
            return(false);
        }
        m_mapElements.Clear();
        m_vecAllElements.Clear();
        int           contentOffset = 0;
        List <string> vecLine;

        vecLine = GameAssist.readCsvLine(strContent, ref contentOffset);
        if (vecLine.Count != 36)
        {
            Ex.Logger.Log("Dungeons.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "DungeonsID")
        {
            Ex.Logger.Log("Dungeons.csv中字段[DungeonsID]位置不对应"); return(false);
        }
        if (vecLine[1] != "FunctionID")
        {
            Ex.Logger.Log("Dungeons.csv中字段[FunctionID]位置不对应"); return(false);
        }
        if (vecLine[2] != "Type")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Type]位置不对应"); return(false);
        }
        if (vecLine[3] != "SceneResource")
        {
            Ex.Logger.Log("Dungeons.csv中字段[SceneResource]位置不对应"); return(false);
        }
        if (vecLine[4] != "MonsterConfigure")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MonsterConfigure]位置不对应"); return(false);
        }
        if (vecLine[5] != "Name")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Name]位置不对应"); return(false);
        }
        if (vecLine[6] != "Music")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Music]位置不对应"); return(false);
        }
        if (vecLine[7] != "Describe")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Describe]位置不对应"); return(false);
        }
        if (vecLine[8] != "RewardShow")
        {
            Ex.Logger.Log("Dungeons.csv中字段[RewardShow]位置不对应"); return(false);
        }
        if (vecLine[9] != "MonsterIcon")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MonsterIcon]位置不对应"); return(false);
        }
        if (vecLine[10] != "FBTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[FBTime]位置不对应"); return(false);
        }
        if (vecLine[11] != "ExitTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ExitTime]位置不对应"); return(false);
        }
        if (vecLine[12] != "Close")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Close]位置不对应"); return(false);
        }
        if (vecLine[13] != "CloseType")
        {
            Ex.Logger.Log("Dungeons.csv中字段[CloseType]位置不对应"); return(false);
        }
        if (vecLine[14] != "ShowMap")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ShowMap]位置不对应"); return(false);
        }
        if (vecLine[15] != "MapResource")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapResource]位置不对应"); return(false);
        }
        if (vecLine[16] != "MapLayer")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapLayer]位置不对应"); return(false);
        }
        if (vecLine[17] != "MapSkewing")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapSkewing]位置不对应"); return(false);
        }
        if (vecLine[18] != "MapRatio")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapRatio]位置不对应"); return(false);
        }
        if (vecLine[19] != "PKType")
        {
            Ex.Logger.Log("Dungeons.csv中字段[PKType]位置不对应"); return(false);
        }
        if (vecLine[20] != "LimitLevel")
        {
            Ex.Logger.Log("Dungeons.csv中字段[LimitLevel]位置不对应"); return(false);
        }
        if (vecLine[21] != "ResetTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ResetTime]位置不对应"); return(false);
        }
        if (vecLine[22] != "OpenTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[OpenTime]位置不对应"); return(false);
        }
        if (vecLine[23] != "Team")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Team]位置不对应"); return(false);
        }
        if (vecLine[24] != "TeamMembers")
        {
            Ex.Logger.Log("Dungeons.csv中字段[TeamMembers]位置不对应"); return(false);
        }
        if (vecLine[25] != "ChallengeTimes")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ChallengeTimes]位置不对应"); return(false);
        }
        if (vecLine[26] != "BuyTimes")
        {
            Ex.Logger.Log("Dungeons.csv中字段[BuyTimes]位置不对应"); return(false);
        }
        if (vecLine[27] != "Reward1Star")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Reward1Star]位置不对应"); return(false);
        }
        if (vecLine[28] != "Reward2Star")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Reward2Star]位置不对应"); return(false);
        }
        if (vecLine[29] != "Reward3Star")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Reward3Star]位置不对应"); return(false);
        }
        if (vecLine[30] != "StarLevel")
        {
            Ex.Logger.Log("Dungeons.csv中字段[StarLevel]位置不对应"); return(false);
        }
        if (vecLine[31] != "FinalLevel")
        {
            Ex.Logger.Log("Dungeons.csv中字段[FinalLevel]位置不对应"); return(false);
        }
        if (vecLine[32] != "Relive")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Relive]位置不对应"); return(false);
        }
        if (vecLine[33] != "AutoMode")
        {
            Ex.Logger.Log("Dungeons.csv中字段[AutoMode]位置不对应"); return(false);
        }
        if (vecLine[34] != "AutoScope")
        {
            Ex.Logger.Log("Dungeons.csv中字段[AutoScope]位置不对应"); return(false);
        }
        if (vecLine[35] != "Mission")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Mission]位置不对应"); return(false);
        }

        while (true)
        {
            vecLine = GameAssist.readCsvLine(strContent, ref contentOffset);
            if ((int)vecLine.Count == 0)
            {
                break;
            }
            if ((int)vecLine.Count != (int)36)
            {
                return(false);
            }
            DungeonsElement member = new DungeonsElement();
            member.DungeonsID       = Convert.ToInt32(vecLine[0]);
            member.FunctionID       = Convert.ToInt32(vecLine[1]);
            member.Type             = Convert.ToInt32(vecLine[2]);
            member.SceneResource    = vecLine[3];
            member.MonsterConfigure = vecLine[4];
            member.Name             = vecLine[5];
            member.Music            = vecLine[6];
            member.Describe         = vecLine[7];
            member.RewardShow       = Convert.ToInt32(vecLine[8]);
            member.MonsterIcon      = vecLine[9];
            member.FBTime           = Convert.ToInt32(vecLine[10]);
            member.ExitTime         = Convert.ToInt32(vecLine[11]);
            member.Close            = Convert.ToInt32(vecLine[12]);
            member.CloseType        = Convert.ToInt32(vecLine[13]);
            member.ShowMap          = vecLine[14];
            member.MapResource      = vecLine[15];
            member.MapLayer         = vecLine[16];
            member.MapSkewing       = vecLine[17];
            member.MapRatio         = Convert.ToInt32(vecLine[18]);
            member.PKType           = vecLine[19];
            member.LimitLevel       = Convert.ToInt32(vecLine[20]);
            member.ResetTime        = vecLine[21];
            member.OpenTime         = vecLine[22];
            member.Team             = Convert.ToInt32(vecLine[23]);
            member.TeamMembers      = Convert.ToInt32(vecLine[24]);
            member.ChallengeTimes   = Convert.ToInt32(vecLine[25]);
            member.BuyTimes         = Convert.ToInt32(vecLine[26]);
            member.Reward1Star      = Convert.ToInt32(vecLine[27]);
            member.Reward2Star      = Convert.ToInt32(vecLine[28]);
            member.Reward3Star      = Convert.ToInt32(vecLine[29]);
            member.StarLevel        = Convert.ToInt32(vecLine[30]);
            member.FinalLevel       = Convert.ToInt32(vecLine[31]);
            member.Relive           = Convert.ToInt32(vecLine[32]);
            member.AutoMode         = Convert.ToInt32(vecLine[33]);
            member.AutoScope        = Convert.ToInt32(vecLine[34]);
            member.Mission          = Convert.ToInt32(vecLine[35]);

            member.IsValidate = true;
            m_vecAllElements.Add(member);
            m_mapElements[member.DungeonsID] = member;
        }
        return(true);
    }
Exemple #2
0
 private DungeonsTable()
 {
     m_mapElements    = new Dictionary <int, DungeonsElement>();
     m_emptyItem      = new DungeonsElement();
     m_vecAllElements = new List <DungeonsElement>();
 }
Exemple #3
0
    public bool LoadBin(byte[] binContent)
    {
        m_mapElements.Clear();
        m_vecAllElements.Clear();
        int nCol, nRow;
        int readPos = 0;

        readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nCol);
        readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nRow);
        List <string> vecLine     = new List <string>(nCol);
        List <int>    vecHeadType = new List <int>(nCol);
        string        tmpStr;
        int           tmpInt;

        for (int i = 0; i < nCol; i++)
        {
            readPos += GameAssist.ReadString(binContent, readPos, out tmpStr);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out tmpInt);
            vecLine.Add(tmpStr);
            vecHeadType.Add(tmpInt);
        }
        if (vecLine.Count != 36)
        {
            Ex.Logger.Log("Dungeons.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "DungeonsID")
        {
            Ex.Logger.Log("Dungeons.csv中字段[DungeonsID]位置不对应"); return(false);
        }
        if (vecLine[1] != "FunctionID")
        {
            Ex.Logger.Log("Dungeons.csv中字段[FunctionID]位置不对应"); return(false);
        }
        if (vecLine[2] != "Type")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Type]位置不对应"); return(false);
        }
        if (vecLine[3] != "SceneResource")
        {
            Ex.Logger.Log("Dungeons.csv中字段[SceneResource]位置不对应"); return(false);
        }
        if (vecLine[4] != "MonsterConfigure")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MonsterConfigure]位置不对应"); return(false);
        }
        if (vecLine[5] != "Name")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Name]位置不对应"); return(false);
        }
        if (vecLine[6] != "Music")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Music]位置不对应"); return(false);
        }
        if (vecLine[7] != "Describe")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Describe]位置不对应"); return(false);
        }
        if (vecLine[8] != "RewardShow")
        {
            Ex.Logger.Log("Dungeons.csv中字段[RewardShow]位置不对应"); return(false);
        }
        if (vecLine[9] != "MonsterIcon")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MonsterIcon]位置不对应"); return(false);
        }
        if (vecLine[10] != "FBTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[FBTime]位置不对应"); return(false);
        }
        if (vecLine[11] != "ExitTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ExitTime]位置不对应"); return(false);
        }
        if (vecLine[12] != "Close")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Close]位置不对应"); return(false);
        }
        if (vecLine[13] != "CloseType")
        {
            Ex.Logger.Log("Dungeons.csv中字段[CloseType]位置不对应"); return(false);
        }
        if (vecLine[14] != "ShowMap")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ShowMap]位置不对应"); return(false);
        }
        if (vecLine[15] != "MapResource")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapResource]位置不对应"); return(false);
        }
        if (vecLine[16] != "MapLayer")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapLayer]位置不对应"); return(false);
        }
        if (vecLine[17] != "MapSkewing")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapSkewing]位置不对应"); return(false);
        }
        if (vecLine[18] != "MapRatio")
        {
            Ex.Logger.Log("Dungeons.csv中字段[MapRatio]位置不对应"); return(false);
        }
        if (vecLine[19] != "PKType")
        {
            Ex.Logger.Log("Dungeons.csv中字段[PKType]位置不对应"); return(false);
        }
        if (vecLine[20] != "LimitLevel")
        {
            Ex.Logger.Log("Dungeons.csv中字段[LimitLevel]位置不对应"); return(false);
        }
        if (vecLine[21] != "ResetTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ResetTime]位置不对应"); return(false);
        }
        if (vecLine[22] != "OpenTime")
        {
            Ex.Logger.Log("Dungeons.csv中字段[OpenTime]位置不对应"); return(false);
        }
        if (vecLine[23] != "Team")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Team]位置不对应"); return(false);
        }
        if (vecLine[24] != "TeamMembers")
        {
            Ex.Logger.Log("Dungeons.csv中字段[TeamMembers]位置不对应"); return(false);
        }
        if (vecLine[25] != "ChallengeTimes")
        {
            Ex.Logger.Log("Dungeons.csv中字段[ChallengeTimes]位置不对应"); return(false);
        }
        if (vecLine[26] != "BuyTimes")
        {
            Ex.Logger.Log("Dungeons.csv中字段[BuyTimes]位置不对应"); return(false);
        }
        if (vecLine[27] != "Reward1Star")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Reward1Star]位置不对应"); return(false);
        }
        if (vecLine[28] != "Reward2Star")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Reward2Star]位置不对应"); return(false);
        }
        if (vecLine[29] != "Reward3Star")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Reward3Star]位置不对应"); return(false);
        }
        if (vecLine[30] != "StarLevel")
        {
            Ex.Logger.Log("Dungeons.csv中字段[StarLevel]位置不对应"); return(false);
        }
        if (vecLine[31] != "FinalLevel")
        {
            Ex.Logger.Log("Dungeons.csv中字段[FinalLevel]位置不对应"); return(false);
        }
        if (vecLine[32] != "Relive")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Relive]位置不对应"); return(false);
        }
        if (vecLine[33] != "AutoMode")
        {
            Ex.Logger.Log("Dungeons.csv中字段[AutoMode]位置不对应"); return(false);
        }
        if (vecLine[34] != "AutoScope")
        {
            Ex.Logger.Log("Dungeons.csv中字段[AutoScope]位置不对应"); return(false);
        }
        if (vecLine[35] != "Mission")
        {
            Ex.Logger.Log("Dungeons.csv中字段[Mission]位置不对应"); return(false);
        }

        for (int i = 0; i < nRow; i++)
        {
            DungeonsElement member = new DungeonsElement();
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.DungeonsID);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.FunctionID);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Type);
            readPos += GameAssist.ReadString(binContent, readPos, out member.SceneResource);
            readPos += GameAssist.ReadString(binContent, readPos, out member.MonsterConfigure);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Name);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Music);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Describe);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.RewardShow);
            readPos += GameAssist.ReadString(binContent, readPos, out member.MonsterIcon);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.FBTime);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ExitTime);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Close);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.CloseType);
            readPos += GameAssist.ReadString(binContent, readPos, out member.ShowMap);
            readPos += GameAssist.ReadString(binContent, readPos, out member.MapResource);
            readPos += GameAssist.ReadString(binContent, readPos, out member.MapLayer);
            readPos += GameAssist.ReadString(binContent, readPos, out member.MapSkewing);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.MapRatio);
            readPos += GameAssist.ReadString(binContent, readPos, out member.PKType);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.LimitLevel);
            readPos += GameAssist.ReadString(binContent, readPos, out member.ResetTime);
            readPos += GameAssist.ReadString(binContent, readPos, out member.OpenTime);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Team);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.TeamMembers);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ChallengeTimes);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.BuyTimes);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Reward1Star);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Reward2Star);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Reward3Star);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.StarLevel);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.FinalLevel);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Relive);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.AutoMode);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.AutoScope);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Mission);

            member.IsValidate = true;
            m_vecAllElements.Add(member);
            m_mapElements[member.DungeonsID] = member;
        }
        return(true);
    }