예제 #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 != 13)
        {
            Ex.Logger.Log("SysIcon.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "ID")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ID]位置不对应"); return(false);
        }
        if (vecLine[1] != "Name")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Name]位置不对应"); return(false);
        }
        if (vecLine[2] != "Desc")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Desc]位置不对应"); return(false);
        }
        if (vecLine[3] != "Type")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Type]位置不对应"); return(false);
        }
        if (vecLine[4] != "Order")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Order]位置不对应"); return(false);
        }
        if (vecLine[5] != "Icon")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Icon]位置不对应"); return(false);
        }
        if (vecLine[6] != "ShowLv")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ShowLv]位置不对应"); return(false);
        }
        if (vecLine[7] != "ShowTaskRe")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ShowTaskRe]位置不对应"); return(false);
        }
        if (vecLine[8] != "ShowTaskCo")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ShowTaskCo]位置不对应"); return(false);
        }
        if (vecLine[9] != "OpenLv")
        {
            Ex.Logger.Log("SysIcon.csv中字段[OpenLv]位置不对应"); return(false);
        }
        if (vecLine[10] != "OpenTaskRe")
        {
            Ex.Logger.Log("SysIcon.csv中字段[OpenTaskRe]位置不对应"); return(false);
        }
        if (vecLine[11] != "OpenTaskCo")
        {
            Ex.Logger.Log("SysIcon.csv中字段[OpenTaskCo]位置不对应"); return(false);
        }
        if (vecLine[12] != "Prompt")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Prompt]位置不对应"); return(false);
        }

        while (true)
        {
            vecLine = GameAssist.readCsvLine(strContent, ref contentOffset);
            if ((int)vecLine.Count == 0)
            {
                break;
            }
            if ((int)vecLine.Count != (int)13)
            {
                return(false);
            }
            SysIconElement member = new SysIconElement();
            member.ID         = Convert.ToInt32(vecLine[0]);
            member.Name       = vecLine[1];
            member.Desc       = vecLine[2];
            member.Type       = Convert.ToInt32(vecLine[3]);
            member.Order      = Convert.ToInt32(vecLine[4]);
            member.Icon       = vecLine[5];
            member.ShowLv     = Convert.ToInt32(vecLine[6]);
            member.ShowTaskRe = Convert.ToInt32(vecLine[7]);
            member.ShowTaskCo = Convert.ToInt32(vecLine[8]);
            member.OpenLv     = Convert.ToInt32(vecLine[9]);
            member.OpenTaskRe = Convert.ToInt32(vecLine[10]);
            member.OpenTaskCo = Convert.ToInt32(vecLine[11]);
            member.Prompt     = Convert.ToInt32(vecLine[12]);

            member.IsValidate = true;
            m_vecAllElements.Add(member);
            m_mapElements[member.ID] = member;
        }
        return(true);
    }
예제 #2
0
 private SysIconTable()
 {
     m_mapElements    = new Dictionary <int, SysIconElement>();
     m_emptyItem      = new SysIconElement();
     m_vecAllElements = new List <SysIconElement>();
 }
예제 #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 != 13)
        {
            Ex.Logger.Log("SysIcon.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "ID")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ID]位置不对应"); return(false);
        }
        if (vecLine[1] != "Name")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Name]位置不对应"); return(false);
        }
        if (vecLine[2] != "Desc")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Desc]位置不对应"); return(false);
        }
        if (vecLine[3] != "Type")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Type]位置不对应"); return(false);
        }
        if (vecLine[4] != "Order")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Order]位置不对应"); return(false);
        }
        if (vecLine[5] != "Icon")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Icon]位置不对应"); return(false);
        }
        if (vecLine[6] != "ShowLv")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ShowLv]位置不对应"); return(false);
        }
        if (vecLine[7] != "ShowTaskRe")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ShowTaskRe]位置不对应"); return(false);
        }
        if (vecLine[8] != "ShowTaskCo")
        {
            Ex.Logger.Log("SysIcon.csv中字段[ShowTaskCo]位置不对应"); return(false);
        }
        if (vecLine[9] != "OpenLv")
        {
            Ex.Logger.Log("SysIcon.csv中字段[OpenLv]位置不对应"); return(false);
        }
        if (vecLine[10] != "OpenTaskRe")
        {
            Ex.Logger.Log("SysIcon.csv中字段[OpenTaskRe]位置不对应"); return(false);
        }
        if (vecLine[11] != "OpenTaskCo")
        {
            Ex.Logger.Log("SysIcon.csv中字段[OpenTaskCo]位置不对应"); return(false);
        }
        if (vecLine[12] != "Prompt")
        {
            Ex.Logger.Log("SysIcon.csv中字段[Prompt]位置不对应"); return(false);
        }

        for (int i = 0; i < nRow; i++)
        {
            SysIconElement member = new SysIconElement();
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ID);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Name);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Desc);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Type);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Order);
            readPos += GameAssist.ReadString(binContent, readPos, out member.Icon);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ShowLv);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ShowTaskRe);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ShowTaskCo);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.OpenLv);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.OpenTaskRe);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.OpenTaskCo);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Prompt);

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