protected override void OnAddElement(ReorderableList list) { ThemesManager.CreateTheme(); Window.OnGuiChanged(); Window.MarkAllMetaDirty(); IsMetaDirty = true; }
protected override void OnDrawElement(Rect rect, int index, bool isActive, bool isFocused) { var themes = ThemesLibrary.Themes; var fieldRect = CalculateFieldRect(rect, themes.Count + 1); var offsetPerField = CalculateOffsetPerField(fieldRect); var item = MetaItems[index]; var name = EditorGUI.TextField(fieldRect, item.Name); if (name != item.Name && !string.IsNullOrEmpty(name)) { ThemesManager.ChangeSpriteName(item.Id, name); item.Name = name; } fieldRect.x += offsetPerField; fieldRect.x += (fieldRect.width - ElementHeight) / 2f; fieldRect.height = ElementHeight; fieldRect.width = ElementHeight; foreach (var theme in themes) { var prop = theme.GetSpriteProperty(item.Id); prop.Value = (Sprite)EditorGUI.ObjectField(fieldRect, prop.Value, typeof(Sprite), false); fieldRect.x += offsetPerField; } }
protected override void OnRemoveElement(ReorderableList list) { var item = MetaItems[list.index]; ThemesManager.DeleteFont(item.Id); Window.OnGuiChanged(); IsMetaDirty = true; }
protected override void OnDrawElement(Rect rect, int index, bool isActive, bool isFocused) { var fieldRect = CalculateFieldRect(rect, 1); var item = MetaItems[index]; var name = EditorGUI.TextField(fieldRect, item.Name); if (name != item.Name && !string.IsNullOrEmpty(name)) { ThemesManager.ChangeThemeName(item.Id, name); item.Name = name; } }
protected override void OnRemoveElement(ReorderableList list) { var index = list.index; if (index >= 0 && index < MetaItems.Count) { var item = MetaItems[index]; ThemesManager.DeleteTheme(item.Id); } Window.OnGuiChanged(); Window.MarkAllMetaDirty(); IsMetaDirty = true; }
protected override void OnDrawElement(Rect rect, int index, bool isActive, bool isFocused) { var themes = ThemesLibrary.Themes; var fieldRect = CalculateFieldRect(rect, themes.Count + 1); var offsetPerField = CalculateOffsetPerField(fieldRect); var item = MetaItems[index]; var name = EditorGUI.TextField(fieldRect, item.Name); if (name != item.Name && !string.IsNullOrEmpty(name)) { ThemesManager.ChangeColorName(item.Id, name); item.Name = name; } fieldRect.x += offsetPerField; foreach (var theme in themes) { var prop = theme.GetColorProperty(item.Id); prop.Value = EditorGUI.ColorField(fieldRect, prop.Value); fieldRect.x += offsetPerField; } }
protected override void OnReorderElement(ReorderableList list, int oldIndex, int newIndex) { ThemesManager.ChangeFontsOrder(oldIndex, newIndex); Window.OnGuiChanged(); IsMetaDirty = true; }