mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
0.2版本,重构代码,增加Editor
This commit is contained in:
81
Scripts/UI/Internal/Coordinate.cs
Normal file
81
Scripts/UI/Internal/Coordinate.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[Serializable]
|
||||
public class Coordinate : IEquatable<Coordinate>
|
||||
{
|
||||
[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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user