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 GetProvinceName(string faction) { List <string> provinceName = NamesPool.ProvinceNames[faction]; string exclusiveName = NamesPool.GetExclusiveName(ref provinceName); NamesPool.ProvinceNames[faction] = provinceName; return(exclusiveName); }
public string GetSystemName() { if (NamesPool.SystemNames.Count == 0) { ++this.planetIteration; this.GetNewSystemNameList(); } return(NamesPool.GetExclusiveName(ref NamesPool.SystemNames)); }
private static void AppendDuplicate(ref string name, ref List <string> usedNames) { if (!usedNames.Contains(name)) { return; } int num = 1; string str; for (str = string.Format("{0} {1}", (object)name, (object)NamesPool.ToRomanNumeral(num)); usedNames.Contains(str); str = string.Format("{0} {1}", (object)name, (object)NamesPool.ToRomanNumeral(num))) { ++num; } usedNames.Add(str); name = str; }
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); }
private void GetNewSystemNameList() { XmlDocument document = new XmlDocument(); document.Load(ScriptHost.FileSystem, this._lastFileName); XmlElement documentElement = document.DocumentElement; NamesPool.SystemNames.Clear(); NamesPool.SystemNames = XmlHelper.GetDataCollection <string>(documentElement, "SystemNames", "string"); for (int index1 = 0; index1 < NamesPool.SystemNames.Count; ++index1) { List <string> systemNames; int index2; (systemNames = NamesPool.SystemNames)[index2 = index1] = systemNames[index2] + " " + NamesPool.ToRomanNumeral(this.planetIteration); } }
public string GetSalvageProjectName(string projtype) { return(App.Localize(NamesPool.Choose(NamesPool.SalvageProjectNames[projtype]))); }
public string GetFleetName(string faction) { return(NamesPool.Choose(NamesPool.FleetNames[faction])); }