public virtual void Set(UnitTemplate template, ItemUpgradeType type) { this.Template = template; this.Type = type; label.text = type.DisplayName.Text; UpdateState(); }
void SelectCallback(ItemUpgradeType type) { toggleGroup.allowSwitchOff = false; if (OnSelect != null) { OnSelect(type); } }
public virtual ItemUpgradesData.Element GetDataElement(ItemUpgradeType target) { if (Data == null) { return(null); } var element = Data.Find(target); return(element); }
public virtual ItemUpgradeType Find(string name) { for (int i = 0; i < list.Length; i++) { if (ItemUpgradeType.CompareID(list[i].name, name)) { return(list[i]); } } return(null); }
public virtual Element Find(ItemUpgradeType type) { for (int i = 0; i < list.Count; i++) { if (list[i].Type == type) { return(list[i]); } } return(null); }
public virtual ElementData Find(ItemUpgradeType type) { for (int i = 0; i < elements.Length; i++) { if (elements[i].Type == type) { return(elements[i]); } } return(null); }
public virtual ItemUpgradesData.Element GetDataElement(ItemTemplate item, ItemUpgradeType type) { var data = Find(item); if (data == null) { return(null); } var element = data.Find(type); return(element); }
private ItemUpgradeTypeUITemplate CreateTemplate(ItemUpgradeType type) { var instance = Instantiate(this.template, panel); var script = instance.GetComponent <ItemUpgradeTypeUITemplate>(); script.Init(toggleGroup); script.Set(type); script.OnSelect += SelectCallback; return(script); }
public Element(ItemUpgradeType type) : this(type, 0) { }
public Element(ItemUpgradeType type, int value) { this.type = type; this.value = value; }
public virtual void GetElements(ItemTemplate item, ItemUpgradeType type, out ItemUpgradesTemplate.ElementData template, out ItemUpgradesData.Element data) { template = GetTemplateElement(item, type); data = GetDataElement(item, type); }
public virtual void Perform(PlayerInventoryCore.ItemData item, ItemUpgradeType type) { Perform(item.Instance, type.ID); }
public virtual void Perform(ItemInstance itemInstance, ItemUpgradeType type) { Perform(itemInstance, type.ID); }
public virtual void GetElements(ItemUpgradeType target, out ItemUpgradesTemplate.ElementData template, out ItemUpgradesData.Element data) { template = GetTemplateElement(target); data = GetDataElement(target); }
public virtual ItemUpgradesTemplate.ElementData GetTemplateElement(ItemTemplate item, ItemUpgradeType type) { var element = item.Upgrades.Template.Find(type); return(element); }
void TypeSelectCallback(ItemUpgradeType selection) { property.Show(); property.Set(Template, selection); }
public virtual ItemUpgradesTemplate.ElementData GetTemplateElement(ItemUpgradeType target) { var element = Template.Upgrades.Template.Find(target); return(element); }
public virtual void FormatUpgradeLabel(TMP_Text label, ItemTemplate item, ItemUpgradeType type, float value) { Player.Units.Upgrades.GetElements(item, type, out var template, out var data); if (item.Upgrades.isApplicable(type)) { label.gameObject.SetActive(true); if (template == null || data == null) { FormatLabel(label, type.name, value); } else { var multiplier = template.Percentage.CalculateMultiplier(data.Value); FormatLabel(label, type.name, value * multiplier); } } else { label.gameObject.SetActive(false); } }
public virtual bool isApplicable(ItemUpgradeType type) { return(applicable.Contains(type)); }
public virtual void Set(ItemUpgradeType context) { this.Context = context; context.Icon.ApplyTo(icon); }