public void Init(MLot mlot, VLot vlot) { _MLot = mlot; _VLot = vlot; #region 数据检测 if (mlot.Cfg.Count < 1) { mlot.Cfg.Count = 1; } if (mlot.Cfg.ColCount < 1 || mlot.Cfg.ColCount > 9) { mlot.Cfg.ColCount = 1; } if (mlot.Cfg.RowCount < 1 || mlot.Cfg.RowCount > 9) { mlot.Cfg.RowCount = 1; } if (mlot.Cfg.Speed < 1 || mlot.Cfg.Speed > 100) { mlot.Cfg.Speed = 10; } #endregion _Items = mlot.Nodes[0].Items; _Rounds = mlot.Nodes[0].Rounds; _Result = new Item[mlot.Cfg.ColCount * mlot.Cfg.RowCount]; _Random = new Random(); _Time = new DispatcherTimer(); _Time.Interval = new TimeSpan(0, 0, 0, 0, 1000 / mlot.Cfg.Speed); _Time.Tick += new EventHandler(Time_Tick); }
private MLot GenM(string key) { _MLot = new MLot(); WebClient client = new WebClient(); client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCompleted); client.DownloadStringAsync(new Uri("/l.ashx", UriKind.Relative)); LotCfg cfg = new LotCfg(); cfg.RowCount = 3; cfg.ColCount = 1; cfg.Speed = 30; _MLot.Cfg = cfg; LotFav fav = new LotFav(); fav.BackgroundImage = "/demo.jpg"; fav.Run = System.Windows.Input.Key.R; fav.AmonMe = System.Windows.Input.Key.Space; fav.KeepOn = System.Windows.Input.Key.Enter; fav.End = System.Windows.Input.Key.S; _MLot.Fav = fav; return _MLot; }