示例#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 ItemTypesContainsDescription(string enumName, string description)
        {
            vItemType e = enumName.ToEnum <vItemType>();

            return(e.DisplayFormat().Equals(description));
        }
示例#3
0
 /// <summary>
 /// Get Default Item type text
 /// </summary>
 /// <returns></returns>
 public string ItemTypeText()
 {
     return(ItemTypeText(type.DisplayFormat()));
 }