public async Task <ObservableCollection <RAGWAchievements.Result> > GetAchievementsAsync(string id) { string response = await htp.GetStringAsync(String.Format("https://api.rawg.io/api/games/{0}/achievements", id.ToString())); var data = AchievementsModel.FromJson(response); string url = ""; int i = 1; while (data.Next != null) { i++; url = data.Next.AbsoluteUri.Remove(data.Next.AbsoluteUri.Length - 1, 1) + i; try { string _res = await htp.GetStringAsync(url); var _data = AchievementsModel.FromJson(_res); data.Results.AddRange(_data.Results); } catch (Exception) { Achievements = new ObservableCollection <RAGWAchievements.Result>(data.Results.ToList()); return(Achievements); } } //return new ObservableCollection<RAGWAchievements.Result>(data.Results.ToList()); Achievements = new ObservableCollection <RAGWAchievements.Result>(data.Results.ToList()); return(Achievements); }
private void InitAchievements() { XmlNode node = m_pDoc.SelectSingleNode(@"root/achievement"); m_pAchievements = new AchievementsModel(node, this); }
public AchievementController() { _achievementsModel = new AchievementsModel(new AchievementLogic()); }
public AchievementController(AchievementsModel achievementsModel) { _achievementsModel = achievementsModel; }
public Boolean OpenBox(ref String ItemName) { PocketModule pocket = m_pDb.GetPocketModel(); Int32 delta = -1 * Cost; if (pocket.Point.UpdatePoint(delta)) { Int32 TotalWeight = 0; List <AwardItemModel> list = m_pModel.ItemList; foreach (AwardItemModel tmp in list) { TotalWeight += tmp.Weight; } Random r = new Random(); Int32 result = r.Next(TotalWeight); AwardItemModel SelectItem = null; foreach (AwardItemModel tmp in list) { result -= tmp.Weight; if (result <= 0) { SelectItem = tmp; break; } } AchievementsModel achi_model = m_pDb.GetAchievementsModel(); AchievementGroupModel group = achi_model.GetAchievementGroup(ModelParam.AWARD_BOX_ACHIEVEMENT); group.SetProgress(1); Int32 Item_id = SelectItem.ItemId; Int32 Count = SelectItem.Number; if (Item_id >= 0) { ItemModel item = m_pDb.GetItemModel(Item_id); ItemName = item.Description + Count + "个"; List <PocketItemModule> itemlist = pocket.ItemList; foreach (PocketItemModule tmp in itemlist) { if (tmp.Id == Item_id) { tmp.UpdateNumber(Count); } } } else { ItemName = SelectItem.ItemName; } return(true); } else { return(false); } }
public void Generate(GlobalContext context, ControllerCollection controllerCollection, GlobalContainer container) { var model = new AchievementsModel(context.References.Achievements); context.AchievementsModel = model; }
public AchievementController(String userid) { m_pDb = MainDatabaseManager.GetDatabase(userid); m_pModel = m_pDb.GetAchievementsModel(); }