public void Init() { //아이템 순서 고정 l_itemEquip = new List <cItem_equip>(); l_itemUse = new List <cItem_use>(); for (byte i = 0; i < 3; i++) { cItem pUse; citemTable.GetItemInfo(out pUse, i); l_itemUse.Add((cItem_use)pUse); } l_itemEtc = new List <cItem_etc>(); money = new cGold(); rock = new cRock(); dia = new cDia(); jewerly = new List <cJewerly>(); for (byte i = 0; i < 5; i++) { jewerly.Add(new cJewerly()); } soul = new List <cSoul>(); for (byte i = 0; i < 4; i++) { soul.Add(new cSoul()); } }
//데이터 동기화 public void SyncData() { money = new cGold(); rock = new cRock(); dia = new cDia(); jewerly = new cJewerly[inventory.GetJewerly().Count]; for (byte i = 0; i < jewerly.Length; i++) { jewerly[i] = new cJewerly(); } soul = new cSoul[inventory.GetSoul().Count]; for (byte i = 0; i < soul.Length; i++) { soul[i] = new cSoul(); } money.value = inventory.GetMoney().value; rock.value = inventory.GetRock().value; dia.value = inventory.GetDia().value; for (byte i = 0; i < jewerly.Length; i++) { jewerly[i].value = inventory.GetJewerly()[i].value; } for (byte i = 0; i < soul.Length; i++) { soul[i].value = inventory.GetSoul()[i].value; } item_equip = new cItem_equip[inventory.GetItemEquip().Count]; for (byte i = 0; i < inventory.GetItemEquip().Count; i++) { item_equip[i] = new cItem_equip(inventory.GetItemEquip()[i]); } item_use = new cItem_use[inventory.GetItemUse().Count]; for (byte i = 0; i < inventory.GetItemUse().Count; i++) { item_use[i] = new cItem_use(inventory.GetItemUse()[i]); } item_etc = new cItem_etc[inventory.GetItemEtc().Count]; for (byte i = 0; i < inventory.GetItemEtc().Count; i++) { item_etc[i] = new cItem_etc(inventory.GetItemEtc()[i]); } }
public void LoadUserData() { bool _fileExist = true; string fileDir = Application.persistentDataPath + "/Saves"; System.IO.DirectoryInfo _dr = new System.IO.DirectoryInfo(fileDir); if (_dr.Exists == false) { _dr.Create(); } cSaveLoad.LoadData <cPlayerInfo>(saveString, ref _fileExist); //생성된 데이터가 없을 때 if (_fileExist == false) { //재화 초기화 cGold money = new cGold(); cRock rock = new cRock(); cDia dia = new cDia(); cJewerly[] jewerly = new cJewerly[5]; for (byte i = 0; i < jewerly.Length; i++) { jewerly[i] = new cJewerly(); } cSoul[] soul = new cSoul[4]; for (byte i = 0; i < soul.Length; i++) { soul[i] = new cSoul(); } //무기 레벨 초기화 cProperty axeLevel = new cProperty("AxeLevel", 1); cAxe tAxe = new cAxe(cWeaponTable.GetAxeInfo(axeLevel)); //스킬레벨 초기화 byte[] skillLevel = new byte[4]; for (byte i = 0; i < 4; i++) { skillLevel[i] = 3; } //점령지 점령 여부 초기화 bool[] flaged = new bool[15]; for (byte i = 0; i < flaged.Length; i++) { flaged[i] = false; } //보스 점령 여부 초기화 bool[] bossDone = new bool[5]; for (byte i = 0; i < bossDone.Length; i++) { bossDone[i] = false; } //퀵슬롯 아이템 넘버 초기화 short[] quickSlotItemNum = new short[4]; for (byte i = 0; i < 4; i++) { quickSlotItemNum[i] = -1; } //보석상점 가격 초기화 cJewerly[] pPrevStorePrice = new cJewerly[5]; cJewerly[] pAvStorePrice = new cJewerly[5]; cJewerly[] pCurStorePrice = new cJewerly[5]; for (byte i = 0; i < 5; i++) { pPrevStorePrice[i] = new cJewerly("보석", i * 1000 + 100); pAvStorePrice[i] = new cJewerly("보석", i * 1000 + 100); pCurStorePrice[i] = new cJewerly("보석", i * 1000 + 100); } cProperty pClothCoupon = new cProperty("clothCoupon", 0); bool[] pMyWeaponsId = new bool[15]; for (byte i = 0; i < pMyWeaponsId.Length; i++) { pMyWeaponsId[i] = true; } pMyWeaponsId[0] = true; pMyWeaponsId[1] = true; pMyWeaponsId[2] = true; byte pCurWeaponId = 0; bool[] pMyClothesId = new bool[17]; for (byte i = 0; i < pMyClothesId.Length; i++) { pMyClothesId[i] = true; } pMyClothesId[0] = true; pMyClothesId[1] = true; pMyClothesId[2] = true; byte pCurClothId = 0; _playerInfo = new cPlayerInfo("이름입니다.", tAxe, skillLevel, flaged, bossDone, quickSlotItemNum, this.GetComponent <cInventory>(), money, rock, dia, jewerly, soul, pPrevStorePrice, pAvStorePrice, pCurStorePrice, pClothCoupon, pMyWeaponsId, pCurWeaponId, pMyClothesId, pCurClothId); SaveUserData(); Debug.Log("Initialized Done - CreatedInitData"); } //기존 데이터가 있으면.. else { _playerInfo = new cPlayerInfo(cSaveLoad.LoadData <cPlayerInfo>(saveString), this.GetComponent <cInventory>()); Debug.Log("Initialized Done - Data Exists"); } }
public cPlayerInfo(string pNickName, cAxe pAxe, byte[] pSkillLevel, bool[] pFlaged, bool[] pBossDone, short[] pQuickSlotItemNum, cInventory pInventory, cGold pMoney, cRock pRock, cDia pDia, cJewerly[] pJewerly, cSoul[] pSoul, cJewerly[] pPrevStorePrice, cJewerly[] pAvStorePrice, cJewerly[] pCurStorePrice, cProperty pClothCoupon, bool[] pMyWeaponsId, byte pCurWeaponId, bool[] pMyClothesId, byte pCurClothId, cItem_equip[] pItem_equip = null, cItem_use[] pItem_use = null, cItem_etc[] pItem_etc = null) { clothCoupon = new cProperty("clothCoupon", pClothCoupon.value); myWeaponsId = new bool[pMyWeaponsId.Length]; for (byte i = 0; i < pMyWeaponsId.Length; i++) { myWeaponsId[i] = pMyWeaponsId[i]; } curWeaponId = pCurWeaponId; myClothesId = new bool[pMyClothesId.Length]; for (byte i = 0; i < pMyClothesId.Length; i++) { myClothesId[i] = pMyClothesId[i]; } curClothId = pCurClothId; prevStorePrice = new cJewerly[5]; avStorePrice = new cJewerly[5]; curStorePrice = new cJewerly[5]; for (byte i = 0; i < 5; i++) { prevStorePrice[i] = new cJewerly(pPrevStorePrice[i]._name, pPrevStorePrice[i].value); avStorePrice[i] = new cJewerly(pAvStorePrice[i]._name, pAvStorePrice[i].value); curStorePrice[i] = new cJewerly(pCurStorePrice[i]._name, pCurStorePrice[i].value); } weapon = new cAxe(pAxe); skillLevel = new byte[4]; for (byte i = 0; i < skillLevel.Length; i++) { skillLevel[i] = pSkillLevel[i]; } flaged = new bool[15]; for (byte i = 0; i < flaged.Length; i++) { flaged[i] = pFlaged[i]; } bossDone = new bool[5]; for (byte i = 0; i < bossDone.Length; i++) { bossDone[i] = pBossDone[i]; } quickSlotItemNum = new short[4]; for (byte i = 0; i < quickSlotItemNum.Length; i++) { quickSlotItemNum[i] = pQuickSlotItemNum[i]; } inventory = pInventory; inventory.Init(); nickName = pNickName; inventory.GetMoney().value = pMoney.value; inventory.GetRock().value = pRock.value; inventory.GetDia().value = pDia.value; for (byte i = 0; i < pJewerly.Length; i++) { inventory.GetJewerly()[i].value = pJewerly[i].value; } for (byte i = 0; i < pSoul.Length; i++) { inventory.GetSoul()[i].value = pSoul[i].value; } if (pItem_equip != null) { for (byte i = 0; i < pItem_equip.Length; i++) { inventory.GetItemEquip().Add(pItem_equip[i]); } } if (pItem_use != null) { for (byte i = 0; i < pItem_use.Length; i++) { inventory.GetItemUse().Add(pItem_use[i]); } } if (pItem_etc != null) { for (byte i = 0; i < pItem_use.Length; i++) { inventory.GetItemEtc().Add(pItem_etc[i]); } } }