public void addAllPlayer(StringGroup pList) { uiPlayerList.Dispatcher.Invoke(() => { uiPlayerList.ItemsSource = null; var cache = pList.ToStringGroup(); foreach (string item in cache) { gm.gamePlayerList.Add(new Player { PlayerIPAddress = item }); } uiPlayerList.ItemsSource = gm.gamePlayerList; }); }
public void inputPlayerData(StringGroup input) { var cache = input.ToStringGroup(); foreach (Player item in gm.gamePlayerList) { if (item.PlayerName == cache[4]) { item.NowLife = cache[1]; item.NowTime = cache[0]; item.NowUnit = cache[2]; //压入成就宣布队列 if (cache[4] != "") { prizeLine.Enqueue(new PrizeStructure { PlayerName = cache[3], PrizeName = cache[4] }); } return; } } //刷新 this.FlushPlayerList(); }
public void allPlayerData(StringGroup data) { //split player var playerSplit = data.ToStringGroup(); //先取出组信息 var groupMsg = new StringGroup(playerSplit[0], "#").ToStringGroup(); if (groupMsg[0] == gm.ms.TeamAName) { uiTeamAMark.Dispatcher.Invoke(() => { uiTeamAMark.Text = groupMsg[1]; }); uiTeamBMark.Dispatcher.Invoke(() => { uiTeamBMark.Text = groupMsg[4]; }); uiTeamAPP.Dispatcher.Invoke(() => { uiTeamAPP.Text = groupMsg[2]; }); uiTeamBPP.Dispatcher.Invoke(() => { uiTeamBPP.Text = groupMsg[5]; }); } else { uiTeamAMark.Dispatcher.Invoke(() => { uiTeamAMark.Text = groupMsg[4]; }); uiTeamBMark.Dispatcher.Invoke(() => { uiTeamBMark.Text = groupMsg[1]; }); uiTeamAPP.Dispatcher.Invoke(() => { uiTeamAPP.Text = groupMsg[5]; }); uiTeamBPP.Dispatcher.Invoke(() => { uiTeamBPP.Text = groupMsg[2]; }); } int index = 0; foreach (string item in playerSplit) { if (index == 0) { index++; continue; } //split data var dataSplit = new StringGroup(item, "#").ToStringGroup(); //process untiData var cache1 = new StringGroup(dataSplit[0], "@").ToStringGroup(); var unitData = new List<PlayerUnitData>(); foreach (string item2 in cache1) { var cache2 = new StringGroup(item2, "%").ToStringGroup(); unitData.Add(new PlayerUnitData { Unit = cache2[3], Mark = cache2[0], Life = cache2[1], PerfomancePoint = cache2[2] }); } foreach (Player item3 in gm.gamePlayerList) { if (item3.PlayerName == dataSplit[4]) { item3.PlayerUnitPrize = unitData; item3.FinallyMark = dataSplit[1]; item3.FinallyPP = dataSplit[2]; item3.FinallyPrize = dataSplit[3]; } } index++; } //input to list var teamAList = new List<Player>(); var teamBList = new List<Player>(); var result = from i in gm.gamePlayerList where i.PlayerGroupName != "" group i by i.PlayerGroupName; foreach (IGrouping<string, Player> item in result) { if (item.Key == gm.ms.TeamAName) { foreach (Player item2 in item) { teamAList.Add(item2); } } else { foreach (Player item2 in item) { teamBList.Add(item2); } } } //show uiTeamAList.Dispatcher.Invoke(() => { uiTeamAList.ItemsSource = teamAList;}); uiTeamBList.Dispatcher.Invoke(() => { uiTeamBList.ItemsSource = teamBList; }); uiNewPlay.Dispatcher.Invoke(() => { uiNewPlay.IsEnabled = true; }); uiExit.Dispatcher.Invoke(() => { uiExit.IsEnabled = true;}); }
public void addPlayerInformation(StringGroup playerInfo) { var cache1 = playerInfo.ToStringGroup(); List<string> cache2 = new StringGroup(cache1[5], "#").ToList(); List<string> cache3 = new StringGroup(cache1[7], "#").ToList(); //add to core foreach (Player item in gm.gamePlayerList) { if (item.PlayerIPAddress == cache1[10]) { item.PlayerName = cache1[0]; item.ModList = cache3; item.BackgroundName = cache1[8]; item.BGMName = cache1[9]; item.DutyUnit = cache2; item.PlayerGroupName = cache1[6]; } } if (gm.ms.MapName == "") { gm.ms.MapName = cache1[1]; gm.ms.MapMD5 = cache1[2]; gm.ms.GameMode = cache1[4]; gm.ms.CountMode = cache1[3]; } //add team if (gm.ms.TeamAName == "") { gm.ms.TeamAName = cache1[6]; uiTeamAName.Dispatcher.Invoke(() => { uiTeamAName.Text = cache1[6]; }); } else if (gm.ms.TeamBName == "") { gm.ms.TeamBName = cache1[6]; uiTeamBName.Dispatcher.Invoke(() => { uiTeamBName.Text = cache1[6]; }); } else { } //add to ui uiGameMapName.Dispatcher.Invoke(() => { if (uiGameMapName.Text == "") { uiGameMapName.Text = cache1[1]; } }); uiGameMode.Dispatcher.Invoke(() => { if (uiGameMode.Text == "") { switch (cache1[4]) { case BallanceOnline.Const.GameMode.RankedRace: uiGameMode.Text = "排位赛"; break; case BallanceOnline.Const.GameMode.RelayRace: uiGameMode.Text = "接力赛"; break; } } }); uiGameRule.Dispatcher.Invoke(() => { if (uiGameRule.Text == "") { switch (cache1[3]) { case BallanceOnline.Const.CountMode.HighScore: uiGameRule.Text = "HS"; break; case BallanceOnline.Const.CountMode.SpeedRun: uiGameRule.Text = "SR"; break; case BallanceOnline.Const.CountMode.CrazyHighScore: uiGameRule.Text = "疯狂HS"; break; case BallanceOnline.Const.CountMode.CrazySpeedRun: uiGameRule.Text = "疯狂SR"; break; } } }); //show player var playerSplit = from item in gm.gamePlayerList where item.PlayerGroupName != "" group item by item.PlayerGroupName; foreach (var item in playerSplit) { if (item.Key == gm.ms.TeamAName) { uiTeamAList.Dispatcher.Invoke(() => { uiTeamAList.ItemsSource = item.ToList<Player>();}); } else { uiTeamBList.Dispatcher.Invoke(() => { uiTeamBList.ItemsSource = item.ToList<Player>();}); } } }