Skip to content

Commit

Permalink
#Update-vs1.0.13
Browse files Browse the repository at this point in the history
## [1.0.13] - 30/01/2023
### Changed
- Romoção de campos não utilizados.
- Remoção de atribuições desnecessárias.
- Transformando possiveis campos em `readonly`.
  • Loading branch information
BelicusBr committed Jan 30, 2023
1 parent 20eb0b3 commit e5842ea
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 41 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
## [1.0.13] - 30/01/2023
### Changed
- Romoção de campos não utilizados.
- Remoção de atribuições desnecessárias.
- Transformando possiveis campos em `readonly`.
## [1.0.12] 09/01/2023
### Change
O corpo do método `public static Vector2Int GetBaseResolutionPlatform()` foi alterado.
Expand Down
4 changes: 2 additions & 2 deletions Editor/IGU/Attributes/IGUCustomDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Cobilas.Unity.Editor.Graphics.IGU {
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal sealed class IGUCustomDrawerAttribute : Attribute {
private Type typeTarget;
private bool useForChildren;
private readonly Type typeTarget;
private readonly bool useForChildren;

public Type TypeTarget => typeTarget;
public bool UseForChildren => useForChildren;
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/Attributes/IGUCustomFieldDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Cobilas.Unity.Editor.Graphics.IGU {
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal sealed class IGUCustomFieldDrawerAttribute : Attribute {
private string targetField;
private readonly string targetField;

public string TargetField => targetField;

Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/Auxiliaries/IGUObjectDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Cobilas.Unity.Editor.Graphics.IGU {
[CustomPropertyDrawer(typeof(IGUObject), true)]
public class IGUObjectDrawer : PropertyDrawer {

private Dictionary<int, SerializedObject> pairs = new Dictionary<int, SerializedObject>();
private readonly Dictionary<int, SerializedObject> pairs = new Dictionary<int, SerializedObject>();

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
EditorGUI.BeginProperty(position, label, property);
Expand Down
8 changes: 4 additions & 4 deletions Editor/IGU/Auxiliaries/IGUPropertyDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
namespace Cobilas.Unity.Editor.Graphics.IGU {
public static class IGUPropertyDrawer {
public delegate void IGUPropertyDrawerCallback(Type type, IGUObjectPropertyDrawer drawer);
private static Dictionary<Type, IGUObjectPropertyDrawer> list = new Dictionary<Type, IGUObjectPropertyDrawer>();
private static Dictionary<Type, IGUObjectPropertyDrawer> listSubClass = new Dictionary<Type, IGUObjectPropertyDrawer>();
private static Dictionary<Type, IGUObjectPropertyDrawer> listUseForChildren = new Dictionary<Type, IGUObjectPropertyDrawer>();
private static Dictionary<string, PropertyDrawer> listFieldDrawer = new Dictionary<string, PropertyDrawer>();
private readonly static Dictionary<Type, IGUObjectPropertyDrawer> list = new Dictionary<Type, IGUObjectPropertyDrawer>();
private readonly static Dictionary<Type, IGUObjectPropertyDrawer> listSubClass = new Dictionary<Type, IGUObjectPropertyDrawer>();
private readonly static Dictionary<Type, IGUObjectPropertyDrawer> listUseForChildren = new Dictionary<Type, IGUObjectPropertyDrawer>();
private readonly static Dictionary<string, PropertyDrawer> listFieldDrawer = new Dictionary<string, PropertyDrawer>();

[InitializeOnLoadMethod]
private static void Init() {
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/IGUObjects/IGUComboBoxDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Cobilas.Unity.Editor.Graphics.IGU {
[IGUCustomDrawer(typeof(IGUComboBox))]
public class IGUComboBoxDraw : IGUObjectDraw {
private Dictionary<int, int> SelectIndex = new Dictionary<int, int>();
private readonly Dictionary<int, int> SelectIndex = new Dictionary<int, int>();

protected override void IOnGUI(Rect position, SerializedObject serialized)
=> base.IOnGUI(position, serialized);
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/IGUObjects/IGUSelectionGridDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Cobilas.Unity.Editor.Graphics.IGU {
[IGUCustomDrawer(typeof(IGUSelectionGrid))]
public class IGUSelectionGridDraw : IGUObjectDraw {
private Dictionary<int, int> SelectIndex = new Dictionary<int, int>();
private readonly Dictionary<int, int> SelectIndex = new Dictionary<int, int>();

protected override void IOnGUI(Rect position, SerializedObject serialized)
=> base.IOnGUI(position, serialized);
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/Values/IGUColorDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
EditorGUI.indentLevel++;
color = EditorGUI.ColorField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("color"), color);
textColor = EditorGUI.ColorField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("text color"), textColor);
backgroundColor = EditorGUI.ColorField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("background color"), backgroundColor);
backgroundColor = EditorGUI.ColorField(MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("background color"), backgroundColor);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck()) {
prop_color.colorValue = color;
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/Values/IGUConfigDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
isVisible = EditorGUI.Toggle(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("is visible"), isVisible);
isEnabled = EditorGUI.Toggle(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("is enabled"), isEnabled);
depth = EditorGUI.IntField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("depth"), depth);
MouseButtonType buttonType = (MouseButtonType)EditorGUI.EnumPopup(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("mouse type"), (MouseButtonType)mouseType);
MouseButtonType buttonType = (MouseButtonType)EditorGUI.EnumPopup(MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("mouse type"), (MouseButtonType)mouseType);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck()) {
prop_depth.intValue = depth;
Expand Down
3 changes: 1 addition & 2 deletions Editor/IGU/Values/IGUContentDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace Cobilas.Unity.Editor.Graphics.IGU {
[CustomPropertyDrawer(typeof(IGUContent))]
[IGUCustomFieldDrawer("#IGUContent")]
public class IGUContentDraw : CPropertyDrawer {
private IGUContent content = new IGUContent();
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
//foldout
position.height = SingleLineHeight;
Expand All @@ -30,7 +29,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
text = EditorGUI.TextField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("text"), text);
image = ObjectField<Texture>(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("image"), image as Texture);
if (hide_Tooltip)
tooltip = EditorGUI.TextField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("tooltip"), tooltip);
tooltip = EditorGUI.TextField(MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("tooltip"), tooltip);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck()) {
prop_text.stringValue = text;
Expand Down
3 changes: 1 addition & 2 deletions Editor/IGU/Values/IGUTextSettingsDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace Cobilas.Unity.Editor.Graphics.IGU {
[CustomPropertyDrawer(typeof(IGUTextSettings))]
[IGUCustomFieldDrawer("#IGUTextSettings")]
public class IGUTextSettingsDraw : CPropertyDrawer {
private IGUTextSettings settings = new IGUTextSettings();
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
//foldout
position.height = SingleLineHeight;
Expand All @@ -33,7 +32,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
selectionColor = EditorGUI.ColorField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("selection color"), selectionColor);
cursorFlashSpeed = EditorGUI.FloatField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("cursor flash speed"), cursorFlashSpeed);
doubleClickSelectsWord = EditorGUI.Toggle(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("double click selects word"), doubleClickSelectsWord);
tripleClickSelectsLine = EditorGUI.Toggle(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("triple click selects line"), tripleClickSelectsLine);
tripleClickSelectsLine = EditorGUI.Toggle(MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("triple click selects line"), tripleClickSelectsLine);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck()) {
prop_cursorColor.colorValue = cursorColor;
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/Values/MarkedTextDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
text = EditorGUI.TextField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("text"), text);
textColor = EditorGUI.ColorField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("text color"), textColor);
unchangeText = EditorGUI.Toggle(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("unchange text"), unchangeText);
fontStyle = (FontStyle)EditorGUI.EnumPopup(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("font style"), fontStyle);
fontStyle = (FontStyle)EditorGUI.EnumPopup(MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("font style"), fontStyle);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck()) {
prop_text.stringValue = text;
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/Values/MaxMinSliderDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
EditorGUI.BeginChangeCheck();
EditorGUI.indentLevel++;
min = EditorGUI.FloatField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("min"), min);
max = EditorGUI.FloatField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("max"), max);
max = EditorGUI.FloatField(MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("max"), max);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck()) {
prop_min.floatValue = min;
Expand Down
2 changes: 1 addition & 1 deletion Editor/IGU/Values/MaxMinSliderIntDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
EditorGUI.BeginChangeCheck();
EditorGUI.indentLevel++;
min = EditorGUI.IntField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("min"), min);
max = EditorGUI.IntField(position = MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("max"), max);
max = EditorGUI.IntField(MoveDownWithBlankSpace(position), IGUTextObject.GetGUIContentTemp("max"), max);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck()) {
prop_min.intValue = min;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/IGU/Auxiliaries/HashCodeCompare.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Cobilas.Unity.Graphics.IGU {
public sealed class HashCodeCompare {
private int[] list;
private readonly int[] list;

public HashCodeCompare(int capacity) => list = new int[capacity];

Expand Down
2 changes: 1 addition & 1 deletion Runtime/IGU/Auxiliaries/IGUContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class IGUContainer : IGUBehaviour, IIGUContainer, ISerializationCallbackR
private bool wasDestroyed;
private Action onIGU;
private Action<List<IIGUObject>> alteredDepth;
private List<IIGUObject> AlteredDepthList = new List<IIGUObject>();
private readonly List<IIGUObject> AlteredDepthList = new List<IIGUObject>();

void IIGUContainer.OnIGU() {
onIGU?.Invoke();
Expand Down
9 changes: 5 additions & 4 deletions Runtime/IGU/Auxiliaries/IGUDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ namespace Cobilas.Unity.Graphics.IGU {
public class IGUDrawer : IGUBehaviour, ISerializationCallbackReceiver {
private Action onIGU;
private Coroutine EndOfFrameCoroutine = null;
private IGUToolTip toolTip = new IGUToolTip();
private readonly IGUToolTip toolTip = new IGUToolTip();
[SerializeField] private IGUMouseInput[] mouses;
[SerializeField] private IGUContainer[] containers;
#if UNITY_EDITOR
#pragma warning disable IDE0052
[SerializeField, HideInInspector] private Vector2 editor_ScaleFactor;
[SerializeField, HideInInspector] private Vector2Int editor_CurrentResolution;

#pragma warning restore IDE0052
#endif

private static IGUDrawer drawer;
Expand Down Expand Up @@ -158,12 +159,12 @@ public static Vector2Int GetBaseResolutionPlatform() {

private sealed class IGUToolTip {
private string tooltip;
private GUIContent gUIContent;
private bool close;
private Vector2 position;
private Vector2 scaleFactor;
private GUIStyle style;
private IGUColor color;
private readonly GUIContent gUIContent;

public IGUToolTip() {
color = IGUColor.DefaultBoxColor;
Expand All @@ -188,7 +189,7 @@ public IGUToolTip() {
public void Draw() {
if (close) return;
gUIContent.text = tooltip;
style = style == null ? GUI.skin.box : style;
style = style ?? GUI.skin.box;
Vector2 size = style.CalcSize(gUIContent);
Matrix4x4 oldMatrix = GUI.matrix;
GUI.color = color.MyColor;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/IGU/IGUObjects/IGUButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Cobilas.Unity.Graphics.IGU.Elements {
public class IGUButton : IGUTextObject, ISerializationCallbackReceiver {
public const string DefaultContentIGUButton = "IGU Button";
private List<string> stackTraceCount = new List<string>();
private readonly List<string> stackTraceCount = new List<string>();
[SerializeField] protected bool[] clicked;
[SerializeField] protected GUIStyle buttonStyle;
[SerializeField] protected IGUOnClickEvent onClick;
Expand Down
1 change: 0 additions & 1 deletion Runtime/IGU/IGUObjects/IGUHorizontalScrollbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Cobilas.Unity.Graphics.IGU.Elements {
public class IGUHorizontalScrollbar : IGUSliderObject {
private float oldValue;
[SerializeField] protected float scrollbarThumbSize;
[SerializeField] protected IGUOnSliderValueEvent onModifiedScrollbar;
[SerializeField] protected IGUOnSliderIntValueEvent onModifiedScrollbarInt;
Expand Down
4 changes: 2 additions & 2 deletions Runtime/IGU/IGUObjects/IGUNumericBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public override void OnIGU() {
}

private void InitEvents() {
buttonLeft.OnClick.AddListener(() => { value = value - additionValue; });
buttonRight.OnClick.AddListener(() => { value = value + additionValue; });
buttonLeft.OnClick.AddListener(() => value -= additionValue);
buttonRight.OnClick.AddListener(() => value += additionValue);
}

void ISerializationCallbackReceiver.OnBeforeSerialize() { }
Expand Down
4 changes: 2 additions & 2 deletions Runtime/IGU/IGUObjects/IGUNumericBoxInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public override void OnIGU() {
}

private void InitEvents() {
buttonLeft.OnClick.AddListener(() => { value = value - additionValue; });
buttonRight.OnClick.AddListener(() => { value = value + additionValue; });
buttonLeft.OnClick.AddListener(() => value -= additionValue);
buttonRight.OnClick.AddListener(() => value += additionValue);
}

void ISerializationCallbackReceiver.OnBeforeSerialize() { }
Expand Down
2 changes: 1 addition & 1 deletion Runtime/IGU/IGUObjects/IGUSelectionGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Cobilas.Unity.Graphics.IGU.Elements {
public class IGUSelectionGrid : IGUObject, ISerializationCallbackReceiver {

private HashCodeCompare compare = new HashCodeCompare(6);
private readonly HashCodeCompare compare = new HashCodeCompare(6);
[SerializeField] protected int _xCount;
[SerializeField] protected bool useTooltip;
[SerializeField] protected Vector2 spacing;
Expand Down
14 changes: 8 additions & 6 deletions Runtime/Resolution/CobilasResolutions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ void ISerializationCallbackReceiver.OnBeforeSerialize() { }

//[CRIOLM_CallWhen(typeof(ContainerManager), CRIOLMType.AfterSceneLoad)]
[CallWhenStart(InitializePriority.Low, "#ContainerManager")]
#pragma warning disable IDE0051 // Remover membros privados não utilizados
private static void Init() {
#pragma warning restore IDE0051 // Remover membros privados não utilizados
cb_resolutions = FindObjectOfType<CobilasResolutions>();
cb_resolutions.Internal_Refresh();
}
Expand Down Expand Up @@ -132,12 +134,12 @@ private static bool ContainsFrequency(int frequency) {
return false;
}

private static bool ContainsAspectRatio(AspectRatio aspectRatio) {
for (int I = 0; I < ArrayManipulation.ArrayLength(cb_resolutions.aspectRatios); I++)
if (cb_resolutions.aspectRatios[I] == aspectRatio)
return true;
return false;
}
//private static bool ContainsAspectRatio(AspectRatio aspectRatio) {
// for (int I = 0; I < ArrayManipulation.ArrayLength(cb_resolutions.aspectRatios); I++)
// if (cb_resolutions.aspectRatios[I] == aspectRatio)
// return true;
// return false;
//}

private static bool ContainsResolution(Resolution resolution) {
for (int I = 0; I < ArrayManipulation.ArrayLength(cb_resolutions.resolutions); I++)
Expand Down
5 changes: 3 additions & 2 deletions com.cobilas.unity.graphics.gpack
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "com.cobilas.unity.graphics",
"version": "1.0.12",
"version": "1.0.13",
"repository": "https://github.com/BelicusBr/com.cobilas.unity.graphics.git",
"relatedPackages": [
"1.0.7",
"1.0.8",
"1.0.9",
"1.0.10",
"1.0.11",
"1.0.12"
"1.0.12",
"1.0.13"
],
"gitDependencies": [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.cobilas.unity.graphics",
"version": "1.0.12",
"version": "1.0.13",
"displayName": "Cobilas Graphics",
"description": "Pacote que adiciona e manipula elementos",
"licensesUrl": "https://github.com/BelicusBr/com.cobilas.unity.graphics/blob/main/LICENSE.md",
Expand Down

0 comments on commit e5842ea

Please sign in to comment.