// Use this for initialization void Start() { ability = GlobalGameData.GameValues.RoleAbility; namedProgressList = new Dictionary <string, Transform>(); int progressCount = gameObject.transform.childCount; for (int i = 0; i < progressCount; i++) { Transform child = gameObject.transform.GetChild(i); namedProgressList.Add(child.name, child); } if (null != ability) { // Set existing values foreach (KeyValuePair <string, Transform> progress in namedProgressList) { string propName = progress.Key; Transform p = progress.Value; int existed = EntityUtil.GetValue <int>(ability, propName); p.Find("Value").GetComponent <Text>().text = existed.ToString(); p.Find("ProgressBar").GetComponent <Slider>().value = (float)existed / 100.0f; } } }
public void UpdateGlobalGameValues(GameValues gameValues) { if (null != gameValues.RoleAbility) { RoleAbility ability = GlobalGameData.GameValues.RoleAbility; ability.Attack += gameValues.RoleAbility.Attack; ability.Defence += gameValues.RoleAbility.Defence; ability.Evasion += gameValues.RoleAbility.Evasion; } if (null != gameValues.RoleStatus) { RoleStatus status = GlobalGameData.GameValues.RoleStatus; status.HealthPoint += gameValues.RoleStatus.HealthPoint; status.ManaPoint += gameValues.RoleStatus.ManaPoint; status.SkillPoint += gameValues.RoleStatus.SkillPoint; status.ExperiencePoint += gameValues.RoleStatus.ExperiencePoint; } GlobalGameData.GameValues.ExampleOtherValue += gameValues.ExampleOtherValue; }