작업 조건 분석 기능 개발

This commit is contained in:
정영민
2025-03-10 16:42:23 +09:00
parent 840638c6e3
commit f2029fd8c9
2988 changed files with 569938 additions and 2342 deletions

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6a5231398945a144834450ce33d6942
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f025679ac6aed9147844744f7e9cbb4c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56fcdc0f416ebe04088d3f689400e96d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: