예제 #1
0
        public string GetName(RTPN_NameSlot slot, Gender gender = 0)
        {
            string        str;
            List <string> strs = this.NamesFor(slot, gender);
            int           num  = 0;

            if (strs.Count == 0)
            {
                Log.Error(string.Concat(new object[] { "Name list for gender=", gender, " slot=", slot, " is empty." }));
                return("Errorname");
            }
            while (true)
            {
                str = strs.RandomElement <string>();
                if (!NameUseChecker.NameWordIsUsed(str))
                {
                    return(str);
                }
                num++;
                if (num > 50)
                {
                    break;
                }
            }
            return(str);
        }
예제 #2
0
        public void AddNames(RTPN_NameSlot slot, Gender gender, IEnumerable <string> namesToAdd)
        {
            IEnumerator <string> enumerator = namesToAdd.GetEnumerator();

            try {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.Current;
                    this.NamesFor(slot, gender).Add(current);
                }
            }
            finally {
                if (enumerator == null)
                {
                }
                enumerator.Dispose();
            }
        }
예제 #3
0
        public void AddNamesFromFile(RTPN_NameSlot slot, Gender gender, string fileName)
        {
            string namesPath = Path.GetFullPath(Path.Combine(modBasePath, "Name Lists/")).Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);

            this.AddNames(slot, gender, RTPN_FileRead.LinesFromFile(string.Concat(namesPath, fileName)));
        }
예제 #4
0
 public List <string> NamesFor(RTPN_NameSlot slot, Gender gender)
 {
     return(this.names[(int)gender, (int)slot]);
 }