コード例 #1
0
    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;
    }
コード例 #4
0
    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
ファイル: AffixValueInfo.cs プロジェクト: Etabli/DA-GAME
 public AffixValueInfo(AffixValueInfo src) : this(src.BaseValueMin, src.BaseValueMax, src.Progressions)
 {
 }
コード例 #7
0
ファイル: AffixInfo.cs プロジェクト: Etabli/DA-GAME
 private AffixInfo(AffixValueInfo valueInfo, string description)
 {
     Description = description;
     ValueInfo   = new AffixValueInfo(valueInfo);
 }
コード例 #8
0
ファイル: AffixInfo.cs プロジェクト: Etabli/DA-GAME
 public AffixInfo(AffixType type, AffixValueInfo valueInfo, string description)
     : this(valueInfo, description)
 {
     Type = type;
 }
コード例 #9
0
ファイル: AffixInfo.cs プロジェクト: Etabli/DA-GAME
 /// <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
ファイル: AffixInfo.cs プロジェクト: Etabli/DA-GAME
 /// <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
ファイル: AffixInfo.cs プロジェクト: Etabli/DA-GAME
 /// <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);