Exemple #1
0
        public static void CreateWindow()
        {
            if (instance == null)
            {
                var window = vItemEnumsWindow.GetWindow <vItemEnumsWindow>("Item Enums", true);
                instance    = window;
                window.skin = Resources.Load("vSkin") as GUISkin;
                #region Get all vItemType values of current Enum
                try
                {
                    window._itemTypeNames = Enum.GetNames(typeof(vItemType)).vToList();
                    for (int i = 0; i < window._itemTypeNames.Count; i++)
                    {
                        vItemType att = (vItemType)Enum.Parse(typeof(vItemType), (window._itemTypeNames[i]));
                        window._itemTypeEnumFormats.Add(att.DisplayFormat());
                    }
                }
                catch
                {
                }
                #endregion

                #region Get all vItemAttributes values of current Enum
                try
                {
                    window._itemAttributeNames = Enum.GetNames(typeof(vItemAttributes)).vToList();
                    for (int i = 0; i < window._itemAttributeNames.Count; i++)
                    {
                        vItemAttributes att = (vItemAttributes)Enum.Parse(typeof(vItemAttributes), (window._itemAttributeNames[i]));
                        window._itemAttributesEnumFormats.Add(att.DisplayFormat());
                    }
                }
                catch
                {
                }
                #endregion
                window.datas = Resources.LoadAll <vItemEnumsList>("");
                for (int i = 0; i < window.datas.Length; i++)
                {
                    window.itemEnumEditorList.Add(DynamicEnum.vItemEnumsListEditor.CreateEditor(window.datas[i]) as DynamicEnum.vItemEnumsListEditor);
                }
                window.minSize = new Vector2(460, 600);
            }
        }
        bool ItemAttributesContainsDescription(string enumName, string description)
        {
            vItemAttributes e = enumName.ToEnum <vItemAttributes>();

            return(e.DisplayFormat().Equals(description));
        }