public List<Bot> getBots() { List<Bot> bots = new List<Bot>(); String[] botsRaw = loadBots().Split(';'); foreach(String botRaw in botsRaw) { Bot bot; String[] botMeta = botRaw.Split('-'); String metaName = null; Char metaIcon = ' '; Color metaColor = new Color(); char metaIntelligence = 'd'; Image metaAvatar = null; foreach (String metaRaw in botMeta) { if (metaRaw.Contains("%N%")) { //Name metaName = metaRaw.Replace("%N%", ""); if (debug) { Console.WriteLine(metaName); } } else if (metaRaw.Contains("%I%")) { //ICON metaIcon = Convert.ToChar(metaRaw.Replace("%I%", "")); if (debug) { Console.WriteLine(metaIcon); } }else if(metaRaw.Contains("%A%")) { //Avatar metaAvatar = parseImage(metaRaw.Replace("%A%", "")); } else if (metaRaw.Contains("%i%")) { //Intelligience metaIntelligence = Convert.ToChar(metaRaw.Replace("%I%","")); } else if (metaRaw.Contains("%C%")) { //Farbe int r = 0, g = 0, b = 0; String[] colorRaw = metaRaw.Replace("%C%", "").Split(','); foreach (String metaColorRaw in colorRaw) { if (metaColorRaw.Contains("r")) { r = Convert.ToInt16(metaColorRaw.Replace("r", "")); } else if (metaColorRaw.Contains("g")) { g = Convert.ToInt16(metaColorRaw.Replace("g", "")); } else if (metaColorRaw.Contains("b")) { b = Convert.ToInt16(metaColorRaw.Replace("b", "")); } if (debug) { Console.WriteLine(metaColorRaw); } } metaColor = Color.FromArgb(r, g, b); } else { } } Bot tmpBot = new Bot(metaIntelligence, metaName, metaIcon, metaColor, metaAvatar); bots.Add(tmpBot); } return bots; }
private void newGame(Player pRED, Player pBLU, Bot bRED, Bot bBLU, String starter) { this.pRED = pRED; this.pBLU = pBLU; this.bRED = bRED; this.bBLU = bBLU; this.turn = starter; }