Exemple #1
0
    public void Initialized(CUnit unit)
    {
        CDataManager dataMgr = CDataManager.Inst;

        if (dataMgr == null)
        {
            return;
        }

        m_inventoryInfo = dataMgr.PlayerRecord.InventoryInfo;

        m_unit       = unit;
        m_actionCtrl = unit.GetComponent <CActionCtrl>();

        if (m_unit == null)
        {
            return;
        }

        // 장비 아이템을 장착
        InitSlot();
        InitWeaponSlot(dataMgr);

        m_wearableMgr.Init(m_actionCtrl.Anim.gameObject, m_inventoryInfo);
        m_unit.Status.ResisterSet(m_wearableMgr.TotalResister);
    }
Exemple #2
0
    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);
        }
    }
Exemple #3
0
    public void Init(GameObject wearTarget, Data.InventoryInfo inventoryInfo)
    {
        m_wearTarget    = wearTarget;
        m_inventoryInfo = inventoryInfo;

        InitEquip();
    }
Exemple #4
0
    void EquipmentSet(Data.InventoryInfo inventoryInfo)
    {
        inventoryInfo.curArmIdx  = m_nCurset;
        inventoryInfo.curBodyIdx = m_nCurset;
        inventoryInfo.curLegIdx  = m_nCurset;
        inventoryInfo.curHeadIdx = m_nCurset;

        inventoryInfo.curWeaponIdx = 1;
        inventoryInfo.subWeaponIdx = m_nNotset + 1;
    }
        public void SaveInventoryInfo(InventoryInfo inventoryInfo)
        {
            m_inventoryInfo = inventoryInfo;

            XmlDocument document = new XmlDocument();

            document.AppendChild(document.CreateXmlDeclaration("1.0", "utf-8", "yes"));

            XmlNode root = document.CreateNode(XmlNodeType.Element, "Inventory", string.Empty);

            document.AppendChild(root);

            #region ItemSave

            XmlNode items = document.CreateNode(XmlNodeType.Element, "Items", string.Empty);
            root.AppendChild(items);

            if (inventoryInfo.itemList == null)
            {
                return;
            }

            for (int i = 0; i < inventoryInfo.itemList.Count; i++)
            {
                if (inventoryInfo.itemList[i] == null || inventoryInfo.itemList[i].item == null)
                {
                    continue;
                }

                XmlNode item = document.CreateNode(XmlNodeType.Element, "Item", string.Empty);
                items.AppendChild(item);

                XmlElement index = document.CreateElement("index");
                index.InnerText = inventoryInfo.itemList[i].item.ItemIdx.ToString();
                item.AppendChild(index);

                XmlElement count = document.CreateElement("count");
                count.InnerText = inventoryInfo.itemList[i].count.ToString();
                item.AppendChild(count);
            }

            #endregion

            #region SpellSave
            XmlNode spells = document.CreateNode(XmlNodeType.Element, "Spells", string.Empty);
            root.AppendChild(spells);

            if (inventoryInfo.spellList == null)
            {
                return;
            }

            for (int i = 0; i < inventoryInfo.spellList.Count; i++)
            {
                if (inventoryInfo.spellList[i] == null)
                {
                    continue;
                }

                XmlNode item = document.CreateNode(XmlNodeType.Element, "Spell", string.Empty);
                spells.AppendChild(item);

                XmlElement index = document.CreateElement("index");
                index.InnerText = inventoryInfo.spellList[i].item.ItemIdx.ToString();
                item.AppendChild(index);

                XmlElement count = document.CreateElement("count");
                count.InnerText = inventoryInfo.spellList[i].count.ToString();
                item.AppendChild(count);
            }
            #endregion

            #region EqiupsSave

            XmlNode equips = document.CreateNode(XmlNodeType.Element, "Equips", string.Empty);
            root.AppendChild(equips);

            XmlElement weapon = document.CreateElement("Weapon");
            weapon.InnerText = inventoryInfo.curWeaponIdx.ToString();
            equips.AppendChild(weapon);

            XmlElement subWeapon = document.CreateElement("SubWeapon");
            subWeapon.InnerText = inventoryInfo.subWeaponIdx.ToString();
            equips.AppendChild(subWeapon);

            XmlElement body = document.CreateElement("Body");
            body.InnerText = inventoryInfo.curBodyIdx.ToString();
            equips.AppendChild(body);

            XmlElement leg = document.CreateElement("Leg");
            leg.InnerText = inventoryInfo.curLegIdx.ToString();
            equips.AppendChild(leg);

            XmlElement arm = document.CreateElement("Arm");
            arm.InnerText = inventoryInfo.curArmIdx.ToString();
            equips.AppendChild(arm);

            XmlElement head = document.CreateElement("Head");
            head.InnerText = inventoryInfo.curHeadIdx.ToString();
            equips.AppendChild(head);

            #endregion
            //document.Save("./Assets/Resources/Data/Inventory.xml");
            File.WriteAllText(Application.streamingAssetsPath + "/Data/Inventory.xml", document.OuterXml);
        }