Skip to content

Commit

Permalink
修复Unity版本兼容问题
Browse files Browse the repository at this point in the history
  • Loading branch information
monitor1394 committed Feb 21, 2021
1 parent 2fdd554 commit 4ea5168
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Assets/XCharts/Editor/BaseChartEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ protected void BlockListField(bool all, params SerializedProperty[] props)
for (int i = 0; i < prop.arraySize; i++)
{
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
EditorGUILayout.Space(-EditorGUIUtility.singleLineHeight - EditorGUIUtility.standardVerticalSpacing);
EditorGUILayout.Space();
var currRect = EditorGUILayout.GetControlRect();

var rect1 = new Rect(currRect.width + k_IconXOffset,
Expand Down
4 changes: 2 additions & 2 deletions Assets/XCharts/Editor/PropertyDrawers/ThemeDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ private void OnGUI()
else if (IsAssetsExist(XChartsMgr.GetThemeAssetPath(m_ChartName)))
{
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath="
+ XChartsMgr.GetThemeAssetPath(m_ChartName)), 5);
+ XChartsMgr.GetThemeAssetPath(m_ChartName)));
}
else
{
XChartsMgr.ExportTheme(target.theme, m_ChartName);
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath="
+ XChartsMgr.GetThemeAssetPath(m_ChartName)), 5);
+ XChartsMgr.GetThemeAssetPath(m_ChartName)));
}
}
}
Expand Down
19 changes: 10 additions & 9 deletions Assets/XCharts/Editor/Utility/ChartEditorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class ChartEditorHelper
public const float INDENT_WIDTH = 15;
public const float BOOL_WIDTH = 15;
public const float ARROW_WIDTH = 13;
public const float BLOCK_WIDTH = 0;
public const float GAP_WIDTH = 0;
#endif

Expand All @@ -26,8 +27,8 @@ public class Styles
font = headerStyle.font,
fontStyle = headerStyle.fontStyle,
};
public static readonly GUIContent iconAdd = EditorGUIUtility.TrIconContent("Toolbar Plus", "Add");
public static readonly GUIContent iconRemove = EditorGUIUtility.TrIconContent("Toolbar Minus", "Remove");
public static readonly GUIContent iconAdd = new GUIContent("+", "Add");
public static readonly GUIContent iconRemove = new GUIContent("-", "Remove");
public static readonly GUIContent iconUp = new GUIContent("", "Up");
public static readonly GUIContent iconDown = new GUIContent("", "Down");
public static readonly GUIStyle invisibleButton = "InvisibleButton";
Expand Down Expand Up @@ -286,20 +287,20 @@ public static void MakeList(ref Rect drawRect, ref float height, SerializedPrope
{
EditorGUI.indentLevel++;
var listSize = listProp.arraySize;
var iconWidth = 14;
var iconWidth = 15;
var iconGap = 3f;
if (showSize)
{
if (showOrder)
{
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth - 1, drawRect.height);
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth + 2, drawRect.height);
var iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += BLOCK_WIDTH;
}
if (GUI.Button(iconRect, Styles.iconAdd, Styles.invisibleButton))
if (GUI.Button(iconRect, Styles.iconAdd))
{
if (listProp.displayName.Equals("Series"))
{
Expand Down Expand Up @@ -361,15 +362,15 @@ public static void MakeList(ref Rect drawRect, ref float height, SerializedPrope
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var isSerie = "Serie".Equals(element.type);
var elementRect = isSerie
? new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH, drawRect.height)
? new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - iconGap, drawRect.height)
: new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height);
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
var iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (XChartsSettings.editorBlockEnable)
{
iconRect.x += BLOCK_WIDTH;
}
if (GUI.Button(iconRect, Styles.iconUp, Styles.invisibleButton))
if (GUI.Button(iconRect, Styles.iconUp))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
}
Expand All @@ -378,7 +379,7 @@ public static void MakeList(ref Rect drawRect, ref float height, SerializedPrope
{
iconRect.x += BLOCK_WIDTH;
}
if (GUI.Button(iconRect, Styles.iconDown, Styles.invisibleButton))
if (GUI.Button(iconRect, Styles.iconDown))
{
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
}
Expand All @@ -387,7 +388,7 @@ public static void MakeList(ref Rect drawRect, ref float height, SerializedPrope
{
iconRect.x += BLOCK_WIDTH;
}
if (GUI.Button(iconRect, Styles.iconRemove, Styles.invisibleButton))
if (GUI.Button(iconRect, Styles.iconRemove))
{
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
}
Expand Down
3 changes: 1 addition & 2 deletions Assets/XCharts/Editor/XCharts.Editor.asmdef
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "XCharts.Editor",
"references": [
"XCharts.Runtime",
"Unity.TextMeshPro"

This comment has been minimized.

Copy link
@psarras

psarras Feb 26, 2021

I think this must have been a mistake? By removing this reference we cannot enable TextMeshPro? At least it doesn't work for me #125

"XCharts.Runtime"
],
"includePlatforms": [
"Editor"
Expand Down
1 change: 1 addition & 0 deletions Assets/XCharts/Resources/XChartsSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ MonoBehaviour:
m_SerieScatterSymbolSize: 20
m_SerieScatterSymbolSelectedSize: 30
m_EditorBlockEnable: 1
m_EditorShowAllListData: 0
m_MaxPainter: 10
m_LineSmoothStyle: 3
m_LineSmoothness: 2
Expand Down
1 change: 0 additions & 1 deletion Assets/XCharts/Runtime/XCharts.Runtime.asmdef
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "XCharts.Runtime",
"references": [
"Unity.TextMeshPro"

This comment has been minimized.

Copy link
@psarras

psarras Feb 26, 2021

I think this must have been a mistake? By removing this reference we cannot enable TextMeshPro? At least it doesn't work for me #125

],
"optionalUnityReferences": [],
"includePlatforms": [],
Expand Down
3 changes: 3 additions & 0 deletions Assets/XCharts/Runtime/XChartsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
namespace XCharts
{
[Serializable]
#if UNITY_2018_3

[ExcludeFromPresetAttribute]
#endif
public class XChartsSettings : ScriptableObject
{

Expand Down

0 comments on commit 4ea5168

Please sign in to comment.