Beispiel #1
0
        public static List <ThemeIconset> Import()
        {
            var imported = new List <ThemeIconset>();

            foreach (var path in Directory.GetDirectories(Theme.storagePath + "Iconsets"))
            {
                imported.Add(ThemeIconset.Import(path));
            }
            return(imported);
        }
Beispiel #2
0
        public static ThemeIconset Import(string path)
        {
            path = path.Replace("\\", "/");
            var iconset = new ThemeIconset();

            iconset.name     = path.GetPathTerm();
            iconset.path     = path;
            iconset.contents = ThemeContent.ImportDefaults(path);
            iconset.contents.AddRange(ThemeContent.Import(path));
            return(iconset);
        }
Beispiel #3
0
        public static void Monitor()
        {
            var contents = typeof(EditorGUIUtility).GetVariable <Hashtable>("s_IconGUIContents");

            if (contents.Count != ThemeContent.iconAmount)
            {
                var path = ThemeIconset.all.Count == 1 ? ThemeIconset.all[0].path : null;
                ThemeIconset.all = path.IsNull() ? ThemeIconset.Import() : ThemeIconset.Import(path).AsList();
                Theme.ApplyIconset();
            }
        }
Beispiel #4
0
 public Theme Use(Theme other)
 {
     this.UseVariables(other, typeof(InternalAttribute).AsList());
     if (this.name.IsEmpty())
     {
         this.name = other.name;
     }
     if (this.path.IsEmpty())
     {
         this.path = other.path;
     }
     this.skinset = other.skinset;
     this.iconset = other.iconset;
     this.palette = other.palette;
     this.fontset = other.fontset;
     return(this);
 }
Beispiel #5
0
 public void Deserialize(string data)
 {
     foreach (var line in data.GetLines())
     {
         if (line.Trim().IsEmpty())
         {
             continue;
         }
         var term  = line.Parse("", " ").Trim();
         var value = line.Parse(" ").Trim().Trim("=").Trim();
         if (term.Matches("CustomizablePalette", true))
         {
             this.customizablePalette = value.ToBool();
         }
         else if (term.Matches("CustomizableFontset", true))
         {
             this.customizableFontset = value.ToBool();
         }
         else if (term.Matches("CustomizableIconset", true))
         {
             this.customizableIconset = value.ToBool();
         }
         else if (term.Matches("Palette", true))
         {
             this.palette = ThemePalette.all.Find(x => x.name == value) ?? new ThemePalette();
         }
         else if (term.Matches("Fontset", true))
         {
             this.fontset = ThemeFontset.all.Find(x => x.name == value) ?? new ThemeFontset();
         }
         else if (term.Matches("Iconset", true))
         {
             this.iconset = ThemeIconset.all.Find(x => x.name == value) ?? new ThemeIconset();
         }
         else if (term.Matches("Skinset", true))
         {
             var variants = value.Split("+");
             this.defaultVariants = variants.Skip(1).ToArray();
             this.skinset         = ThemeSkinset.all.Find(x => x.name == variants[0]) ?? new ThemeSkinset();
         }
     }
 }