예제 #1
0
        private async Task <SCCMListPresenter.LoadFuncResult> QueryData(SCCMListPresenter list, int page, int reqid)
        {
            try
            {
                var r = await MainGame.Inst.Backend.QueryUserLevel(MainGame.Inst.Profile, QueryUserLevelCategory.NewLevels, string.Empty, page);

                if (r == null)
                {
                    return(SCCMListPresenter.LoadFuncResult.Error);
                }
                else
                {
                    if (r.Count == 0)
                    {
                        return(SCCMListPresenter.LoadFuncResult.LastPage);
                    }
                    else
                    {
                        MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                        {
                            if (list.IsCurrentRequest(reqid))
                            {
                                foreach (var levelmeta in r)
                                {
                                    list.AddEntry(new SCCMListElementOnlinePlayable(levelmeta));
                                }
                            }
                        });

                        return(SCCMListPresenter.LoadFuncResult.Success);
                    }
                }
            }
            catch (Exception e)
            {
                SAMLog.Error("SCCMTN::QD", e);

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                    {
                        L10NText   = L10NImpl.STR_CPP_COMERR,
                        TextColor  = FlatColors.Clouds,
                        Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),

                        CloseOnClick = true,
                    }, true);
                });

                return(SCCMListPresenter.LoadFuncResult.Error);
            }
        }