Esempio n. 1
0
 public void add(ModuleBean mb)
 {
     mb.index = lastIndex + 1;
     if (moduleList[mb.index] != null)
     {
         throw new Exception(mb.index + " ModuleIndexUsed");
     }
     else
     {
         moduleList[mb.index] = new ModuleBean();
     }
     moduleList[mb.index] = mb;
     length++;
     if (mb.index > lastIndex)
     {
         lastIndex = mb.index;
     }
     if (mb.id > lastModuleId)
     {
         lastModuleId = mb.id;
     }
     if (mb.sort_index > lastSortIndex)
     {
         lastSortIndex = mb.sort_index;
     }
 }
Esempio n. 2
0
        public void copyModuleWithNewBody(String charactor, int bodyId, String name)
        {
            CharacterTbl   chaTbl  = findCharactor(charactor);
            List <CosBean> coslist = chaTbl.findCosByItemId(bodyId);

            if (coslist.Count == 0)
            {
                throw new Exception("BodyItemId" + bodyId + "NotFound");
            }
            ModuleBean mb = modules.findModuleByCos(charactor, StringCut.cosId2String(coslist[0].id));

            copyModuleWithNewBody(mb.id, name);
        }
Esempio n. 3
0
 public ModuleBean(ModuleBean old)
 {
     index         = old.index;
     attr          = old.attr;
     chara         = old.chara;
     cos           = old.cos;
     id            = old.id;
     name          = old.name;
     ng            = old.ng;
     shop_ed_day   = old.shop_ed_day;
     shop_ed_month = old.shop_ed_month;
     shop_ed_year  = old.shop_ed_year;
     shop_price    = old.shop_price;
     shop_st_day   = old.shop_st_day;
     shop_st_month = old.shop_st_month;
     shop_st_year  = old.shop_st_year;
     sort_index    = old.sort_index;
 }
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 Modules(string[] ori)
        {
            //寻找长度行
            foreach (string line in ori.Reverse())
            {
                if (line.Contains("data_list.length"))
                {
                    length     = Int32.Parse(StringCut.splitAfterEqual(line));
                    moduleList = new ModuleBean[length + 500];
                    break;
                }
            }
            foreach (string line in ori)
            {
                //读取文件
                //注释
                if (line[0].Equals('#'))
                {
                    continue;
                }
                //最后一行
                if (line.Contains("data_list.length"))
                {
                    break;
                }
                string[] linearr = new string[4];
                //切分
                linearr = linecut(line);
                int    index = Int32.Parse(linearr[1]);
                String key   = linearr[2];
                String value = linearr[3];
                if (moduleList[index] == null)
                {
                    moduleList[index] = new ModuleBean();
                }
                moduleList[index].index = index;
                if (index > lastIndex)
                {
                    lastIndex = index;
                }
                switch (key)
                {
                case "attr":
                    moduleList[index].attr = Int32.Parse(value);
                    break;

                case "chara":
                    moduleList[index].chara = value;
                    break;

                case "cos":
                    moduleList[index].cos = value;
                    break;

                case "id":
                    moduleList[index].id = Int32.Parse(value);
                    if (moduleList[index].id > lastModuleId)
                    {
                        lastModuleId = moduleList[index].id;
                    }
                    break;

                case "name":
                    moduleList[index].name = value;
                    break;

                case "ng":
                    moduleList[index].ng = Int32.Parse(value);
                    break;

                case "shop_ed_day":
                    moduleList[index].shop_ed_day = Int32.Parse(value);
                    break;

                case "shop_ed_month":
                    moduleList[index].shop_ed_month = Int32.Parse(value);
                    break;

                case "shop_ed_year":
                    moduleList[index].shop_ed_year = Int32.Parse(value);
                    break;

                case "shop_price":
                    moduleList[index].shop_price = Int32.Parse(value);
                    break;

                case "shop_st_day":
                    moduleList[index].shop_st_day = Int32.Parse(value);
                    break;

                case "shop_st_month":
                    moduleList[index].shop_st_month = Int32.Parse(value);
                    break;

                case "shop_st_year":
                    moduleList[index].shop_st_year = Int32.Parse(value);
                    break;

                case "sort_index":
                    moduleList[index].sort_index = Int32.Parse(value);
                    if (moduleList[index].sort_index > lastSortIndex)
                    {
                        lastSortIndex = moduleList[index].sort_index;
                    }
                    break;

                default:
                    Console.WriteLine(value);
                    break;
                }
            }
            if ((lastIndex + 1) > length)
            {
                length = lastIndex + 1;
            }
        }