示例#1
0
        private void SetState(string evt, byte[] body)
        {
            var data = new VMEODFNewspaperData(body);

            int bonusSkill = -1;

            for (int i = 0; i < 8; i++)
            {
                var skill = data.Points.Where(x => x.Skilltype == i).ToList();
                var now   = skill.LastOrDefault() ?? new VMEODFNewspaperPoint()
                {
                    Skilltype = i, Multiplier = 1
                };
                if (i == 0)
                {
                    GraphTab.SetDate(now.Day);
                }
                var last = (skill.Count > 1) ? skill[skill.Count - 2] : now;
                BarGraphs[i].Percent = now.Multiplier;
                BarGraphs[i].Bonus   = (now.Flags & 1) > 0;
                if (BarGraphs[i].Bonus)
                {
                    bonusSkill = i;
                }
                BarGraphs[i].Difference = now.Multiplier - last.Multiplier;
            }

            GraphTab.Graph.Populate(data.Points);
            FrontTab.Populate(data.News, bonusSkill);
        }
示例#2
0
        public void GetDynPayouts(VMAsyncNewspaperCallback callback)
        {
            Host.InBackground(() =>
            {
                var data = new VMEODFNewspaperData();
                using (var db = DAFactory.Get())
                {
                    var days      = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalDays;
                    var limitdays = days - 7;
                    var history   = db.DynPayouts.GetPayoutHistory(limitdays);

                    var result = new List <VMEODFNewspaperPoint>();
                    foreach (var p in history)
                    {
                        result.Add(new VMEODFNewspaperPoint()
                        {
                            Day        = p.day,
                            Skilltype  = p.skilltype,
                            Multiplier = p.multiplier,
                            Flags      = p.flags
                        });
                    }
                    data.Points = result.OrderBy(x => x.Day).ToList();

                    var evts  = db.Events.GetLatestNameDesc(7);
                    data.News = evts.Select(x => new VMEODFNewspaperNews()
                    {
                        ID          = x.event_id,
                        Name        = x.title,
                        Description = x.description,
                        StartDate   = x.start_day.Ticks,
                        EndDate     = (x.type == Database.DA.DbEvents.DbEventType.mail_only)?x.start_day.Ticks:x.end_day.Ticks
                    }).ToList();

                    callback(data);
                }
            });
        }