public string GetName(string sex) { string name = string.Format("{0} {1}", (object)NamesPool.Choose(this.ListA), (object)NamesPool.Choose(this.ListB)); NamesPool.AppendDuplicate(ref name, ref this.UsedNames); return(name); }
public string GetName(string sex) { string name = NamesPool.Choose(this.ListA); NamesPool.AppendDuplicate(ref name, ref this.UsedNames); return(name); }
public string GetName( GameSession game, int playerid, ShipClass shipclass, IEnumerable <string> checknames = null) { string name = ""; foreach (List <KeyValuePair <string, string> > list in this.Lists) { if (list.Any <KeyValuePair <string, string> >((Func <KeyValuePair <string, string>, bool>)(x => { if (!(x.Key == "")) { return(x.Key.ToLower().Contains(shipclass.ToString().ToLower())); } return(true); }))) { name += string.Format("{0}", (object)NamesPool.Choose(list.Where <KeyValuePair <string, string> >((Func <KeyValuePair <string, string>, bool>)(x => { if (!(x.Key == "")) { return(x.Key.ToLower().Contains(shipclass.ToString().ToLower())); } return(true); })).Select <KeyValuePair <string, string>, string>((Func <KeyValuePair <string, string>, string>)(x => x.Value)).ToList <string>())); } } List <string> usedNames = new List <string>(); usedNames.AddRange(game.GameDatabase.GetShipInfos(true).Where <ShipInfo>((Func <ShipInfo, bool>)(x => x.DesignInfo.PlayerID == playerid)).Select <ShipInfo, string>((Func <ShipInfo, string>)(x => x.ShipName))); foreach (InvoiceInfo invoiceInfo in game.GameDatabase.GetInvoiceInfosForPlayer(playerid)) { foreach (BuildOrderInfo buildOrderInfo in game.GameDatabase.GetBuildOrdersForInvoiceInstance(invoiceInfo.ID)) { usedNames.Add(buildOrderInfo.ShipName); } } if (checknames != null) { usedNames.AddRange(checknames); } NamesPool.AppendDuplicate(ref name, ref usedNames); return(name); }