Exemple #1
0
        public const int Parallel = 6000;                   // 并行
        // Blender = 7000;                                  // 混合器

        static TweenType()
        {
            var fieldInfos    = typeof(TweenType).GetFields();
            var fieldsList    = new List <FieldInfo>();
            var attributeList = new List <EnumPropertyAttribute>();

            foreach (var fieldInfo in fieldInfos)
            {
                var attributes = fieldInfo.GetCustomAttributes(true);
                foreach (var attribute in attributes)
                {
                    if (attribute.GetType() == typeof(EnumPropertyAttribute))
                    {
                        var enumPropertyAttribute = attribute as EnumPropertyAttribute;
                        if (enumPropertyAttribute == null || !enumPropertyAttribute.Display)
                        {
                            continue;
                        }
                        fieldsList.Add(fieldInfo);
                        attributeList.Add(enumPropertyAttribute);
                    }
                }
            }

            for (var i = 0; i < fieldsList.Count; i++)
            {
                var fieldInfo   = fieldsList[i];
                var attribute   = attributeList[i];
                var indexValue  = (int)fieldInfo.GetValue(null);
                var displayName = string.IsNullOrEmpty(attribute.DisplayName) ? fieldInfo.Name : attribute.DisplayName;

                ValueTypeDic.Add(indexValue, displayName);
                TypeValueDic.Add(displayName, indexValue);
            }
        }
Exemple #2
0
        public const int Parallel = 6000;                   // 并行
        // Blender = 7000;                                  // 混合器

        static TweenType()
        {
            var enumName = nameof(TweenType);
            var infos    = SerializeEnumAttribute.TypeInfosDic[enumName];

            foreach (var info in infos)
            {
                ValueTypeDic.Add(info.Index, info.DisplayName);
                TypeValueDic.Add(info.DisplayName, info.Index);
            }
        }