public static Player CreateBot(BotType type, List <Player> players) { Player bot = new Player(null); bot.Data = new PlayerData(); bot.Data.Id = IdMgr.GetNewPlayerId(); String name = BotNameAccessor.GetBotName(type); if (players.Exists(p => p.Data.Name.Equals(name))) { Random rand = new Random(Environment.TickCount); bot.Data.PlayerColor = Color.FromRgb((byte)rand.Next(255), (byte)rand.Next(255), (byte)rand.Next(255)); bot.Data.Name = name + " " + bot.GetId(); } else { Color botColor = players[0].Data.PlayerColor; bot.Data.PlayerColor = Color.FromRgb((byte)(0xFF - botColor.R), (byte)(0xFF - botColor.G), (byte)(0xFF - botColor.B)); bot.Data.Name = name; } bot.Data.HashId = bot.Data.Name; bot.Data.PlayerType = PlayerType.BOT; bot.Data.BotType = type; bot.Data.StartReady = true; return(bot); }
public void UpdateTournamentSettings(TournamentSettings s) { btnReady.IsEnabled = true; lblName.Content = s.Name; lblType.Content = MatchManagerInfoAccessor.GetInfo(s.MMType).Text; lblMap.Content = LevelInfoAccessor.GetInfo(s.Level).Text; lblRounds.Content = s.RoundCount.ToString(Strings.Culture); round = s.PlayedMatches; UpdateMatchCount(s.RoundCount); //#if DEBUG lblBotLevel.Content = BotNameAccessor.GetBotName(s.BotType); lblBots.Content = s.BotCount.ToString(Strings.Culture); //#endif // TODO: mozna se pozdeji pridaji boti i pro normalni hrace - potom se zde musi zobrazit, kdyz prijde zprava }
private void PostInit() { List <ComboData> data = new List <ComboData>(); foreach (MatchManagerType t in Enum.GetValues(typeof(MatchManagerType))) { MatchManagerInfo i = MatchManagerInfoAccessor.GetInfo(t); //#if DEBUG // v debugu pridat vsechny managery data.Add(new ComboData { Id = t, Name = i.Text }); /*#else * if (!i.IsDebug) * data.Add(new ComboData { Id = t, Name = i.Text }); #endif*/ } cbType.ItemsSource = data; cbType.DisplayMemberPath = "Name"; cbType.SelectedValuePath = "Id"; cbType.SelectedValue = MatchManagerType.ONLY_SCORE; data = new List <ComboData>(); foreach (GameLevel l in Enum.GetValues(typeof(GameLevel))) { LevelInfo i = LevelInfoAccessor.GetInfo(l); //#if DEBUG // v debugu pridat vsechny mapy data.Add(new ComboData { Id = l, Name = i.Text }); /*#else * if (!i.IsDebug) * data.Add(new ComboData { Id = l, Name = i.Text }); #endif*/ } cbMap.ItemsSource = data; cbMap.DisplayMemberPath = "Name"; cbMap.SelectedValuePath = "Id"; cbMap.SelectedValue = GameLevel.BASIC_MAP; #if DEBUG tbName.Text = "Test"; #endif //#if DEBUG // pridani dostupnych botu pro testovani data = new List <ComboData>(); data.Add(new ComboData { Id = BotType.LEVEL1, Name = BotNameAccessor.GetBotName(BotType.LEVEL1) }); data.Add(new ComboData { Id = BotType.LEVEL2, Name = BotNameAccessor.GetBotName(BotType.LEVEL2) }); data.Add(new ComboData { Id = BotType.LEVEL3, Name = BotNameAccessor.GetBotName(BotType.LEVEL3) }); cbBot.ItemsSource = data; cbBot.DisplayMemberPath = "Name"; cbBot.SelectedValuePath = "Id"; cbBot.SelectedValue = BotType.LEVEL1; /*#else * tbBotCount.Visibility = Visibility.Hidden; * cbBot.Visibility = Visibility.Hidden; * lblBot.Visibility = Visibility.Hidden; * lblBotCount.Visibility = Visibility.Hidden; #endif*/ }