当前位置: 首页>>代码示例>>C#>>正文


C# ObservableCollection.Skip方法代码示例

本文整理汇总了C#中ObservableCollection.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.Skip方法的具体用法?C# ObservableCollection.Skip怎么用?C# ObservableCollection.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObservableCollection的用法示例。


在下文中一共展示了ObservableCollection.Skip方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleCollisions

        public void HandleCollisions(ObservableCollection<IMoveableObject> moveableObjects)
        {
            for (int i = 0; i < moveableObjects.Count; i++)
            {
                IMoveableObject objectA = moveableObjects[i];
                IEnumerable<IMoveableObject> remainingObjects = moveableObjects.Skip(i + 1);
                foreach (IMoveableObject objectB in remainingObjects)
                {
                    double distance = VectorUtils.GetDistance(objectA, objectB);

                    if (distance < objectA.CollisionRadius + objectB.CollisionRadius)
                    {
                        double smallerRadius = Math.Min(objectA.CollisionRadius, objectB.CollisionRadius);
                        double largerRadius = Math.Max(objectA.CollisionRadius, objectB.CollisionRadius);
                        double intersection = smallerRadius - (distance - largerRadius);
                        double angle = AngleUtils.GetAngle(objectA, objectB);
                        Vector offset = VectorUtils.GetVector(intersection / 2.0, angle);
                        objectA.Position += offset;
                        objectB.Position -= offset;

                        Vector resultingVelocityA = GetResultingVelocityFromCollision(objectA, objectB);
                        Vector resultingVelocityB = GetResultingVelocityFromCollision(objectB, objectA);
                        objectA.Velocity = resultingVelocityA;
                        objectB.Velocity = resultingVelocityB;
                    }
                }
            }
        }
开发者ID:TedMANNERs,项目名称:Educatio,代码行数:28,代码来源:PhysicsEngine.cs

示例2: GetData


//.........这里部分代码省略.........
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },
                new Entities.INTERSchema()
                {
                    Title = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Subtitle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
                    Image = "..\\Images\\Logo.png",
                    Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",

                },

            };

            return new ObservableCollection<Entities.INTERSchema>(data.Skip(MaxResults * pageNumber).Take(MaxResults));
        }
开发者ID:jame259167,项目名称:Appswindows,代码行数:101,代码来源:FakeINTER_INTER.cs

示例3: LoadCollectionsFromDatabase

        // Query database and load the collections and list used by the pivot pages.
        public void LoadCollectionsFromDatabase()
        {
            // Specify the query for all to-do items in the database.
            var ImagesItemsInDb = from ImageItem image in ImageDB.NPImages
                                select image;
            Debug.WriteLine("Query Create");

            // Query the database and load all to-do items.
            AllImageItems = new ObservableCollection<ImageItem>(ImagesItemsInDb);
            Debug.WriteLine("Images now in Collection");

            AllFavImages = new ObservableCollection<ImageItem>();

            // Query the database and load all associated items to their respective collections.
            foreach (ImageItem image in ImagesItemsInDb)
            {
                if ((bool)image.IsFav)
                {
                    AllFavImages.Add(image);
                }
            }
            Debug.WriteLine("All Favs Created");

            // Load a list of all categories.
            int AllFavLength = (AllFavImages == null)? 0 : AllFavImages.Count;
            int MaxLength = 8;
            if (AllFavLength > 0)
            {
                if (AllFavLength <= MaxLength)
                    MainFavImages = new ObservableCollection<ImageItem>(AllFavImages.Skip(0).Take(AllFavLength));
                else
                    MainFavImages = new ObservableCollection<ImageItem>(AllFavImages.Skip(0).Take(MaxLength));
            }
            Debug.WriteLine("Main Favs Created");
        }
开发者ID:Sliverb,项目名称:NoraPic,代码行数:36,代码来源:NpDbViewModel.cs

示例4: GetDemosHeader

		public Task<List<Demo>> GetDemosHeader(List<string> folders)
		{
			List<Demo> demos = new List<Demo>();

			for (int i = 0; i < 20; i++)
			{
				ObservableCollection<PlayerExtended> players = new ObservableCollection<PlayerExtended>();
				Random random = new Random();

				ObservableCollection<EntryKillEvent> entryKills = new ObservableCollection<EntryKillEvent>();
				for (int indexEntryKill = 0; indexEntryKill < random.Next(5); indexEntryKill++)
				{
					EntryKillEvent entryKill = new EntryKillEvent(random.Next(7000, 100000))
					{
						KilledName = "killed" + indexEntryKill,
						KilledSteamId = random.Next(8000000),
						KilledTeam = Team.Terrorist,
						KillerName = "killer" + indexEntryKill,
						KillerSteamId = random.Next(800000),
						KillerTeam = Team.CounterTerrorist
					};
					entryKills.Add(entryKill);
				}

				for (int j = 0; j < 10; j++)
				{
					PlayerExtended player = new PlayerExtended
					{
						Name = "player" + (j + 1),
						HeadshotCount = random.Next(14),
						OnekillCount = random.Next(10, 30),
						TwokillCount = random.Next(10, 20),
						ThreekillCount = random.Next(0, 10),
						FourKillCount = random.Next(0, 5),
						FiveKillCount = random.Next(0, 2),
						Clutch1V1Count = random.Next(1),
						Clutch1V2Count = random.Next(1),
						Clutch1V3Count = random.Next(1),
						Clutch1V4Count = random.Next(1),
						Clutch1V5Count = random.Next(1),
						BombDefusedCount = random.Next(0, 2),
						BombPlantedCount = random.Next(0, 2),
						EntryKills = entryKills,
						DeathCount = random.Next(0, 32),
						KillsCount = random.Next(30),
						AssistCount = random.Next(15),
						Score = random.Next(10, 80),
						RoundMvpCount = random.Next(6)
					};

					players.Add(player);
				}

				ObservableCollection<Round> rounds = new ObservableCollection<Round>();
				for (int k = 0; k < 32; k++)
				{
					Round round = new Round
					{
						Number = k + 1,
						OneKillCount = random.Next(5),
						TwoKillCount = random.Next(2),
						ThreeKillCount = random.Next(1),
						FourKillCount = random.Next(1),
						FiveKillCount = random.Next(1),
						EquipementValueTeam1 = random.Next(4200, 30000),
						EquipementValueTeam2 = random.Next(4200, 30000),
						StartMoneyTeam1 = random.Next(4200, 50000),
						StartMoneyTeam2 = random.Next(4200, 50000),
						Tick = random.Next(7000, 100000)
					};

					rounds.Add(round);
				}

				Demo demo = new Demo
				{
					Id = "de_dust25445648778447878",
					Name = "mydemo" + (i + 1) + ".dem",
					Tickrate = 128,
					MapName = "de_dust2",
					ClientName = "localhost",
					Hostname = "local",
					OneKillCount = random.Next(50, 90),
					TwoKillCount = random.Next(20, 50),
					ThreeKillCount = random.Next(10),
					FourKillCount = random.Next(3),
					FiveKillCount = random.Next(1),
					Path = "C:\\mydemo.dem",
					ScoreTeam1 = 16,
					ScoreTeam2 = 6,
					Type = "GOTV",
					Comment = "comment",
					ScoreFirstHalfTeam1 = 10,
					ScoreFirstHalfTeam2 = 5,
					ScoreSecondHalfTeam1 = 6,
					ScoreSecondHalfTeam2 = 1,
					Players = players,
					PlayersTeam1 = new ObservableCollection<PlayerExtended>(players.Take(5)),
					PlayersTeam2 = new ObservableCollection<PlayerExtended>(players.Skip(5).Take(5)),
					MostBombPlantedPlayer = players.ElementAt(random.Next(10)),
//.........这里部分代码省略.........
开发者ID:HaKDMoDz,项目名称:CSGO-Demos-Manager,代码行数:101,代码来源:DemosServiceDesign.cs

示例5: AnalyzeDemo

		public Task<Demo> AnalyzeDemo(Demo demo)
		{
			Random random = new Random();

			ObservableCollection<PlayerExtended> players = new ObservableCollection<PlayerExtended>();
			for (int i = 0; i < 10; i++)
			{
				PlayerExtended player = new PlayerExtended
				{
					Name = "player" + (i + 1),
					HeadshotCount = random.Next(14),
					OnekillCount = random.Next(10, 30),
					TwokillCount = random.Next(10, 20),
					ThreekillCount = random.Next(0, 10),
					FourKillCount = random.Next(0, 5),
					FiveKillCount = random.Next(0, 2),
					Clutch1V1Count = random.Next(1),
					Clutch1V2Count = random.Next(1),
					Clutch1V3Count = random.Next(1),
					Clutch1V4Count = random.Next(1),
					Clutch1V5Count = random.Next(1),
					BombDefusedCount = random.Next(0, 2),
					BombPlantedCount = random.Next(0, 2),
					DeathCount = random.Next(0, 32),
					KillsCount = random.Next(30),
					AssistCount = random.Next(15),
					Score = random.Next(10, 80),
					RoundMvpCount = random.Next(6),
					RankNumberNew = 5,
					RankNumberOld = 4,
					RatingHltv = (float)random.NextDouble(),
					SteamId = random.Next(1000, 800000),
					IsOverwatchBanned = random.Next(100) < 40,
					IsVacBanned = random.Next(100) < 40,
					TeamKillCount = random.Next(0, 1),
					WinCount = random.Next(10, 687)
				};

				players.Add(player);

				ObservableCollection<EntryKillEvent> entryKills = new ObservableCollection<EntryKillEvent>();
				for (int indexEntryKill = 0; indexEntryKill < random.Next(5); indexEntryKill++)
				{
					EntryKillEvent entryKill = new EntryKillEvent(random.Next(7000, 100000))
					{
						Killed = players.ElementAt(random.Next(0, 9)),
						KilledTeam = Team.Terrorist,
						Killer = players.ElementAt(random.Next(0, 9)),
						KillerTeam = Team.CounterTerrorist
					};
					entryKills.Add(entryKill);
				}

				ObservableCollection<OpenKillEvent> openKills = new ObservableCollection<OpenKillEvent>();
				for (int indexOpenKill = 0; indexOpenKill < random.Next(5); indexOpenKill++)
				{
					OpenKillEvent openKill = new OpenKillEvent(random.Next(7000, 100000))
					{
						Killed = players.ElementAt(random.Next(0, 9)),
						KilledTeam = Team.Terrorist,
						Killer = players.ElementAt(random.Next(0, 9)),
						KillerTeam = Team.CounterTerrorist
					};
					openKills.Add(openKill);
				}

				players.Last().EntryKills = entryKills;
				players.Last().OpeningKills = openKills;
			}

			ObservableCollection<TeamExtended> teams = new ObservableCollection<TeamExtended>
			{
				new TeamExtended
				{
					Name = "Team 1",
					Players = new ObservableCollection<PlayerExtended>(players.Take(5))
				},
				new TeamExtended
				{
					Name = "Team 2",
					Players = new ObservableCollection<PlayerExtended>(players.Skip(5).Take(5))
				}
			};

			ObservableCollection<Round> rounds = new ObservableCollection<Round>();
			for (int i = 0; i < 32; i++)
			{
				Round round = new Round
				{
					Number = i + 1,
					OneKillCount = random.Next(5),
					TwoKillCount = random.Next(2),
					ThreeKillCount = random.Next(1),
					FourKillCount = random.Next(1),
					FiveKillCount = random.Next(1),
					EquipementValueTeam1 = random.Next(4200, 30000),
					EquipementValueTeam2 = random.Next(4200, 30000),
					StartMoneyTeam1 = random.Next(4200, 50000),
					StartMoneyTeam2 = random.Next(4200, 50000),
					Tick = random.Next(7000, 100000),
//.........这里部分代码省略.........
开发者ID:Calak,项目名称:CSGO-Demos-Manager,代码行数:101,代码来源:DemosServiceDesign.cs

示例6: FindAlerteDetailByListCleAlerte

        public IQueryable<AlerteDetail> FindAlerteDetailByListCleAlerte(ObservableCollection<int> listCleAlerte)
        {
            int step = 2000;

            if (listCleAlerte.Count > step)
            {
                List<AlerteDetail> alertes = new List<AlerteDetail>();
                int index = 0;
                while (index < listCleAlerte.Count)
                {
                    IEnumerable<int> list = listCleAlerte.Skip(index).Take(step);
                    if (index == 0)
                    {
                        alertes = this.ObjectContext.AlerteDetail.Where(a => list.Contains(a.CleAlerte)).ToList();
                    }
                    else
                    {
                        alertes.AddRange(this.ObjectContext.AlerteDetail.Where(a => list.Contains(a.CleAlerte)).ToList());
                    }
                    index += step;
                }

                return alertes.AsQueryable();
            }
            else
            {
                return this.ObjectContext.AlerteDetail.Where(a => listCleAlerte.Contains(a.CleAlerte));
            }
        }
开发者ID:JeanNguon,项目名称:Projet,代码行数:29,代码来源:ProtecaDomainService.partial.cs

示例7: FindPpsByListCle

        public IQueryable<Pp> FindPpsByListCle(ObservableCollection<int> listClePp)
        {
            int step = 100;

            if (listClePp.Count > step)
            {
                List<Pp> Pps = new List<Pp>();
                int index = 0;
                while (index < listClePp.Count)
                {
                    IEnumerable<int> list = listClePp.Skip(index).Take(step);
                    if (index == 0)
                    {
                        Pps = this.ObjectContext.Pps.Include("PpJumelee").Include("PpJumelee1").Where(a => list.Contains(a.ClePp)).ToList();
                    }
                    else
                    {
                        Pps.AddRange(this.ObjectContext.Pps.Include("PpJumelee").Include("PpJumelee1").Where(a => list.Contains(a.ClePp)).ToList());
                    }
                    index += step;
                }

                return Pps.AsQueryable();
            }
            else
            {
                return this.ObjectContext.Pps.Include("PpJumelee").Include("PpJumelee1")
                                             .Where(a => listClePp.Contains(a.ClePp));
            }
        }
开发者ID:JeanNguon,项目名称:Projet,代码行数:30,代码来源:ProtecaDomainService.partial.cs

示例8: FindEqEquipementsByListCle

        public IQueryable<EqEquipement> FindEqEquipementsByListCle(ObservableCollection<int> listCleEquipement)
        {
            int step = 100;

            if (listCleEquipement.Count > step)
            {
                List<EqEquipement> equipements = new List<EqEquipement>();
                int index = 0;
                while (index < listCleEquipement.Count)
                {
                    IEnumerable<int> list = listCleEquipement.Skip(index).Take(step);
                    if (index == 0)
                    {
                        equipements = this.ObjectContext.EqEquipement
                            .Include("TypeEquipement")
                            .Include("Pp")
                            .Where(a => list.Contains(a.CleEquipement)).ToList();
                    }
                    else
                    {
                        equipements.AddRange(this.ObjectContext.EqEquipement
                            .Include("TypeEquipement")
                            .Include("Pp")
                            .Where(a => list.Contains(a.CleEquipement)).ToList());
                    }
                    index += step;
                }

                return equipements.AsQueryable();
            }
            else
            {
                return this.ObjectContext.EqEquipement
                            .Include("TypeEquipement")
                            .Include("Pp")
                            .Where(a => listCleEquipement.Contains(a.CleEquipement));
            }
        }
开发者ID:JeanNguon,项目名称:Projet,代码行数:38,代码来源:ProtecaDomainService.partial.cs

示例9: AnalyzeDemo

		public Task<Demo> AnalyzeDemo(Demo demo, CancellationToken token)
		{
			Random random = new Random();

			ObservableCollection<PlayerExtended> players = new ObservableCollection<PlayerExtended>();
			for (int i = 0; i < 10; i++)
			{
				PlayerExtended player = new PlayerExtended
				{
					Name = "player" + (i + 1),
					HeadshotCount = random.Next(14),
					OnekillCount = random.Next(10, 30),
					TwokillCount = random.Next(10, 20),
					ThreekillCount = random.Next(0, 10),
					FourKillCount = random.Next(0, 5),
					FiveKillCount = random.Next(0, 2),
					Clutch1V1Count = random.Next(1),
					Clutch1V2Count = random.Next(1),
					Clutch1V3Count = random.Next(1),
					Clutch1V4Count = random.Next(1),
					Clutch1V5Count = random.Next(1),
					BombDefusedCount = random.Next(0, 2),
					BombPlantedCount = random.Next(0, 2),
					DeathCount = random.Next(0, 32),
					KillsCount = random.Next(30),
					AssistCount = random.Next(15),
					Score = random.Next(10, 80),
					RoundMvpCount = random.Next(6),
					RankNumberNew = 5,
					RankNumberOld = 4,
					RatingHltv = (float)random.NextDouble(),
					SteamId = random.Next(1000, 800000),
					IsOverwatchBanned = random.Next(100) < 40,
					IsVacBanned = random.Next(100) < 40,
					TeamKillCount = random.Next(0, 1),
					WinCount = random.Next(10, 687),
					MolotovThrownCount = random.Next(0, 10),
					DecoyThrownCount = random.Next(0, 10),
					IncendiaryThrownCount = random.Next(20),
					SmokeThrownCount = random.Next(20),
					FlashbangThrownCount = random.Next(20),
					HeGrenadeThrownCount = random.Next(20),
					BombExplodedCount = random.Next(5),
					AvatarUrl = string.Empty,
					ClutchCount = random.Next(5),
					ClutchLostCount = random.Next(5),
					KillDeathRatio = (decimal)random.NextDouble(),
					MatchCount = random.Next(100),
					OpponentClutchCount = random.Next(5),
					RoundPlayedCount = random.Next(100)
				};

				players.Add(player);
			}
			TeamExtended teamT = new TeamExtended
			{
				Name = "Team 1",
				Players = new ObservableCollection<PlayerExtended>(players.Take(5))
			};
			TeamExtended teamCt = new TeamExtended
			{
				Name = "Team 2",
				Players = new ObservableCollection<PlayerExtended>(players.Skip(5).Take(5))
			};

			ObservableCollection<Round> rounds = new ObservableCollection<Round>();
			for (int i = 0; i < 32; i++)
			{
				ObservableCollection<KillEvent> kills = new ObservableCollection<KillEvent>();
				for (int j = 0; j < random.Next(1, 9); j++)
				{
					PlayerExtended killer = players.ElementAt(random.Next(9));
					PlayerExtended killed = players.ElementAt(random.Next(9));
					kills.Add(new KillEvent(random.Next(1, 10000), random.Next(1, 100))
					{
						KillerName = killer.Name,
						KillerSteamId = killer.SteamId,
						KillerSide = killer.Side,
						KilledName = killed.Name,
						KilledSteamId = killed.SteamId,
						KilledSide = killed.Side,
						RoundNumber = i,
						Weapon = Weapon.WeaponList.ElementAt(random.Next(44))
					});
				}

				// generate open / entry kills for this round
				Round round = new Round
				{
					Number = i + 1,
					OneKillCount = random.Next(5),
					TwoKillCount = random.Next(2),
					ThreeKillCount = random.Next(1),
					FourKillCount = random.Next(1),
					FiveKillCount = random.Next(1),
					EquipementValueTeam1 = random.Next(4200, 30000),
					EquipementValueTeam2 = random.Next(4200, 30000),
					StartMoneyTeam1 = random.Next(4200, 50000),
					StartMoneyTeam2 = random.Next(4200, 50000),
					Tick = random.Next(7000, 100000),
//.........这里部分代码省略.........
开发者ID:green-s,项目名称:CSGO-Demos-Manager,代码行数:101,代码来源:DemosServiceDesign.cs


注:本文中的ObservableCollection.Skip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。