public override void SetValueInfo(AffixValueInfo info)
    {
        if (!(info.BaseValueMin is AffixValueMultiple))
        {
            throw new ArgumentException($"Info needs to be of type AffixValueMultiple!");
        }

        originalInfo = info;

        // First clear all exisiting inputs
        while (inputs.Count > 0)
        {
            RemoveInput(inputs.Count - 1);
        }

        var min = info.BaseValueMin as AffixValueMultiple;
        var max = info.BaseValueMax as AffixValueMultiple;

        for (int i = 0; i < min.Count; i++)
        {
            if (!(min[i] is AffixValueSingle) && !(min[i] is AffixValueRange))
            {
                throw new ArgumentException($"Info contains affix values other than single or range!");
            }

            GameObject prefab = min[i] is AffixValueSingle ? singleInputPrefab : rangeInputPrefab;
            AddInput(i, prefab);
            var input = inputs.Last();
            input.SetValueInfo(new AffixValueInfo(min[i], max[i], info.Progressions[i]));
        }

        UpdateIsChanged();
    }
示例#2
0
    public override void SetValueInfo(AffixValueInfo info)
    {
        if (!(info.BaseValueMin is AffixValueRange))
        {
            throw new ArgumentException("Can only display AffixValueRange info!", nameof(info));
        }

        MinimumInput.SetValueInfo(info.BaseValueMin as AffixValueRange);
        MaximumInput.SetValueInfo(info.BaseValueMax as AffixValueRange);

        MinimumInput.Progression = info.Progression;

        UpdateIsChanged();
    }
示例#3
0
    public void SetInfo(AffixValueInfo info)
    {
        if (ReferenceEquals(info, currentInfo))
        {
            return;
        }

        currentInfo = info;

        Type type = info.BaseValueMin.GetType();

        UpdateValueDisplay(type);
        input.SetValueInfo(info);
        TypeDropdown.value = TypeDropdown.options.FindIndex(option => option.text == type.Name.Remove(0, "AffixValue".Length));
        previousType       = TypeDropdown.value;
    }
    public override void SetValueInfo(AffixValueInfo info)
    {
        if (!(info.BaseValueMin is AffixValueSingle))
        {
            throw new ArgumentException($"Can only display AffixValueSingle info!", nameof(info));
        }

        originalMinimum = info.BaseValueMin as AffixValueSingle;
        originalMaximum = info.BaseValueMax as AffixValueSingle;

        MinimumInput.text = originalMinimum.ToString();
        MaximumInput.text = originalMaximum.ToString();

        Progression = info.Progression;

        UpdateIsMaximumChanged(MaximumInput.text);
        UpdateIsMinimumChanged(MinimumInput.text);
        UpdateIsProgressionChanged();
    }
示例#5
0
        private void SaveAffixInfoButton_Click(object sender, EventArgs e)
        {
            AffixProgression newProgression = new AffixProgression(localProgressionFunctionName, localProgressionParameters);

            AffixValueInfo newValueInfo = null;

            if (localValueType == AffixValueType.SingleValue)
            {
                newValueInfo = new AffixValueInfo(localBaseValueMinSingle, localBaseValueMaxSingle, newProgression);
            }
            else if (localValueType == AffixValueType.Range)
            {
                newValueInfo = new AffixValueInfo(localBaseValueMinRange, localBaseValueMaxRange, newProgression);
            }

            AffixInfo newInfo = new AffixInfo(localValueType, localName, newValueInfo, localDescription);

            Serializer.SaveAffixInfoToDisk(newInfo);
            AffixInfo.Register(newInfo);
            currentInfo = newInfo;
            UpdateAllLabels();
        }
示例#6
0
 public AffixValueInfo(AffixValueInfo src) : this(src.BaseValueMin, src.BaseValueMax, src.Progressions)
 {
 }
示例#7
0
 private AffixInfo(AffixValueInfo valueInfo, string description)
 {
     Description = description;
     ValueInfo   = new AffixValueInfo(valueInfo);
 }
示例#8
0
 public AffixInfo(AffixType type, AffixValueInfo valueInfo, string description)
     : this(valueInfo, description)
 {
     Type = type;
 }
示例#9
0
 /// <summary>
 /// Creates a new AffixInfo object and its associated type
 /// </summary>
 public AffixInfo(int id, string name, AffixValueInfo valueInfo, string description)
     : this(AffixType.Replace(id, name), valueInfo, description)
 {
 }
示例#10
0
 /// <summary>
 /// Creates a new AffixInfo object and its associated type
 /// </summary>
 public AffixInfo(string name, AffixValueInfo valueInfo, string description)
     : this(AffixType.CreateNew(name), valueInfo, description)
 {
 }
示例#11
0
 /// <summary>
 /// Creates a new AffixInfo object and its associated type
 /// </summary>
 public AffixInfo(string name, AffixValueInfo valueInfo) : this(name, valueInfo, "")
 {
 }
示例#12
0
 public abstract void SetValueInfo(AffixValueInfo info);