Example #1
0
 public void RandInfo(TDBaseNameData nameData, AgeRange range = AgeRange.Adult, Gender gender = Gender.Male, string lastName = null)
 {
     IsCelebrity = false;
     AgeRange    = range;
     Gender      = gender;
     NameLib     = nameData.TDID;
     Age         = RandUtil.RangeInt(AgeRangeData[AgeRange]);
     NameData    = GetNameData(NameLib);
     HeadIcon    = NameData.RandHeadIcon(Gender, Const.PTag_Normal);
     if (lastName.IsInv())
     {
         LastName = NameData.RandLastNameKey();
     }
     else
     {
         if (BaseLanguageMgr.AllLastNames.Contains(lastName))
         {
             LastName = lastName;
         }
         else
         {
             throw new Exception("没有这个姓氏:" + lastName);
         }
     }
     if (FirstName.IsInv())
     {
         FirstName = NameData.RandFirstNameKey(Gender);
     }
     OnRandInfo();
 }
Example #2
0
 public void Generate()
 {
     IsCelebrity = true;
     AgeRange    = GetAgeRange();
     NameData    = GetNameData(NameLib);
     HeadIcon    = NameData.RandHeadIcon(Gender, Const.PTag_Normal);
     OnGenerate();
 }
Example #3
0
        public virtual TData RandPerson(TDBaseNameData nameData, AgeRange range = AgeRange.Adult, Gender gender = Gender.Male, string lastName = null, Func <TData, TData> onProcessInfo = null)
        {
            TData person = new TData();

            if (onProcessInfo != null)
            {
                person = onProcessInfo.Invoke(person);
            }
            person.RandInfo(nameData, range, gender, lastName);
            SpawnAdd(person, person.GetTDID());
            return(person);
        }
Example #4
0
 public override void OnBeAdded(BaseCoreMono selfMono, params object[] obj)
 {
     base.OnBeAdded(selfMono, obj);
     NameData = GetNameData(NameLib);
     AgeRange = GetAgeRange();
 }