/// <summary> /// 更新物品 /// </summary> /// <param name="index">索引</param> /// <param name="type">奖励类型</param> /// <param name="id">物品编号</param> /// <param name="count">数量</param> private void UpdateItem(int index, mw.Enums.RewardType type, int id, int count) { StringBuilder builder = new StringBuilder(); builder.Append(this.typeDropDownList.Items[(int)type].Text); builder.Append(" | "); switch ((int)type) { // 0 经济类型 case 0: { if (id == 0 || !playerHistroy.economicName.ContainsKey(id)) { goto cannotFindID; } builder.Append(playerHistroy.economicName[id] + "(" + id + ")"); } break; // 1 物品 case 1: { if (!TableManager.ItemTable.ContainsKey(id)) { goto cannotFindID; } mw.ItemConfig itemInfo = TableManager.ItemTable[id]; builder.Append(TextManager.GetText(itemInfo.name) + "(" + id + ")"); } break; // 2 武魂 case 2: { if (!TableManager.HeroTable.ContainsKey(id)) { goto cannotFindID; } mw.HeroBaseConfig heroInfo = TableManager.HeroTable[id]; builder.Append(TextManager.GetText(heroInfo.name) + "(" + id + ")"); } break; // 3 饰品 case 3: { if (!TableManager.StoneTable.ContainsKey(id)) { goto cannotFindID; } mw.StoneConfig stoneInfo = TableManager.StoneTable[id]; builder.Append(TextManager.GetText(stoneInfo.name) + "(" + id + ")"); } break; // 4 晶石 case 4: { if (!TableManager.PetStoneTable.ContainsKey(id)) { goto cannotFindID; } mw.ItemConfig psInfo = TableManager.PetStoneTable[id]; builder.Append(TextManager.GetText(psInfo.name) + "(" + id + ")"); } break; // 5 坐骑碎片 case 5: { if (!TableManager.MountTable.ContainsKey(id)) { goto cannotFindID; } mw.MountConfig mountInfo = TableManager.MountTable[id]; builder.Append(TableManager.MountTable[id].name + "(" + id + ")"); } break; // 6 武将 case 6: { if (!TableManager.HeroTable.ContainsKey(id)) { goto cannotFindID; } builder.Append(TableManager.HeroTable[id].name + "(" + id + ")"); } break; // 7 经验 case 7: { if (id == 0) { builder.Append(TableManager.GetGMTText(338)); } else { builder.Append(TableManager.GetGMTText(339)); } } break; // 8 宠物 case 8: { if (!TableManager.PetTable.ContainsKey(id)) { goto cannotFindID; } mw.PetConfig petInfo = TableManager.PetTable[id]; builder.Append(TextManager.GetText(petInfo.name) + "[" + petInfo.petstar + " STAR]" + "(" + id + ")"); } break; // 9 坐骑 case 9: { if (!TableManager.MountTable.ContainsKey(id)) { goto cannotFindID; } mw.MountConfig mountInfo = TableManager.MountTable[id]; builder.Append(TextManager.GetText(mountInfo.name) + "(" + id + ")"); } break; } goto count; cannotFindID: builder.Append("Unknown(" + id + ")"); count: builder.Append(" | ").Append(count); if (index < this.itemListBox.Items.Count) { this.itemListBox.Items[index].Text = builder.ToString(); } else { this.itemListBox.Items.Add(new ListItem(builder.ToString(), index.ToString())); } }
private static string GetItemName(int rwdType, int id) { switch (rwdType) { // 0 经济类型 case 0: return(string.Format("{0}({1})", TableManager.GetGMTText(21000 + (id)), id)); break; // 1 物品 case 1: { mw.ItemConfig config = null; TableManager.ItemTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; // 2 武魂 case 2: case 3: { mw.HeroBaseConfig config = null; TableManager.HeroTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; // 3 饰品 case 4: { mw.StoneConfig config = null; TableManager.StoneTable.TryGetValue(id, out config); if (null != config) { string[] color = { "0", "1", "blue", "purple", "orange", "red" }; return(string.Format("{0}[{1}]({2})", TextManager.GetText(config.name), color[config.color], id)); } } break; case 5: { mw.PetConfig config = null; TableManager.PetTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}[{1} STAR]({2})", TextManager.GetText(config.name), config.petstar, id)); } } break; // 8 晶石 case 8: { mw.ItemConfig config = null; TableManager.PetStoneTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; // 9 10 坐骑碎片 case 9: case 10: { Regex r = new Regex("\\[.*?\\]"); mw.MountConfig config = null; TableManager.MountTable.TryGetValue(id, out config); if (null != config) { return(string.Format("{0}({1})", TextManager.GetText(config.name), id)); } } break; } return("Unknown Id: " + id); }