public void Init() { XmlDocument itemXml = new XmlDocument(); itemXml.LoadXml(Resources.Load(ItemPath).ToString()); XmlNodeList list = itemXml.DocumentElement.GetElementsByTagName("Model"); for (int i = 0; i < list.Count; i++) { Item item = new Item(list[i] as XmlElement); _itemMap.Add(item.id, item); int blockId = BlockData.GetBlockId(item.sceneBlockType, item.sceneBlockExtendId); if (blockId > 0) { _blockIdToItemMap.Add(blockId, item); } } string userItemInfo = Resources.Load(InitUserItemPath).ToString(); JsonData jsonData = JsonMapper.ToObject(userItemInfo); for (int i = 0; i < jsonData.Count; i++) { UserItemData data = new UserItemData(jsonData[i]); userItemDatas.Add(data); } }
public override void Init(params object[] param) { //初始化用户的材料信息 List <UserItemData> list = ItemManager.Instance.GetInitUserItemData(); for (int i = 0; i < list.Count; i++) { UserItemData data = list[i]; UserItem userItem = UserItemFactory.GenerateUserItem(data.id, data.num, this.place); AddUserItem(userItem); } }