private void SetServantInfo(string name, PeSex sex, int health, int healthMax, int stamina, int stamina_max, int hunger, int hunger_max, int comfort, int comfort_max, int oxygen, int oxygen_max, int shield, int shield_max, int energy, int energy_max, int attack, int defense) { mLbName.text = name; mSprSex.spriteName = sex == PeSex.Male ? "man" : "woman"; mLbHealth.text = Convert.ToString(health) + "/" + Convert.ToString(healthMax); mSdHealth.sliderValue = (healthMax > 0) ? Convert.ToSingle(health) / healthMax : 0; mLbStamina.text = Convert.ToString(stamina) + "/" + Convert.ToString(stamina_max); mSdStamina.sliderValue = (stamina_max > 0) ? Convert.ToSingle(stamina) / stamina_max : 0; mLbHunger.text = Convert.ToString(hunger) + "/" + Convert.ToString(hunger_max); mSdHunger.sliderValue = (hunger_max > 0) ? Convert.ToSingle(hunger) / hunger_max : 0; mLbComfort.text = Convert.ToString(comfort) + "/" + Convert.ToString(comfort_max); mSdComfort.sliderValue = (comfort_max > 0) ? Convert.ToSingle(comfort) / comfort_max : 0; mLbOxygen.text = Convert.ToString(oxygen) + "/" + Convert.ToString(oxygen_max); mSdOxygen.sliderValue = (oxygen_max > 0) ? Convert.ToSingle(oxygen) / oxygen_max : 0; mLbShield.text = Convert.ToString(shield) + "/" + Convert.ToString(shield_max); mSdShield.sliderValue = (shield_max > 0) ? Convert.ToSingle(shield) / shield_max : 0; mLbEnergy.text = Convert.ToString(energy) + "/" + Convert.ToString(energy_max); mSdEnergy.sliderValue = (energy_max > 0) ? Convert.ToSingle(energy) / energy_max : 0; mLbAttack.text = Convert.ToString(attack); mLbDefense.text = Convert.ToString(defense); }
public static void ExtSetSex(this PeEntity entity, PeSex sex) { CommonCmpt info = entity.GetCmpt <CommonCmpt>(); if (null == info) { return; } info.sex = sex; }
public static bool IsMatch(PeSex sex, PeSex require) { if (sex == PeSex.Undefined) { return(true); } if (sex == require) { return(true); } return(false); }
static List <FirstName> GetFirstName(PeSex sex) { List <FirstName> listName = new List <FirstName>(10); foreach (FirstName ite in sFirstNamePool) { if (PeGender.Convert(ite.mSex + 1) == sex) { listName.Add(ite); } } return(listName); }
public CharacterName Fetch(PeSex sex, int race) { CharacterName characterName = GetRandomNpcName(sex, race, mList); if (null == characterName) { Debug.LogWarning("no random name, return default:" + CharacterName.Default.ToString()); return(CharacterName.Default); } mList.Add(characterName); return(characterName); }
public static CustomCharactor.ESex Convert(PeSex v) { if (v == PeSex.Male) { return(CustomCharactor.ESex.Male); } else if (v == PeSex.Female) { return(CustomCharactor.ESex.Female); } else { return(CustomCharactor.ESex.Max); } }
static CharacterName GetRandomNpcName(PeSex sex, int race, List <CharacterName> exclude) { List <FirstName> firstNameArray = GetFirstName(sex); if (firstNameArray.Count <= 0) { Debug.LogError("random first name exhausted for sex:" + sex); return(null); } Shuffle(firstNameArray); foreach (FirstName fn in firstNameArray) { List <LastName> lastNameArray = GetLastName(race, fn.mLabel); if (lastNameArray.Count <= 0) { Debug.LogWarning("no last name can be used by race[" + race + "], which matchs the first name [" + fn.mText + "], label:" + fn.mLabel); continue; } Shuffle(lastNameArray); foreach (LastName ln in lastNameArray) { CharacterName characterName = new CharacterName(fn.mText, ln.mText); if (!exclude.Exists(delegate(CharacterName name) { if (name.Equals(characterName)) { return(true); } else { return(false); } })) { return(characterName); } } } Debug.LogError("random name exhausted for sex:" + sex + " race:" + race); return(null); }
static void InitEquipment(PeEntity entity, IEnumerable <int> equipmentItemProtoIds) { if (equipmentItemProtoIds == null) { return; } Pathea.EquipmentCmpt equipmentCmpt = entity.GetCmpt <Pathea.EquipmentCmpt>(); if (null == equipmentCmpt) { Debug.LogError("no equipment cmpt"); return; } PeSex entitySex = entity.ExtGetSex(); foreach (int equipmentItemProtoId in equipmentItemProtoIds) { ItemAsset.ItemProto itemProto = ItemAsset.ItemProto.Mgr.Instance.Get(equipmentItemProtoId); if (itemProto == null) { continue; } if (!PeGender.IsMatch(itemProto.equipSex, entitySex)) { continue; } ItemAsset.ItemObject itemObj = ItemAsset.ItemMgr.Instance.CreateItem(equipmentItemProtoId); if (itemObj != null) { equipmentCmpt.PutOnEquipment(itemObj); } } }
public CharacterName FetchName(PeSex sex, int race) { return(mNameGenerater.Fetch(sex, race)); }