public void SaveBoxInfo(BoxInfo boxInfo) { m_boxInfo = boxInfo; XmlDocument document = new XmlDocument(); document.AppendChild(document.CreateXmlDeclaration("1.0", "utf-8", "yes")); XmlNode root = document.CreateNode(XmlNodeType.Element, "BoxInfo", string.Empty); document.AppendChild(root); XmlNode items = document.CreateNode(XmlNodeType.Element, "Items", string.Empty); root.AppendChild(items); if (boxInfo.itemList == null) { return; } for (int i = 0; i < boxInfo.itemList.Count; i++) { if (boxInfo.itemList[i].item == null) { return; } XmlNode item = document.CreateNode(XmlNodeType.Element, "Item", string.Empty); items.AppendChild(item); XmlElement index = document.CreateElement("index"); index.InnerText = boxInfo.itemList[i].item.ItemIdx.ToString(); item.AppendChild(index); XmlElement count = document.CreateElement("count"); count.InnerText = boxInfo.itemList[i].count.ToString(); item.AppendChild(count); } XmlNode equips = document.CreateNode(XmlNodeType.Element, "Equips", string.Empty); root.AppendChild(equips); for (int i = 0; i < boxInfo.equipmentList.Count; i++) { XmlNode partNode = document.CreateNode(XmlNodeType.Element, "Parts", string.Empty); equips.AppendChild(partNode); XmlElement type = document.CreateElement("partsType"); type.InnerText = boxInfo.equipmentList[i].partsType.ToString(); partNode.AppendChild(type); XmlElement index = document.CreateElement("index"); index.InnerText = boxInfo.equipmentList[i].index.ToString(); partNode.AppendChild(index); } //document.Save("./Assets/Resources/Data/BoxInfo.xml"); File.WriteAllText(Application.streamingAssetsPath + "/Data/BoxInfo.xml", document.OuterXml); }
public void SaveUserData() { if (string.IsNullOrEmpty(m_name)) { m_messageUI.ShowSubMessage("Please Input UserName", 2f); return; } //m_nNotset += m_playerInfo.gender == Gender.Male ? 100 : 0; Data.BoxInfo boxInfo = CDataManager.Inst.PlayerRecord.BoxInfo; Data.InventoryInfo inventoryInfo = CDataManager.Inst.PlayerRecord.InventoryInfo; AddEquipmentInBox(boxInfo); EquipmentSet(inventoryInfo); inventoryInfo.itemList.Add(CreateItem(0)); boxInfo.itemList.Add(CreateItem(2)); CDataManager.Inst.PlayerRecord.SaveUserData(m_name, m_Gender); CLoadingScene.LoadingScene("Lobby"); if (CSoundManager.Inst != null) { CSoundManager.Inst.StopBgm(m_bgmAudio); } }
IEnumerator InitCoroutine() { while (m_dataMgr == null) { m_dataMgr = CDataManager.Inst; yield return(null); } m_boxInfo = m_dataMgr.PlayerRecord.BoxInfo; m_equipmentContainer = m_dataMgr.EquipmentContainer; EquipmentBoxInit(); yield return(null); }
void AddEquipmentInBox(Data.BoxInfo boxInfo) { Data.EquipmentBoxInfo equipInfo = null; for (int i = 0; i < (int)PartsType.WEAPON; i++) { equipInfo = new Data.EquipmentBoxInfo(); equipInfo.partsType = (PartsType)i; equipInfo.index = m_nNotset; boxInfo.equipmentList.Add(equipInfo); } equipInfo = new Data.EquipmentBoxInfo(); equipInfo.partsType = PartsType.WEAPON; equipInfo.index = m_nCurset + 1; boxInfo.equipmentList.Add(equipInfo); }
void UpdateBoxIcon() { if (m_itemBox == null) { return; } for (int i = 0; i < m_boxIcons.Count; i++) { m_boxIcons[i].sprite = m_emptyIcon; } for (int i = 0; i < m_equpmentIcons.Count; i++) { m_equpmentIcons[i].sprite = m_emptyIcon; } //20개당 페이지 갱신 Data.BoxInfo boxInfo = m_itemBox.BoxInfo; if (boxInfo != null) { for (int i = 0; i < boxInfo.itemList.Count; i++) { if (i >= m_boxIcons.Count) { break; } m_boxIcons[i].sprite = boxInfo.itemList[i].item.IconImg; } //16개당 페이지 갱신 for (int i = 0; i < m_itemBox.Equipments.Count; i++) { if (i >= m_equpmentIcons.Count) { break; } CItemBase itemBase = m_itemBox.Equipments[i] as CItemBase; m_equpmentIcons[i].sprite = itemBase.IconImg; } } }