public static async Task Initialize() { var response = await RestHelper.GetRequestAsync("api/Assets/heroes"); Heroes = RestHelper.ConvertJsonToObject <List <Models.DatabaseModels.Hero> >(response.Content); if (Heroes != null && Heroes?.Count != 0) { await LocalPlayerData.SaveLocalData(Heroes, "heroes-asset-data.json"); } else { Heroes = await LocalPlayerData.LoadLocalData <List <Models.DatabaseModels.Hero> >("heroes-asset-data.json"); } }
public static async Task Initialize() { var response = await RestHelper.GetRequestAsync("api/Assets/monsters"); Monsters = RestHelper.ConvertJsonToObject <List <Models.DatabaseModels.Monster> >(response.Content); if (Monsters != null && Monsters?.Count != 0) { await LocalPlayerData.SaveLocalData(Monsters, "monsters-asset-data.json"); } else { Monsters = await LocalPlayerData.LoadLocalData <List <Models.DatabaseModels.Monster> >("monsters-asset-data.json"); } }
public static async Task Initialize() { NormalScenes = await LocalPlayerData.LoadLocalData <List <Models.DatabaseModels.Scene> >("normal-scenes-asset-data.json"); if (NormalScenes == null || NormalScenes?.Count == 0) { var response = await RestHelper.GetRequestAsync("api/Assets/scenes"); NormalScenes = RestHelper.ConvertJsonToObject <List <Models.DatabaseModels.Scene> >(response.Content); if (NormalScenes != null && NormalScenes?.Count != 0) { await LocalPlayerData.SaveLocalData(NormalScenes, "normal-scenes-asset-data.json"); } else { NormalScenes = await LocalPlayerData.LoadLocalData <List <Models.DatabaseModels.Scene> >("normal-scenes-asset-data.json"); } } }