Esempio n. 1
0
 public CosBean(CosBean old)
 {
     index    = old.index;
     haveId   = old.haveId;
     id       = old.id;
     haveItem = old.haveItem;
     foreach (ItemBean i in old.item)
     {
         item.Add(new ItemBean(i));
     }
     haveLength = old.haveLength;
     length     = old.length;
 }
Esempio n. 2
0
 public int findBodyNo(CosBean cos)
 {
     foreach (ItemBean i in cos.item)
     {
         foreach (CharacterItemBean c in itemList)
         {
             if (c.no == Int32.Parse(i.item))
             {
                 if (c.sub_id == 10)
                 {
                     return(c.no);
                 }
                 break;
             }
         }
     }
     throw new Exception(cos.item + " BodyNotFound");
 }
Esempio n. 3
0
        private void doCos(string line)
        {
            int index = Int32.Parse(StringCut.splitPoint(line, 2));

            if (cosList[index] == null)
            {
                cosList[index] = new CosBean();
            }
            cosList[index].index = index;
            if (index > lastCosIndex)
            {
                lastCosIndex = index;
            }
            String key   = StringCut.splitBeforeEqual(line);
            String value = StringCut.splitAfterEqual(line);

            switch (key)
            {
            case "id":
                cosList[index].haveId = true;
                cosList[index].id     = Int32.Parse(value);
                if (cosList[index].id > lastCosId)
                {
                    lastCosId = cosList[index].id;
                }
                break;

            case "length":
                cosList[index].haveLength = true;
                cosList[index].length     = Int32.Parse(value);
                break;

            default:
                cosList[index].haveItem = true;
                ItemBean item = new ItemBean();
                item.index = Int32.Parse(key);
                item.item  = value;
                cosList[index].item.Add(item);
                break;
            }
        }
Esempio n. 4
0
        public void copyModuleWithNewBody(int moduleId, String name)
        {
            ModuleBean   mb     = new ModuleBean(modules.findModuleById(moduleId));
            CharacterTbl chaTbl = findCharactor(mb.chara);

            //更新module
            mb.id         = modules.lastModuleId + 1;
            mb.sort_index = modules.lastSortIndex + 1;
            if (!name.Equals(""))
            {
                mb.name = mb.name + name;
            }
            int oriCosId = StringCut.cosString2Id(mb.cos);

            mb.cos = StringCut.cosId2String(chaTbl.lastCosId + 1);
            modules.add(mb);

            //更新cos
            CosBean newCos    = new CosBean(chaTbl.findCosById(oriCosId));
            int     OldBodyno = chaTbl.findBodyNo(newCos);

            newCos.id = chaTbl.lastCosId + 1;
            foreach (ItemBean i in newCos.item)
            {
                if (Int32.Parse(i.item) == OldBodyno)
                {
                    i.item = (chaTbl.lastItemNo + 1).ToString();
                }
            }
            chaTbl.addCos(newCos);
            logs.modules.Add(new ModuleLogBean(modules.findModuleById(moduleId), mb, chaTbl.findCosById(oriCosId), newCos));

            //新增身体
            CharacterItemBean newItem = copyItemByNo(mb.chara, OldBodyno);

            //更新缩略图
            String spiritName = sprdb.addMD(mb.id);

            //更新日志
        }
Esempio n. 5
0
 public void addCos(CosBean newCos)
 {
     newCos.index = lastCosIndex + 1;
     if (cosList[newCos.index] != null)
     {
         throw new Exception("ModuleIndex" + newCos.index + "Used");
     }
     else
     {
         cosList[newCos.index] = new CosBean();
     }
     cosList[newCos.index] = newCos;
     cosLength++;
     if (newCos.index > lastCosIndex)
     {
         lastCosIndex = newCos.index;
     }
     if (newCos.id > lastCosId)
     {
         lastCosId = newCos.id;
     }
 }