using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace XCharts { [Serializable] public class Coordinate : IEquatable { [SerializeField] private float m_Left; [SerializeField] private float m_Right; [SerializeField] private float m_Top; [SerializeField] private float m_Bottom; [SerializeField] private float m_Tickness; [SerializeField] private int m_FontSize; public float left { get { return m_Left; } set { m_Left = value; } } public float right { get { return m_Right; } set { m_Right = value; } } public float top { get { return m_Top; } set { m_Top = value; } } public float bottom { get { return m_Bottom; } set { m_Bottom = value; } } public float tickness { get { return m_Tickness; } set { m_Tickness = value; } } public int fontSize { get { return m_FontSize; } set { m_FontSize = value; } } public static Coordinate defaultCoordinate { get { var coordinate = new Coordinate { m_Left = 40f, m_Right = 80f, m_Top = 40f, m_Bottom = 25f, m_Tickness = 0.6f, m_FontSize = 16, }; return coordinate; } } public void Copy(Coordinate other) { m_Left = other.left; m_Right = other.right; m_Top = other.top; m_Bottom = other.bottom; m_Tickness = other.tickness; } public override bool Equals(object obj) { if (!(obj is Coordinate)) return false; return Equals((Coordinate)obj); } public bool Equals(Coordinate other) { return m_Left == other.left && m_Right == other.right && m_Top == other.top && m_Bottom == other.bottom && m_Tickness == other.tickness && m_FontSize == other.fontSize; } public static bool operator ==(Coordinate point1, Coordinate point2) { return point1.Equals(point2); } public static bool operator !=(Coordinate point1, Coordinate point2) { return !point1.Equals(point2); } public override int GetHashCode() { return base.GetHashCode(); } } }