//=================================================== /// <summary> /// Sets the number of itens in the Text attacthed to the Red/Blue button . /// </summary> /// <param name="qt">Quantity of itens.</param> //=================================================== public void SetQuantityText() { Abilites.SetSkillsQuantity(); // build the dictionary and update to be used. // Set number of itens at H2 TextH2 = H2.transform.Find("QuantityFrame").transform.Find("Quantity Text").GetComponent <Text> (); RawImage rwH2 = H2.transform.Find("Icon").GetComponent <RawImage> (); string skillNameInH2 = rwH2.texture.name; if (Abilites.SkillsQuantity [skillNameInH2] < 100) { TextH2.text = Abilites.SkillsQuantity [skillNameInH2].ToString(); } else { TextH2.text = "+99"; // don't show more than 99 } // Set number of itens at H3 TextH3 = H3.transform.Find("QuantityFrame").transform.Find("Quantity Text").GetComponent <Text> (); RawImage rwH3 = H3.transform.Find("Icon").GetComponent <RawImage> (); string skillNameInH3 = rwH3.texture.name; if (Abilites.SkillsQuantity [skillNameInH3] < 100) { TextH3.text = Abilites.SkillsQuantity [skillNameInH3].ToString(); } else { TextH3.text = "+99"; // don't show more than 99 } }
void Awake() { Abilites.SetSkillsDescritions(); skillDescription = ModalPanelSkillDescription.Instance(); SetQuantityText(); isSkillDescriptionVisualized = false; }
/// <summary> /// Increases given ability of worker by provided value. In case worker does /// not have given ability it will be added to his abilites list and value of /// ability will be set to provided value /// </summary> public void UpdateAbility(ProjectTechnology ability, float abilityValue) { abilityValue = Mathf.Clamp(abilityValue, 0f, MAX_ABILITY_VALUE); if (true == Abilites.ContainsKey(ability)) { SafeFloat abilityCurrentValue = Abilites[ability]; Abilites[ability] = new SafeFloat(abilityCurrentValue.Value + abilityValue); } else { Abilites.Add(ability, new SafeFloat(abilityValue)); } AbilityUpdated?.Invoke(this, ability, abilityValue); }