コード例 #1
0
        public void AddEnumValue <TEnum>(AbilityChange.ChangeType changeType, string source, List <AbilityChange> accumulator)
        {
            TEnum value;

            try {
                value = (TEnum)Enum.Parse(typeof(TEnum), source);
                accumulator.Add(new AbilityChange()
                {
                    Type = changeType, Value = value
                });
            } catch (Exception ex)
            {
                IEDebug.Log($"Could not parse enum value {source} for field {changeType.ToString()}. Expected value of type {typeof(TEnum).ToString()}. Exception: {ex.ToString()}");
            }
        }
コード例 #2
0
        public void AddIntValue(AbilityChange.ChangeType changeType, string source, List <AbilityChange> accumulator)
        {
            int value;

            if (int.TryParse(source, out value))
            {
                accumulator.Add(new AbilityChange()
                {
                    Type = changeType, Value = value
                });
            }
            else
            {
                IEDebug.Log($"Tried to assign non-int value {source} to field {changeType.ToString()}");
            }
        }