public void add(CustomizeItemBean cib) { cib.index = lastIndex + 1; if (itemList[cib.index] == null) { itemList[cib.index] = new CustomizeItemBean(); } else { throw new Exception(cib.index + " UsedCustomizeItemIndex"); } itemList[cib.index] = cib; if (cib.index > lastIndex) { lastIndex = cib.index; } if (cib.sort_index > lastSort_index) { lastSort_index = cib.sort_index; } if (cib.id > lastId) { lastId = cib.id; } length++; }
public void copyCustomizeItemByObjId(int cstmItemNo, String name) { CustomizeItemBean cib = new CustomizeItemBean(cstmItems.findCstmItemByObjId(cstmItemNo)); cib.id = cstmItems.lastId + 1; cib.sort_index = cstmItems.lastSort_index + 1; cib.obj_id = findLastItemId() + 1; cib.name = cib.name + name; cstmItems.add(cib); logs.cstmItems.Add(new CSTMItemLogBean(cstmItems.findCstmItemByObjId(cstmItemNo), cib)); for (int i = 0; i <= 9; i++) { copyItemByNo(characterList[i], cstmItemNo, cib.obj_id); } sprdb.addCST(cib.id); }
public CustomizeItems(String[] ori) { //寻找长度行 int flag = 0; foreach (string line in ori.Reverse()) { switch (StringCut.splitBeforeEqual(line)) { case "version": version = Int32.Parse(StringCut.splitAfterEqual(line)); flag++; break; case "patch": patch = Int32.Parse(StringCut.splitAfterEqual(line)); flag++; break; case "length": length = Int32.Parse(StringCut.splitAfterEqual(line)); itemList = new CustomizeItemBean[length + 500]; flag++; break; } if (flag == 3) { break; } } foreach (string line in ori) { //读取文件 //注释 if (line[0].Equals('#')) { continue; } //最后一行 if (line.Contains("data_list.length")) { break; } //切分 int index = Int32.Parse(StringCut.splitPoint(line, 2)); String key = StringCut.splitBeforeEqual(line); String value = StringCut.splitAfterEqual(line); if (itemList[index] == null) { itemList[index] = new CustomizeItemBean(); } itemList[index].index = index; if (lastIndex < index) { lastIndex = index; } switch (key) { case "chara": itemList[index].chara = value; break; case "id": if (Int32.Parse(value) > lastId) { lastId = Int32.Parse(value); } itemList[index].id = Int32.Parse(value); break; case "name": itemList[index].name = value; break; case "ng": itemList[index].ng = Int32.Parse(value); break; case "obj_id": itemList[index].obj_id = Int32.Parse(value); break; case "parts": itemList[index].parts = value; break; case "sell_type": itemList[index].sell_type = Int32.Parse(value); break; case "shop_ed_day": itemList[index].shop_ed_day = Int32.Parse(value); break; case "shop_ed_month": itemList[index].shop_ed_month = Int32.Parse(value); break; case "shop_ed_year": itemList[index].shop_ed_year = Int32.Parse(value); break; case "shop_price": itemList[index].shop_price = Int32.Parse(value); break; case "shop_st_day": itemList[index].shop_st_day = Int32.Parse(value); break; case "shop_st_month": itemList[index].shop_st_month = Int32.Parse(value); break; case "shop_st_year": itemList[index].shop_st_year = Int32.Parse(value); break; case "sort_index": if (Int32.Parse(value) > lastSort_index) { lastSort_index = Int32.Parse(value); } itemList[index].sort_index = Int32.Parse(value); break; default: Console.WriteLine(value); break; } } }