private void FillWithTestCatalog() { string file = "TestCatalog.json"; var catalogJson = File.ReadAllText(TestAssetsUtils.GetPathRaw() + $"/Avatar/{file}"); //Utils.GetTestAssetPath returns an URI not compatible with the really convenient File.ReadAllText list = Newtonsoft.Json.JsonConvert.DeserializeObject <WearableItemDummy[]>(catalogJson).ToList(); // JsonUtility cannot deserialize jsons whose root is an array }
public static AvatarModel GetTestAvatarModel(string name, string fileName) { var avatarjson = File.ReadAllText(TestAssetsUtils.GetPathRaw() + "/Avatar/" + fileName); AvatarModel model = JsonUtility.FromJson <AvatarModel>(avatarjson); model.name = name; return(model); }
public static void CreateTestSmartItemCatalogLocalSingleObject() { AssetCatalogBridge.i.ClearCatalog(); string jsonPath = TestAssetsUtils.GetPathRaw() + "/BuilderInWorldCatalog/smartItemSceneObjectCatalog.json"; if (File.Exists(jsonPath)) { string jsonValue = File.ReadAllText(jsonPath); AssetCatalogBridge.i.AddFullSceneObjectCatalog(jsonValue); } }
public static void CreateTestCatalogLocalMultipleFloorObjects() { AssetCatalogBridge.i.ClearCatalog(); string jsonPath = TestAssetsUtils.GetPathRaw() + "/BuilderInWorldCatalog/multipleSceneObjectsCatalog.json"; if (File.Exists(jsonPath)) { string jsonValue = File.ReadAllText(jsonPath); AssetCatalogBridge.i.AddFullSceneObjectCatalog(jsonValue); } }
public static void CreateNFT() { string jsonPath = TestAssetsUtils.GetPathRaw() + "/BuilderInWorldCatalog/nftAsset.json"; if (File.Exists(jsonPath)) { string jsonValue = File.ReadAllText(jsonPath); NFTOwner owner = NFTOwner.defaultNFTOwner; owner.assets.Add(JsonUtility.FromJson <NFTInfo>(jsonValue)); BIWNFTController.i.NftsFeteched(owner); } }