Merge pull request '작업 조건 분석 기능 개발' (#12) from dev/jym/250310_00 into main
Reviewed-on: http://220.90.135.190:3000/UVCXR/ChunilENG/pulls/12
This commit was merged in pull request #12.
This commit is contained in:
9
Assets/Chart And Graph.meta
Normal file
9
Assets/Chart And Graph.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d31fb10c683f64b48949dee11f743c66
|
||||
folderAsset: yes
|
||||
timeCreated: 1560595642
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/Chart And Graph/3rd party notices.txt
Normal file
19
Assets/Chart And Graph/3rd party notices.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
The following 3rd parties are integrated into Graph and Chart:
|
||||
|
||||
In the folder Chart And Graph/Themes/Common/Fonts :
|
||||
|
||||
Each font has it's own folder with full license detials
|
||||
|
||||
Exo2 - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/exo-2
|
||||
ABeeZee - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/abeezee
|
||||
Comprehension - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/comprehension
|
||||
Enriqueta - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/enriqueta
|
||||
Fengardo-neue - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/fengardo-neue
|
||||
Overpass - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/overpass
|
||||
Rambla - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/rambla
|
||||
Scada - SIL OPEN FONT LICENSE - https://www.fontsquirrel.com/license/scada
|
||||
|
||||
SimpleJson in the folder Chart And Graph/SimpleJSON-master:
|
||||
Licensed under MIT license :https://github.com/Bunny83/SimpleJSON/blob/master/LICENSE
|
||||
|
||||
|
||||
8
Assets/Chart And Graph/3rd party notices.txt.meta
Normal file
8
Assets/Chart And Graph/3rd party notices.txt.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b593c70250d4fb94bb76f653a500cd6d
|
||||
timeCreated: 1536774863
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Chart And Graph/Editor.meta
Normal file
8
Assets/Chart And Graph/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3905511a019a5dd48ae207994f8a2e88
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Chart And Graph/Editor/AutoFloatInspector.cs
Normal file
32
Assets/Chart And Graph/Editor/AutoFloatInspector.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(AutoFloat))]
|
||||
class AutoFloatInspector : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
label = EditorGUI.BeginProperty(position, label, property);
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
SerializedProperty auto = property.FindPropertyRelative("Automatic");
|
||||
SerializedProperty val = property.FindPropertyRelative("Value");
|
||||
int indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
bool res = EditorGUI.ToggleLeft(position,"Auto",auto.boolValue);
|
||||
EditorGUI.indentLevel = indent;
|
||||
EditorGUI.indentLevel++;
|
||||
if (auto.boolValue == false && EditorGUI.showMixedValue == false)
|
||||
val.floatValue = EditorGUILayout.FloatField("Value",val.floatValue);
|
||||
auto.boolValue = res;
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/AutoFloatInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/AutoFloatInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c989bbf118ca01e4aab213559170875f
|
||||
timeCreated: 1479209594
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
275
Assets/Chart And Graph/Editor/AxisInspector.cs
Normal file
275
Assets/Chart And Graph/Editor/AxisInspector.cs
Normal file
@@ -0,0 +1,275 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomEditor(typeof(AxisBase), true)]
|
||||
class AxisInspector : Editor
|
||||
{
|
||||
bool mMain = false;
|
||||
bool mSub = false;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
AxisBase axis = (AxisBase)target;
|
||||
|
||||
if (axis.gameObject == null)
|
||||
return;
|
||||
|
||||
AnyChart chart = axis.gameObject.GetComponent<AnyChart>();
|
||||
if (chart == null)
|
||||
return;
|
||||
if((chart is AxisChart) == false)
|
||||
{
|
||||
EditorGUILayout.LabelField(string.Format("Chart of type {0} does not support axis",chart.GetType().Name));
|
||||
return;
|
||||
}
|
||||
SerializedProperty simpleViewProp = serializedObject.FindProperty("SimpleView");
|
||||
if (simpleViewProp == null)
|
||||
return;
|
||||
|
||||
Type canvasType = (chart is ICanvas) ? typeof(CanvasAttribute) : typeof(NonCanvasAttribute);
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
bool negate = false;
|
||||
if (simpleViewProp.boolValue == true)
|
||||
negate = GUILayout.Button("Advanced View");
|
||||
else
|
||||
negate = GUILayout.Button("Simple View");
|
||||
if (negate)
|
||||
simpleViewProp.boolValue = !simpleViewProp.boolValue;
|
||||
bool simple = simpleViewProp.boolValue;
|
||||
|
||||
|
||||
SerializedProperty depth = serializedObject.FindProperty("depth");
|
||||
if (depth != null)
|
||||
EditorGUILayout.PropertyField(depth);
|
||||
SerializedProperty format= serializedObject.FindProperty("format");
|
||||
EditorGUILayout.PropertyField(format);
|
||||
if (simple)
|
||||
DoSimpleView(canvasType);
|
||||
else
|
||||
DoAdvanvedView(canvasType,true);
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
serializedObject.Update();
|
||||
}
|
||||
|
||||
void SetValue(SerializedProperty assignTo,SerializedProperty from)
|
||||
{
|
||||
|
||||
if(assignTo.propertyType != from.propertyType)
|
||||
{
|
||||
Debug.LogWarning("type does not match");
|
||||
return;
|
||||
}
|
||||
|
||||
if (assignTo.type == "AutoFloat")
|
||||
{
|
||||
SerializedProperty auto = assignTo.FindPropertyRelative("Automatic");
|
||||
SerializedProperty val = assignTo.FindPropertyRelative("Value");
|
||||
SerializedProperty autofrom = from.FindPropertyRelative("Automatic");
|
||||
SerializedProperty valfrom = from.FindPropertyRelative("Value");
|
||||
auto.boolValue = autofrom.boolValue;
|
||||
val.floatValue = valfrom.floatValue;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (assignTo.propertyType)
|
||||
{
|
||||
case SerializedPropertyType.Float:
|
||||
assignTo.floatValue = from.floatValue;
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
assignTo.intValue = from.intValue;
|
||||
break;
|
||||
case SerializedPropertyType.Enum:
|
||||
assignTo.enumValueIndex = from.enumValueIndex;
|
||||
break;
|
||||
case SerializedPropertyType.Boolean:
|
||||
assignTo.boolValue = from.boolValue;
|
||||
break;
|
||||
case SerializedPropertyType.String:
|
||||
assignTo.stringValue = from.stringValue;
|
||||
break;
|
||||
case SerializedPropertyType.ObjectReference:
|
||||
assignTo.objectReferenceValue = from.objectReferenceValue;
|
||||
break;
|
||||
default:
|
||||
Debug.LogWarning("type cannot be set");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Type getTypeFromField(Type type,string fieldName)
|
||||
{
|
||||
FieldInfo inf = type.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (inf == null)
|
||||
return null;
|
||||
return inf.FieldType;
|
||||
}
|
||||
|
||||
bool CompareValues(Type type,string fieldName,object a,object b)
|
||||
{
|
||||
FieldInfo inf= type.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
object valA = inf.GetValue(a);
|
||||
object valB = inf.GetValue(b);
|
||||
if(valA is UnityEngine.Object && valB is UnityEngine.Object)
|
||||
{
|
||||
if(((UnityEngine.Object)valA) == ((UnityEngine.Object)valB))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if (valA == null && valB == null)
|
||||
return true;
|
||||
if (valA == null || valB == null)
|
||||
return false;
|
||||
return valA.Equals(valB);
|
||||
}
|
||||
|
||||
void DoSimpleView(Type canvasType)
|
||||
{
|
||||
SerializedProperty it = serializedObject.FindProperty("mainDivisions");
|
||||
SerializedProperty SubDivisions = serializedObject.FindProperty("subDivisions");
|
||||
object mainDivision = ((AxisBase)target).MainDivisions;
|
||||
object subDivision = ((AxisBase)target).SubDivisions;
|
||||
if (it == null || SubDivisions == null)
|
||||
return;
|
||||
SerializedProperty end = it.GetEndProperty();
|
||||
while(it.NextVisible(true) && SerializedProperty.EqualContents(end,it) == false)
|
||||
{
|
||||
if (it.name == "SimpleView")
|
||||
continue;
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), it.name, canvasType) == false)
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), it.name, canvasType) == false)
|
||||
continue;
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), it.name, typeof(SimpleAttribute)) == false)
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), it.name, typeof(SimpleAttribute)) == false)
|
||||
continue;
|
||||
SerializedProperty clone = SubDivisions.FindPropertyRelative(it.name);
|
||||
if (clone == null)
|
||||
Debug.LogWarning("can't find property " + it.name);
|
||||
bool equal = CompareValues(typeof(ChartDivisionInfo), clone.name, mainDivision, subDivision);
|
||||
Type t = getTypeFromField(typeof(ChartDivisionInfo), clone.name);
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = !equal;
|
||||
DoMixedFiled(it, t);
|
||||
EditorGUI.showMixedValue = false;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
SetValue(clone, it);
|
||||
}
|
||||
DoAdvanvedView(canvasType,false);
|
||||
}
|
||||
public void DoMixedFiled(SerializedProperty prop,Type type)
|
||||
{
|
||||
if(prop.type == "AutoFloat")
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel(prop.displayName);
|
||||
SerializedProperty auto = prop.FindPropertyRelative("Automatic");
|
||||
SerializedProperty val = prop.FindPropertyRelative("Value");
|
||||
auto.boolValue = EditorGUILayout.ToggleLeft("Auto", auto.boolValue);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel++;
|
||||
if (auto.boolValue == false && EditorGUI.showMixedValue == false)
|
||||
val.floatValue = EditorGUILayout.FloatField("Value",val.floatValue);
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
return;
|
||||
}
|
||||
switch(prop.propertyType)
|
||||
{
|
||||
case SerializedPropertyType.Float:
|
||||
if(prop.name == "FontSharpness")
|
||||
prop.floatValue = EditorGUILayout.Slider(prop.displayName, prop.floatValue,1f,3f);
|
||||
else
|
||||
prop.floatValue = EditorGUILayout.FloatField(prop.displayName,prop.floatValue);
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
if (prop.name == "FractionDigits")
|
||||
prop.intValue = EditorGUILayout.IntSlider(prop.displayName, prop.intValue,0,7);
|
||||
else
|
||||
prop.intValue = EditorGUILayout.IntField(prop.displayName, prop.intValue);
|
||||
break;
|
||||
case SerializedPropertyType.Enum:
|
||||
ChartDivisionAligment selected = (ChartDivisionAligment)Enum.Parse( typeof(ChartDivisionAligment), prop.enumNames[prop.enumValueIndex]);
|
||||
Enum res = EditorGUILayout.EnumPopup(prop.displayName, selected);
|
||||
string newName= Enum.GetName(typeof(ChartDivisionAligment), res);
|
||||
for (int i = 0; i < prop.enumNames.Length; ++i)
|
||||
{
|
||||
if (prop.enumNames[i] == newName)
|
||||
{
|
||||
prop.enumValueIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SerializedPropertyType.String:
|
||||
prop.stringValue = EditorGUILayout.TextField(prop.displayName, prop.stringValue);
|
||||
break;
|
||||
case SerializedPropertyType.Boolean:
|
||||
prop.boolValue = EditorGUILayout.Toggle(prop.displayName, prop.boolValue);
|
||||
break;
|
||||
case SerializedPropertyType.ObjectReference:
|
||||
if(type != null)
|
||||
prop.objectReferenceValue = EditorGUILayout.ObjectField(prop.displayName, prop.objectReferenceValue, type, true);
|
||||
break;
|
||||
default:
|
||||
Debug.LogWarning("type cannot be set");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoAdvanvedView(Type canvasType,bool includeSimple)
|
||||
{
|
||||
SerializedProperty mainDivisions = serializedObject.FindProperty("mainDivisions");
|
||||
SerializedProperty subDivisions = serializedObject.FindProperty("subDivisions");
|
||||
mMain =mainDivisions.isExpanded = EditorGUILayout.Foldout(mainDivisions.isExpanded, "Main Divisions");
|
||||
if (mMain)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
SerializedProperty end = mainDivisions.GetEndProperty();
|
||||
while (mainDivisions.NextVisible(true) && SerializedProperty.EqualContents(mainDivisions, end) == false)
|
||||
{
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), mainDivisions.name, canvasType) == false)
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), mainDivisions.name, canvasType) == false)
|
||||
continue;
|
||||
if (includeSimple == false)
|
||||
{
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), mainDivisions.name, typeof(SimpleAttribute)))
|
||||
continue;
|
||||
}
|
||||
EditorGUILayout.PropertyField(mainDivisions);
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
mSub = subDivisions.isExpanded = EditorGUILayout.Foldout(subDivisions.isExpanded, "Sub Divisions");
|
||||
if (mSub)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
SerializedProperty end = subDivisions.GetEndProperty();
|
||||
while (subDivisions.NextVisible(true) && SerializedProperty.EqualContents(subDivisions, end) == false)
|
||||
{
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), subDivisions.name, canvasType) == false)
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(AxisBase), subDivisions.name, canvasType) == false)
|
||||
continue;
|
||||
if (includeSimple == false)
|
||||
{
|
||||
if (ChartEditorCommon.HasAttributeOfType(typeof(ChartDivisionInfo), subDivisions.name, typeof(SimpleAttribute)))
|
||||
continue;
|
||||
}
|
||||
EditorGUILayout.PropertyField(subDivisions);
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/AxisInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/AxisInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 898567b381452e94794158c16012f617
|
||||
timeCreated: 1479124371
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
364
Assets/Chart And Graph/Editor/BarChartInspetor.cs
Normal file
364
Assets/Chart And Graph/Editor/BarChartInspetor.cs
Normal file
@@ -0,0 +1,364 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(BarChart),true)]
|
||||
class BarChartInspetor : Editor
|
||||
{
|
||||
bool mCategories = false;
|
||||
bool mGroups = false;
|
||||
string mCategoryError = null;
|
||||
string mNewCategoryName = "";
|
||||
string mNewGroupName = "";
|
||||
string mGroupError = null;
|
||||
GUIStyle mRedStyle;
|
||||
GUIStyle mBold;
|
||||
HashSet<string> mAllNames = new HashSet<string>();
|
||||
GUIStyle mSplitter;
|
||||
List<int> mToRemove = new List<int>();
|
||||
List<int> mToUp = new List<int>();
|
||||
Dictionary<string, string> mOperations = new Dictionary<string, string>();
|
||||
ChartDataEditor mWindow;
|
||||
bool mUpdateWindow = false;
|
||||
Texture mSettings;
|
||||
GUIContent MaxBarValue = new GUIContent("Max Bar Value :", "All the bars are scaled according to this value, Bars that are larger then this value are clamped");
|
||||
GUIContent MinBarValue = new GUIContent("Min Bar Value :", "All the bars are scaled according to this value, Bars that are lower then this value are clamped");
|
||||
RenameWindow mRenameWindow;
|
||||
public void OnEnable()
|
||||
{
|
||||
mRedStyle = new GUIStyle();
|
||||
mRedStyle.normal.textColor = Color.red;
|
||||
|
||||
mSplitter = new GUIStyle();
|
||||
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
|
||||
mSplitter.stretchWidth = true;
|
||||
mSplitter.margin = new RectOffset(0, 0, 7, 7);
|
||||
}
|
||||
|
||||
public void Splitter()
|
||||
{
|
||||
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Color restoreColor = GUI.color;
|
||||
GUI.color = new Color(0.5f, 0.5f, 0.5f);
|
||||
mSplitter.Draw(position, false, false, false, false);
|
||||
GUI.color = restoreColor;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoOperations(SerializedProperty items,int size,string type)
|
||||
{
|
||||
mToRemove.Clear();
|
||||
mToUp.Clear();
|
||||
bool up = false;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
|
||||
string arg = type + "|" + name;
|
||||
string res = null;
|
||||
if (up == true)
|
||||
{
|
||||
mToUp.Add(i);
|
||||
up = false;
|
||||
}
|
||||
if (mOperations.TryGetValue(arg, out res))
|
||||
{
|
||||
if (res == "remove")
|
||||
mToRemove.Add(i);
|
||||
if (res == "up" && i > 0)
|
||||
mToUp.Add(i);
|
||||
if (res == "down")
|
||||
up = true;
|
||||
mOperations.Remove(arg);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mToRemove.Count; i++)
|
||||
items.DeleteArrayElementAtIndex(mToRemove[i]);
|
||||
for (int i = 0; i < mToUp.Count; i++)
|
||||
{
|
||||
int cur = mToUp[i];
|
||||
items.MoveArrayElement(cur, cur - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
|
||||
{
|
||||
SerializedProperty items = data.FindPropertyRelative(property);
|
||||
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
|
||||
//bool up, down;
|
||||
mAllNames.Clear();
|
||||
int size = items.arraySize;
|
||||
if (Event.current.type == EventType.Layout)
|
||||
DoOperations(items, size, type);
|
||||
size = items.arraySize;
|
||||
if (items.isExpanded)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
mAllNames.Add(name);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
bool toogle = false;
|
||||
if (nameProp != null)
|
||||
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
|
||||
else
|
||||
{
|
||||
toogle = false;
|
||||
EditorGUILayout.LabelField(name);
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
if(GUILayout.Button("..."))
|
||||
DoContext(type, name);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (toogle)
|
||||
{
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
if (nameProp != null)
|
||||
{
|
||||
SerializedProperty end = entry.GetEndProperty(true);
|
||||
entry.Next(true);
|
||||
if (SerializedProperty.EqualContents(entry, end) == false)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (entry.name != "Name")
|
||||
EditorGUILayout.PropertyField(entry, true);
|
||||
}
|
||||
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (errorMessage != null)
|
||||
EditorGUILayout.LabelField(errorMessage, mRedStyle);
|
||||
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
|
||||
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
newName = EditorGUILayout.TextField(newName);
|
||||
//GUILayout.Space(indentAdd.xMin);
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
bool error = false;
|
||||
if (newName.Trim().Length == 0)
|
||||
{
|
||||
errorMessage = "Name can't be empty";
|
||||
error = true;
|
||||
}
|
||||
else if (ChartEditorCommon.IsAlphaNum(newName) == false)
|
||||
{
|
||||
errorMessage = "Name conatins invalid characters";
|
||||
error = true;
|
||||
}
|
||||
else if (mAllNames.Contains(newName))
|
||||
{
|
||||
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
|
||||
error = true;
|
||||
}
|
||||
if (error == false)
|
||||
{
|
||||
errorMessage = null;
|
||||
items.InsertArrayElementAtIndex(size);
|
||||
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
|
||||
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
|
||||
if (newItemName == null)
|
||||
newItem.stringValue = newName;
|
||||
else
|
||||
newItemName.stringValue = newName;
|
||||
newName = "";
|
||||
UpdateWindow();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = null;
|
||||
}
|
||||
UpdateWindow();
|
||||
}
|
||||
|
||||
void callback(object val)
|
||||
{
|
||||
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
|
||||
mOperations[pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
bool RenameGroup(string fromName, string toName)
|
||||
{
|
||||
BarChart barChart = (BarChart)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
barChart.DataSource.RenameGroup(fromName, toName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if (barChart.gameObject.activeInHierarchy)
|
||||
barChart.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(barChart);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenameCategory(string fromName,string toName)
|
||||
{
|
||||
BarChart barChart = (BarChart)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
barChart.DataSource.RenameCategory(fromName, toName);
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if(barChart.gameObject.activeInHierarchy)
|
||||
barChart.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(barChart);
|
||||
return true;
|
||||
}
|
||||
void RenameCalled(object val)
|
||||
{
|
||||
var data = (KeyValuePair<string, string>)val;
|
||||
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
|
||||
mRenameWindow = window;
|
||||
if(data.Key == "category")
|
||||
window.ShowDialog(data.Value, data.Key, RenameCategory);
|
||||
else if(data.Key == "group")
|
||||
window.ShowDialog(data.Value, data.Key, RenameGroup);
|
||||
}
|
||||
void DoContext(string type,string name)
|
||||
{
|
||||
string arg = type + "|" + name;
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Move Up"), false,callback, new KeyValuePair<string, string>(arg, "up"));
|
||||
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
|
||||
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
|
||||
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
|
||||
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
void UpdateWindow()
|
||||
{
|
||||
mUpdateWindow = true;
|
||||
}
|
||||
void OnDisable()
|
||||
{
|
||||
if(mRenameWindow != null)
|
||||
{
|
||||
mRenameWindow.Close();
|
||||
mRenameWindow = null;
|
||||
}
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.Close();
|
||||
mWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
serializedObject.Update();
|
||||
SerializedProperty barData = serializedObject.FindProperty("Data");
|
||||
EditorGUILayout.BeginVertical();
|
||||
Splitter();
|
||||
if(mBold == null)
|
||||
{
|
||||
mBold = new GUIStyle(EditorStyles.foldout);
|
||||
//mBold.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
// EditorStyles.foldout.fontStyle = FontStyle.Bold;
|
||||
// fold = EditorGUILayout.Foldout(fold,"Bar Data", EditorStyles.foldout);
|
||||
//EditorStyles.foldout.fontStyle = FontStyle.Normal;
|
||||
// if (fold)
|
||||
// {
|
||||
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
NamedItemEditor(barData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
|
||||
NamedItemEditor(barData, "group", "mGroups", "Groups", ref mGroupError, ref mGroups, ref mNewGroupName);
|
||||
|
||||
SerializedProperty maxProp = barData.FindPropertyRelative("maxValue");
|
||||
SerializedProperty minProp = barData.FindPropertyRelative("minValue");
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(MinBarValue, EditorStyles.boldLabel);
|
||||
SerializedProperty automaticProp = barData.FindPropertyRelative("automaticMinValue");
|
||||
bool automatic = automaticProp.boolValue;
|
||||
automatic = GUILayout.Toggle(automatic, "Auto");
|
||||
GUILayout.FlexibleSpace();
|
||||
automaticProp.boolValue = automatic;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
EditorGUILayout.PropertyField(minProp);
|
||||
if (minProp.doubleValue > maxProp.doubleValue)
|
||||
minProp.doubleValue = maxProp.doubleValue - 0.1;
|
||||
}
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(MaxBarValue, EditorStyles.boldLabel);
|
||||
automaticProp = barData.FindPropertyRelative("automaticMaxValue");
|
||||
automatic = automaticProp.boolValue;
|
||||
automatic = GUILayout.Toggle(automatic, "Auto");
|
||||
GUILayout.FlexibleSpace();
|
||||
automaticProp.boolValue = automatic;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
|
||||
EditorGUILayout.PropertyField(maxProp);
|
||||
if (minProp.doubleValue > maxProp.doubleValue)
|
||||
maxProp.doubleValue = minProp.doubleValue + 0.1;
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Edit Values...") && mWindow == null)
|
||||
mWindow = ChartDataEditor.ShowForObject(serializedObject);
|
||||
//}
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (mUpdateWindow == true)
|
||||
{
|
||||
mUpdateWindow = false;
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.SetEditedObject(serializedObject);
|
||||
mWindow.Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/BarChartInspetor.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/BarChartInspetor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 056f0fff5e172de468df8c3392cabaac
|
||||
timeCreated: 1473969758
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "Bitsplash.GraphAndChart.Editor",
|
||||
"references": [
|
||||
"GUID:aa9320822a6e56c41a6d780e3d208040"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": false,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6b78e7ca51d6ea40a07a6f0f01838a7
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
408
Assets/Chart And Graph/Editor/CandleChartInspector.cs
Normal file
408
Assets/Chart And Graph/Editor/CandleChartInspector.cs
Normal file
@@ -0,0 +1,408 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomEditor(typeof(CandleChart), true)]
|
||||
class CandleChartInspector : Editor
|
||||
{
|
||||
bool mCategories = false;
|
||||
string mCategoryError = null;
|
||||
string mNewCategoryName = "";
|
||||
GUIStyle mRedStyle;
|
||||
GUIStyle mBold;
|
||||
HashSet<string> mAllNames = new HashSet<string>();
|
||||
GUIStyle mSplitter;
|
||||
List<int> mToRemove = new List<int>();
|
||||
List<int> mToUp = new List<int>();
|
||||
Dictionary<string, string> mOperations = new Dictionary<string, string>();
|
||||
ChartDataEditor mWindow;
|
||||
Texture mSettings;
|
||||
|
||||
RenameWindow mRenameWindow = null;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
mRedStyle = new GUIStyle();
|
||||
mRedStyle.normal.textColor = Color.red;
|
||||
|
||||
mSplitter = new GUIStyle();
|
||||
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
|
||||
mSplitter.stretchWidth = true;
|
||||
mSplitter.margin = new RectOffset(0, 0, 7, 7);
|
||||
}
|
||||
|
||||
public void Splitter()
|
||||
{
|
||||
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Color restoreColor = GUI.color;
|
||||
GUI.color = new Color(0.5f, 0.5f, 0.5f);
|
||||
mSplitter.Draw(position, false, false, false, false);
|
||||
GUI.color = restoreColor;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsAlphaNum(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void DoOperations(SerializedProperty items, int size, string type)
|
||||
{
|
||||
mToRemove.Clear();
|
||||
mToUp.Clear();
|
||||
bool up = false;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
|
||||
string arg = type + "|" + name;
|
||||
string res = null;
|
||||
|
||||
if (up == true)
|
||||
{
|
||||
mToUp.Add(i);
|
||||
up = false;
|
||||
}
|
||||
|
||||
if (mOperations.TryGetValue(arg, out res))
|
||||
{
|
||||
if (res == "remove")
|
||||
mToRemove.Add(i);
|
||||
if (res == "up" && i > 0)
|
||||
mToUp.Add(i);
|
||||
if (res == "down")
|
||||
up = true;
|
||||
mOperations.Remove(arg);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mToRemove.Count; i++)
|
||||
{
|
||||
items.DeleteArrayElementAtIndex(mToRemove[i]);
|
||||
}
|
||||
for (int i = 0; i < mToUp.Count; i++)
|
||||
{
|
||||
int cur = mToUp[i];
|
||||
items.MoveArrayElement(cur, cur - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void CandleSettings(SerializedProperty item)
|
||||
{
|
||||
SerializedProperty entry = item.Copy();
|
||||
EditorGUILayout.LabelField(entry.name);
|
||||
EditorGUI.indentLevel++;
|
||||
SerializedProperty end = entry.GetEndProperty(true);
|
||||
entry.Next(true);
|
||||
if (SerializedProperty.EqualContents(entry, end) == false)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (target is CandleChart) // canvas graph chart
|
||||
{
|
||||
if ((entry.name == "CandlePrefab"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entry.name == "CandleHoverPrefab")
|
||||
continue;
|
||||
}
|
||||
EditorGUILayout.PropertyField(entry, true);
|
||||
}
|
||||
while (entry.Next(false) && SerializedProperty.EqualContents(entry, end) == false);
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
|
||||
{
|
||||
SerializedProperty items = data.FindPropertyRelative(property);
|
||||
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
|
||||
//bool up, down;
|
||||
mAllNames.Clear();
|
||||
int size = items.arraySize;
|
||||
if (Event.current.type == EventType.Layout)
|
||||
DoOperations(items, size, type);
|
||||
size = items.arraySize;
|
||||
if (items.isExpanded)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
mAllNames.Add(name);
|
||||
bool toogle = false;
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (nameProp != null)
|
||||
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
|
||||
else
|
||||
{
|
||||
toogle = false;
|
||||
EditorGUILayout.LabelField(name);
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GUILayout.Button("..."))
|
||||
DoContext(type, name);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (toogle)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
if (nameProp != null)
|
||||
{
|
||||
SerializedProperty end = entry.GetEndProperty(true);
|
||||
entry.Next(true);
|
||||
if (SerializedProperty.EqualContents(entry, end) == false)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (entry.name != "Name" && entry.name != "Data")
|
||||
{
|
||||
if (target is CandleChart) // canvas graph chart
|
||||
{
|
||||
if ((entry.name == "LinePrefab") || (entry.name == "FillPrefab") || (entry.name == "DotPrefab") || (entry.name == "Depth"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((entry.name == "LineHoverPrefab") || (entry.name == "PointHoverPrefab"))
|
||||
continue;
|
||||
}
|
||||
if (entry.name == "UpCandle" || entry.name == "DownCandle")
|
||||
CandleSettings(entry);
|
||||
else
|
||||
EditorGUILayout.PropertyField(entry, true);
|
||||
}
|
||||
}
|
||||
while (entry.Next(false) && SerializedProperty.EqualContents(entry, end) == false);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessage != null)
|
||||
EditorGUILayout.LabelField(errorMessage, mRedStyle);
|
||||
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
|
||||
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
newName = EditorGUILayout.TextField(newName);
|
||||
//GUILayout.Space(indentAdd.xMin);
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
bool error = false;
|
||||
if (newName.Trim().Length == 0)
|
||||
{
|
||||
errorMessage = "Name can't be empty";
|
||||
error = true;
|
||||
}
|
||||
else if (IsAlphaNum(newName) == false)
|
||||
{
|
||||
errorMessage = "Name conatins invalid characters";
|
||||
error = true;
|
||||
}
|
||||
else if (mAllNames.Contains(newName))
|
||||
{
|
||||
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
|
||||
error = true;
|
||||
}
|
||||
if (error == false)
|
||||
{
|
||||
errorMessage = null;
|
||||
items.InsertArrayElementAtIndex(size);
|
||||
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
|
||||
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
|
||||
if (newItemName == null)
|
||||
newItem.stringValue = newName;
|
||||
else
|
||||
newItemName.stringValue = newName;
|
||||
newName = "";
|
||||
UpdateWindow();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = null;
|
||||
}
|
||||
UpdateWindow();
|
||||
}
|
||||
void callback(object val)
|
||||
{
|
||||
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
|
||||
mOperations[pair.Key] = pair.Value;
|
||||
}
|
||||
bool RenameCategory(string oldName, string newName)
|
||||
{
|
||||
CandleChart graph = (CandleChart)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
graph.DataSource.RenameCategory(oldName, newName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if (graph.gameObject.activeInHierarchy)
|
||||
graph.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(graph);
|
||||
return true;
|
||||
}
|
||||
void RenameCalled(object val)
|
||||
{
|
||||
var data = (KeyValuePair<string, string>)val;
|
||||
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
|
||||
mRenameWindow = window;
|
||||
window.ShowDialog(data.Value, data.Key, RenameCategory);
|
||||
}
|
||||
void DoContext(string type, string name)
|
||||
{
|
||||
string arg = type + "|" + name;
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
|
||||
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
|
||||
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
|
||||
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
void UpdateWindow()
|
||||
{
|
||||
}
|
||||
void OnDisable()
|
||||
{
|
||||
if (mRenameWindow != null)
|
||||
{
|
||||
mRenameWindow.Close();
|
||||
mRenameWindow = null;
|
||||
}
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.Close();
|
||||
mWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
SerializedProperty autoScrollHorizontally = serializedObject.FindProperty("autoScrollHorizontally");
|
||||
SerializedProperty horizontalScrolling = serializedObject.FindProperty("horizontalScrolling");
|
||||
SerializedProperty autoScrollVertically = serializedObject.FindProperty("autoScrollVertically");
|
||||
SerializedProperty verticalScrolling = serializedObject.FindProperty("verticalScrolling");
|
||||
// SerializedProperty scrollable = serializedObject.FindProperty("scrollable");
|
||||
// EditorGUILayout.PropertyField(scrollable);
|
||||
// if (scrollable.boolValue == true)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(autoScrollHorizontally);
|
||||
if (autoScrollHorizontally.boolValue == false)
|
||||
EditorGUILayout.PropertyField(horizontalScrolling);
|
||||
EditorGUILayout.PropertyField(autoScrollVertically);
|
||||
if (autoScrollVertically.boolValue == false)
|
||||
EditorGUILayout.PropertyField(verticalScrolling);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
SerializedProperty graphData = serializedObject.FindProperty("Data");
|
||||
EditorGUILayout.BeginVertical();
|
||||
Splitter();
|
||||
if (mBold == null)
|
||||
mBold = new GUIStyle(EditorStyles.foldout);
|
||||
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
NamedItemEditor(graphData, "category", "mSerializedData", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
SerializedProperty horizontalOrigin = graphData.FindPropertyRelative("horizontalViewOrigin");
|
||||
SerializedProperty horizontalSize = graphData.FindPropertyRelative("horizontalViewSize");
|
||||
SerializedProperty automaticcHorizontaViewGap = graphData.FindPropertyRelative("automaticcHorizontaViewGap");
|
||||
|
||||
SerializedProperty verticalOrigin = graphData.FindPropertyRelative("verticalViewOrigin");
|
||||
SerializedProperty verticalSize = graphData.FindPropertyRelative("verticalViewSize");
|
||||
SerializedProperty automaticVerticalViewGap = graphData.FindPropertyRelative("automaticVerticalViewGap");
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Horizontal View", EditorStyles.boldLabel);
|
||||
SerializedProperty automaticProp = graphData.FindPropertyRelative("automaticHorizontalView");
|
||||
bool automatic = automaticProp.boolValue;
|
||||
automatic = GUILayout.Toggle(automatic, "Auto");
|
||||
GUILayout.FlexibleSpace();
|
||||
automaticProp.boolValue = automatic;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
EditorGUILayout.PropertyField(horizontalOrigin);
|
||||
EditorGUILayout.PropertyField(horizontalSize);
|
||||
// if (horizontalSize.doubleValue < 0.0)
|
||||
// horizontalSize.doubleValue = 0.0001;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(automaticcHorizontaViewGap, new GUIContent("Horizontal Gap"));
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Vertical View", EditorStyles.boldLabel);
|
||||
automaticProp = graphData.FindPropertyRelative("automaticVerticallView");
|
||||
automatic = automaticProp.boolValue;
|
||||
automatic = GUILayout.Toggle(automatic, "Auto");
|
||||
GUILayout.FlexibleSpace();
|
||||
automaticProp.boolValue = automatic;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
EditorGUILayout.PropertyField(verticalOrigin);
|
||||
EditorGUILayout.PropertyField(verticalSize);
|
||||
// if (verticalSize.doubleValue < 0.0)
|
||||
// verticalSize.doubleValue = 0.0001;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(automaticVerticalViewGap, new GUIContent("Vertical Gap"));
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
serializedObject.Update();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/CandleChartInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/CandleChartInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e95afd72773c44d4ab4ccd60a38ac39e
|
||||
timeCreated: 1504187754
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Assets/Chart And Graph/Editor/CategoryDataEditor.cs
Normal file
67
Assets/Chart And Graph/Editor/CategoryDataEditor.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(GraphDataFiller.CategoryData))]
|
||||
class CategoryDataEditor : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2f;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
var enabled = property.FindPropertyRelative("Enabled");
|
||||
|
||||
property.isExpanded = EditorGUILayout.Foldout(property.isExpanded, property.displayName);
|
||||
if(property.isExpanded)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(enabled);
|
||||
if (enabled.boolValue == true)
|
||||
{
|
||||
var dataType = property.FindPropertyRelative("DataType");
|
||||
EditorGUILayout.PropertyField(dataType);
|
||||
int item = dataType.enumValueIndex;
|
||||
var iterator = property.Copy();
|
||||
var end = iterator.GetEndProperty();
|
||||
bool hasNext = iterator.NextVisible(true);
|
||||
Type t = typeof(GraphDataFiller.CategoryData);
|
||||
while (hasNext)
|
||||
{
|
||||
if ((SerializedProperty.EqualContents(iterator, end)))
|
||||
break;
|
||||
bool show = false;
|
||||
|
||||
foreach (object attrb in t.GetField(iterator.name).GetCustomAttributes(false))
|
||||
{
|
||||
var cast = attrb as ChartFillerEditorAttribute;
|
||||
if (cast != null)
|
||||
{
|
||||
if ((int)cast.ShowForType == item)
|
||||
{
|
||||
show = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (show)
|
||||
EditorGUILayout.PropertyField(iterator);
|
||||
// Debug.Log(iterator.displayName);
|
||||
hasNext = iterator.NextVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/CategoryDataEditor.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/CategoryDataEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7ad20a161538c146aa76559c3f89754
|
||||
timeCreated: 1536697084
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/Chart And Graph/Editor/CategoryLabelsInspector.cs
Normal file
26
Assets/Chart And Graph/Editor/CategoryLabelsInspector.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomEditor(typeof(CategoryLabels))]
|
||||
class CategoryLabelsLabelsInspector : ItemLabelsBaseEditor
|
||||
{
|
||||
protected override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "category labels";
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool isSupported(AnyChart chart)
|
||||
{
|
||||
return ((IInternalUse)chart).InternalSupportsCategoryLables;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31ece195e6c596940a2dd7720c53058e
|
||||
timeCreated: 1480254476
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
96
Assets/Chart And Graph/Editor/ChartDataEditor.cs
Normal file
96
Assets/Chart And Graph/Editor/ChartDataEditor.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class ChartDataEditor : UnityEditor.EditorWindow
|
||||
{
|
||||
SerializedObject mEditedObject;
|
||||
SerializedProperty mBarData;
|
||||
SerializedProperty mCategories;
|
||||
SerializedProperty mGroups;
|
||||
SerializedProperty mData;
|
||||
Dictionary<string, SerializedProperty> mValues;
|
||||
|
||||
public static ChartDataEditor ShowForObject(SerializedObject obj)
|
||||
{
|
||||
ChartDataEditor window = (ChartDataEditor)EditorWindow.GetWindow(typeof(ChartDataEditor));
|
||||
window.SetEditedObject(obj);
|
||||
return window;
|
||||
}
|
||||
|
||||
public void SetEditedObject(SerializedObject obj)
|
||||
{
|
||||
mEditedObject = obj;
|
||||
mBarData = mEditedObject.FindProperty("Data");
|
||||
mCategories = mBarData.FindPropertyRelative("mCategories");
|
||||
mGroups = mBarData.FindPropertyRelative("mGroups");
|
||||
mData = mBarData.FindPropertyRelative("mData");
|
||||
LoadData();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LoadData()
|
||||
{
|
||||
if(mValues == null)
|
||||
mValues = new Dictionary<string, SerializedProperty>();
|
||||
mValues.Clear();
|
||||
int size = mData.arraySize;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty prop = mData.GetArrayElementAtIndex(i);
|
||||
string columnName = prop.FindPropertyRelative("ColumnName").stringValue;
|
||||
string rowName = prop.FindPropertyRelative("GroupName").stringValue;
|
||||
SerializedProperty amount = prop.FindPropertyRelative("Amount");
|
||||
string keyName = getKey(columnName, rowName);
|
||||
mValues[keyName] = amount;
|
||||
}
|
||||
}
|
||||
|
||||
string getKey(string column,string row)
|
||||
{
|
||||
return string.Format("{0}|{1}", column, row);
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
GUILayout.Label("Edit Values", EditorStyles.boldLabel);
|
||||
GUILayout.BeginVertical();
|
||||
int categoryCount = mCategories.arraySize;
|
||||
int groupCount = mGroups.arraySize;
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label(" ",GUILayout.Width(EditorGUIUtility.fieldWidth));
|
||||
for (int i = 0; i < groupCount; i++)
|
||||
{
|
||||
string group = mGroups.GetArrayElementAtIndex(i).stringValue;
|
||||
GUILayout.Label(group, GUILayout.Width(EditorGUIUtility.fieldWidth));
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
for (int i=0; i<categoryCount; i++)
|
||||
{
|
||||
SerializedProperty catProp = mCategories.GetArrayElementAtIndex(i);
|
||||
string category = catProp.FindPropertyRelative("Name").stringValue;
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(category, GUILayout.Width(EditorGUIUtility.fieldWidth));
|
||||
for (int j=0; j<groupCount; j++)
|
||||
{
|
||||
string group = mGroups.GetArrayElementAtIndex(j).stringValue;
|
||||
string keyName = getKey(category, group);
|
||||
double value =0.0;
|
||||
SerializedProperty prop;
|
||||
if (mValues.TryGetValue(keyName, out prop))
|
||||
value = prop.doubleValue;
|
||||
else
|
||||
prop = null;
|
||||
double newVal = EditorGUILayout.DoubleField(value, GUILayout.Width(EditorGUIUtility.fieldWidth));
|
||||
if(newVal != value)
|
||||
prop.doubleValue = newVal;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
mEditedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/ChartDataEditor.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/ChartDataEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b917e1b2904ebf348a64f64b59a51908
|
||||
timeCreated: 1474501984
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
38
Assets/Chart And Graph/Editor/ChartEditorCommon.cs
Normal file
38
Assets/Chart And Graph/Editor/ChartEditorCommon.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
class ChartEditorCommon
|
||||
{
|
||||
internal static bool IsAlphaNum(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
internal static bool HasAttributeOfType(Type type, string fieldName, Type attributeType)
|
||||
{
|
||||
FieldInfo inf = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
if (inf == null)
|
||||
return false;
|
||||
object[] attrb = inf.GetCustomAttributes(attributeType, true);
|
||||
if (attrb == null)
|
||||
return false;
|
||||
return attrb.Length > 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/ChartEditorCommon.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/ChartEditorCommon.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fc5bc09e01eda34da606695525bf023
|
||||
timeCreated: 1479124371
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Assets/Chart And Graph/Editor/ChartOrientedSizeInspector.cs
Normal file
58
Assets/Chart And Graph/Editor/ChartOrientedSizeInspector.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using ChartAndGraph;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(ChartOrientedSize))]
|
||||
class ChartOrientedSizeInspector : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight * 2;
|
||||
}
|
||||
|
||||
void DoField(SerializedProperty prop, string label, Rect position)
|
||||
{
|
||||
float size = GUI.skin.label.CalcSize(new GUIContent(label)).x;
|
||||
Rect labelRect = new Rect(position.x, position.y, size, position.height);
|
||||
Rect FieldRect = new Rect(labelRect.xMax, position.y, position.width - size, position.height);
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
float val = prop.floatValue;
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
float labelWidth = EditorGUIUtility.labelWidth;
|
||||
EditorGUIUtility.labelWidth = 5;
|
||||
val = EditorGUI.FloatField(FieldRect, " ", val);
|
||||
EditorGUIUtility.labelWidth = labelWidth;
|
||||
prop.floatValue = val;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
|
||||
label = EditorGUI.BeginProperty(position, label, property);
|
||||
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
|
||||
position = EditorGUI.IndentedRect(position);
|
||||
|
||||
float halfWidth = position.width *0.5f;
|
||||
float y = position.y + EditorGUIUtility.singleLineHeight;
|
||||
float height = position.height - EditorGUIUtility.singleLineHeight;
|
||||
Rect breadthRect = new Rect(position.x, y, halfWidth, height);
|
||||
Rect depthRect = new Rect(breadthRect.xMax, y, halfWidth, height);
|
||||
|
||||
int indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel=0;
|
||||
SerializedProperty breadth = property.FindPropertyRelative("Breadth");
|
||||
SerializedProperty depth = property.FindPropertyRelative("Depth");
|
||||
DoField(breadth, "Breadth:", breadthRect);
|
||||
DoField(depth, "Depth:", depthRect);
|
||||
EditorGUI.indentLevel = indent;
|
||||
// EditorGUILayout.EndVertical();
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f48c9091dc0c084595117abe8222c22
|
||||
timeCreated: 1473684701
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/Chart And Graph/Editor/EditorMenu.Full.cs
Normal file
60
Assets/Chart And Graph/Editor/EditorMenu.Full.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
|
||||
partial class EditorMenu
|
||||
{
|
||||
private static void InstanciateWorldSpace(string path)
|
||||
{
|
||||
GameObject obj = Resources.Load<GameObject>(path);
|
||||
// GameObject obj = AssetDatabase.LoadAssetAtPath<GameObject>(path);
|
||||
GameObject newObj = (GameObject)GameObject.Instantiate(obj);
|
||||
newObj.name = newObj.name.Replace("(Clone)", "");
|
||||
Undo.RegisterCreatedObjectUndo(newObj, "Create Object");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Radar/3D")]
|
||||
public static void AddRadarChartWorldSpace()
|
||||
{
|
||||
InstanciateWorldSpace("MenuPrefabs/3DRadar");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Bar/3D/Simple")]
|
||||
public static void AddBarChartSimple3D()
|
||||
{
|
||||
InstanciateWorldSpace("MenuPrefabs/Bar3DSimple");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Bar/3D/Multiple Groups")]
|
||||
public static void AddBarChartMultiple3D()
|
||||
{
|
||||
InstanciateWorldSpace("MenuPrefabs/Bar3DMultiple");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Torus/3D")]
|
||||
public static void AddTorusChart3D()
|
||||
{
|
||||
InstanciateWorldSpace("MenuPrefabs/Torus3D");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Pie/3D")]
|
||||
public static void AddPieChart3D()
|
||||
{
|
||||
InstanciateWorldSpace("MenuPrefabs/Pie3D");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Graph/3D")]
|
||||
public static void AddGraph3D()
|
||||
{
|
||||
InstanciateWorldSpace("MenuPrefabs/3DGraph");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/EditorMenu.Full.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/EditorMenu.Full.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 128e6b85597fded4f886f1f5aea62b53
|
||||
timeCreated: 1560597478
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
154
Assets/Chart And Graph/Editor/EditorMenu.cs
Normal file
154
Assets/Chart And Graph/Editor/EditorMenu.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
partial class EditorMenu
|
||||
{
|
||||
private static void InstanciateCanvas(string path)
|
||||
{
|
||||
Canvas[] canvases = GameObject.FindObjectsOfType<Canvas>();
|
||||
if (canvases == null || canvases.Length == 0)
|
||||
{
|
||||
EditorUtility.DisplayDialog("No canvas in scene", "Please add a canvas to the scene and try again", "Ok");
|
||||
return;
|
||||
}
|
||||
Canvas canvas = null;
|
||||
foreach(Canvas c in canvases)
|
||||
{
|
||||
if(c.transform.parent == null)
|
||||
{
|
||||
canvas = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (canvas == null)
|
||||
{
|
||||
EditorUtility.DisplayDialog("No canvas in scene", "Please add a canvas to the scene and try again", "Ok");
|
||||
return;
|
||||
}
|
||||
GameObject obj = Resources.Load<GameObject>(path);
|
||||
GameObject newObj = (GameObject)GameObject.Instantiate(obj);
|
||||
newObj.transform.SetParent(canvas.transform,false);
|
||||
newObj.name = newObj.name.Replace("(Clone)","");
|
||||
Undo.RegisterCreatedObjectUndo(newObj, "Create Object");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Clear All")]
|
||||
public static void ClearChartGarbage()
|
||||
{
|
||||
ChartItem[] children = GameObject.FindObjectsOfType<ChartItem>();
|
||||
for (int i = 0; i < children.Length; ++i)
|
||||
{
|
||||
if (children[i] != null)
|
||||
{
|
||||
ChartCommon.SafeDestroy(children[i].gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
[MenuItem("Tools/Charts/Fix prefabs")]
|
||||
public static void ClearPrefabs()
|
||||
{
|
||||
if (EditorUtility.DisplayDialog("Warning", "Make sure to backup your project before calling Fix Prefabs", "OK", "Cancel") == false)
|
||||
return;
|
||||
string[] prefabs = AssetDatabase.FindAssets("t:prefab");
|
||||
|
||||
foreach (var guid in prefabs)
|
||||
{
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
// Load the contents of the Prefab Asset.
|
||||
try
|
||||
{
|
||||
GameObject contentsRoot = UnityEditor.PrefabUtility.LoadPrefabContents(path);
|
||||
if (contentsRoot.GetComponentInChildren<AnyChart>() != null)
|
||||
{
|
||||
Debug.Log("Fixing " + path);
|
||||
bool save = false;
|
||||
// Modify Prefab contents.
|
||||
foreach (var item in contentsRoot.GetComponentsInChildren<ChartItem>())
|
||||
{
|
||||
if (item == null)
|
||||
continue;
|
||||
if (item.gameObject != null)
|
||||
{
|
||||
save = true;
|
||||
GameObject.DestroyImmediate(item.gameObject);
|
||||
}
|
||||
}
|
||||
if (save)
|
||||
{
|
||||
Debug.Log("Saving " + path);
|
||||
UnityEditor.PrefabUtility.SaveAsPrefabAsset(contentsRoot, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("No change to prefab " + path);
|
||||
}
|
||||
}
|
||||
UnityEditor.PrefabUtility.UnloadPrefabContents(contentsRoot);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Debug.Log("Failed " + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
[MenuItem("Tools/Charts/Radar/Canvas")]
|
||||
public static void AddRadarChartCanvas()
|
||||
{
|
||||
InstanciateCanvas("MenuPrefabs/2DRadar");
|
||||
}
|
||||
|
||||
|
||||
|
||||
[MenuItem("Tools/Charts/Bar/Canvas/Simple")]
|
||||
public static void AddBarChartSimpleCanvas()
|
||||
{
|
||||
InstanciateCanvas("MenuPrefabs/BarCanvasSimple");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Bar/Canvas/Multiple Groups")]
|
||||
public static void AddBarChartMultipleCanvas()
|
||||
{
|
||||
InstanciateCanvas("MenuPrefabs/BarCanvasMultiple");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[MenuItem("Tools/Charts/Torus/Canvas")]
|
||||
public static void AddTorusChartCanvas()
|
||||
{
|
||||
InstanciateCanvas("MenuPrefabs/TorusCanvas");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Charts/Pie/Canvas")]
|
||||
public static void AddPieChartCanvas()
|
||||
{
|
||||
InstanciateCanvas("MenuPrefabs/PieCanvas");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[MenuItem("Tools/Charts/Graph/Canvas")]
|
||||
public static void AddGraphMultiple()
|
||||
{
|
||||
InstanciateCanvas("MenuPrefabs/GraphMultiple");
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("Tools/Charts/Legend")]
|
||||
public static void AddChartLegend()
|
||||
{
|
||||
InstanciateCanvas("MenuPrefabs/Legend");
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/EditorMenu.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/EditorMenu.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57e0bbe359ea30c4d814819575d1a81d
|
||||
timeCreated: 1481803595
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
399
Assets/Chart And Graph/Editor/GraphChartInspector.cs
Normal file
399
Assets/Chart And Graph/Editor/GraphChartInspector.cs
Normal file
@@ -0,0 +1,399 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomEditor(typeof(GraphChartBase), true)]
|
||||
class GraphChartInspector : Editor
|
||||
{
|
||||
string mEditedCategory = "";
|
||||
bool mCategories = false;
|
||||
string mCategoryError = null;
|
||||
string mNewCategoryName = "";
|
||||
GUIStyle mRedStyle;
|
||||
GUIStyle mBold;
|
||||
HashSet<string> mAllNames = new HashSet<string>();
|
||||
GUIStyle mSplitter;
|
||||
List<int> mToRemove = new List<int>();
|
||||
List<int> mToUp = new List<int>();
|
||||
Dictionary<string, string> mOperations = new Dictionary<string, string>();
|
||||
Texture mSettings;
|
||||
GraphDataEditor mWindow;
|
||||
RenameWindow mRenameWindow = null;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
mRedStyle = new GUIStyle();
|
||||
mRedStyle.normal.textColor = Color.red;
|
||||
|
||||
mSplitter = new GUIStyle();
|
||||
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
|
||||
mSplitter.stretchWidth = true;
|
||||
mSplitter.margin = new RectOffset(0, 0, 7, 7);
|
||||
}
|
||||
|
||||
public void Splitter()
|
||||
{
|
||||
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Color restoreColor = GUI.color;
|
||||
GUI.color = new Color(0.5f, 0.5f, 0.5f);
|
||||
mSplitter.Draw(position, false, false, false, false);
|
||||
GUI.color = restoreColor;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsAlphaNum(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void DoOperations(SerializedProperty items, int size, string type)
|
||||
{
|
||||
mToRemove.Clear();
|
||||
mToUp.Clear();
|
||||
bool up = false;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
|
||||
string arg = type + "|" + name;
|
||||
string res = null;
|
||||
|
||||
if (up == true)
|
||||
{
|
||||
mToUp.Add(i);
|
||||
up = false;
|
||||
}
|
||||
|
||||
if (mOperations.TryGetValue(arg, out res))
|
||||
{
|
||||
if (res == "remove")
|
||||
mToRemove.Add(i);
|
||||
if (res == "up" && i > 0)
|
||||
mToUp.Add(i);
|
||||
if (res == "down")
|
||||
up = true;
|
||||
mOperations.Remove(arg);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mToRemove.Count; i++)
|
||||
{
|
||||
items.DeleteArrayElementAtIndex(mToRemove[i]);
|
||||
}
|
||||
for (int i = 0; i < mToUp.Count; i++)
|
||||
{
|
||||
int cur = mToUp[i];
|
||||
items.MoveArrayElement(cur, cur - 1);
|
||||
}
|
||||
}
|
||||
private void DataEditor(SerializedProperty data, string type, string property, string caption)
|
||||
{
|
||||
|
||||
}
|
||||
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
|
||||
{
|
||||
SerializedProperty items = data.FindPropertyRelative(property);
|
||||
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
|
||||
//bool up, down;
|
||||
mAllNames.Clear();
|
||||
int size = items.arraySize;
|
||||
if (Event.current.type == EventType.Layout)
|
||||
DoOperations(items, size, type);
|
||||
size = items.arraySize;
|
||||
if (items.isExpanded)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
mAllNames.Add(name);
|
||||
bool toogle = false;
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (nameProp != null)
|
||||
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
|
||||
else
|
||||
{
|
||||
toogle = false;
|
||||
EditorGUILayout.LabelField(name);
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GUILayout.Button("..."))
|
||||
DoContext(type, name);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (toogle)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
if (nameProp != null)
|
||||
{
|
||||
SerializedProperty end = entry.GetEndProperty(true);
|
||||
entry.Next(true);
|
||||
if (SerializedProperty.EqualContents(entry, end) == false)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (entry.name != "Name" && entry.name != "data")
|
||||
{
|
||||
if (entry.name == "ViewOrder")
|
||||
continue;
|
||||
if (target is GraphChart) // canvas graph chart
|
||||
{
|
||||
if ((entry.name == "LinePrefab") || (entry.name == "FillPrefab") || (entry.name == "DotPrefab") || (entry.name == "Depth"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((entry.name == "LineHoverPrefab") || (entry.name == "PointHoverPrefab"))
|
||||
continue;
|
||||
}
|
||||
EditorGUILayout.PropertyField(entry, true);
|
||||
}
|
||||
}
|
||||
while (entry.Next(false) && SerializedProperty.EqualContents(entry, end) == false);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(EditorGUI.IndentedRect(EditorGUILayout.GetControlRect()).xMin);
|
||||
if (GUILayout.Button("Edit Values..."))
|
||||
{
|
||||
mEditedCategory = name;
|
||||
if (mWindow == null)
|
||||
mWindow = GraphDataEditor.ShowForObject(serializedObject, mEditedCategory);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
if (errorMessage != null)
|
||||
EditorGUILayout.LabelField(errorMessage, mRedStyle);
|
||||
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
|
||||
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
newName = EditorGUILayout.TextField(newName);
|
||||
//GUILayout.Space(indentAdd.xMin);
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
bool error = false;
|
||||
if (newName.Trim().Length == 0)
|
||||
{
|
||||
errorMessage = "Name can't be empty";
|
||||
error = true;
|
||||
}
|
||||
else if (IsAlphaNum(newName) == false)
|
||||
{
|
||||
errorMessage = "Name conatins invalid characters";
|
||||
error = true;
|
||||
}
|
||||
else if (mAllNames.Contains(newName))
|
||||
{
|
||||
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
|
||||
error = true;
|
||||
}
|
||||
if (error == false)
|
||||
{
|
||||
errorMessage = null;
|
||||
items.InsertArrayElementAtIndex(size);
|
||||
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
|
||||
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
|
||||
if (newItemName == null)
|
||||
newItem.stringValue = newName;
|
||||
else
|
||||
newItemName.stringValue = newName;
|
||||
newName = "";
|
||||
UpdateWindow();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = null;
|
||||
}
|
||||
UpdateWindow();
|
||||
}
|
||||
void callback(object val)
|
||||
{
|
||||
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
|
||||
mOperations[pair.Key] = pair.Value;
|
||||
}
|
||||
bool RenameCategory(string oldName, string newName)
|
||||
{
|
||||
GraphChartBase graph = (GraphChartBase)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
graph.DataSource.RenameCategory(oldName, newName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if (graph.gameObject.activeInHierarchy)
|
||||
graph.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(graph);
|
||||
return true;
|
||||
}
|
||||
void RenameCalled(object val)
|
||||
{
|
||||
var data = (KeyValuePair<string, string>)val;
|
||||
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
|
||||
mRenameWindow = window;
|
||||
window.ShowDialog(data.Value, data.Key, RenameCategory);
|
||||
}
|
||||
void DoContext(string type, string name)
|
||||
{
|
||||
string arg = type + "|" + name;
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
|
||||
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
|
||||
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
|
||||
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
void UpdateWindow()
|
||||
{
|
||||
}
|
||||
void OnDisable()
|
||||
{
|
||||
if (mRenameWindow != null)
|
||||
{
|
||||
mRenameWindow.Close();
|
||||
mRenameWindow = null;
|
||||
}
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.Close();
|
||||
mWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
//serializedObject.Update();
|
||||
DrawDefaultInspector();
|
||||
|
||||
SerializedProperty autoScrollHorizontally = serializedObject.FindProperty("autoScrollHorizontally");
|
||||
SerializedProperty horizontalScrolling = serializedObject.FindProperty("horizontalScrolling");
|
||||
SerializedProperty autoScrollVertically = serializedObject.FindProperty("autoScrollVertically");
|
||||
SerializedProperty verticalScrolling = serializedObject.FindProperty("verticalScrolling");
|
||||
// SerializedProperty scrollable = serializedObject.FindProperty("scrollable");
|
||||
// EditorGUILayout.PropertyField(scrollable);
|
||||
// if (scrollable.boolValue == true)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(autoScrollHorizontally);
|
||||
if (autoScrollHorizontally.boolValue == false)
|
||||
EditorGUILayout.PropertyField(horizontalScrolling);
|
||||
EditorGUILayout.PropertyField(autoScrollVertically);
|
||||
if (autoScrollVertically.boolValue == false)
|
||||
EditorGUILayout.PropertyField(verticalScrolling);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
SerializedProperty graphData = serializedObject.FindProperty("Data");
|
||||
EditorGUILayout.BeginVertical();
|
||||
Splitter();
|
||||
if (mBold == null)
|
||||
mBold = new GUIStyle(EditorStyles.foldout);
|
||||
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
|
||||
|
||||
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
NamedItemEditor(graphData, "category", "mSerializedData", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
SerializedProperty horizontalOrigin = graphData.FindPropertyRelative("horizontalViewOrigin");
|
||||
SerializedProperty horizontalSize = graphData.FindPropertyRelative("horizontalViewSize");
|
||||
SerializedProperty automaticcHorizontaViewGap = graphData.FindPropertyRelative("automaticcHorizontaViewGap");
|
||||
|
||||
SerializedProperty verticalOrigin = graphData.FindPropertyRelative("verticalViewOrigin");
|
||||
SerializedProperty verticalSize = graphData.FindPropertyRelative("verticalViewSize");
|
||||
SerializedProperty automaticVerticalViewGap = graphData.FindPropertyRelative("automaticVerticalViewGap");
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Horizontal View", EditorStyles.boldLabel);
|
||||
SerializedProperty automaticProp = graphData.FindPropertyRelative("automaticHorizontalView");
|
||||
EditorGUILayout.PropertyField(automaticProp, new GUIContent("Auto"));
|
||||
bool automatic = automaticProp.boolValue;
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
EditorGUILayout.PropertyField(horizontalOrigin);
|
||||
EditorGUILayout.PropertyField(horizontalSize);
|
||||
// if (horizontalSize.doubleValue < 0.0)
|
||||
// horizontalSize.doubleValue = 0.0001;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(automaticcHorizontaViewGap, new GUIContent("Horizontal Gap"));
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField("Vertical View", EditorStyles.boldLabel);
|
||||
automaticProp = graphData.FindPropertyRelative("automaticVerticallView");
|
||||
EditorGUILayout.PropertyField(automaticProp, new GUIContent("Auto"));
|
||||
automatic = automaticProp.boolValue;
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
EditorGUILayout.PropertyField(verticalOrigin);
|
||||
EditorGUILayout.PropertyField(verticalSize);
|
||||
// if (verticalSize.doubleValue < 0.0)
|
||||
// verticalSize.doubleValue = 0.0001;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.PropertyField(automaticVerticalViewGap, new GUIContent("Vertical Gap"));
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.SetEditedObject(serializedObject, mEditedCategory);
|
||||
mWindow.Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/GraphChartInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/GraphChartInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8671bd55b44fd0d46ad162bc055df077
|
||||
timeCreated: 1480533379
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
128
Assets/Chart And Graph/Editor/GraphDataEditor.cs
Normal file
128
Assets/Chart And Graph/Editor/GraphDataEditor.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
class GraphDataEditor : UnityEditor.EditorWindow
|
||||
{
|
||||
SerializedObject mThisObject;
|
||||
SerializedObject mEditedObject;
|
||||
string category;
|
||||
SerializedProperty mGraphData;
|
||||
SerializedProperty mCategories;
|
||||
SerializedProperty mCategory;
|
||||
Dictionary<string, SerializedProperty> mValues;
|
||||
SerializedObject mObject;
|
||||
|
||||
[SerializeField]
|
||||
Vector2[] Data;
|
||||
public static GraphDataEditor ShowForObject(SerializedObject obj,string category)
|
||||
{
|
||||
GraphDataEditor window = (GraphDataEditor)EditorWindow.GetWindow(typeof(GraphDataEditor));
|
||||
window.SetEditedObject(obj, category);
|
||||
return window;
|
||||
}
|
||||
|
||||
int FindCategoryIndex(string category)
|
||||
{
|
||||
for(int i=0; i<mCategories.arraySize; i++)
|
||||
{
|
||||
string name = mCategories.GetArrayElementAtIndex(i).FindPropertyRelative("Name").stringValue;
|
||||
if (name == category)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
public void SetEditedObject(SerializedObject obj,string categoryName)
|
||||
{
|
||||
category = categoryName;
|
||||
mEditedObject = obj;
|
||||
|
||||
mGraphData = mEditedObject.FindProperty("Data");
|
||||
mCategories = mGraphData.FindPropertyRelative("mSerializedData");
|
||||
// LoadData();
|
||||
|
||||
int catIndex = FindCategoryIndex(categoryName);
|
||||
if (catIndex == -1)
|
||||
{
|
||||
mCategory = null;
|
||||
return;
|
||||
}
|
||||
mCategory = mCategories.GetArrayElementAtIndex(catIndex);
|
||||
|
||||
var arr = mCategory.FindPropertyRelative("InitialData");
|
||||
|
||||
mThisObject = new SerializedObject(this);
|
||||
SerializedProperty serialProp = mThisObject.FindProperty("Data");
|
||||
SetArray(arr, serialProp);
|
||||
}
|
||||
|
||||
string getKey(string column, string row)
|
||||
{
|
||||
return string.Format("{0}|{1}", column, row);
|
||||
}
|
||||
|
||||
void ShowCategoryArray()
|
||||
{
|
||||
|
||||
}
|
||||
void SetArray(SerializedProperty from,SerializedProperty to)
|
||||
{
|
||||
to.arraySize = from.arraySize;
|
||||
for (int i = 0; i < from.arraySize; i++)
|
||||
{
|
||||
Vector2 val = from.GetArrayElementAtIndex(i).vector2Value;
|
||||
to.GetArrayElementAtIndex(i).vector2Value = val;
|
||||
}
|
||||
}
|
||||
void SetArray(Vector2[] from, SerializedProperty to)
|
||||
{
|
||||
to.arraySize = from.Length;
|
||||
for (int i = 0; i < from.Length; i++)
|
||||
{
|
||||
Vector2 val = from[i];
|
||||
to.GetArrayElementAtIndex(i).vector2Value = val;
|
||||
}
|
||||
}
|
||||
Vector2[] FillDataCustomCodeImplementation()
|
||||
{
|
||||
return new Vector2[] { new Vector2(1, 1), new Vector2(2, 2), new Vector2(3, 3), new Vector2(4, 4) };
|
||||
}
|
||||
Func<Vector2[]> FillDataCustomCode = null;
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
|
||||
SerializedProperty serialProp = mThisObject.FindProperty("Data");
|
||||
|
||||
GUILayout.Label("Edit Values - " + category, EditorStyles.boldLabel);
|
||||
|
||||
if (mCategory == null)
|
||||
return;
|
||||
Vector2[] customArr = null;
|
||||
//FillDataCustomCode = FillDataCustomCodeImplementation;
|
||||
if (FillDataCustomCode != null)
|
||||
{
|
||||
if (GUILayout.Button("Fill Data From Custom Code"))
|
||||
{
|
||||
customArr = FillDataCustomCode();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.PropertyField(serialProp, true);
|
||||
|
||||
var arr = mCategory.FindPropertyRelative("InitialData");
|
||||
if (customArr != null)
|
||||
{
|
||||
SetArray(customArr, arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mThisObject.ApplyModifiedProperties())
|
||||
SetArray(serialProp, arr);
|
||||
}
|
||||
mEditedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/GraphDataEditor.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/GraphDataEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03f0eb5ac4118424f8d68f32ef5ffa1b
|
||||
timeCreated: 1584550686
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
36
Assets/Chart And Graph/Editor/GraphDataFillerEditor.cs
Normal file
36
Assets/Chart And Graph/Editor/GraphDataFillerEditor.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomEditor(typeof(GraphDataFiller), true)]
|
||||
class GraphDataFillerEditor : Editor
|
||||
{
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* This is a work around and must not be deleteed
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* */
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
// var cats = serializedObject.FindProperty("Categories");
|
||||
// EditorGUILayout.PropertyField(cats);
|
||||
// CategoryDataEditor
|
||||
// Categories
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/GraphDataFillerEditor.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/GraphDataFillerEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05791da4c4a2fc44281046536e32e237
|
||||
timeCreated: 1560715350
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/Chart And Graph/Editor/GroupLabelsInspector.cs
Normal file
26
Assets/Chart And Graph/Editor/GroupLabelsInspector.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomEditor(typeof(GroupLabels))]
|
||||
class GroupLabelsInspector : ItemLabelsBaseEditor
|
||||
{
|
||||
protected override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "group labels";
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool isSupported(AnyChart chart)
|
||||
{
|
||||
return ((IInternalUse)chart).InternalSupportsGroupLabels;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/GroupLabelsInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/GroupLabelsInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a56a06b898a879418ba574600eaf84a
|
||||
timeCreated: 1480254476
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Chart And Graph/Editor/ItemLabelsBaseEditor.cs
Normal file
35
Assets/Chart And Graph/Editor/ItemLabelsBaseEditor.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
abstract class ItemLabelsBaseEditor : Editor
|
||||
{
|
||||
protected abstract string Name { get; }
|
||||
protected abstract bool isSupported(AnyChart chart);
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
|
||||
|
||||
ItemLabelsBase labels = (ItemLabelsBase)target;
|
||||
|
||||
if (labels.gameObject == null)
|
||||
return;
|
||||
|
||||
AnyChart chart = labels.gameObject.GetComponent<AnyChart>();
|
||||
if (chart == null)
|
||||
return;
|
||||
if (isSupported(chart) == false)
|
||||
{
|
||||
EditorGUILayout.HelpBox(string.Format("Chart of type {0} does not support {1}", chart.GetType().Name,Name),MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/ItemLabelsBaseEditor.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/ItemLabelsBaseEditor.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67d1379f880dde846adec8a6157669d1
|
||||
timeCreated: 1480254476
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/Chart And Graph/Editor/ItemLabelsInspector.cs
Normal file
26
Assets/Chart And Graph/Editor/ItemLabelsInspector.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomEditor(typeof(ItemLabels))]
|
||||
class ItemLabelsLabelsInspector : ItemLabelsBaseEditor
|
||||
{
|
||||
protected override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "item labels";
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool isSupported(AnyChart chart)
|
||||
{
|
||||
return ((IInternalUse)chart).InternalSupportsItemLabels;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/ItemLabelsInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/ItemLabelsInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12cb0562684057a448410b90a0e565f8
|
||||
timeCreated: 1480254476
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/Chart And Graph/Editor/MaterialTilingInspector.cs
Normal file
40
Assets/Chart And Graph/Editor/MaterialTilingInspector.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(MaterialTiling))]
|
||||
class MaterialTilingInspector : PropertyDrawer
|
||||
{
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
label = EditorGUI.BeginProperty(position, label, property);
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
SerializedProperty auto = property.FindPropertyRelative("EnableTiling");
|
||||
SerializedProperty val = property.FindPropertyRelative("TileFactor");
|
||||
int indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
bool res = !EditorGUI.ToggleLeft(position,"Stretch", !auto.boolValue);
|
||||
EditorGUI.indentLevel = indent;
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel++;
|
||||
if (auto.boolValue == true && EditorGUI.showMixedValue == false)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Remember to enable texture repeat mode in order to make tiling work !",MessageType.Warning,true);
|
||||
EditorGUILayout.HelpBox("For the best results on canvas , set the tiling factor to the pixel size of the textre", MessageType.Info, true);
|
||||
val.floatValue = EditorGUILayout.FloatField("Tiling Factor",val.floatValue);
|
||||
if (val.floatValue <= 0f)
|
||||
val.floatValue = 0.01f;
|
||||
}
|
||||
auto.boolValue = res;
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c894d939d8cec94fa27b4e6b437e6bc
|
||||
timeCreated: 1479370450
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
326
Assets/Chart And Graph/Editor/PieChartInspector.cs
Normal file
326
Assets/Chart And Graph/Editor/PieChartInspector.cs
Normal file
@@ -0,0 +1,326 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(PieChart), true)]
|
||||
class PieChartInspetor : Editor
|
||||
{
|
||||
bool mCategories = false;
|
||||
string mCategoryError = null;
|
||||
string mNewCategoryName = "";
|
||||
GUIStyle mRedStyle;
|
||||
GUIStyle mBold;
|
||||
HashSet<string> mAllNames = new HashSet<string>();
|
||||
GUIStyle mSplitter;
|
||||
List<int> mToRemove = new List<int>();
|
||||
List<int> mToUp = new List<int>();
|
||||
Dictionary<string, string> mOperations = new Dictionary<string, string>();
|
||||
ChartDataEditor mWindow;
|
||||
bool mUpdateWindow = false;
|
||||
Texture mSettings;
|
||||
|
||||
RenameWindow mRenameWindow = null;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
mRedStyle = new GUIStyle();
|
||||
mRedStyle.normal.textColor = Color.red;
|
||||
|
||||
mSplitter = new GUIStyle();
|
||||
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
|
||||
mSplitter.stretchWidth = true;
|
||||
mSplitter.margin = new RectOffset(0, 0, 7, 7);
|
||||
}
|
||||
|
||||
public void Splitter()
|
||||
{
|
||||
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Color restoreColor = GUI.color;
|
||||
GUI.color = new Color(0.5f, 0.5f, 0.5f);
|
||||
mSplitter.Draw(position, false, false, false, false);
|
||||
GUI.color = restoreColor;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsAlphaNum(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void DoOperations(SerializedProperty items, int size, string type)
|
||||
{
|
||||
mToRemove.Clear();
|
||||
mToUp.Clear();
|
||||
bool up = false;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
|
||||
string arg = type + "|" + name;
|
||||
string res = null;
|
||||
if (up == true)
|
||||
{
|
||||
mToUp.Add(i);
|
||||
up = false;
|
||||
}
|
||||
if (mOperations.TryGetValue(arg, out res))
|
||||
{
|
||||
if (res == "remove")
|
||||
mToRemove.Add(i);
|
||||
if (res == "up" && i > 0)
|
||||
mToUp.Add(i);
|
||||
if (res == "down")
|
||||
up = true;
|
||||
mOperations.Remove(arg);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mToRemove.Count; i++)
|
||||
items.DeleteArrayElementAtIndex(mToRemove[i]);
|
||||
for (int i = 0; i < mToUp.Count; i++)
|
||||
{
|
||||
int cur = mToUp[i];
|
||||
items.MoveArrayElement(cur, cur - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private SerializedProperty getArrayCategory(SerializedProperty arr, string name)
|
||||
{
|
||||
for (int i = 0; i < arr.arraySize; i++)
|
||||
{
|
||||
SerializedProperty prop = arr.GetArrayElementAtIndex(i);
|
||||
if (prop.FindPropertyRelative("ColumnName").stringValue == name)
|
||||
return prop.FindPropertyRelative("Amount");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
|
||||
{
|
||||
SerializedProperty items = data.FindPropertyRelative(property);
|
||||
SerializedProperty dataValues = data.FindPropertyRelative("mData");
|
||||
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
|
||||
//bool up, down;
|
||||
mAllNames.Clear();
|
||||
int size = items.arraySize;
|
||||
if (Event.current.type == EventType.Layout)
|
||||
DoOperations(items, size, type);
|
||||
size = items.arraySize;
|
||||
if (items.isExpanded)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
mAllNames.Add(name);
|
||||
|
||||
bool toogle = false;
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (nameProp != null)
|
||||
toogle = entry.isExpanded =EditorGUILayout.Foldout(entry.isExpanded, name);
|
||||
else
|
||||
{
|
||||
toogle = false;
|
||||
EditorGUILayout.LabelField(name);
|
||||
}
|
||||
SerializedProperty valueProp = getArrayCategory(dataValues, name);
|
||||
GUILayout.FlexibleSpace();
|
||||
if(valueProp != null)
|
||||
EditorGUILayout.PropertyField(valueProp);
|
||||
if (GUILayout.Button("..."))
|
||||
DoContext(type, name);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (toogle)
|
||||
{
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
if (nameProp != null)
|
||||
{
|
||||
SerializedProperty end = entry.GetEndProperty(true);
|
||||
entry.Next(true);
|
||||
if (SerializedProperty.EqualContents(entry, end) == false)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (entry.name != "Name")
|
||||
EditorGUILayout.PropertyField(entry, true);
|
||||
}
|
||||
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (errorMessage != null)
|
||||
EditorGUILayout.LabelField(errorMessage, mRedStyle);
|
||||
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
|
||||
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
newName = EditorGUILayout.TextField(newName);
|
||||
//GUILayout.Space(indentAdd.xMin);
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
bool error = false;
|
||||
if (newName.Trim().Length == 0)
|
||||
{
|
||||
errorMessage = "Name can't be empty";
|
||||
error = true;
|
||||
}
|
||||
else if (IsAlphaNum(newName) == false)
|
||||
{
|
||||
errorMessage = "Name conatins invalid characters";
|
||||
error = true;
|
||||
}
|
||||
else if (mAllNames.Contains(newName))
|
||||
{
|
||||
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
|
||||
error = true;
|
||||
}
|
||||
if (error == false)
|
||||
{
|
||||
errorMessage = null;
|
||||
items.InsertArrayElementAtIndex(size);
|
||||
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
|
||||
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
|
||||
if (newItemName == null)
|
||||
newItem.stringValue = newName;
|
||||
else
|
||||
newItemName.stringValue = newName;
|
||||
newName = "";
|
||||
UpdateWindow();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = null;
|
||||
}
|
||||
UpdateWindow();
|
||||
}
|
||||
|
||||
void callback(object val)
|
||||
{
|
||||
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
|
||||
mOperations[pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
bool RenameCategory(string fromName, string toName)
|
||||
{
|
||||
PieChart pieChart = (PieChart)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
pieChart.DataSource.RenameCategory(fromName, toName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if (pieChart.gameObject.activeInHierarchy)
|
||||
pieChart.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(pieChart);
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenameCalled(object val)
|
||||
{
|
||||
var data = (KeyValuePair<string, string>)val;
|
||||
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
|
||||
mRenameWindow = window;
|
||||
if (data.Key == "category")
|
||||
window.ShowDialog(data.Value, data.Key, RenameCategory);
|
||||
}
|
||||
void DoContext(string type, string name)
|
||||
{
|
||||
string arg = type + "|" + name;
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
|
||||
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
|
||||
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
|
||||
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
void UpdateWindow()
|
||||
{
|
||||
mUpdateWindow = true;
|
||||
}
|
||||
void OnDisable()
|
||||
{
|
||||
if(mRenameWindow != null)
|
||||
{
|
||||
mRenameWindow.Close();
|
||||
mRenameWindow = null;
|
||||
}
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.Close();
|
||||
mWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
serializedObject.Update();
|
||||
SerializedProperty barData = serializedObject.FindProperty("Data");
|
||||
EditorGUILayout.BeginVertical();
|
||||
Splitter();
|
||||
if (mBold == null)
|
||||
mBold = new GUIStyle(EditorStyles.foldout);
|
||||
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
NamedItemEditor(barData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (mUpdateWindow == true)
|
||||
{
|
||||
mUpdateWindow = false;
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.SetEditedObject(serializedObject);
|
||||
mWindow.Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/PieChartInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/PieChartInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcc024b6935dfff44aece802ded95e9a
|
||||
timeCreated: 1480008753
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
83
Assets/Chart And Graph/Editor/PrefabOverrideChart.cs
Normal file
83
Assets/Chart And Graph/Editor/PrefabOverrideChart.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
//#if UNITY_2018_3_OR_NEWER
|
||||
//#if UNITY_EDITOR
|
||||
//using UnityEngine;
|
||||
//using System.Collections;
|
||||
//using UnityEditor;
|
||||
//using ChartAndGraph;
|
||||
|
||||
//public class PrefabOverrideChart : UnityEditor.AssetPostprocessor
|
||||
//{
|
||||
// static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
|
||||
// {
|
||||
// foreach (string path in importedAssets)
|
||||
// {
|
||||
// string lowPath = path.ToLower();
|
||||
// if (lowPath.EndsWith(".prefab"))
|
||||
// {
|
||||
// if (ContainsPath(lowPath) == false)
|
||||
// {
|
||||
// // Debug.Log(lowPath);
|
||||
// EditorApplication.delayCall += () => CleanPrefab(path);
|
||||
// AddPath(lowPath);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// foreach (string path in deletedAssets)
|
||||
// {
|
||||
// RemovePath(path.ToLower());
|
||||
// }
|
||||
// }
|
||||
// [MenuItem("EditorPrefs/Clear all Editor Preferences")]
|
||||
// static void deleteAllExample()
|
||||
// {
|
||||
|
||||
// EditorPrefs.DeleteAll();
|
||||
// }
|
||||
// static bool ContainsPath(string path)
|
||||
// {
|
||||
// return EditorPrefs.GetBool("GraphAndChartPrefabOverride$" + path, false);
|
||||
// }
|
||||
// static void RemovePath(string path)
|
||||
// {
|
||||
// EditorPrefs.DeleteKey("GraphAndChartPrefabOverride$" + path);
|
||||
// }
|
||||
// static void AddPath(string path)
|
||||
// {
|
||||
// EditorPrefs.SetBool("GraphAndChartPrefabOverride$" + path, true);
|
||||
// }
|
||||
// static void CleanPrefab(string path)
|
||||
// {
|
||||
// GameObject obj = PrefabUtility.LoadPrefabContents(path);
|
||||
// //AssetDatabase.DeleteAsset(path);
|
||||
// bool savePrefab = false;
|
||||
// foreach (var item in obj.GetComponentsInChildren<AnyChart>(true))
|
||||
// {
|
||||
// savePrefab = true;
|
||||
// // if (item == null)
|
||||
// // continue;
|
||||
// // if (item.gameObject == null)
|
||||
// // continue;
|
||||
// // Debug.Log("destroy " + item.gameObject.name);
|
||||
// while (item.gameObject.transform.childCount > 0)
|
||||
// {
|
||||
// var innerObj = item.gameObject.transform.GetChild(0).gameObject;
|
||||
// if (innerObj != null)
|
||||
// {
|
||||
// // Debug.Log("destroy inner" + innerObj.name);
|
||||
|
||||
// GameObject.DestroyImmediate(innerObj);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
// if (savePrefab)
|
||||
// PrefabUtility.SaveAsPrefabAsset(obj, path);
|
||||
// PrefabUtility.UnloadPrefabContents(obj);
|
||||
// }
|
||||
|
||||
//}
|
||||
//#endif
|
||||
//#endif
|
||||
12
Assets/Chart And Graph/Editor/PrefabOverrideChart.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/PrefabOverrideChart.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb3ccf7dc2806314e99c1bbc160aabec
|
||||
timeCreated: 1579105195
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
328
Assets/Chart And Graph/Editor/PyramidChartInspector.cs
Normal file
328
Assets/Chart And Graph/Editor/PyramidChartInspector.cs
Normal file
@@ -0,0 +1,328 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(PyramidChart), true)]
|
||||
class PyramidChartInspetor : Editor
|
||||
{
|
||||
bool mCategories = false;
|
||||
string mCategoryError = null;
|
||||
string mNewCategoryName = "";
|
||||
GUIStyle mRedStyle;
|
||||
GUIStyle mBold;
|
||||
HashSet<string> mAllNames = new HashSet<string>();
|
||||
GUIStyle mSplitter;
|
||||
List<int> mToRemove = new List<int>();
|
||||
List<int> mToUp = new List<int>();
|
||||
Dictionary<string, string> mOperations = new Dictionary<string, string>();
|
||||
ChartDataEditor mWindow;
|
||||
bool mUpdateWindow = false;
|
||||
Texture mSettings;
|
||||
|
||||
RenameWindow mRenameWindow = null;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
mRedStyle = new GUIStyle();
|
||||
mRedStyle.normal.textColor = Color.red;
|
||||
|
||||
mSplitter = new GUIStyle();
|
||||
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
|
||||
mSplitter.stretchWidth = true;
|
||||
mSplitter.margin = new RectOffset(0, 0, 7, 7);
|
||||
}
|
||||
|
||||
public void Splitter()
|
||||
{
|
||||
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Color restoreColor = GUI.color;
|
||||
GUI.color = new Color(0.5f, 0.5f, 0.5f);
|
||||
mSplitter.Draw(position, false, false, false, false);
|
||||
GUI.color = restoreColor;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsAlphaNum(string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
{
|
||||
if (!(char.IsLetter(str[i])) && (!(char.IsNumber(str[i]))) && str[i] != ' ')
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void DoOperations(SerializedProperty items, int size, string type)
|
||||
{
|
||||
mToRemove.Clear();
|
||||
mToUp.Clear();
|
||||
bool up = false;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
|
||||
string arg = type + "|" + name;
|
||||
string res = null;
|
||||
if (up == true)
|
||||
{
|
||||
mToUp.Add(i);
|
||||
up = false;
|
||||
}
|
||||
if (mOperations.TryGetValue(arg, out res))
|
||||
{
|
||||
if (res == "remove")
|
||||
mToRemove.Add(i);
|
||||
if (res == "up" && i > 0)
|
||||
mToUp.Add(i);
|
||||
if (res == "down")
|
||||
up = true;
|
||||
mOperations.Remove(arg);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mToRemove.Count; i++)
|
||||
items.DeleteArrayElementAtIndex(mToRemove[i]);
|
||||
for (int i = 0; i < mToUp.Count; i++)
|
||||
{
|
||||
int cur = mToUp[i];
|
||||
items.MoveArrayElement(cur, cur - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private SerializedProperty getArrayCategory(SerializedProperty arr, string name)
|
||||
{
|
||||
for (int i = 0; i < arr.arraySize; i++)
|
||||
{
|
||||
SerializedProperty prop = arr.GetArrayElementAtIndex(i);
|
||||
if (prop.FindPropertyRelative("ColumnName").stringValue == name)
|
||||
return prop.FindPropertyRelative("Amount");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
|
||||
{
|
||||
SerializedProperty items = data.FindPropertyRelative(property);
|
||||
SerializedProperty dataValues = data.FindPropertyRelative("mData");
|
||||
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
|
||||
//bool up, down;
|
||||
mAllNames.Clear();
|
||||
int size = items.arraySize;
|
||||
if (Event.current.type == EventType.Layout)
|
||||
DoOperations(items, size, type);
|
||||
size = items.arraySize;
|
||||
if (items.isExpanded)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
mAllNames.Add(name);
|
||||
|
||||
bool toogle = false;
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (nameProp != null)
|
||||
toogle = entry.isExpanded =EditorGUILayout.Foldout(entry.isExpanded, name);
|
||||
else
|
||||
{
|
||||
toogle = false;
|
||||
EditorGUILayout.LabelField(name);
|
||||
}
|
||||
SerializedProperty valueProp = getArrayCategory(dataValues, name);
|
||||
GUILayout.FlexibleSpace();
|
||||
// if(valueProp != null)
|
||||
// EditorGUILayout.PropertyField(valueProp);
|
||||
if (GUILayout.Button("..."))
|
||||
DoContext(type, name);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (toogle)
|
||||
{
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
if (nameProp != null)
|
||||
{
|
||||
SerializedProperty end = entry.GetEndProperty(true);
|
||||
entry.Next(true);
|
||||
if (SerializedProperty.EqualContents(entry, end) == false)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (entry.name != "Name")
|
||||
EditorGUILayout.PropertyField(entry, true);
|
||||
if (entry.name == "HeightRatio" && valueProp != null)
|
||||
valueProp.floatValue = entry.floatValue;
|
||||
|
||||
}
|
||||
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (errorMessage != null)
|
||||
EditorGUILayout.LabelField(errorMessage, mRedStyle);
|
||||
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
|
||||
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
newName = EditorGUILayout.TextField(newName);
|
||||
//GUILayout.Space(indentAdd.xMin);
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
bool error = false;
|
||||
if (newName.Trim().Length == 0)
|
||||
{
|
||||
errorMessage = "Name can't be empty";
|
||||
error = true;
|
||||
}
|
||||
else if (IsAlphaNum(newName) == false)
|
||||
{
|
||||
errorMessage = "Name conatins invalid characters";
|
||||
error = true;
|
||||
}
|
||||
else if (mAllNames.Contains(newName))
|
||||
{
|
||||
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
|
||||
error = true;
|
||||
}
|
||||
if (error == false)
|
||||
{
|
||||
errorMessage = null;
|
||||
items.InsertArrayElementAtIndex(size);
|
||||
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
|
||||
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
|
||||
if (newItemName == null)
|
||||
newItem.stringValue = newName;
|
||||
else
|
||||
newItemName.stringValue = newName;
|
||||
newName = "";
|
||||
UpdateWindow();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = null;
|
||||
}
|
||||
UpdateWindow();
|
||||
}
|
||||
|
||||
void callback(object val)
|
||||
{
|
||||
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
|
||||
mOperations[pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
bool RenameCategory(string fromName, string toName)
|
||||
{
|
||||
PyramidChart pyramidChart = (PyramidChart)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
pyramidChart.DataSource.RenameCategory(fromName, toName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if (pyramidChart.gameObject.activeInHierarchy)
|
||||
pyramidChart.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(pyramidChart);
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenameCalled(object val)
|
||||
{
|
||||
var data = (KeyValuePair<string, string>)val;
|
||||
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
|
||||
mRenameWindow = window;
|
||||
if (data.Key == "category")
|
||||
window.ShowDialog(data.Value, data.Key, RenameCategory);
|
||||
}
|
||||
void DoContext(string type, string name)
|
||||
{
|
||||
string arg = type + "|" + name;
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
|
||||
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
|
||||
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
|
||||
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
void UpdateWindow()
|
||||
{
|
||||
mUpdateWindow = true;
|
||||
}
|
||||
void OnDisable()
|
||||
{
|
||||
if(mRenameWindow != null)
|
||||
{
|
||||
mRenameWindow.Close();
|
||||
mRenameWindow = null;
|
||||
}
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.Close();
|
||||
mWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
SerializedProperty barData = serializedObject.FindProperty("Data");
|
||||
EditorGUILayout.BeginVertical();
|
||||
Splitter();
|
||||
if (mBold == null)
|
||||
mBold = new GUIStyle(EditorStyles.foldout);
|
||||
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
NamedItemEditor(barData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
serializedObject.Update();
|
||||
if (mUpdateWindow == true)
|
||||
{
|
||||
mUpdateWindow = false;
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.SetEditedObject(serializedObject);
|
||||
mWindow.Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/PyramidChartInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/PyramidChartInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79e4c0b8020ab4a42a6d990ae8dc88c3
|
||||
timeCreated: 1579446121
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
392
Assets/Chart And Graph/Editor/RadarChartInspector.cs
Normal file
392
Assets/Chart And Graph/Editor/RadarChartInspector.cs
Normal file
@@ -0,0 +1,392 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
[CustomEditor(typeof(RadarChart), true)]
|
||||
class RadarChartInspector : Editor
|
||||
{
|
||||
bool mCategories = false;
|
||||
bool mGroups = false;
|
||||
string mCategoryError = null;
|
||||
string mNewCategoryName = "";
|
||||
string mNewGroupName = "";
|
||||
string mGroupError = null;
|
||||
GUIStyle mRedStyle;
|
||||
GUIStyle mBold;
|
||||
HashSet<string> mAllNames = new HashSet<string>();
|
||||
GUIStyle mSplitter;
|
||||
List<int> mToRemove = new List<int>();
|
||||
List<int> mToUp = new List<int>();
|
||||
Dictionary<string, string> mOperations = new Dictionary<string, string>();
|
||||
ChartDataEditor mWindow;
|
||||
bool mUpdateWindow = false;
|
||||
Texture mSettings;
|
||||
GUIContent MaxRadarValue = new GUIContent("Max Value :", "All radar values are scale according to this value");
|
||||
GUIContent MinRadarValue = new GUIContent("Min Value :", "All radar values are scale according to this value");
|
||||
RenameWindow mRenameWindow;
|
||||
|
||||
string[] NonCanvas = new string[]
|
||||
{
|
||||
"LinePrefab",
|
||||
"PointPrefab",
|
||||
"Seperation",
|
||||
"Curve",
|
||||
"FillSmoothing"
|
||||
};
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
|
||||
mRedStyle = new GUIStyle();
|
||||
mRedStyle.normal.textColor = Color.red;
|
||||
|
||||
mSplitter = new GUIStyle();
|
||||
mSplitter.normal.background = EditorGUIUtility.whiteTexture;
|
||||
mSplitter.stretchWidth = true;
|
||||
mSplitter.margin = new RectOffset(0, 0, 7, 7);
|
||||
}
|
||||
|
||||
public void Splitter()
|
||||
{
|
||||
Rect position = GUILayoutUtility.GetRect(GUIContent.none, mSplitter, GUILayout.Height(1f));
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
Color restoreColor = GUI.color;
|
||||
GUI.color = new Color(0.5f, 0.5f, 0.5f);
|
||||
mSplitter.Draw(position, false, false, false, false);
|
||||
GUI.color = restoreColor;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoOperations(SerializedProperty items, int size, string type)
|
||||
{
|
||||
mToRemove.Clear();
|
||||
mToUp.Clear();
|
||||
bool up = false;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
|
||||
string arg = type + "|" + name;
|
||||
string res = null;
|
||||
if (up == true)
|
||||
{
|
||||
mToUp.Add(i);
|
||||
up = false;
|
||||
}
|
||||
if (mOperations.TryGetValue(arg, out res))
|
||||
{
|
||||
if (res == "remove")
|
||||
mToRemove.Add(i);
|
||||
if (res == "up" && i > 0)
|
||||
mToUp.Add(i);
|
||||
if (res == "down")
|
||||
up = true;
|
||||
mOperations.Remove(arg);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mToRemove.Count; i++)
|
||||
items.DeleteArrayElementAtIndex(mToRemove[i]);
|
||||
for (int i = 0; i < mToUp.Count; i++)
|
||||
{
|
||||
int cur = mToUp[i];
|
||||
items.MoveArrayElement(cur, cur - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void NamedItemEditor(SerializedProperty data, string type, string property, string caption, ref string errorMessage, ref bool foldout, ref string newName)
|
||||
{
|
||||
SerializedProperty items = data.FindPropertyRelative(property);
|
||||
items.isExpanded = EditorGUILayout.Foldout(items.isExpanded, caption);
|
||||
//bool up, down;
|
||||
mAllNames.Clear();
|
||||
int size = items.arraySize;
|
||||
if (Event.current.type == EventType.Layout)
|
||||
DoOperations(items, size, type);
|
||||
size = items.arraySize;
|
||||
if (items.isExpanded)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SerializedProperty entry = items.GetArrayElementAtIndex(i);
|
||||
if (entry == null)
|
||||
continue;
|
||||
SerializedProperty nameProp = entry.FindPropertyRelative("Name");
|
||||
string name = null;
|
||||
if (nameProp == null)
|
||||
name = entry.stringValue;
|
||||
else
|
||||
name = nameProp.stringValue;
|
||||
mAllNames.Add(name);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
bool toogle = false;
|
||||
if (nameProp != null)
|
||||
toogle = entry.isExpanded = EditorGUILayout.Foldout(entry.isExpanded, name);
|
||||
else
|
||||
{
|
||||
toogle = false;
|
||||
EditorGUILayout.LabelField(name);
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GUILayout.Button("..."))
|
||||
DoContext(type, name);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (toogle)
|
||||
{
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
if (nameProp != null)
|
||||
{
|
||||
SerializedProperty end = entry.GetEndProperty(true);
|
||||
entry.Next(true);
|
||||
if (SerializedProperty.EqualContents(entry, end) == false)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (entry.name != "Name")
|
||||
{
|
||||
if(target is CanvasRadarChart)
|
||||
{
|
||||
|
||||
if (NonCanvas.Contains(entry.name))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entry.name == "LineHover" || entry.name == "PointHover")
|
||||
continue;
|
||||
}
|
||||
EditorGUILayout.PropertyField(entry, true);
|
||||
}
|
||||
|
||||
}
|
||||
while (entry.Next(entry.name == "Materials") && SerializedProperty.EqualContents(entry, end) == false);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (errorMessage != null)
|
||||
EditorGUILayout.LabelField(errorMessage, mRedStyle);
|
||||
EditorGUILayout.LabelField(string.Format("Add new {0} :", type));
|
||||
//Rect indentAdd = EditorGUI.IndentedRect(new Rect(0f, 0f, 1000f, 1000f));
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
newName = EditorGUILayout.TextField(newName);
|
||||
//GUILayout.Space(indentAdd.xMin);
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
bool error = false;
|
||||
if (newName.Trim().Length == 0)
|
||||
{
|
||||
errorMessage = "Name can't be empty";
|
||||
error = true;
|
||||
}
|
||||
else if (ChartEditorCommon.IsAlphaNum(newName) == false)
|
||||
{
|
||||
errorMessage = "Name conatins invalid characters";
|
||||
error = true;
|
||||
}
|
||||
else if (mAllNames.Contains(newName))
|
||||
{
|
||||
errorMessage = string.Format("A {0} named {1} already exists in this chart", type, newName);
|
||||
error = true;
|
||||
}
|
||||
if (error == false)
|
||||
{
|
||||
errorMessage = null;
|
||||
items.InsertArrayElementAtIndex(size);
|
||||
SerializedProperty newItem = items.GetArrayElementAtIndex(size);
|
||||
SerializedProperty newItemName = newItem.FindPropertyRelative("Name");
|
||||
if (newItemName == null)
|
||||
newItem.stringValue = newName;
|
||||
else
|
||||
newItemName.stringValue = newName;
|
||||
newName = "";
|
||||
UpdateWindow();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = null;
|
||||
}
|
||||
UpdateWindow();
|
||||
}
|
||||
|
||||
void callback(object val)
|
||||
{
|
||||
KeyValuePair<string, string> pair = (KeyValuePair<string, string>)val;
|
||||
mOperations[pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
bool RenameGroup(string fromName, string toName)
|
||||
{
|
||||
RadarChart radarChart = (RadarChart)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
radarChart.DataSource.RenameGroup(fromName, toName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if (radarChart.gameObject.activeInHierarchy)
|
||||
radarChart.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(radarChart);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenameCategory(string fromName, string toName)
|
||||
{
|
||||
RadarChart radarChart = (RadarChart)serializedObject.targetObject;
|
||||
try
|
||||
{
|
||||
radarChart.DataSource.RenameCategory(fromName, toName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
serializedObject.Update();
|
||||
if (radarChart.gameObject.activeInHierarchy)
|
||||
radarChart.GenerateChart();
|
||||
else
|
||||
EditorUtility.SetDirty(radarChart);
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenameCalled(object val)
|
||||
{
|
||||
var data = (KeyValuePair<string, string>)val;
|
||||
RenameWindow window = EditorWindow.GetWindow<RenameWindow>();
|
||||
mRenameWindow = window;
|
||||
if (data.Key == "category")
|
||||
window.ShowDialog(data.Value, data.Key, RenameCategory);
|
||||
else if (data.Key == "group")
|
||||
window.ShowDialog(data.Value, data.Key, RenameGroup);
|
||||
}
|
||||
|
||||
void DoContext(string type, string name)
|
||||
{
|
||||
string arg = type + "|" + name;
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Move Up"), false, callback, new KeyValuePair<string, string>(arg, "up"));
|
||||
menu.AddItem(new GUIContent("Move Down"), false, callback, new KeyValuePair<string, string>(arg, "down"));
|
||||
menu.AddItem(new GUIContent("Remove"), false, callback, new KeyValuePair<string, string>(arg, "remove"));
|
||||
menu.AddItem(new GUIContent("Rename.."), false, RenameCalled, new KeyValuePair<string, string>(type, name));
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
|
||||
void UpdateWindow()
|
||||
{
|
||||
mUpdateWindow = true;
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (mRenameWindow != null)
|
||||
{
|
||||
mRenameWindow.Close();
|
||||
mRenameWindow = null;
|
||||
}
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.Close();
|
||||
mWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
serializedObject.Update();
|
||||
SerializedProperty radarData = serializedObject.FindProperty("Data");
|
||||
EditorGUILayout.BeginVertical();
|
||||
Splitter();
|
||||
if (mBold == null)
|
||||
{
|
||||
mBold = new GUIStyle(EditorStyles.foldout);
|
||||
}
|
||||
|
||||
EditorGUILayout.LabelField("Data", EditorStyles.boldLabel);
|
||||
EditorGUI.indentLevel++;
|
||||
NamedItemEditor(radarData, "category", "mCategories", "Categories", ref mCategoryError, ref mCategories, ref mNewCategoryName);
|
||||
NamedItemEditor(radarData, "group", "mGroups", "Groups", ref mGroupError, ref mGroups, ref mNewGroupName);
|
||||
|
||||
SerializedProperty maxProp = radarData.FindPropertyRelative("maxValue");
|
||||
SerializedProperty minProp = radarData.FindPropertyRelative("minValue");
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(MaxRadarValue, EditorStyles.boldLabel);
|
||||
SerializedProperty automaticProp = radarData.FindPropertyRelative("automaticMaxValue");
|
||||
bool automatic = automaticProp.boolValue;
|
||||
automatic = GUILayout.Toggle(automatic, "Auto");
|
||||
GUILayout.FlexibleSpace();
|
||||
automaticProp.boolValue = automatic;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
|
||||
EditorGUILayout.PropertyField(maxProp);
|
||||
if (0f > maxProp.doubleValue)
|
||||
maxProp.doubleValue = 0.001f;
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(MinRadarValue, EditorStyles.boldLabel);
|
||||
automaticProp = radarData.FindPropertyRelative("automaticMinValue");
|
||||
automatic = automaticProp.boolValue;
|
||||
automatic = GUILayout.Toggle(automatic, "Auto");
|
||||
GUILayout.FlexibleSpace();
|
||||
automaticProp.boolValue = automatic;
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if (automatic == false)
|
||||
{
|
||||
|
||||
EditorGUILayout.PropertyField(minProp);
|
||||
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Edit Values...") && mWindow == null)
|
||||
mWindow = ChartDataEditor.ShowForObject(serializedObject);
|
||||
//}
|
||||
EditorGUI.indentLevel--;
|
||||
EditorGUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (mUpdateWindow == true)
|
||||
{
|
||||
mUpdateWindow = false;
|
||||
if (mWindow != null)
|
||||
{
|
||||
mWindow.SetEditedObject(serializedObject);
|
||||
mWindow.Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/RadarChartInspector.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/RadarChartInspector.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec3a557017cfb7040b5a426cb7f71a47
|
||||
timeCreated: 1489858254
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Assets/Chart And Graph/Editor/RenameWindow.cs
Normal file
71
Assets/Chart And Graph/Editor/RenameWindow.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
class RenameWindow :EditorWindow
|
||||
{
|
||||
string mStartName;
|
||||
string mValue = "";
|
||||
string mType;
|
||||
Func<string, string, bool> mRenameMethod;
|
||||
string mMessage = null;
|
||||
|
||||
public void ShowDialog(string currentName,string type,Func<string,string, bool> renameMethod)
|
||||
{
|
||||
mStartName = currentName;
|
||||
mValue = currentName;
|
||||
mType = type;
|
||||
mRenameMethod = renameMethod;
|
||||
float height = (float)(EditorGUIUtility.singleLineHeight * 6f);
|
||||
minSize = maxSize = new Vector2(300, height);
|
||||
Show();
|
||||
|
||||
}
|
||||
void OnGUI()
|
||||
{
|
||||
EditorGUILayout.LabelField(string.Format("Select a new {0} name",mType));
|
||||
mValue = EditorGUILayout.TextField(mValue);
|
||||
bool disabled = false;
|
||||
if (mValue.Trim().Length == 0)
|
||||
{
|
||||
mMessage = null;
|
||||
EditorGUILayout.LabelField("Name can't be empty");
|
||||
disabled = true;
|
||||
}
|
||||
else
|
||||
if (ChartEditorCommon.IsAlphaNum(mValue) == false)
|
||||
{
|
||||
mMessage = null;
|
||||
EditorGUILayout.LabelField("Name contains invalid charecters");
|
||||
disabled = true;
|
||||
}
|
||||
if (mMessage != null)
|
||||
EditorGUILayout.LabelField(mMessage);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUI.enabled = !disabled;
|
||||
if (GUILayout.Button("Rename"))
|
||||
{
|
||||
if (mStartName == mValue)
|
||||
Close();
|
||||
else
|
||||
{
|
||||
if (mRenameMethod(mStartName,mValue))
|
||||
Close();
|
||||
else
|
||||
mMessage = string.Format("A {0} by the name {1} already exists", mType, mValue);
|
||||
}
|
||||
}
|
||||
GUI.enabled = true;
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GUILayout.Button("Cancel"))
|
||||
Close();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/Chart And Graph/Editor/RenameWindow.cs.meta
Normal file
12
Assets/Chart And Graph/Editor/RenameWindow.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66d4769f533803d49a88420cd97553f9
|
||||
timeCreated: 1481046854
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Chart And Graph/Manual - Lite Edition.pdf
Normal file
BIN
Assets/Chart And Graph/Manual - Lite Edition.pdf
Normal file
Binary file not shown.
7
Assets/Chart And Graph/Manual - Lite Edition.pdf.meta
Normal file
7
Assets/Chart And Graph/Manual - Lite Edition.pdf.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98c66a6fc30a2c64698b02c48d7d968d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Chart And Graph/Materials.meta
Normal file
9
Assets/Chart And Graph/Materials.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfc5174a9e572cd43bb89ff3fc90bbeb
|
||||
folderAsset: yes
|
||||
timeCreated: 1481296195
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Chart And Graph/Materials/Canvas.meta
Normal file
9
Assets/Chart And Graph/Materials/Canvas.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77a1babc1e1ba114d9877fe33a767863
|
||||
folderAsset: yes
|
||||
timeCreated: 1481296236
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
116
Assets/Chart And Graph/Materials/Canvas/Circle Point Black.mat
Normal file
116
Assets/Chart And Graph/Materials/Canvas/Circle Point Black.mat
Normal file
@@ -0,0 +1,116 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Circle Point Black
|
||||
m_Shader: {fileID: 4800000, guid: 818b0e872599e3948b6cceff71a30540, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AlphaTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailBump:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailTex:
|
||||
m_Texture: {fileID: 2800000, guid: 4bbfd1267a79d8a4aa7bdc0d969caa9b, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainBump:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 4bbfd1267a79d8a4aa7bdc0d969caa9b, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- PixelSnap: 0
|
||||
- _Angle: 0
|
||||
- _BumpScale: 1
|
||||
- _ChartTiling: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Shininess: 0.2
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _Strength: 1
|
||||
- _UVSec: 0
|
||||
- _UseUIAlphaClip: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorFrom: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ColorTo: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _Combine: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _Specular: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab0868582e51a8e44abb165770658056
|
||||
timeCreated: 1490639290
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
116
Assets/Chart And Graph/Materials/Canvas/Circle Point.mat
Normal file
116
Assets/Chart And Graph/Materials/Canvas/Circle Point.mat
Normal file
@@ -0,0 +1,116 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Circle Point
|
||||
m_Shader: {fileID: 4800000, guid: 818b0e872599e3948b6cceff71a30540, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AlphaTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailBump:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailTex:
|
||||
m_Texture: {fileID: 2800000, guid: 4bbfd1267a79d8a4aa7bdc0d969caa9b, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainBump:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 4bbfd1267a79d8a4aa7bdc0d969caa9b, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- PixelSnap: 0
|
||||
- _Angle: 0
|
||||
- _BumpScale: 1
|
||||
- _ChartTiling: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Shininess: 0.2
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _Strength: 1
|
||||
- _UVSec: 0
|
||||
- _UseUIAlphaClip: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorFrom: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorTo: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Combine: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _Specular: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be1ca05f8d1cf90449194e1af4839df0
|
||||
timeCreated: 1480865726
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Dim Dotted Line 1
|
||||
m_Shader: {fileID: 4800000, guid: 0a799adfcb28a1847873696ef5d3c504, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 1ba7ca3d464d30a4e880070bc56d4383, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 0.5514706, g: 0.5514706, b: 0.5514706, a: 0.103}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c9d5cb6cbfffcf47aefcbeb0f0b37b6
|
||||
timeCreated: 1484495093
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Dim Dotted Line 2
|
||||
m_Shader: {fileID: 4800000, guid: 0a799adfcb28a1847873696ef5d3c504, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 1ba7ca3d464d30a4e880070bc56d4383, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0.141}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f4ec85425306614c9a6d154f2e9407b
|
||||
timeCreated: 1513871321
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Dim white Dotted Line
|
||||
m_Shader: {fileID: 4800000, guid: 0a799adfcb28a1847873696ef5d3c504, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 1ba7ca3d464d30a4e880070bc56d4383, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abcb2a54f658da247af7ed9cd76bd244
|
||||
timeCreated: 1560614468
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
95
Assets/Chart And Graph/Materials/Canvas/Dotted Line.mat
Normal file
95
Assets/Chart And Graph/Materials/Canvas/Dotted Line.mat
Normal file
@@ -0,0 +1,95 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Dotted Line
|
||||
m_Shader: {fileID: 4800000, guid: 0a799adfcb28a1847873696ef5d3c504, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 1ba7ca3d464d30a4e880070bc56d4383, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _Strength: 0.2
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 0.5514706, g: 0.5514706, b: 0.5514706, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 387acf3cc0524344980e92fa3f38dfd1
|
||||
timeCreated: 1481296206
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
90
Assets/Chart And Graph/Materials/Canvas/Plain Line.mat
Normal file
90
Assets/Chart And Graph/Materials/Canvas/Plain Line.mat
Normal file
@@ -0,0 +1,90 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Plain Line
|
||||
m_Shader: {fileID: 4800000, guid: 0a799adfcb28a1847873696ef5d3c504, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 9959c8d64e68c9b49a96dd9de08c4315, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 0.5514706, g: 0.5514706, b: 0.5514706, a: 0.297}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdb13d53e3b6bb549950dfa33b36f965
|
||||
timeCreated: 1555445867
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
116
Assets/Chart And Graph/Materials/Canvas/Round Point.mat
Normal file
116
Assets/Chart And Graph/Materials/Canvas/Round Point.mat
Normal file
@@ -0,0 +1,116 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Round Point
|
||||
m_Shader: {fileID: 4800000, guid: 818b0e872599e3948b6cceff71a30540, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords:
|
||||
- _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AlphaTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailBump:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailTex:
|
||||
m_Texture: {fileID: 2800000, guid: 4bbfd1267a79d8a4aa7bdc0d969caa9b, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainBump:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 191e43c5f0b13f84abf52a5c14cb8805, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- PixelSnap: 0
|
||||
- _Angle: 0
|
||||
- _BumpScale: 1
|
||||
- _ChartTiling: 1
|
||||
- _ColorMask: 15
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Shininess: 0.2
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _Stencil: 0
|
||||
- _StencilComp: 8
|
||||
- _StencilOp: 0
|
||||
- _StencilReadMask: 255
|
||||
- _StencilWriteMask: 255
|
||||
- _Strength: 1
|
||||
- _UVSec: 0
|
||||
- _UseUIAlphaClip: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorFrom: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ColorTo: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Combine: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _Specular: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b44e6f88dc1476049bfcb25ce2908c91
|
||||
timeCreated: 1484497418
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Chart And Graph/Playmaker.meta
Normal file
9
Assets/Chart And Graph/Playmaker.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73edf63da03f2134cb3abb4edae6b0a8
|
||||
folderAsset: yes
|
||||
timeCreated: 1560715350
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
66
Assets/Chart And Graph/Playmaker/AddBarCategoryAction.cs
Normal file
66
Assets/Chart And Graph/Playmaker/AddBarCategoryAction.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Bar Category")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("Adds or updates a category in a bar chart. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class AddBarCategoryAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
[Tooltip("The material used for the category , make sure to use only canvas material for canvas charts ")]
|
||||
public FsmMaterial Material;
|
||||
[Tooltip("The color of a bar on a mouse hover for this category")]
|
||||
public FsmColor HoverColor;
|
||||
[Tooltip("The color of a bar on a mouse click for this category")]
|
||||
public FsmColor ClickColor;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
Material = null;
|
||||
HoverColor = Color.white;
|
||||
ClickColor = Color.white;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (checkObject.GetComponent<BarChart>() == null)
|
||||
return "Object must be a either a CanvasBarChart chart or a WorldSpaceBarChart chart";
|
||||
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
if (Material.Value == null)
|
||||
return "Material cannot be null";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var bar = chart.GetComponent<BarChart>();
|
||||
if(bar.DataSource.HasCategory(CategoryName.Value))
|
||||
bar.DataSource.SetMaterial(CategoryName.Value, new ChartDynamicMaterial(Material.Value, HoverColor.Value, ClickColor.Value));
|
||||
else
|
||||
bar.DataSource.AddCategory(CategoryName.Value, new ChartDynamicMaterial(Material.Value, HoverColor.Value, ClickColor.Value));
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 525ed9c4a258a2c45976e091a244ab74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8184574aa283d854ab591cdee248af12
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Bar Chart Category Template")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Adds or updates a category in a Bar chart from a Template. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class BarCategoryFromTemplate : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The template object for the chart. Or null for defualt template")]
|
||||
public FsmGameObject TemplateObject;
|
||||
|
||||
[Tooltip("The index of the template category")]
|
||||
public FsmInt TemplateIndex;
|
||||
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
TemplateObject = null;
|
||||
TemplateIndex = 0;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (checkObject.GetComponent<BarChart>() == null)
|
||||
return "Object must be a bar chart";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var bar = chart.GetComponent<BarChart>();
|
||||
GameObject template = TemplateObject.Value;
|
||||
if (template == null || template.GetComponent<BarChart>() == null || (template.GetComponent<BarChart>().GetType() != bar.GetType()))
|
||||
{
|
||||
if (bar is CanvasBarChart)
|
||||
template = ((GameObject)Resources.Load("Chart And Graph/DefualtBarCategoryStyle2D"));
|
||||
else
|
||||
template = ((GameObject)Resources.Load("Chart And Graph/DefualtBarCategoryStyle3D")); // load default
|
||||
|
||||
}
|
||||
|
||||
var templateComponent = template.GetComponent<BarChart>();
|
||||
if (templateComponent.DataSource.TotalCategories == 0)
|
||||
{
|
||||
Debug.LogError("No categories in template chart");
|
||||
return;
|
||||
}
|
||||
|
||||
int index = TemplateIndex.Value;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
if (index >= templateComponent.DataSource.TotalCategories)
|
||||
index = templateComponent.DataSource.TotalCategories - 1;
|
||||
string catName = templateComponent.DataSource.GetCategoryName(index);
|
||||
var material = templateComponent.DataSource.GetMaterial(catName);
|
||||
if (bar.DataSource.HasCategory(CategoryName.Value) == false)
|
||||
bar.DataSource.AddCategory(CategoryName.Value, material);
|
||||
else
|
||||
bar.DataSource.SetMaterial(CategoryName.Value, material);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6a5231398945a144834450ce33d6942
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,89 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Graph Chart Category Template")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Adds or updates a category in a Graph chart from a Template. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class GraphCategoryFromTemplate : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The template object for the chart. Or null for defualt template")]
|
||||
public FsmGameObject TemplateObject;
|
||||
|
||||
[Tooltip("The index of the template category")]
|
||||
public FsmInt TemplateIndex;
|
||||
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
TemplateObject = null;
|
||||
TemplateIndex = 0;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (checkObject.GetComponent<GraphChartBase>() == null)
|
||||
return "Object must be a graph chart";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var graph = chart.GetComponent<GraphChartBase>();
|
||||
GameObject template = TemplateObject.Value;
|
||||
if(template == null || template.GetComponent<GraphChartBase>() == null || (template.GetComponent<GraphChartBase>().GetType() != graph.GetType() ))
|
||||
{
|
||||
if (graph is GraphChart)
|
||||
template = ((GameObject)Resources.Load("Chart And Graph/DefualtGraphCategoryStyle2D"));
|
||||
else
|
||||
template = ((GameObject)Resources.Load("Chart And Graph/DefualtGraphCategoryStyle3D")); // load default
|
||||
|
||||
}
|
||||
var templateComponent = template.GetComponent<GraphChartBase>();
|
||||
var visualStyles = templateComponent.DataSource.StoreAllCategoriesinOrder();
|
||||
if(visualStyles.Length ==0)
|
||||
{
|
||||
Debug.LogError("No categories in template chart");
|
||||
return;
|
||||
}
|
||||
int index = TemplateIndex.Value;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
if (index >= visualStyles.Length)
|
||||
index = visualStyles.Length - 1;
|
||||
var style = visualStyles[index];
|
||||
|
||||
if (graph.DataSource.HasCategory(CategoryName.Value) == false)
|
||||
graph.DataSource.AddCategory(CategoryName.Value, null, 0, new MaterialTiling(), null, false, null, 0);
|
||||
graph.DataSource.RestoreCategory(CategoryName.Value, style);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f025679ac6aed9147844744f7e9cbb4c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,90 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Pie Chart Category Template")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Adds or updates a category in a Pie chart from a Template. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class PieCategoryFromTemplate : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The template object for the chart. Or null for defualt template")]
|
||||
public FsmGameObject TemplateObject;
|
||||
|
||||
[Tooltip("The index of the template category")]
|
||||
public FsmInt TemplateIndex;
|
||||
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
TemplateObject = null;
|
||||
TemplateIndex = 0;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (checkObject.GetComponent<PieChart>() == null)
|
||||
return "Object must be a pie chart";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var pie = chart.GetComponent<PieChart>();
|
||||
GameObject template = TemplateObject.Value;
|
||||
if (template == null || template.GetComponent<PieChart>() == null || (template.GetComponent<PieChart>().GetType() != pie.GetType()))
|
||||
{
|
||||
if (pie is CanvasPieChart)
|
||||
template = ((GameObject)Resources.Load("Chart And Graph/DefualtPieCategoryStyle2D"));
|
||||
else
|
||||
template = ((GameObject)Resources.Load("Chart And Graph/DefualtPieCategoryStyle3D")); // load default
|
||||
|
||||
}
|
||||
|
||||
var templateComponent = template.GetComponent<PieChart>();
|
||||
if (templateComponent.DataSource.TotalCategories == 0)
|
||||
{
|
||||
Debug.LogError("No categories in template chart");
|
||||
return;
|
||||
}
|
||||
|
||||
int index = TemplateIndex.Value;
|
||||
if (index < 0)
|
||||
index = 0;
|
||||
if (index >= templateComponent.DataSource.TotalCategories)
|
||||
index = templateComponent.DataSource.TotalCategories - 1;
|
||||
string catName = templateComponent.DataSource.GetCategoryName(index);
|
||||
var style = templateComponent.DataSource.StoreCategory(catName);
|
||||
if (pie.DataSource.HasCategory(CategoryName.Value) == false)
|
||||
pie.DataSource.AddCategory(CategoryName.Value,(Material)null);
|
||||
pie.DataSource.RestoreCategory(CategoryName.Value, style);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56fcdc0f416ebe04088d3f689400e96d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
101
Assets/Chart And Graph/Playmaker/AddGraphCategory2D.cs
Normal file
101
Assets/Chart And Graph/Playmaker/AddGraphCategory2D.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("2D Graph Chart Category")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("Adds or updates a category in a 2d Graph chart. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class AddGraphCategory2DAdvanced : FsmStateAction
|
||||
{
|
||||
[CheckForComponent(typeof(GraphChart))]
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
|
||||
[ObjectType(typeof(ChartItemEffect))]
|
||||
[Tooltip("The prefab of the line part of the chart, or null")]
|
||||
public FsmObject LineHoverPrefab;
|
||||
|
||||
[Tooltip("The material used for the line part of the category, or null ")]
|
||||
public FsmMaterial LineMaterial;
|
||||
|
||||
[Tooltip("The thinkness of the 2d graph line")]
|
||||
public FsmFloat LineThickness;
|
||||
|
||||
[Tooltip("The the higher this value is , the more the texture is streched along the line. Set it to the texture pixel size for best reuslts. set it to -1 to avoid texture tiling along the line")]
|
||||
public FsmFloat TilingFactor;
|
||||
|
||||
[Tooltip("The material used for the fill part of the category, or null ")]
|
||||
public FsmMaterial FillMaterial;
|
||||
|
||||
[Tooltip("If true the fill materil is streched , otherwise it is clamped ")]
|
||||
public FsmBool StrechFill;
|
||||
|
||||
[ObjectType(typeof(ChartItemEffect))]
|
||||
[Tooltip("The prefab of the point part of the chart, or null")]
|
||||
public FsmObject PointHoverPrefab;
|
||||
[Tooltip("The size of the 2d graph point")]
|
||||
public FsmFloat PointSize;
|
||||
[Tooltip("The material used for the point part of the category , or null ")]
|
||||
public FsmMaterial PointMaterial;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
TilingFactor = -1f;
|
||||
CategoryName = "";
|
||||
PointSize = 1f;
|
||||
LineMaterial = null;
|
||||
LineThickness = 0.2f;
|
||||
FillMaterial = null;
|
||||
StrechFill = false;
|
||||
PointMaterial = null;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var graph = chart.GetComponent<GraphChart>();
|
||||
MaterialTiling m;
|
||||
if (TilingFactor.Value < 0f)
|
||||
m = new MaterialTiling();
|
||||
else
|
||||
m = new MaterialTiling(true, TilingFactor.Value);
|
||||
if (graph.DataSource.HasCategory(CategoryName.Value))
|
||||
{
|
||||
graph.DataSource.SetCategoryPoint(CategoryName.Value, PointMaterial.Value, PointSize.Value);
|
||||
graph.DataSource.SetCategoryLine(CategoryName.Value, LineMaterial.Value, LineThickness.Value, m);
|
||||
graph.DataSource.SetCategoryFill(CategoryName.Value, FillMaterial.Value, StrechFill.Value);
|
||||
graph.DataSource.Set2DCategoryPrefabs(CategoryName.Value, LineHoverPrefab.Value as ChartItemEffect, PointHoverPrefab.Value as ChartItemEffect);
|
||||
}
|
||||
else
|
||||
{
|
||||
graph.DataSource.AddCategory(CategoryName.Value, LineMaterial.Value, LineThickness.Value, m, FillMaterial.Value, StrechFill.Value, PointMaterial.Value, PointSize.Value);
|
||||
graph.DataSource.Set2DCategoryPrefabs(CategoryName.Value, LineHoverPrefab.Value as ChartItemEffect, PointHoverPrefab.Value as ChartItemEffect);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/AddGraphCategory2D.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/AddGraphCategory2D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7ec67385d4ed1c43a2d44e617c001bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
114
Assets/Chart And Graph/Playmaker/AddGraphCategory3D.cs
Normal file
114
Assets/Chart And Graph/Playmaker/AddGraphCategory3D.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("3D Graph Chart Category")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("Adds or updates a category in a 3d Graph chart. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class AddGraphCategory3DAdvanced : FsmStateAction
|
||||
{
|
||||
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
[CheckForComponent(typeof(WorldSpaceGraphChart))]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
|
||||
[Tooltip("The depth of the category in the chart")]
|
||||
public FsmFloat Depth;
|
||||
|
||||
[ObjectType(typeof(PathGenerator))]
|
||||
[Tooltip("The prefab of the line part of the chart, or null")]
|
||||
public FsmObject LinePrefab;
|
||||
|
||||
[Tooltip("The material used for the line part of the category, or null ")]
|
||||
public FsmMaterial LineMaterial;
|
||||
[Tooltip("The thinkness of the 3d graph line")]
|
||||
public FsmFloat LineThickness;
|
||||
|
||||
[Tooltip("The the higher this value is , the more the texture is streched along the line. Set it to the texture pixel size for best reuslts. set it to -1 to avoid texture tiling along the line")]
|
||||
public FsmFloat TilingFactor;
|
||||
|
||||
[ObjectType(typeof(FillPathGenerator))]
|
||||
[Tooltip("The prefab of the fill part of the chart, or null")]
|
||||
public FsmObject FillPrefab;
|
||||
|
||||
[Tooltip("The material used for the fill part of the category, or null ")]
|
||||
public FsmMaterial FillMaterial;
|
||||
|
||||
[Tooltip("If true the fill materil is streched , otherwise it is clamped ")]
|
||||
public FsmBool StrechFill;
|
||||
|
||||
[Tooltip("The prefab of the point part of the chart, or null")]
|
||||
public FsmGameObject PointPrefab;
|
||||
|
||||
[Tooltip("The material used for the point part of the category , or null ")]
|
||||
public FsmMaterial PointMaterial;
|
||||
|
||||
[Tooltip("The size of the 3d graph point")]
|
||||
public FsmFloat PointSize;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
TilingFactor = -1f;
|
||||
CategoryName = "";
|
||||
PointSize = 1f;
|
||||
Depth = 0f;
|
||||
LinePrefab = null;
|
||||
LineMaterial = null;
|
||||
LineThickness = 0.2f;
|
||||
FillPrefab = null;
|
||||
FillMaterial = null;
|
||||
StrechFill = false;
|
||||
PointPrefab = null;
|
||||
PointMaterial = null;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var graph = chart.GetComponent<WorldSpaceGraphChart>();
|
||||
MaterialTiling m;
|
||||
if (TilingFactor.Value < 0f)
|
||||
m = new MaterialTiling();
|
||||
else
|
||||
m = new MaterialTiling(true, TilingFactor.Value);
|
||||
if (graph.DataSource.HasCategory(CategoryName.Value))
|
||||
{
|
||||
graph.DataSource.SetCategoryPoint(CategoryName.Value, PointMaterial.Value, PointSize.Value);
|
||||
graph.DataSource.SetCategoryLine(CategoryName.Value, LineMaterial.Value, LineThickness.Value, m);
|
||||
graph.DataSource.SetCategoryFill(CategoryName.Value, FillMaterial.Value, StrechFill.Value);
|
||||
|
||||
graph.DataSource.Set3DCategoryDepth(CategoryName.Value, Depth.Value);
|
||||
graph.DataSource.Set3DCategoryPrefabs(CategoryName.Value, LinePrefab.Value as PathGenerator, FillPrefab.Value as FillPathGenerator, PointPrefab.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
graph.DataSource.AddCategory3DGraph(CategoryName.Value, LinePrefab.Value as PathGenerator, LineMaterial.Value, LineThickness.Value, m, FillPrefab.Value as FillPathGenerator, FillMaterial.Value, StrechFill.Value, PointPrefab.Value, PointMaterial.Value, PointSize.Value, Depth.Value, false, 20);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/AddGraphCategory3D.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/AddGraphCategory3D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6c0a502e8f03624fb8a4e8f50197e8f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
69
Assets/Chart And Graph/Playmaker/AddGroupAction.cs
Normal file
69
Assets/Chart And Graph/Playmaker/AddGroupAction.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Add Group")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Adds a group to a bar or radar chart")]
|
||||
public class AddGroupAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
[Tooltip("The Name of the new group. A chart object cannot have duplicate group names")]
|
||||
public FsmString GroupName;
|
||||
|
||||
[Tooltip("If true , and a group with the same name already exist in the chart , then no error is generated")]
|
||||
public FsmBool AddOnlyIfMissing;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
GroupName = "";
|
||||
AddOnlyIfMissing = true;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (checkObject.GetComponent<RadarChart>() == null && checkObject.GetComponent<BarChart>() == null)
|
||||
return "Object must be a either a radar chart or bar chart";
|
||||
if (GroupName.Value == "" || GroupName.Value == null)
|
||||
return "GroupName name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject obj = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var chart = obj.GetComponent<BarChart>();
|
||||
if (chart != null)
|
||||
{
|
||||
if(AddOnlyIfMissing.Value == false || chart.DataSource.HasGroup(GroupName.Value))
|
||||
chart.DataSource.AddGroup(GroupName.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
RadarChart radar = obj.GetComponent<RadarChart>();
|
||||
if (radar != null)
|
||||
{
|
||||
if (AddOnlyIfMissing.Value == false || radar.DataSource.HasGroup(GroupName.Value) == false)
|
||||
radar.DataSource.AddGroup(GroupName.Value);
|
||||
}
|
||||
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/AddGroupAction.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/AddGroupAction.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fc4c056e330bb34f91575c891545d0c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
Assets/Chart And Graph/Playmaker/AddPieCategory2D.cs
Normal file
76
Assets/Chart And Graph/Playmaker/AddPieCategory2D.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("2D Pie Chart Category")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("Adds or updates a category in a 2d pie chart with advanced settings. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class AddPieCategory2DAdvanced : FsmStateAction
|
||||
{
|
||||
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
[CheckForComponent(typeof(CanvasPieChart))]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[Tooltip("The material used for the category , make sure to use only canvas material for canvas charts ")]
|
||||
public FsmMaterial Material;
|
||||
|
||||
[Tooltip("The color of a bar on a mouse hover for this category")]
|
||||
public FsmColor HoverColor;
|
||||
|
||||
[Tooltip("The color of a bar on a mouse click for this category")]
|
||||
public FsmColor ClickColor;
|
||||
|
||||
[Tooltip("a value between 0 and 1. This is the size of this category relative to other categories in the pie")]
|
||||
public FsmFloat RadiusScale;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
Material = null;
|
||||
HoverColor = Color.white;
|
||||
ClickColor = Color.white;
|
||||
RadiusScale = 1f;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var pie = chart.GetComponent<PieChart>();
|
||||
if (pie.DataSource.HasCategory(CategoryName.Value))
|
||||
{
|
||||
pie.DataSource.SetMaterial(CategoryName.Value, new ChartDynamicMaterial(Material.Value, HoverColor.Value, ClickColor.Value));
|
||||
pie.DataSource.SetCateogryParams(CategoryName.Value, RadiusScale.Value, 1f, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
pie.DataSource.AddCategory(CategoryName.Value, new ChartDynamicMaterial(Material.Value, HoverColor.Value, ClickColor.Value), RadiusScale.Value, 1f, 0f);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/AddPieCategory2D.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/AddPieCategory2D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d51a1c5b7fb38094388386b739eac501
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
78
Assets/Chart And Graph/Playmaker/AddPieCategory3D.cs
Normal file
78
Assets/Chart And Graph/Playmaker/AddPieCategory3D.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("3D Pie Chart Category")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("Adds or updates a category in a 3d pie chart with advanced settings. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class AddPieCategory3DAdvanced : FsmStateAction
|
||||
{
|
||||
[CheckForComponent(typeof(WorldSpacePieChart))]
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[Tooltip("The material used for the category , make sure to use only canvas material for canvas charts ")]
|
||||
public FsmMaterial Material;
|
||||
[Tooltip("The color of a bar on a mouse hover for this category")]
|
||||
public FsmColor HoverColor;
|
||||
[Tooltip("The color of a bar on a mouse click for this category")]
|
||||
public FsmColor ClickColor;
|
||||
|
||||
[Tooltip("a value between 0 and 1. This is the size of this category relative to other categories in the pie")]
|
||||
public FsmFloat RadiusScale;
|
||||
|
||||
[Tooltip("a value between 0 and 1. This is the size of this category depth relative to other categories in the pie")]
|
||||
public FsmFloat DepthScale;
|
||||
|
||||
[Tooltip("a value between 0 and 1. This is the offset of this category depth relative to other categories in the pie")]
|
||||
public FsmFloat DepthOffset;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
Material = null;
|
||||
HoverColor = Color.white;
|
||||
ClickColor = Color.white;
|
||||
RadiusScale = 1f;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var pie = chart.GetComponent<PieChart>();
|
||||
if (pie.DataSource.HasCategory(CategoryName.Value))
|
||||
{
|
||||
pie.DataSource.SetMaterial(CategoryName.Value,new ChartDynamicMaterial(Material.Value, HoverColor.Value, ClickColor.Value));
|
||||
pie.DataSource.SetCateogryParams(CategoryName.Value, RadiusScale.Value, DepthScale.Value, DepthOffset.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
pie.DataSource.AddCategory(CategoryName.Value, new ChartDynamicMaterial(Material.Value, HoverColor.Value, ClickColor.Value), RadiusScale.Value, DepthScale.Value, DepthOffset.Value);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/AddPieCategory3D.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/AddPieCategory3D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27770f21fa80a9f47b66497c589403d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
94
Assets/Chart And Graph/Playmaker/AddRadarCategory2D.cs
Normal file
94
Assets/Chart And Graph/Playmaker/AddRadarCategory2D.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("2D Radar Chart Category")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("Adds or updates a category in a 2d radar chart with advanced settings. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class AddRadarCategory2DAdvanced : FsmStateAction
|
||||
{
|
||||
|
||||
[CheckForComponent(typeof(CanvasRadarChart))]
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[ObjectType(typeof(ChartItemEffect))]
|
||||
[Tooltip("The prefab of the line part of the chart, or null")]
|
||||
public FsmObject LineHoverPrefab;
|
||||
|
||||
[Tooltip("The material used for the line part of the category, or nuWWll ")]
|
||||
public FsmMaterial LineMaterial;
|
||||
|
||||
[Tooltip("The thinkness of the 3d graph line")]
|
||||
public FsmFloat LineThickness;
|
||||
|
||||
[ObjectType(typeof(ChartItemEffect))]
|
||||
[Tooltip("The prefab of the point part of the chart, or null")]
|
||||
public FsmObject PointHoverPrefab;
|
||||
|
||||
[Tooltip("The material used for the point part of the category , or null ")]
|
||||
public FsmMaterial PointMaterial;
|
||||
|
||||
[Tooltip("The size of the 3d graph point")]
|
||||
public FsmFloat PointSize;
|
||||
|
||||
[Tooltip("The material used for the fill part of the category, or null ")]
|
||||
public FsmMaterial FillMaterial;
|
||||
|
||||
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
LineHoverPrefab = null;
|
||||
LineMaterial = null;
|
||||
LineThickness = 0.5f;
|
||||
PointHoverPrefab = null;
|
||||
PointMaterial = null;
|
||||
PointSize = 1f;
|
||||
FillMaterial = null;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var radar = chart.GetComponent<RadarChart>();
|
||||
if (radar.DataSource.HasCategory(CategoryName.Value))
|
||||
{
|
||||
radar.DataSource.SetCategoryFill(CategoryName.Value, FillMaterial.Value);
|
||||
radar.DataSource.SetCategoryLine(CategoryName.Value, LineMaterial.Value, LineThickness.Value);
|
||||
radar.DataSource.SetCategoryPoint(CategoryName.Value, PointMaterial.Value, PointSize.Value);
|
||||
radar.DataSource.SetCategoryHover(CategoryName.Value, LineHoverPrefab.Value as ChartItemEffect, PointHoverPrefab.Value as ChartItemEffect);
|
||||
}
|
||||
else
|
||||
{
|
||||
radar.DataSource.AddCategory(CategoryName.Value, null, LineMaterial.Value, LineThickness.Value, null, PointMaterial.Value, PointSize.Value, FillMaterial.Value);
|
||||
radar.DataSource.SetCategoryHover(CategoryName.Value, LineHoverPrefab.Value as ChartItemEffect, PointHoverPrefab.Value as ChartItemEffect);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/AddRadarCategory2D.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/AddRadarCategory2D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa4ff8437b549e847a539839e5134dd2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
101
Assets/Chart And Graph/Playmaker/AddRadarCategory3D.cs
Normal file
101
Assets/Chart And Graph/Playmaker/AddRadarCategory3D.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("3D Radar Chart Category")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("Adds or updates a category in a 3d radar chart with advanced settings. If the category already exist , it's settings will be updated. Otherwise it will be created with the settings")]
|
||||
public class AddRadarCategory3DAdvanced : FsmStateAction
|
||||
{
|
||||
[CheckForComponent(typeof(WorldSpaceRadarChart))]
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
[Tooltip("The Name of the new category. A chart object cannot have duplicate category names")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[ObjectType(typeof(PathGenerator))]
|
||||
[Tooltip("The prefab of the line part of the chart, or null")]
|
||||
public FsmObject LinePrefab;
|
||||
|
||||
[Tooltip("The material used for the line part of the category, or null ")]
|
||||
public FsmMaterial LineMaterial;
|
||||
|
||||
[Tooltip("The thinkness of the 3d graph line")]
|
||||
public FsmFloat LineThickness;
|
||||
|
||||
[Tooltip("The prefab of the point part of the chart, or null")]
|
||||
public FsmGameObject PointPrefab;
|
||||
|
||||
[Tooltip("The material used for the point part of the category , or null ")]
|
||||
public FsmMaterial PointMaterial;
|
||||
|
||||
[Tooltip("The size of the 3d graph point")]
|
||||
public FsmFloat PointSize;
|
||||
|
||||
[Tooltip("The material used for the fill part of the category, or null ")]
|
||||
public FsmMaterial FillMaterial;
|
||||
|
||||
[Tooltip("The smothing used for the fill part of the category, or null ")]
|
||||
public FsmInt FillSmoothing;
|
||||
|
||||
[Tooltip("The curve used for the fill part of the category, or null ")]
|
||||
public FsmFloat Curve;
|
||||
|
||||
[Tooltip("The seperation used for the fill part of the category, or null ")]
|
||||
public FsmFloat Seperation;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
LinePrefab = null;
|
||||
LineMaterial = null;
|
||||
LineThickness = 0.5f;
|
||||
PointPrefab = null;
|
||||
PointMaterial = null;
|
||||
PointSize = 1f;
|
||||
FillMaterial = null;
|
||||
FillSmoothing = 3;
|
||||
Curve = 0f;
|
||||
Seperation = 0f;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "Category name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
GameObject chart = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var radar = chart.GetComponent<RadarChart>();
|
||||
if (radar.DataSource.HasCategory(CategoryName.Value) == false)
|
||||
{
|
||||
radar.DataSource.Set3DCategoryFill(CategoryName.Value, FillMaterial.Value, FillSmoothing.Value);
|
||||
radar.DataSource.Set3DCategoryLine(CategoryName.Value, LinePrefab.Value as PathGenerator, LineMaterial.Value,LineThickness.Value);
|
||||
radar.DataSource.Set3DCategoryPoint(CategoryName.Value, PointPrefab.Value, PointMaterial.Value, PointSize.Value);
|
||||
radar.DataSource.Set3DCategoryOrientation(CategoryName.Value, Seperation.Value, Curve.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
radar.DataSource.Add3DCategory(CategoryName.Value, LinePrefab.Value as PathGenerator, LineMaterial.Value, LineThickness.Value, PointPrefab.Value, PointMaterial.Value, PointSize.Value, FillMaterial.Value, FillSmoothing.Value, Curve.Value, Seperation.Value);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/AddRadarCategory3D.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/AddRadarCategory3D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 978c25b3b9908644bacb3979be553651
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
154
Assets/Chart And Graph/Playmaker/AppendGraphPointAction.cs
Normal file
154
Assets/Chart And Graph/Playmaker/AppendGraphPointAction.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Append Graph Point")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Appends a point to a graph chart")]
|
||||
public class AppendGraphPointAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the category.")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[Tooltip("The time of the value change animation, in seconds")]
|
||||
public FsmFloat AnimationTime;
|
||||
|
||||
[Tooltip("The time zone for dates if specified")]
|
||||
public DateTimeKind DateTimeKind;
|
||||
|
||||
[Tooltip("the size of the point to add , or -1 for default size")]
|
||||
public FsmFloat PointSize;
|
||||
|
||||
|
||||
public FsmFloat XValueFloat;
|
||||
|
||||
public FsmFloat YValueFloat;
|
||||
|
||||
[Tooltip("the year part of the x value date")]
|
||||
public FsmInt XDateYear;
|
||||
|
||||
[Tooltip("the month part of the x value date")]
|
||||
public FsmInt XDateMonth;
|
||||
|
||||
[Tooltip("the day part of the x value date")]
|
||||
public FsmInt XDateDay;
|
||||
|
||||
[Tooltip("the hour part of the x value date")]
|
||||
public FsmInt XDateHour;
|
||||
|
||||
[Tooltip("the minute part of the x value date")]
|
||||
public FsmInt XDateMinute;
|
||||
|
||||
[Tooltip("the second part of the x value date")]
|
||||
public FsmInt XDateSecond;
|
||||
|
||||
[Tooltip("the year part of the y value date")]
|
||||
public FsmInt YDateYear;
|
||||
|
||||
[Tooltip("the month part of the y value date")]
|
||||
public FsmInt YDateMonth;
|
||||
|
||||
[Tooltip("the day part of the y value date")]
|
||||
public FsmInt YDateDay;
|
||||
|
||||
[Tooltip("the hour part of the y value date")]
|
||||
public FsmInt YDateHour;
|
||||
|
||||
[Tooltip("the minute part of the y value date")]
|
||||
public FsmInt YDateMinute;
|
||||
|
||||
[Tooltip("the second part of the y value date")]
|
||||
public FsmInt YDateSecond;
|
||||
|
||||
private Coroutine mAnimationWait;
|
||||
|
||||
|
||||
public bool XValueIsDate;
|
||||
public bool YValueIsDate;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
PointSize = -1;
|
||||
CategoryName = "";
|
||||
AnimationTime = 0f;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (checkObject.GetComponent<GraphChart>() == null)
|
||||
return "Object must be a GraphChart";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "CategoryName name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
private double GetValue(bool isDate, FsmFloat floatValue,FsmInt year, FsmInt month, FsmInt day ,FsmInt hour ,FsmInt min, FsmInt sec)
|
||||
{
|
||||
if(isDate)
|
||||
{
|
||||
DateTime t = new DateTime(year.Value, month.Value, day.Value, hour.Value, min.Value, sec.Value, DateTimeKind);
|
||||
return ChartDateUtility.DateToValue(t);
|
||||
}
|
||||
return floatValue.Value;
|
||||
}
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if (check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject obj = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var chart = obj.GetComponent<GraphChart>();
|
||||
|
||||
if (chart.DataSource.HasCategory(CategoryName.Value) == false)
|
||||
{
|
||||
Debug.LogError("action error : category does not exist");
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
double xValue = GetValue(XValueIsDate, XValueFloat, XDateYear, XDateMonth, XDateDay, XDateHour, XDateMinute, XDateSecond);
|
||||
double yValue = GetValue(YValueIsDate, YValueFloat, YDateYear, YDateMonth, YDateDay, YDateHour, YDateMinute, YDateSecond);
|
||||
|
||||
if (AnimationTime.Value < 0.0001f)
|
||||
{
|
||||
chart.DataSource.AddPointToCategoryRealtime(CategoryName.Value,xValue,yValue,0, PointSize.Value);
|
||||
Finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.DataSource.AddPointToCategoryRealtime(CategoryName.Value, xValue, yValue, AnimationTime.Value, PointSize.Value);
|
||||
mAnimationWait = StartCoroutine(WaitForAnimation(AnimationTime.Value));
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator WaitForAnimation(float time)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
Finish();
|
||||
mAnimationWait = null;
|
||||
}
|
||||
|
||||
public override void OnExit()
|
||||
{
|
||||
base.OnExit();
|
||||
if (mAnimationWait != null)
|
||||
StopCoroutine(mAnimationWait);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f437ec7fa8fc7e84194a5980f92613e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
Assets/Chart And Graph/Playmaker/CheckCategoryAction.cs
Normal file
73
Assets/Chart And Graph/Playmaker/CheckCategoryAction.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Has Category Conditional")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("checks if a category is present in a chart")]
|
||||
public class CheckCategoryAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the category to remove")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmBool StoreResult;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
CategoryName = "";
|
||||
StoreResult = false;
|
||||
}
|
||||
|
||||
public override string ErrorCheck()
|
||||
{
|
||||
GameObject checkObject = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
if (ChartObject == null || checkObject == null)
|
||||
return "Chart object cannot be null";
|
||||
if (checkObject.GetComponent<AnyChart>() == null)
|
||||
return "Object must be a chart type";
|
||||
if (CategoryName.Value == "" || CategoryName.Value == null)
|
||||
return "CategoryName name cannot be null or empty";
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
string check = ErrorCheck();
|
||||
if(check != null)
|
||||
{
|
||||
Debug.LogError(check);
|
||||
return;
|
||||
}
|
||||
var chart = ChartObject.GameObject.Value.GetComponent<AnyChart>();
|
||||
StoreResult.Value = false;
|
||||
if (chart is BarChart)
|
||||
StoreResult.Value = ((BarChart)chart).DataSource.HasCategory(CategoryName.Value);
|
||||
else if (chart is GraphChartBase)
|
||||
{
|
||||
StoreResult.Value = ((GraphChartBase)chart).DataSource.HasCategory(CategoryName.Value);
|
||||
}
|
||||
else if(chart is RadarChart)
|
||||
{
|
||||
StoreResult.Value = ((RadarChart)chart).DataSource.HasCategory(CategoryName.Value);
|
||||
}
|
||||
else if (chart is PieChart)
|
||||
{
|
||||
StoreResult.Value = ((PieChart)chart).DataSource.HasCategory(CategoryName.Value);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/CheckCategoryAction.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/CheckCategoryAction.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 767021f9253f95246b6f37285f5f5567
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user