示例#1
0
        public bool ItemDefNameHelpRebuild()
        {
            List <ItemDef_Str>  newDefList  = new List <ItemDef_Str>();
            List <ItemName_Str> newNameList = new List <ItemName_Str>();
            List <ItemHelp_Str> newHelpList = new List <ItemHelp_Str>();

            for (int i = 0; i < m_ItemList.Count; i++)
            {
                int      def  = i + 1;
                int      name = i + 100;
                int      help = i + 8100;
                Item_Str item = m_ItemList[i];

                //define
                ItemDef_Str newDef;
                newDef.id   = def.ToString();
                newDef.name = item.code.Split(new string[] { "item_" }, StringSplitOptions.RemoveEmptyEntries)[0];
                newDefList.Add(newDef);

                //获取原name string,
                ItemName_Str newName;
                string       oldName = GetItemName(item.name);
                newName.id   = name.ToString();
                newName.name = oldName;
                newNameList.Add(newName);

                //获取原help string
                ItemHelp_Str newHelp;
                string       oldHelp = GetItemHelp(item.help_string);
                newHelp.id   = help.ToString();
                newHelp.name = oldHelp;
                newHelpList.Add(newHelp);

                item.name        = name.ToString();
                item.help_string = help.ToString();

                m_ItemList[i] = item;
            }

            //修改
            m_ItemDefList  = newDefList;
            m_ItemNameList = newNameList;
            m_ItemHelpList = newHelpList;

            //
            SaveItemDefInfo();
            SaveItemInfo();
            SaveItemNameInfo();
            SaveItemHelpInfo();

            return(true);
        }
示例#2
0
        public bool MdfyItemAttr(string id, Item_Str item)
        {
            for (int i = 0; i < m_ItemList.Count; i++)
            {
                if (CFormat.ToSimplified(m_ItemList[i].code) == id)
                {
                    m_ItemList[i] = item;
                    return(true);
                }
            }

            return(false);
        }
示例#3
0
 //item_XX ID   此处把 item_XX称作id
 public bool GetAttrById(string id, out Item_Str item)
 {
     foreach (var it in m_ItemList)
     {
         if (CFormat.ToSimplified(it.code) == id)
         {
             item = it;
             return(true);
         }
     }
     item      = new Item_Str();
     item.more = new List <string>();
     return(false);
 }
示例#4
0
        public bool AddItemAttr(Item_Str item)
        {
            m_ItemList.Add(item);

            return(true);
        }