작업 조건 분석 기능 개발
This commit is contained in:
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:
|
||||
63
Assets/Chart And Graph/Playmaker/CheckGroupAction.cs
Normal file
63
Assets/Chart And Graph/Playmaker/CheckGroupAction.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
#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 Group Conditional")]
|
||||
[ActionCategory("Graph and Chart - Advanced")]
|
||||
[Tooltip("checks if a group is present in a chart")]
|
||||
public class CheckGroupAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the category to remove")]
|
||||
public FsmString GroupName;
|
||||
|
||||
[UIHint(UIHint.Variable)]
|
||||
public FsmBool StoreResult;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
GroupName = "";
|
||||
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<BarChart>() == null && checkObject.GetComponent<RadarChart>() == null)
|
||||
return "Object must be a bar chart type or a radar chart type";
|
||||
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;
|
||||
}
|
||||
var chart = ChartObject.GameObject.Value.GetComponent<AnyChart>();
|
||||
StoreResult.Value = false;
|
||||
if (chart is BarChart)
|
||||
StoreResult.Value = ((BarChart)chart).DataSource.HasGroup(GroupName.Value);
|
||||
else if (chart is RadarChart)
|
||||
StoreResult.Value = ((RadarChart)chart).DataSource.HasGroup(GroupName.Value);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/CheckGroupAction.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/CheckGroupAction.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5711e3089a16dba4485b7f8ee62d5419
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/Chart And Graph/Playmaker/ClearGraphCategoryAction.cs
Normal file
56
Assets/Chart And Graph/Playmaker/ClearGraphCategoryAction.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Remove Category")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Clears a category from a graph chart")]
|
||||
public class ClearGraphCategoryAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the category to remove")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
}
|
||||
|
||||
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 type";
|
||||
if (CategoryName.Value == "" || CategoryName.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<GraphChartBase>();
|
||||
if (chart.DataSource.HasCategory(CategoryName.Value))
|
||||
chart.DataSource.ClearCategory(CategoryName.Value);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2feec183fd3183f4f946af28762556af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Chart And Graph/Playmaker/Editor.meta
Normal file
9
Assets/Chart And Graph/Playmaker/Editor.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ef85873de9c3f742b12f175025aed9a
|
||||
folderAsset: yes
|
||||
timeCreated: 1539558023
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using HutongGames.PlayMaker.Actions;
|
||||
using HutongGames.PlayMakerEditor;
|
||||
|
||||
[CustomActionEditor(typeof(AppendGraphPointAction))]
|
||||
public class CustomActionEditorTest : CustomActionEditor
|
||||
{
|
||||
enum DateOrNumeric
|
||||
{
|
||||
Numeric,
|
||||
Date
|
||||
}
|
||||
public override void OnEnable()
|
||||
{
|
||||
// Do any expensive initialization stuff here.
|
||||
// This is called when the editor is created.
|
||||
}
|
||||
|
||||
public override bool OnGUI()
|
||||
{
|
||||
var action = target as AppendGraphPointAction;
|
||||
|
||||
EditField("ChartObject");
|
||||
EditField("CategoryName");
|
||||
EditField("AnimationTime");
|
||||
EditField("DateTimeKind");
|
||||
EditField("PointSize");
|
||||
|
||||
EditorGUILayout.LabelField("X value:");
|
||||
DateOrNumeric type = DateOrNumeric.Numeric;
|
||||
if (action.XValueIsDate)
|
||||
type = DateOrNumeric.Date;
|
||||
type = (DateOrNumeric)EditorGUILayout.EnumPopup("type", type);
|
||||
action.XValueIsDate = type == DateOrNumeric.Date;
|
||||
if (action.XValueIsDate)
|
||||
{
|
||||
EditField("XDateYear");
|
||||
EditField("XDateMonth");
|
||||
EditField("XDateDay");
|
||||
EditField("XDateHour");
|
||||
EditField("XDateMinute");
|
||||
EditField("XDateSecond");
|
||||
}
|
||||
else
|
||||
EditField("XValueFloat");
|
||||
|
||||
EditorGUILayout.LabelField("Y value:");
|
||||
type = DateOrNumeric.Numeric;
|
||||
if (action.YValueIsDate)
|
||||
type = DateOrNumeric.Date;
|
||||
type = (DateOrNumeric)EditorGUILayout.EnumPopup("type", type);
|
||||
action.YValueIsDate = type == DateOrNumeric.Date;
|
||||
if (action.YValueIsDate)
|
||||
{
|
||||
EditField("YDateYear");
|
||||
EditField("YDateMonth");
|
||||
EditField("YDateDay");
|
||||
EditField("YDateHour");
|
||||
EditField("YDateMinute");
|
||||
EditField("YDateSecond");
|
||||
}
|
||||
else
|
||||
EditField("YValueFloat");
|
||||
|
||||
return GUI.changed;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99d21976d8cc674488ca0e4bffe806f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
77
Assets/Chart And Graph/Playmaker/RemoveCategoryAction.cs
Normal file
77
Assets/Chart And Graph/Playmaker/RemoveCategoryAction.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Remove Category")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Removes a category from any chart")]
|
||||
public class RemoveCategoryAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the category to remove")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
|
||||
[Tooltip("If true , and a category with specified name does not exist in the chart , then no error is generated")]
|
||||
public FsmBool RemoveOnlyIfExist;
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
RemoveOnlyIfExist = true;
|
||||
}
|
||||
|
||||
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 "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<AnyChart>();
|
||||
if(chart is BarChart)
|
||||
{
|
||||
if(RemoveOnlyIfExist.Value == false || ((BarChart)chart).DataSource.HasCategory(CategoryName.Value))
|
||||
((BarChart)chart).DataSource.RemoveCategory(CategoryName.Value);
|
||||
}
|
||||
else if(chart is GraphChartBase)
|
||||
{
|
||||
if (RemoveOnlyIfExist.Value == false || ((GraphChartBase)chart).DataSource.HasCategory(CategoryName.Value))
|
||||
((GraphChartBase)chart).DataSource.RemoveCategory(CategoryName.Value);
|
||||
}
|
||||
else if( chart is PieChart)
|
||||
{
|
||||
if (RemoveOnlyIfExist.Value == false || ((PieChart)chart).DataSource. HasCategory(CategoryName.Value))
|
||||
((PieChart)chart).DataSource.RemoveCategory(CategoryName.Value);
|
||||
}
|
||||
else if( chart is RadarChart)
|
||||
{
|
||||
if (RemoveOnlyIfExist.Value == false || ((RadarChart)chart).DataSource.HasCategory(CategoryName.Value))
|
||||
((RadarChart)chart).DataSource.RemoveCategory(CategoryName.Value);
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1239875cd8d61f4884ed7aa2b96045b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
69
Assets/Chart And Graph/Playmaker/RemoveGroupAction.cs
Normal file
69
Assets/Chart And Graph/Playmaker/RemoveGroupAction.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("Remove Group")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Removes a group from a bar or radar chart")]
|
||||
public class RemoveGroupAction : 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 specified name does not exist in the chart , then no error is generated")]
|
||||
public FsmBool RemoveOnlyIfExist;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
GroupName = "";
|
||||
RemoveOnlyIfExist = 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 (RemoveOnlyIfExist.Value == false || chart.DataSource.HasGroup(GroupName.Value))
|
||||
chart.DataSource.RemoveGroup(GroupName.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
RadarChart radar = obj.GetComponent<RadarChart>();
|
||||
if (radar != null)
|
||||
{
|
||||
if (RemoveOnlyIfExist.Value == false || radar.DataSource.HasGroup(GroupName.Value) == false)
|
||||
radar.DataSource.RemoveGroup(GroupName.Value);
|
||||
}
|
||||
|
||||
}
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/RemoveGroupAction.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/RemoveGroupAction.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3558391a5ddc0b14e94849f2e835ab6a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
106
Assets/Chart And Graph/Playmaker/SetValueBarAction.cs
Normal file
106
Assets/Chart And Graph/Playmaker/SetValueBarAction.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Set Value - Bar Chart")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Sets the value of a category and group")]
|
||||
public class SetValueBarAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the category.")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[Tooltip("The Name of the group")]
|
||||
public FsmString GroupName;
|
||||
|
||||
[Tooltip("The Value to set")]
|
||||
public FsmFloat Value;
|
||||
|
||||
[Tooltip("The time of the value change animation, in seconds")]
|
||||
public FsmFloat AnimationTime;
|
||||
|
||||
private Coroutine mAnimationWait;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
GroupName = "";
|
||||
CategoryName = "";
|
||||
Value = 1f;
|
||||
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<BarChart>() == null)
|
||||
return "Object must be a either a bar chart";
|
||||
if (GroupName.Value == "" || GroupName.Value == null)
|
||||
return "GroupName name cannot be null or empty";
|
||||
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;
|
||||
}
|
||||
|
||||
GameObject obj = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var chart = obj.GetComponent<BarChart>();
|
||||
|
||||
if (chart.DataSource.HasCategory(CategoryName.Value) == false)
|
||||
{
|
||||
Debug.LogError("action error : category does not exist");
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
if(chart.DataSource.HasGroup(GroupName.Value) == false)
|
||||
{
|
||||
Debug.LogError("action error : group does not exist");
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (AnimationTime.Value < 0.0001f)
|
||||
{
|
||||
chart.DataSource.SetValue(CategoryName.Value, GroupName.Value, Value.Value);
|
||||
Finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.DataSource.SlideValue(CategoryName.Value, GroupName.Value, Value.Value, AnimationTime.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
|
||||
11
Assets/Chart And Graph/Playmaker/SetValueBarAction.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/SetValueBarAction.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a7690d562bf1114c8a271b9704e066a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
92
Assets/Chart And Graph/Playmaker/SetValuePieAction.cs
Normal file
92
Assets/Chart And Graph/Playmaker/SetValuePieAction.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Set Value - Pie Chart")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Sets the value of a category and group")]
|
||||
public class SetValuePieAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the category to change ")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[Tooltip("The Value to set")]
|
||||
public FsmFloat Value;
|
||||
|
||||
[Tooltip("The time of the value change animation, in seconds")]
|
||||
public FsmFloat AnimationTime;
|
||||
|
||||
private Coroutine mAnimationWait;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CategoryName = "";
|
||||
Value = 1f;
|
||||
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<PieChart>() == null)
|
||||
return "Object must be a either a pie chart";
|
||||
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;
|
||||
}
|
||||
GameObject obj = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var chart = obj.GetComponent<PieChart>();
|
||||
if (chart.DataSource.HasCategory(CategoryName.Value) == false)
|
||||
{
|
||||
Debug.LogError("action error : category does not exist");
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (AnimationTime.Value < 0.0001f)
|
||||
{
|
||||
chart.DataSource.SetValue(CategoryName.Value, Value.Value);
|
||||
Finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
chart.DataSource.SlideValue(CategoryName.Value, Value.Value, AnimationTime.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
|
||||
11
Assets/Chart And Graph/Playmaker/SetValuePieAction.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/SetValuePieAction.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9e22dc608005e74ca82c61f200b2d61
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
62
Assets/Chart And Graph/Playmaker/SetValueRadarAction.cs
Normal file
62
Assets/Chart And Graph/Playmaker/SetValueRadarAction.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
#if PLAYMAKER
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace HutongGames.PlayMaker.Actions
|
||||
{
|
||||
[Title("Set Value - Radar Chart")]
|
||||
[ActionCategory("Graph and Chart")]
|
||||
[Tooltip("Sets the value of a category and group")]
|
||||
public class SetValueRadarAction : FsmStateAction
|
||||
{
|
||||
[Tooltip("The chart object to perform the operation on")]
|
||||
public FsmOwnerDefault ChartObject;
|
||||
|
||||
[Tooltip("The Name of the group")]
|
||||
public FsmString CategoryName;
|
||||
|
||||
[Tooltip("The Name of the new category.")]
|
||||
public FsmString GroupName;
|
||||
|
||||
[Tooltip("The Value to set")]
|
||||
public FsmFloat Value;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
GroupName = "";
|
||||
CategoryName = "";
|
||||
Value = 1f;
|
||||
}
|
||||
|
||||
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)
|
||||
return "Object must be a either a radar";
|
||||
if (GroupName.Value == "" || GroupName.Value == null)
|
||||
return "GroupName name cannot be null or empty";
|
||||
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;
|
||||
}
|
||||
GameObject obj = Fsm.GetOwnerDefaultTarget(ChartObject);
|
||||
var chart = obj.GetComponent<RadarChart>();
|
||||
chart.DataSource.SetValue(CategoryName.Value, GroupName.Value, Value.Value);
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Chart And Graph/Playmaker/SetValueRadarAction.cs.meta
Normal file
11
Assets/Chart And Graph/Playmaker/SetValueRadarAction.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 077aab4b2bc161747bc4eba2a931c6ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user