void Start() { var gOb = gameObject.GetComponent <PlayerObjectLoadController>(); gOb.initLoad(); //所持データ possessionData = GameObject.Find("possessionData").GetComponent <PossessionBaseController>().possessionData; //STATEの初期化 state = STATE.初期読み込み_設定; }
public void PossesionDataMake() { possessionData = new PossessionData(); possessionData.layraEquipList = new EquipmentData[ConstantList.WEAPON_TOTAL_NUM]; possessionData.ericeEquipList = new EquipmentData[ConstantList.WEAPON_TOTAL_NUM]; possessionData.ItemList = new ItemData[ConstantList.ITEM_TOTAL_NUM]; var maney = GameObject.Find("PossesionData/maney"); possessionData.Maney = Convert.ToInt32(maney.GetComponent <Text>().text); for (int i = 0; i < ConstantList.WEAPON_TOTAL_NUM; i++) { equipmentData = new EquipmentData(); //jsonファイルからデシリアイズして各EquipmentDataのデータを登録するためにまたjsonに戻す textAsset = Resources.Load <TextAsset>("Data/Json/Equipment/layra/" + i); JsonUtility.FromJsonOverwrite(textAsset.text, equipmentData); possessionData.layraEquipList[i] = equipmentData; } for (int i = 0; i < ConstantList.WEAPON_TOTAL_NUM; i++) { equipmentData = new EquipmentData(); //jsonファイルからデシリアイズして各EquipmentDataのデータを登録するためにまたjsonに戻す textAsset = Resources.Load <TextAsset>("Data/Json/Equipment/erice/" + i); JsonUtility.FromJsonOverwrite(textAsset.text, equipmentData); possessionData.ericeEquipList[i] = equipmentData; } for (int i = 0; i < ConstantList.ITEM_TOTAL_NUM; i++) { ItemData = new ItemData(); //jsonファイルからデシリアイズして各EquipmentDataのデータを登録するためにまたjsonに戻す textAsset = Resources.Load <TextAsset>("Data/Json/Item/" + i); JsonUtility.FromJsonOverwrite(textAsset.text, ItemData); possessionData.ItemList[i] = ItemData; } string json = JsonUtility.ToJson(possessionData); File.WriteAllText("Assets\\Resources\\Data\\Json\\InitializeData\\Possession\\possession.json", json); }