Compare commits
133 Commits
lh/0328_Pr
...
jym/250512
| Author | SHA1 | Date | |
|---|---|---|---|
| 51315cbe5f | |||
| f6d787cb19 | |||
|
|
265d6159ff | ||
|
|
43cb130001 | ||
|
|
33b4c73685 | ||
|
|
83d2d17542 | ||
| c324fa6802 | |||
|
|
eaadce1b8d | ||
| 23e903420b | |||
| 0927cce982 | |||
|
|
be2aa42500 | ||
|
|
6611cf4f9b | ||
|
|
f4aae5ecb8 | ||
|
|
332f946465 | ||
|
|
ca9a67a07c | ||
|
|
118e1662f2 | ||
| 71d425e97d | |||
| a79a5389ae | |||
|
|
df07bcf8b0 | ||
|
|
c719b706c1 | ||
| 5fcf8927f9 | |||
| 85c835fcf3 | |||
|
|
6658ed5dcd | ||
|
|
0379f77337 | ||
|
|
a30049da03 | ||
|
|
3f7b667e50 | ||
| ea59282d65 | |||
| 6e9d1b9425 | |||
|
|
87db23e37d | ||
|
|
78c5e3b714 | ||
|
|
a64717a87e | ||
|
|
3f260d2c57 | ||
|
|
ff8e9ce972 | ||
| 4e544cc54d | |||
|
|
66d446cdc7 | ||
|
|
9e5314663e | ||
| 66abc5bdcd | |||
| 9c59e5e867 | |||
|
|
ce2ed90997 | ||
|
|
a373879d75 | ||
|
|
36392ea150 | ||
|
|
21e0e12ccf | ||
| ee265674b2 | |||
| 2ad3fbcf33 | |||
|
|
77b75c63ce | ||
|
|
24cae4c8db | ||
| a44e2c44c4 | |||
|
|
cef08df8e0 | ||
|
|
7cb9a08144 | ||
|
|
99c6a0f6f1 | ||
| c27db88402 | |||
|
|
5cfad8eab4 | ||
| a24205d929 | |||
|
|
7c958faa42 | ||
|
|
e4344e538b | ||
|
|
1f525994d0 | ||
|
|
d4ead516d2 | ||
| 54551b8a24 | |||
| 6bf31ac71c | |||
|
|
1cd614a45d | ||
|
|
2c3f69b0b8 | ||
| eb769bc312 | |||
| 84740b6133 | |||
| beaf61b399 | |||
|
|
1ce63b9870 | ||
|
|
7c24cb0cc3 | ||
|
|
410a3a5bb4 | ||
| afe8652786 | |||
|
|
516412f585 | ||
| 981a1685f5 | |||
| 92c7655ecb | |||
| 62f019c256 | |||
|
|
b962d25930 | ||
|
|
b87ea36afb | ||
|
|
f28d0a09a2 | ||
|
|
16fe55edc6 | ||
| 67fd6739ec | |||
|
|
807ec619e4 | ||
|
|
a63c42e968 | ||
|
|
92e3b0ce9a | ||
|
|
bc48d7e7e1 | ||
|
|
57fa1f08b6 | ||
|
|
d5ea8b03c5 | ||
|
|
514d9f2937 | ||
| df6077e260 | |||
| b36ea4f93c | |||
| e448686a61 | |||
| abbe0cc807 | |||
|
|
ea774416f8 | ||
|
|
6e1fb78966 | ||
|
|
9ac2fa3807 | ||
| 02f318c548 | |||
|
|
7005d76198 | ||
|
|
7f98e1a06c | ||
|
|
98d2b9cc95 | ||
|
|
f8878387f8 | ||
| 7769886bad | |||
| e7630541dc | |||
| 222bfc347b | |||
| 21277cbc22 | |||
| a1d9ff9da4 | |||
| 0f57e1cb24 | |||
| 70c2b7ae57 | |||
| 64ac9c0755 | |||
|
|
4a9ab69e89 | ||
|
|
a46d2b220a | ||
| 86157ee5d8 | |||
|
|
b636b4ca4d | ||
| 53abd9a361 | |||
| a089d9fe6f | |||
|
|
77ce046ff9 | ||
|
|
3f40f681df | ||
| c207777bf6 | |||
| 24057a4102 | |||
| 8d255ef06c | |||
| 5a293f6c2c | |||
| c3c9b498c4 | |||
| f94ef5b5b1 | |||
|
|
2772a3b928 | ||
|
|
32f1f3d956 | ||
| db11ffc5eb | |||
|
|
66dab5acfd | ||
|
|
347c5853c5 | ||
| 8edfe96073 | |||
|
|
9c3a0e02d7 | ||
|
|
2e01bcf527 | ||
|
|
44724629d3 | ||
|
|
fd8b6052bf | ||
|
|
09b5001f3b | ||
|
|
110b2f87ed | ||
|
|
eee79d1145 | ||
|
|
bfc68b3d93 | ||
|
|
65f0199ec6 |
71
.cursorignore
Normal file
71
.cursorignore
Normal file
@@ -0,0 +1,71 @@
|
||||
# Unity 생성 디렉토리
|
||||
/[Ll]ibrary/
|
||||
/[Tt]emp/
|
||||
/[Oo]bj/
|
||||
/[Bb]uild/
|
||||
/[Bb]uilds/
|
||||
/[Ll]ogs/
|
||||
/[Uu]ser[Ss]ettings/
|
||||
|
||||
# Unity 자동 생성 파일
|
||||
*.pidb.meta
|
||||
*.pdb.meta
|
||||
*.mdb.meta
|
||||
|
||||
# Unity3D 충돌 파일
|
||||
sysinfo.txt
|
||||
|
||||
# 빌드 결과물
|
||||
*.apk
|
||||
*.aab
|
||||
*.unitypackage
|
||||
*.app
|
||||
|
||||
# VS/VS Code 설정
|
||||
.vs/
|
||||
.vscode/
|
||||
*.csproj
|
||||
*.sln
|
||||
*.suo
|
||||
*.tmp
|
||||
*.user
|
||||
*.userprefs
|
||||
*.lock
|
||||
*.ide
|
||||
*.ide-shm
|
||||
*.ide-wal
|
||||
|
||||
# OS 생성 파일
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# 로그 파일
|
||||
*.log
|
||||
|
||||
# 임시 파일
|
||||
*.tmp
|
||||
*.temp
|
||||
*~
|
||||
|
||||
# Unity 에셋 파일
|
||||
*.fbx
|
||||
*.obj
|
||||
*.max
|
||||
*.blend
|
||||
*.dae
|
||||
*.mb
|
||||
*.ma
|
||||
|
||||
# 프로젝트 특정 설정
|
||||
/Assets/SpecialAssets/
|
||||
/Assets/Plugins/ThirdParty/
|
||||
/Assets/StreamingAssets/Config/
|
||||
|
||||
# 임시 작업 디렉토리
|
||||
_temp/
|
||||
_backup/
|
||||
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"visualstudiotoolsforunity.vstuc"
|
||||
]
|
||||
}
|
||||
10
.vscode/launch.json
vendored
Normal file
10
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Attach to Unity",
|
||||
"type": "vstuc",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
60
.vscode/settings.json
vendored
Normal file
60
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/.DS_Store": true,
|
||||
"**/.git": true,
|
||||
"**/.vs": true,
|
||||
"**/.gitmodules": true,
|
||||
"**/.vsconfig": true,
|
||||
"**/*.booproj": true,
|
||||
"**/*.pidb": true,
|
||||
"**/*.suo": true,
|
||||
"**/*.user": true,
|
||||
"**/*.userprefs": true,
|
||||
"**/*.unityproj": true,
|
||||
"**/*.dll": true,
|
||||
"**/*.exe": true,
|
||||
"**/*.pdf": true,
|
||||
"**/*.mid": true,
|
||||
"**/*.midi": true,
|
||||
"**/*.wav": true,
|
||||
"**/*.gif": true,
|
||||
"**/*.ico": true,
|
||||
"**/*.jpg": true,
|
||||
"**/*.jpeg": true,
|
||||
"**/*.png": true,
|
||||
"**/*.psd": true,
|
||||
"**/*.tga": true,
|
||||
"**/*.tif": true,
|
||||
"**/*.tiff": true,
|
||||
"**/*.3ds": true,
|
||||
"**/*.3DS": true,
|
||||
"**/*.fbx": true,
|
||||
"**/*.FBX": true,
|
||||
"**/*.lxo": true,
|
||||
"**/*.LXO": true,
|
||||
"**/*.ma": true,
|
||||
"**/*.MA": true,
|
||||
"**/*.obj": true,
|
||||
"**/*.OBJ": true,
|
||||
"**/*.asset": true,
|
||||
"**/*.cubemap": true,
|
||||
"**/*.flare": true,
|
||||
"**/*.mat": true,
|
||||
"**/*.meta": true,
|
||||
"**/*.prefab": true,
|
||||
"**/*.unity": true,
|
||||
"build/": true,
|
||||
"Build/": true,
|
||||
"Library/": true,
|
||||
"library/": true,
|
||||
"obj/": true,
|
||||
"Obj/": true,
|
||||
"Logs/": true,
|
||||
"logs/": true,
|
||||
"ProjectSettings/": true,
|
||||
"UserSettings/": true,
|
||||
"temp/": true,
|
||||
"Temp/": true
|
||||
},
|
||||
"dotnet.defaultSolution": "OctopusStudio.sln"
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using XED.Manage;
|
||||
|
||||
namespace XED.VirtualFactory
|
||||
{
|
||||
|
||||
214
Assets/Animations/ObjectDistanceLine.cs
Normal file
214
Assets/Animations/ObjectDistanceLine.cs
Normal file
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
//TODO::areabox가 아니라 TwinObject를 대상으로 동작하도록 수정
|
||||
public class ObjectDistanceLine : MonoBehaviour
|
||||
{
|
||||
private Vector3 centerPoint = new();
|
||||
private Vector3[] edges = new Vector3[4];
|
||||
|
||||
private LineRenderer[] lineRenderers = new LineRenderer[4];
|
||||
private int[] distances = new int[4];
|
||||
private Vector3[] hits = new Vector3[4];
|
||||
[SerializeField]
|
||||
private float thickness;
|
||||
|
||||
private int rot;
|
||||
private Dictionary<Vector3, Vector3> dirTable = new();
|
||||
|
||||
TwinObject target;
|
||||
HashSet<TwinObject> targets = new();
|
||||
public event Action onTargetEvent;
|
||||
public event Action onTargetMissing;
|
||||
public event Action<Vector3, int, int> onLineUpdate;
|
||||
public override void AfterAwake()
|
||||
{
|
||||
//var labelCanvas;
|
||||
var lineMat = Resources.Load<Material>("Materials/Mat_LineRender");
|
||||
for (int i = 0; i < lineRenderers.Length; i++)
|
||||
{
|
||||
lineRenderers[i] = new GameObject("DistanceLine").AddComponent<LineRenderer>();
|
||||
lineRenderers[i].transform.SetParent(transform, true);
|
||||
lineRenderers[i].material = lineMat;
|
||||
lineRenderers[i].positionCount = 2;
|
||||
lineRenderers[i].startWidth = thickness;
|
||||
lineRenderers[i].endWidth = thickness;
|
||||
}
|
||||
//onTargetEvent += ()=>labelCanvas.panel_objectdistancelabellist.SetActive(true);
|
||||
//onTargetMissing += ()=>labelCanvas.panel_objectdistancelabellist.SetActive(false);
|
||||
//onLineUpdate += labelCanvas.panel_objectdistancelabellist.DistanceLabelsSetting;
|
||||
}
|
||||
|
||||
public void SetTarget(TwinObject target)
|
||||
{
|
||||
if (target is Wall || target is WallGroup)
|
||||
return;
|
||||
this.target = target;
|
||||
targets.Add(target);
|
||||
gameObject.SetActive(true);
|
||||
onTargetEvent?.Invoke();
|
||||
}
|
||||
|
||||
private void EdgePoints()
|
||||
{
|
||||
var size = target.physics.areabox.bounds.size;
|
||||
edges[0] = centerPoint + EdgePointCalculate(-size.x, -size.z, centerPoint);
|
||||
edges[1] = centerPoint + EdgePointCalculate(size.x, -size.z, centerPoint);
|
||||
edges[2] = centerPoint + EdgePointCalculate(size.x, size.z, centerPoint);
|
||||
edges[3] = centerPoint + EdgePointCalculate(-size.x, size.z, centerPoint);
|
||||
}
|
||||
|
||||
private void CenterPoints()
|
||||
{
|
||||
var size = target.physics.areabox.bounds.size;
|
||||
edges[0] = centerPoint + EdgePointCalculate(-size.x, 0f, centerPoint);
|
||||
edges[1] = centerPoint + EdgePointCalculate(size.x, 0f, centerPoint);
|
||||
edges[2] = centerPoint + EdgePointCalculate(0f, -size.z, centerPoint);
|
||||
edges[3] = centerPoint + EdgePointCalculate(0f, size.z, centerPoint);
|
||||
}
|
||||
private Vector3 EdgePointCalculate(float xValue, float zValue, Vector3 center)
|
||||
{
|
||||
//대각선의 길이,
|
||||
//중점길이
|
||||
var point = center + (new Vector3(xValue, 0, zValue) * 0.5f);
|
||||
var length = Vector3.Distance(point, center);
|
||||
var dir = (point - center).normalized * length;
|
||||
//var pos = RotateVector3(dir, rot);
|
||||
var pos = Quaternion.AngleAxis(rot, Vector3.up) * dir;
|
||||
return pos;
|
||||
}
|
||||
|
||||
public void Off()
|
||||
{
|
||||
targets.Clear();
|
||||
onTargetMissing?.Invoke();
|
||||
}
|
||||
|
||||
void LineRenderSetActive(bool isActive)
|
||||
{
|
||||
foreach(var line in lineRenderers)
|
||||
{
|
||||
line.enabled = isActive;
|
||||
}
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (target == null || targets.Count >1)
|
||||
{
|
||||
Off();
|
||||
LineRenderSetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
//if (areabox == null)
|
||||
// return;
|
||||
//Distance가 4개 모두 0이면 return?
|
||||
LineRenderSetActive(true);
|
||||
rot = Mathf.RoundToInt(target.physics.areabox.transform.localEulerAngles.y);
|
||||
centerPoint = new Vector3(target.physics.areabox.bounds.center.x, 0, target.physics.areabox.bounds.center.z);
|
||||
|
||||
var angle = rot % 90f;
|
||||
if (Mathf.Approximately(angle, 0f))
|
||||
CenterPoints();
|
||||
else
|
||||
EdgePoints();
|
||||
|
||||
var xOrder = edges.OrderBy(l => l.x);
|
||||
var zOrder = edges.OrderBy(l => l.z);
|
||||
dirTable.Clear();
|
||||
dirTable.TryAdd(xOrder.ElementAt(0), Vector3.left);
|
||||
dirTable.TryAdd(xOrder.ElementAt(3), Vector3.right);
|
||||
dirTable.TryAdd(zOrder.ElementAt(0), Vector3.back);
|
||||
dirTable.TryAdd(zOrder.ElementAt(3), Vector3.forward);
|
||||
|
||||
for (int i = 0; i < edges.Length; i++)
|
||||
{
|
||||
//var dir = Dir(dirTable[edges[i]]);
|
||||
var dir = dirTable[edges[i]];
|
||||
if (Physics.Raycast(edges[i], dir, out RaycastHit hit, Mathf.Infinity))
|
||||
{
|
||||
hits[i] = hit.point;
|
||||
}
|
||||
else
|
||||
{
|
||||
hits[i] = edges[i];
|
||||
}
|
||||
distances[i] = Mathf.RoundToInt(Vector3.Distance(hits[i], edges[i]) * 1000f);
|
||||
|
||||
lineRenderers[i].SetPosition(0, edges[i]);
|
||||
lineRenderers[i].SetPosition(1, hits[i]);
|
||||
//3방향중 점중 가장 짧은거
|
||||
|
||||
var pos = DistanceTextPos(edges[i], hits[i]);
|
||||
if (Mathf.Abs(pos.y) == Mathf.Infinity || float.IsNaN(pos.y))
|
||||
continue;
|
||||
onLineUpdate?.Invoke(pos, i, distances[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3 DistanceTextPos(Vector3 edge, Vector3 hit)
|
||||
{
|
||||
var x = Screen.width;
|
||||
var y = Screen.height;
|
||||
|
||||
var hitpoint = Camera.main.WorldToScreenPoint(hit);
|
||||
var edgePoint = Camera.main.WorldToScreenPoint(edge);
|
||||
|
||||
//카메라 끝점 edge와 hit 사이;
|
||||
|
||||
//기울기 가져온다
|
||||
var m = (hitpoint.y - edgePoint.y) / (hitpoint.x - edgePoint.x);
|
||||
if (hitpoint.y > y)
|
||||
{
|
||||
var yPos = y;
|
||||
var xPos = ((yPos - edgePoint.y) / m) + edgePoint.x;
|
||||
hitpoint = new Vector3(xPos, yPos);
|
||||
}
|
||||
else if (hitpoint.y < 0)
|
||||
{
|
||||
var yPos = 0;
|
||||
var xPos = ((yPos - edgePoint.y) / m) + edgePoint.x;
|
||||
hitpoint = new Vector3(xPos, yPos);
|
||||
}
|
||||
|
||||
if (hitpoint.x > x)
|
||||
{
|
||||
var xPos = x;
|
||||
var yPos = (m * (xPos - edgePoint.x)) + edgePoint.y;
|
||||
hitpoint = new Vector3(xPos, yPos);
|
||||
}
|
||||
else if (hitpoint.x < 0)
|
||||
{
|
||||
var xPos = 0;
|
||||
var yPos = (m * (xPos - edgePoint.x)) + edgePoint.y;
|
||||
hitpoint = new Vector3(xPos, yPos);
|
||||
}
|
||||
|
||||
var center = (hitpoint + edgePoint) * 0.5f;
|
||||
return center;
|
||||
}
|
||||
|
||||
void Gizmo()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
// for (int i = 0; i < edges.Length; ++i)
|
||||
// {
|
||||
// Gizmos.DrawSphere(edges[i].pos, 0.1f);
|
||||
// }
|
||||
|
||||
// for (int i = 0; i < hits.Length; ++i)
|
||||
// {
|
||||
// var dir = Dir(dirTable[edges[i]]);
|
||||
// Handles.color = Color.yellow;
|
||||
// Handles.DrawLine(edges[i].pos, hits[i], 1);
|
||||
// Gizmos.DrawRay(edges[i].pos, dir * 10f);
|
||||
// }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Animations/ObjectDistanceLine.cs.meta
Normal file
2
Assets/Animations/ObjectDistanceLine.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bfac6b2ea97a0274787f0bf0d086a76d
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a82b8cc88b7c5504baf7945c65a835d9
|
||||
guid: 7f1ab105e95a7ee44965ac5927623809
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
23039
Assets/NewStudioJYM/APIModal.unity
Normal file
23039
Assets/NewStudioJYM/APIModal.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/APIModal.unity.meta
Normal file
7
Assets/NewStudioJYM/APIModal.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c396f0856dfdd3c4f880ec92b8e0f57b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11115
Assets/NewStudioJYM/AlarmModal.unity
Normal file
11115
Assets/NewStudioJYM/AlarmModal.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/AlarmModal.unity.meta
Normal file
7
Assets/NewStudioJYM/AlarmModal.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07b2c65fe41bd8e43a7bcbd12ddeda0d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5577
Assets/NewStudioJYM/DataModal.unity
Normal file
5577
Assets/NewStudioJYM/DataModal.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/DataModal.unity.meta
Normal file
7
Assets/NewStudioJYM/DataModal.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 760eabef824940d46a364a011f425b80
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17355
Assets/NewStudioJYM/Inspector.unity
Normal file
17355
Assets/NewStudioJYM/Inspector.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/Inspector.unity.meta
Normal file
7
Assets/NewStudioJYM/Inspector.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2284d63b7488f2b45a99645f208eca55
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/NewStudioJYM/Language.json
Normal file
8
Assets/NewStudioJYM/Language.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"defaultLanguage": "Ko",
|
||||
"languages": {
|
||||
"Ko": "한국어",
|
||||
"En": "English",
|
||||
"Ja": "日本語"
|
||||
}
|
||||
}
|
||||
7
Assets/NewStudioJYM/Language.json.meta
Normal file
7
Assets/NewStudioJYM/Language.json.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be71b5d18f50b9f4791093ac7cf722d7
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2328
Assets/NewStudioJYM/LogingModal.unity
Normal file
2328
Assets/NewStudioJYM/LogingModal.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/LogingModal.unity.meta
Normal file
7
Assets/NewStudioJYM/LogingModal.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 259f375e4270b6243af7dd67c3770d95
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20436
Assets/NewStudioJYM/MQTTModal.unity
Normal file
20436
Assets/NewStudioJYM/MQTTModal.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/MQTTModal.unity.meta
Normal file
7
Assets/NewStudioJYM/MQTTModal.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83dffcb445724e44eab4e5f3a2fec973
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2558
Assets/NewStudioJYM/Multilingual.unity
Normal file
2558
Assets/NewStudioJYM/Multilingual.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/Multilingual.unity.meta
Normal file
7
Assets/NewStudioJYM/Multilingual.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb4fd155efe15a040bf1c1c936399a6a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/NewStudioJYM/Scripts.meta
Normal file
8
Assets/NewStudioJYM/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e0d5bd459141d14892f068ccc1d6c13
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
99
Assets/NewStudioJYM/Scripts/ConnectDataManager.cs
Normal file
99
Assets/NewStudioJYM/Scripts/ConnectDataManager.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class ConnectDataManager : MonoBehaviour
|
||||
{
|
||||
private Dictionary<string, SaveConnectedData> saveData = new Dictionary<string, SaveConnectedData>();
|
||||
public Action<string, SaveConnectedData> onConnectData;
|
||||
public Action<SaveConnectedData> onLoadData;
|
||||
|
||||
private Dictionary<string, SaveConnectAlarmData> saveAlarmData = new Dictionary<string, SaveConnectAlarmData>();
|
||||
public Action<string, SaveConnectAlarmData> onConnectAlarm;
|
||||
public Action<SaveConnectAlarmData> onLoadAlarm;
|
||||
|
||||
private MQTTData loadMQTTData;
|
||||
public Action<List<DataClass>> mqttData;
|
||||
public List<SaveMQTTData> saveMQTTDatas = new List<SaveMQTTData>();
|
||||
|
||||
public Action<string, List<DataClass>> apiData;
|
||||
public List<SaveAPIData> saveAPIDatas = new List<SaveAPIData>();
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
var mqttJson = Resources.Load<TextAsset>("MQTTData").text;
|
||||
loadMQTTData = JsonConvert.DeserializeObject<MQTTData>(mqttJson);
|
||||
}
|
||||
|
||||
public void SaveData(string className, SaveConnectedData savedConnetedData)
|
||||
{
|
||||
if (saveData.ContainsKey(className))
|
||||
{
|
||||
saveData.Remove(className);
|
||||
}
|
||||
saveData.Add(className, savedConnetedData);
|
||||
onConnectData?.Invoke(className, savedConnetedData);
|
||||
}
|
||||
public void LoadData(string className)
|
||||
{
|
||||
onLoadData?.Invoke(saveData[className]);
|
||||
}
|
||||
public void RemoveData(string className)
|
||||
{
|
||||
saveData.Remove(className);
|
||||
}
|
||||
|
||||
public void SaveAlarmData(string alarmName, SaveConnectAlarmData saveConnectAlarmData)
|
||||
{
|
||||
if (saveAlarmData.ContainsKey(alarmName))
|
||||
{
|
||||
saveAlarmData.Remove(alarmName);
|
||||
}
|
||||
saveAlarmData.Add(alarmName, saveConnectAlarmData);
|
||||
onConnectAlarm?.Invoke(alarmName, saveConnectAlarmData);
|
||||
}
|
||||
public void LoadAlarmData(string alarmName)
|
||||
{
|
||||
onLoadAlarm?.Invoke(saveAlarmData[alarmName]);
|
||||
}
|
||||
public void RemoveAlarmData(string alarmName)
|
||||
{
|
||||
saveAlarmData.Remove(alarmName);
|
||||
}
|
||||
|
||||
public void SetFilterData(string topicName)
|
||||
{
|
||||
List<DataClass> dataclasses = new List<DataClass>();
|
||||
|
||||
foreach (var data in this.loadMQTTData.dataList)
|
||||
{
|
||||
if (topicName == data.name)
|
||||
{
|
||||
dataclasses.Add(data);
|
||||
}
|
||||
}
|
||||
mqttData?.Invoke(dataclasses);
|
||||
}
|
||||
public void SetMQTTData(SaveMQTTData saveMQTTData)
|
||||
{
|
||||
saveMQTTDatas.Clear();
|
||||
saveMQTTDatas.Add(saveMQTTData);
|
||||
}
|
||||
|
||||
public void SetFilterData(string className, DataClass dataClass)
|
||||
{
|
||||
List<DataClass> dataclasses = new List<DataClass>();
|
||||
dataclasses.Add(dataClass);
|
||||
|
||||
apiData?.Invoke(className, dataclasses);
|
||||
}
|
||||
public void SetAPIData(SaveAPIData saveAPIData)
|
||||
{
|
||||
saveAPIDatas.Clear();
|
||||
saveAPIDatas.Add(saveAPIData);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioJYM/Scripts/ConnectDataManager.cs.meta
Normal file
2
Assets/NewStudioJYM/Scripts/ConnectDataManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f170dee81887b63429a6f12f6a68123f
|
||||
107
Assets/NewStudioJYM/Scripts/Panel_APIConnectModal.cs
Normal file
107
Assets/NewStudioJYM/Scripts/Panel_APIConnectModal.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class Panel_APIConnectModal : PanelBase
|
||||
{
|
||||
public Data api;
|
||||
private DataClass selectedUrlData;
|
||||
|
||||
private TMP_Dropdown Dropdown_URL;
|
||||
private RectTransform ClassNameContent;
|
||||
|
||||
private Button Button_AddClassName;
|
||||
private Button Button_Save;
|
||||
|
||||
private UI_DataBindingItem prf_mqttTopicItem;
|
||||
private List<UI_DataBindingItem> topicItems = new List<UI_DataBindingItem>();
|
||||
private UI_DataBindingItem selectedTopicItem;
|
||||
|
||||
public Action<string, DataClass> onClickFilterButton;
|
||||
public Action<SaveAPIData> onSaveAPIData;
|
||||
|
||||
private void TestDataConnected()
|
||||
{
|
||||
var apiJson = Resources.Load<TextAsset>("Test").text;
|
||||
api = JsonConvert.DeserializeObject<Data>(apiJson);
|
||||
}
|
||||
public override void AfterAwake()
|
||||
{
|
||||
TestDataConnected();
|
||||
prf_mqttTopicItem = Resources.Load<UI_DataBindingItem>("Prefabs/UI/PRF_DataBindingItemItem");
|
||||
|
||||
SetUrlDropdown();
|
||||
Button_AddClassName.onClick.AddListener(AddClassNameItem);
|
||||
Button_Save.onClick.AddListener(Save);
|
||||
}
|
||||
private void SetUrlDropdown()
|
||||
{
|
||||
Dropdown_URL.ClearOptions();
|
||||
List<string> options = new List<string>();
|
||||
|
||||
foreach(var apiData in api.dataList)
|
||||
{
|
||||
options.Add(apiData.name);
|
||||
}
|
||||
Dropdown_URL.AddOptions(options);
|
||||
Dropdown_URL.onValueChanged.AddListener(OnUrlValueChanged);
|
||||
}
|
||||
|
||||
private void OnUrlValueChanged(int index)
|
||||
{
|
||||
selectedUrlData = api.dataList[index];
|
||||
}
|
||||
|
||||
private void OnClickFilterButton(UI_DataBindingItem item)
|
||||
{
|
||||
selectedTopicItem = item;
|
||||
var itemName = item.GetTopicName();
|
||||
onClickFilterButton?.Invoke(itemName, selectedUrlData);
|
||||
}
|
||||
|
||||
private void AddClassNameItem()
|
||||
{
|
||||
var item = Instantiate(prf_mqttTopicItem, ClassNameContent);
|
||||
item.onRemove += RemoveTopicItem;
|
||||
item.onFilter += OnClickFilterButton;
|
||||
topicItems.Add(item);
|
||||
|
||||
Button_AddClassName.transform.SetAsLastSibling();
|
||||
}
|
||||
private void RemoveTopicItem(UI_DataBindingItem item)
|
||||
{
|
||||
topicItems.Remove(item);
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
private void Save()
|
||||
{
|
||||
var apiData = GetAPIData();
|
||||
onSaveAPIData?.Invoke(apiData);
|
||||
}
|
||||
public void SetFilterData(SaveFilterData filterData)
|
||||
{
|
||||
if (selectedTopicItem == null)
|
||||
return;
|
||||
|
||||
selectedTopicItem.SetFilterData(filterData);
|
||||
selectedTopicItem.SetChangedInputFieldTopicName();
|
||||
}
|
||||
private SaveAPIData GetAPIData()
|
||||
{
|
||||
SaveAPIData saveAPIData = new SaveAPIData();
|
||||
saveAPIData.selectedUrl = Dropdown_URL.options[Dropdown_URL.value].text;
|
||||
foreach (var topicItem in topicItems)
|
||||
{
|
||||
saveAPIData.saveFilterData.Add(topicItem.GetFilterData());
|
||||
}
|
||||
|
||||
return saveAPIData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd0689f5a6850a64ebccafe6f7b8893b
|
||||
174
Assets/NewStudioJYM/Scripts/Panel_AlarmConnectModal.cs
Normal file
174
Assets/NewStudioJYM/Scripts/Panel_AlarmConnectModal.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class Panel_AlarmConnectModal : PanelBase
|
||||
{
|
||||
public Data dataStorage;
|
||||
public EventData eventData;
|
||||
|
||||
private RectTransform StorageDataContent;
|
||||
private TMP_Dropdown Dropdown_DataStorage;
|
||||
private Button Button_Save;
|
||||
private Button Button_Cancel;
|
||||
|
||||
private List<DataClass> dataList = new List<DataClass>();
|
||||
|
||||
private List<UI_AlarmDataItem> alarmDatas = new List<UI_AlarmDataItem>();
|
||||
|
||||
private UI_AlarmDataItem prf_AlarmDataItem;
|
||||
private UI_ComparisonSettingItem prf_ComparisonSettingItem;
|
||||
private UI_EventParameterItem prf_EventParameterItem;
|
||||
|
||||
public SaveConnectAlarmData saveConnectAlarmData;
|
||||
public SaveConnectAlarmData loadData = null;
|
||||
|
||||
public Action<string, SaveConnectAlarmData> onSaveConnectAlarmData;
|
||||
|
||||
private void TestDataConnected()
|
||||
{
|
||||
var dataStorageJson = Resources.Load<TextAsset>("Test1").text;
|
||||
dataStorage = JsonConvert.DeserializeObject<Data>(dataStorageJson);
|
||||
|
||||
var evnetJson = Resources.Load<TextAsset>("Test2").text;
|
||||
eventData = JsonConvert.DeserializeObject<EventData>(evnetJson);
|
||||
}
|
||||
public override void AfterAwake()
|
||||
{
|
||||
TestDataConnected();
|
||||
|
||||
prf_AlarmDataItem = Resources.Load<UI_AlarmDataItem>("Prefabs/UI/PRF_AlarmDataItem");
|
||||
prf_ComparisonSettingItem = Resources.Load<UI_ComparisonSettingItem>("Prefabs/UI/PRF_ComparisonSettingItem");
|
||||
prf_EventParameterItem = Resources.Load<UI_EventParameterItem>("Prefabs/UI/PRF_EventParameterItem");
|
||||
|
||||
Button_Save.onClick.AddListener(Save);
|
||||
Button_Cancel.onClick.AddListener(CloseModal);
|
||||
|
||||
SetStorageDataDropdown();
|
||||
}
|
||||
|
||||
private void SetStorageDataDropdown()
|
||||
{
|
||||
Dropdown_DataStorage.ClearOptions();
|
||||
dataList.Clear();
|
||||
|
||||
List<string> displayNames = new List<string>();
|
||||
|
||||
var data = dataStorage.dataList;
|
||||
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
dataList.Add(data[i]);
|
||||
displayNames.Add(data[i].name);
|
||||
}
|
||||
Dropdown_DataStorage.AddOptions(displayNames);
|
||||
Dropdown_DataStorage.onValueChanged.AddListener(OnValueChangedDataStorageDropDown);
|
||||
}
|
||||
private void OnValueChangedDataStorageDropDown(int index)
|
||||
{
|
||||
loadData = new SaveConnectAlarmData();
|
||||
AddStorageDataItem(index);
|
||||
}
|
||||
private void AddStorageDataItem(int index)
|
||||
{
|
||||
foreach(var alarmData in alarmDatas)
|
||||
{
|
||||
Destroy(alarmData.gameObject);
|
||||
}
|
||||
alarmDatas.Clear();
|
||||
|
||||
if (loadData.alarmDataName == null || loadData.alarmDataName == string.Empty)
|
||||
{
|
||||
foreach (var data in dataList[index].fields)
|
||||
{
|
||||
var item = Instantiate(prf_AlarmDataItem, StorageDataContent);
|
||||
item.onUpdateLayout += UpdateLayout;
|
||||
item.SetItem(data, prf_ComparisonSettingItem, prf_EventParameterItem, eventData);
|
||||
alarmDatas.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var data in loadData.alarmFields)
|
||||
{
|
||||
var item = Instantiate(prf_AlarmDataItem, StorageDataContent);
|
||||
item.onUpdateLayout += UpdateLayout;
|
||||
item.SetItem(data, prf_ComparisonSettingItem, prf_EventParameterItem, eventData);
|
||||
alarmDatas.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenModal()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
private void CloseModal()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
private void Save()
|
||||
{
|
||||
var saveConnectAlarmData = GetAlarmData();
|
||||
onSaveConnectAlarmData?.Invoke(saveConnectAlarmData.alarmDataName, saveConnectAlarmData);
|
||||
|
||||
Initialize();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
private void Initialize()
|
||||
{
|
||||
Dropdown_DataStorage.ClearOptions();
|
||||
|
||||
foreach (var alarmData in alarmDatas)
|
||||
{
|
||||
Destroy(alarmData.gameObject);
|
||||
}
|
||||
alarmDatas.Clear();
|
||||
}
|
||||
private void UpdateLayout()
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(StorageDataContent);
|
||||
}
|
||||
private SaveConnectAlarmData GetAlarmData()
|
||||
{
|
||||
var saveConnectAlarmData = new SaveConnectAlarmData();
|
||||
saveConnectAlarmData.alarmDataName = Dropdown_DataStorage.options[Dropdown_DataStorage.value].text;
|
||||
|
||||
foreach (var item in alarmDatas)
|
||||
{
|
||||
var alarmField = item.GetData();
|
||||
|
||||
if (alarmField != null)
|
||||
{
|
||||
saveConnectAlarmData.alarmFields.Add(alarmField);
|
||||
}
|
||||
}
|
||||
return saveConnectAlarmData;
|
||||
}
|
||||
public void LoadData(SaveConnectAlarmData savedData)
|
||||
{
|
||||
OpenModal();
|
||||
|
||||
loadData = savedData;
|
||||
|
||||
SetStorageDataDropdown();
|
||||
// dropdown¿¡¼ ¾Ë¸ÂÀº dataStorage index ã±â
|
||||
for (int i = 0; i < dataList.Count; i++)
|
||||
{
|
||||
if(savedData.alarmDataName == dataList[i].name)
|
||||
{
|
||||
Dropdown_DataStorage.SetValueWithoutNotify(i);
|
||||
AddStorageDataItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6531d3243f1b04943b5395aa2558066b
|
||||
357
Assets/NewStudioJYM/Scripts/Panel_DataConnectModal.cs
Normal file
357
Assets/NewStudioJYM/Scripts/Panel_DataConnectModal.cs
Normal file
@@ -0,0 +1,357 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class Panel_DataConnectModal : PanelBase
|
||||
{
|
||||
public Data api;
|
||||
public Data dataStorage;
|
||||
|
||||
private List<DataClass> apiDatas = new List<DataClass>();
|
||||
private List<DataClass> dataStorageDatas = new List<DataClass>();
|
||||
private bool isAPI;
|
||||
|
||||
public Toggle Toggle_Api;
|
||||
public Toggle Toggle_Storage;
|
||||
public TMP_Dropdown Dropdown_DataList;
|
||||
public Button Button_Cancel;
|
||||
public Button Button_Save;
|
||||
|
||||
private RectTransform RectTransform_APIData;
|
||||
private RectTransform AddStorageDataButtonArea;
|
||||
private RectTransform APIDataListContent;
|
||||
private RectTransform APIContent;
|
||||
private Button Button_loadAPIData;
|
||||
private Button Button_AddStorageData;
|
||||
|
||||
private DataClass loadAPIData;
|
||||
private List<UI_LoadDataHierarchyItem> currentAPIDataItems = new List<UI_LoadDataHierarchyItem>();
|
||||
|
||||
private RectTransform RectTransform_DataStorage;
|
||||
private RectTransform DataStorageContent;
|
||||
private RectTransform AddAPIDataButtonArea;
|
||||
private Button Button_AddAPIData;
|
||||
private Toggle Toggle_limitStorageSetting;
|
||||
|
||||
private UI_LoadDataHierarchyItem prf_loadDataHierarchyItem;
|
||||
private UI_DataSettingItem prf_DataSettingItem;
|
||||
private UI_DataTypeSelectedItem prf_DataTypeSelectedItem;
|
||||
private UI_MatchingTypeDataItem prf_MatchingTypeDataItem;
|
||||
private UI_AddOtherDataItem prf_AddOtherDataItem;
|
||||
private UI_AddOtherDataTypeItem prf_AddOtherDataTypeItem;
|
||||
|
||||
private RectTransform currentContent;
|
||||
private RectTransform currentButtonArea;
|
||||
public UI_DataSettingItem currentDataSettingItem;
|
||||
public List<UI_AddOtherDataItem> currentAddOtherDataItems = new List<UI_AddOtherDataItem>();
|
||||
|
||||
private string currentDataListOptionName;
|
||||
private DataClass currentClass;
|
||||
|
||||
public Action<string, SaveConnectedData> onSaveConnectedData;
|
||||
|
||||
private void TestDataConnected()
|
||||
{
|
||||
var apiJson = Resources.Load<TextAsset>("Test").text;
|
||||
api = JsonConvert.DeserializeObject<Data>(apiJson);
|
||||
|
||||
var dataStorageJson = Resources.Load<TextAsset>("Test1").text;
|
||||
dataStorage = JsonConvert.DeserializeObject<Data>(dataStorageJson);
|
||||
}
|
||||
public override void AfterAwake()
|
||||
{
|
||||
TestDataConnected();
|
||||
|
||||
prf_loadDataHierarchyItem = Resources.Load<UI_LoadDataHierarchyItem>("Prefabs/UI/PRF_LoadDataHierarchyItem");
|
||||
prf_DataSettingItem = Resources.Load<UI_DataSettingItem>("Prefabs/UI/PRF_DataSettingItem");
|
||||
prf_DataTypeSelectedItem = Resources.Load<UI_DataTypeSelectedItem>("Prefabs/UI/PRF_DataTypeSelectedItem");
|
||||
prf_MatchingTypeDataItem = Resources.Load<UI_MatchingTypeDataItem>("Prefabs/UI/PRF_MatchingTypeDataItem");
|
||||
prf_AddOtherDataItem = Resources.Load<UI_AddOtherDataItem>("Prefabs/UI/PRF_AddOtherDataItem");
|
||||
prf_AddOtherDataTypeItem = Resources.Load<UI_AddOtherDataTypeItem>("Prefabs/UI/PRF_AddOtherDataTypeItem");
|
||||
|
||||
Toggle_Api.onValueChanged.AddListener(OnAPIToggleValueChanged);
|
||||
Toggle_Storage.onValueChanged.AddListener(OnDataStorageToggleValueChanged);
|
||||
Toggle_limitStorageSetting.onValueChanged.AddListener(OnLimitStorageSettingToggleValueChanged);
|
||||
|
||||
Button_loadAPIData.onClick.AddListener(LoadAPIData);
|
||||
Button_AddStorageData.onClick.AddListener(() => AddOtherDataItem(null));
|
||||
Button_AddAPIData.onClick.AddListener(() => AddOtherDataItem(null));
|
||||
Button_Cancel.onClick.AddListener(CloseModal);
|
||||
Button_Save.onClick.AddListener(Save);
|
||||
|
||||
RectTransform_APIData.gameObject.SetActive(false);
|
||||
RectTransform_DataStorage.gameObject.SetActive(false);
|
||||
}
|
||||
private void OnAPIToggleValueChanged(bool isOn)
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
RectTransform_APIData.gameObject.SetActive(true);
|
||||
ChangePanel(APIContent, AddStorageDataButtonArea);
|
||||
|
||||
isAPI = true;
|
||||
PopulateDataListDropdown(api.dataList);
|
||||
Toggle_Storage.isOn = false;
|
||||
Toggle_limitStorageSetting.isOn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RectTransform_APIData.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
private void OnDataStorageToggleValueChanged(bool isOn)
|
||||
{
|
||||
if (isOn)
|
||||
{
|
||||
RectTransform_DataStorage.gameObject.SetActive(true);
|
||||
ChangePanel(DataStorageContent, AddAPIDataButtonArea);
|
||||
|
||||
isAPI = false;
|
||||
PopulateDataListDropdown(dataStorage.dataList);
|
||||
Toggle_Api.isOn = false;
|
||||
Toggle_limitStorageSetting.isOn = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
RectTransform_DataStorage.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
private void ChangePanel(RectTransform dataContent, RectTransform buttonArea)
|
||||
{
|
||||
currentContent = dataContent;
|
||||
currentButtonArea = buttonArea;
|
||||
|
||||
currentDataSettingItem = currentContent.GetComponentInChildren<UI_DataSettingItem>();
|
||||
currentAddOtherDataItems.Clear();
|
||||
var currentAddOtherDataItem = currentContent.GetComponentsInChildren<UI_AddOtherDataItem>().ToList();
|
||||
currentAddOtherDataItems.AddRange(currentAddOtherDataItem);
|
||||
}
|
||||
private void OnLimitStorageSettingToggleValueChanged(bool isOn)
|
||||
{
|
||||
var isActive = isOn;
|
||||
DataStorageContent.gameObject.SetActive(isActive);
|
||||
}
|
||||
private void PopulateDataListDropdown(List<DataClass> data)
|
||||
{
|
||||
Dropdown_DataList.ClearOptions();
|
||||
List<string> displayNames = new List<string>();
|
||||
|
||||
if (isAPI)
|
||||
{
|
||||
apiDatas.Clear();
|
||||
|
||||
foreach (var api in data)
|
||||
{
|
||||
apiDatas.Add(api);
|
||||
displayNames.Add(api.name);
|
||||
}
|
||||
|
||||
Dropdown_DataList.AddOptions(displayNames);
|
||||
Dropdown_DataList.onValueChanged.RemoveAllListeners();
|
||||
Dropdown_DataList.onValueChanged.AddListener(OnValueChangedAPIDropDown);
|
||||
|
||||
var notCheckIndex = currentDataListOptionName != null ? displayNames.IndexOf(currentDataListOptionName) : 0;
|
||||
var index = notCheckIndex >= 0 ? notCheckIndex : 0;
|
||||
|
||||
Dropdown_DataList.SetValueWithoutNotify(index);
|
||||
SetLoadApiData(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
dataStorageDatas.Clear();
|
||||
|
||||
foreach (var storageData in data)
|
||||
{
|
||||
dataStorageDatas.Add(storageData);
|
||||
displayNames.Add(storageData.name);
|
||||
}
|
||||
|
||||
Dropdown_DataList.AddOptions(displayNames);
|
||||
Dropdown_DataList.onValueChanged.RemoveAllListeners();
|
||||
Dropdown_DataList.onValueChanged.AddListener(OnValueChangedDataStorageDropDown);
|
||||
|
||||
var notCheckIndex = currentDataListOptionName != null ? displayNames.IndexOf(currentDataListOptionName) : 0;
|
||||
var index = notCheckIndex >= 0 ? notCheckIndex : 0;
|
||||
|
||||
Dropdown_DataList.SetValueWithoutNotify(index);
|
||||
OnValueChangedDataStorageDropDown(index);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnValueChangedAPIDropDown(int index)
|
||||
{
|
||||
SetLoadApiData(index);
|
||||
}
|
||||
private void SetLoadApiData(int index)
|
||||
{
|
||||
var apiData = apiDatas[index];
|
||||
loadAPIData = apiData;
|
||||
}
|
||||
|
||||
void LoadAPIData()
|
||||
{
|
||||
foreach (var dataItem in currentAPIDataItems)
|
||||
Destroy(dataItem.gameObject);
|
||||
|
||||
currentAPIDataItems.Clear();
|
||||
|
||||
var item = Instantiate(prf_loadDataHierarchyItem, APIDataListContent);
|
||||
item.SetData(loadAPIData);
|
||||
item.onClickItem += OnClickAPIDataItem;
|
||||
currentAPIDataItems.Add(item);
|
||||
}
|
||||
private void OnClickAPIDataItem(DataClass data)
|
||||
{
|
||||
AddDataSettingItem(data);
|
||||
}
|
||||
private void OnValueChangedDataStorageDropDown(int index)
|
||||
{
|
||||
AddDataSettingItem(dataStorageDatas[index]);
|
||||
}
|
||||
private void UpdateLayout()
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(currentContent);
|
||||
}
|
||||
private void AddDataSettingItem(DataClass data)
|
||||
{
|
||||
if (currentDataSettingItem != null)
|
||||
{
|
||||
Destroy(currentDataSettingItem.gameObject);
|
||||
currentDataSettingItem = null;
|
||||
}
|
||||
|
||||
var item = Instantiate(prf_DataSettingItem, currentContent);
|
||||
var index = currentButtonArea.transform.GetSiblingIndex();
|
||||
item.transform.SetSiblingIndex(index);
|
||||
item.SetData(data, prf_DataTypeSelectedItem, prf_MatchingTypeDataItem);
|
||||
item.onUpdateLayout += UpdateLayout;
|
||||
currentDataSettingItem = item;
|
||||
}
|
||||
private void AddOtherDataItem(DataClass data)
|
||||
{
|
||||
var item = Instantiate(prf_AddOtherDataItem, currentContent);
|
||||
item.onUpdateLayout += UpdateLayout;
|
||||
item.onDestory += RemoveOtherDataItem;
|
||||
item.SetItem(dataStorage.dataList, data, prf_AddOtherDataTypeItem);
|
||||
item.transform.SetAsLastSibling();
|
||||
currentAddOtherDataItems.Add(item);
|
||||
}
|
||||
private void RemoveOtherDataItem(UI_AddOtherDataItem item)
|
||||
{
|
||||
currentAddOtherDataItems.Remove(item);
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
public SaveConnectedData saveData;
|
||||
void Save()
|
||||
{
|
||||
saveData = GetData();
|
||||
onSaveConnectedData?.Invoke(saveData.dataSource, saveData);
|
||||
Initialize();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OpenModal()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
void CloseModal()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
private void Initialize()
|
||||
{
|
||||
Toggle_Api.SetIsOnWithoutNotify(false);
|
||||
Toggle_Storage.SetIsOnWithoutNotify(false);
|
||||
|
||||
Toggle_limitStorageSetting.SetIsOnWithoutNotify(false);
|
||||
|
||||
currentContent = null;
|
||||
currentButtonArea = null;
|
||||
|
||||
loadAPIData = null;
|
||||
|
||||
foreach (var item in currentAPIDataItems)
|
||||
{
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
currentAPIDataItems.Clear();
|
||||
|
||||
if (currentDataSettingItem != null)
|
||||
{
|
||||
Destroy(currentDataSettingItem.gameObject);
|
||||
currentDataSettingItem = null;
|
||||
}
|
||||
|
||||
foreach (var item in currentAddOtherDataItems)
|
||||
{
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
currentAddOtherDataItems.Clear();
|
||||
|
||||
RectTransform_APIData.gameObject.SetActive(false);
|
||||
RectTransform_DataStorage.gameObject.SetActive(false);
|
||||
}
|
||||
private SaveConnectedData GetData()
|
||||
{
|
||||
SaveConnectedData saveData = new SaveConnectedData();
|
||||
saveData.connectDataClass.Clear();
|
||||
saveData.otherDataClasses.Clear();
|
||||
|
||||
saveData.isAPI = isAPI;
|
||||
saveData.dataListOptionName = Dropdown_DataList.options[Dropdown_DataList.value].text;
|
||||
|
||||
saveData.isLimitStorageSetting = Toggle_limitStorageSetting.isOn;
|
||||
|
||||
var dataclass = currentDataSettingItem.GetData();
|
||||
saveData.dataSource = dataclass.name;
|
||||
saveData.connectDataClass.Add(dataclass);
|
||||
|
||||
foreach (var item in currentAddOtherDataItems)
|
||||
{
|
||||
var otehrDataClass = item.GetData();
|
||||
saveData.otherDataClasses.Add(otehrDataClass);
|
||||
}
|
||||
|
||||
return saveData;
|
||||
}
|
||||
public void SetLoadSaveData(SaveConnectedData saveData)
|
||||
{
|
||||
OpenModal();
|
||||
|
||||
currentClass = saveData.connectDataClass[0];
|
||||
currentDataListOptionName = saveData.dataListOptionName;
|
||||
|
||||
if (saveData.isAPI)
|
||||
{
|
||||
Toggle_Api.isOn = true;
|
||||
LoadAPIData();
|
||||
}
|
||||
else
|
||||
{
|
||||
Toggle_Storage.isOn = true;
|
||||
Toggle_limitStorageSetting.isOn = !saveData.isLimitStorageSetting;
|
||||
Toggle_limitStorageSetting.isOn = saveData.isLimitStorageSetting;
|
||||
}
|
||||
AddDataSettingItem(currentClass);
|
||||
|
||||
foreach (var item in currentAddOtherDataItems)
|
||||
{
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
currentAddOtherDataItems.Clear();
|
||||
|
||||
foreach (var otherClass in saveData.otherDataClasses)
|
||||
{
|
||||
AddOtherDataItem(otherClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91ad386df90464f42afdad28100d8037
|
||||
119
Assets/NewStudioJYM/Scripts/Panel_DataFilterSetting.cs
Normal file
119
Assets/NewStudioJYM/Scripts/Panel_DataFilterSetting.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class Panel_DataFilterSetting : PanelBase
|
||||
{
|
||||
private RectTransform DataListContent;
|
||||
private RectTransform DataContent;
|
||||
private Button Button_Cancel;
|
||||
private Button Button_Save;
|
||||
|
||||
private UI_LoadDataHierarchyItem prf_loadDataHierarchyItem;
|
||||
private UI_DataSettingItem prf_DataSettingItem;
|
||||
private UI_DataTypeSelectedItem prf_DataTypeSelectedItem;
|
||||
private UI_MatchingTypeDataItem prf_MatchingTypeDataItem;
|
||||
|
||||
private List<UI_LoadDataHierarchyItem> currentAPIDataItems = new List<UI_LoadDataHierarchyItem>();
|
||||
public UI_DataSettingItem currentDataSettingItem;
|
||||
private string className;
|
||||
|
||||
public Action<SaveFilterData> onSaveFilterData;
|
||||
public override void AfterAwake()
|
||||
{
|
||||
prf_loadDataHierarchyItem = Resources.Load<UI_LoadDataHierarchyItem>("Prefabs/UI/PRF_LoadDataHierarchyItem");
|
||||
prf_DataSettingItem = Resources.Load<UI_DataSettingItem>("Prefabs/UI/PRF_DataSettingItem");
|
||||
prf_DataTypeSelectedItem = Resources.Load<UI_DataTypeSelectedItem>("Prefabs/UI/PRF_DataTypeSelectedItem");
|
||||
prf_MatchingTypeDataItem = Resources.Load<UI_MatchingTypeDataItem>("Prefabs/UI/PRF_MatchingTypeDataItem");
|
||||
|
||||
Button_Cancel.onClick.AddListener(CloseModal);
|
||||
Button_Save.onClick.AddListener(Save);
|
||||
CloseModal();
|
||||
}
|
||||
public void OpenModal()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
public void CloseModal()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
private void Save()
|
||||
{
|
||||
var saveFilterData = GetSaveFilterData();
|
||||
onSaveFilterData?.Invoke(saveFilterData);
|
||||
CloseModal();
|
||||
}
|
||||
public void SetLoadMQTTDataList(List<DataClass> dataClasses)
|
||||
{
|
||||
SetLoadDataList(dataClasses);
|
||||
}
|
||||
public void SetLoadAPIDataList(string className, List<DataClass> dataClasses)
|
||||
{
|
||||
this.className = className;
|
||||
SetLoadDataList(dataClasses);
|
||||
}
|
||||
private void SetLoadDataList(List<DataClass> dataClasses)
|
||||
{
|
||||
OpenModal();
|
||||
|
||||
if (currentDataSettingItem != null)
|
||||
{
|
||||
Destroy(currentDataSettingItem.gameObject);
|
||||
currentDataSettingItem = null;
|
||||
}
|
||||
|
||||
foreach (var dataItem in currentAPIDataItems)
|
||||
Destroy(dataItem.gameObject);
|
||||
|
||||
currentAPIDataItems.Clear();
|
||||
|
||||
foreach (var dataClass in dataClasses)
|
||||
{
|
||||
var item = Instantiate(prf_loadDataHierarchyItem, DataListContent);
|
||||
item.SetData(dataClass);
|
||||
item.onClickItem += AddDataSettingItem;
|
||||
currentAPIDataItems.Add(item);
|
||||
}
|
||||
}
|
||||
private void AddDataSettingItem(DataClass data)
|
||||
{
|
||||
if (currentDataSettingItem != null)
|
||||
{
|
||||
Destroy(currentDataSettingItem.gameObject);
|
||||
currentDataSettingItem = null;
|
||||
}
|
||||
var item = Instantiate(prf_DataSettingItem, DataContent);
|
||||
item.onUpdateLayout += UpdateLayout;
|
||||
currentDataSettingItem = item;
|
||||
|
||||
if (className == null)
|
||||
{
|
||||
currentDataSettingItem.SetData(data, prf_DataTypeSelectedItem, prf_MatchingTypeDataItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDataSettingItem.SetData(className, data, prf_DataTypeSelectedItem, prf_MatchingTypeDataItem);
|
||||
}
|
||||
}
|
||||
private void UpdateLayout()
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(DataContent);
|
||||
}
|
||||
private SaveFilterData GetSaveFilterData()
|
||||
{
|
||||
SaveFilterData saveFilterData = new SaveFilterData();
|
||||
|
||||
if (currentDataSettingItem != null)
|
||||
{
|
||||
saveFilterData.data = currentDataSettingItem.GetData();
|
||||
}
|
||||
|
||||
return saveFilterData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f82c4dfc98d12004d8c6cfe2357330b4
|
||||
359
Assets/NewStudioJYM/Scripts/Panel_DynamicObjectInfo.cs
Normal file
359
Assets/NewStudioJYM/Scripts/Panel_DynamicObjectInfo.cs
Normal file
@@ -0,0 +1,359 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using XED.Manage;
|
||||
using System.Linq;
|
||||
using XED.Core;
|
||||
using XED.Command;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class Panel_DynamicObjectInfo : PanelBase
|
||||
{
|
||||
public enum InputFieldType
|
||||
{
|
||||
none,
|
||||
posX, posY, posZ,
|
||||
rotX, rotY, rotZ,
|
||||
scaX, scaY, scaZ,
|
||||
}
|
||||
public class SelectedInput
|
||||
{
|
||||
public InputFieldType type = InputFieldType.none;
|
||||
public float value = 0.0f;
|
||||
public SelectedInput(InputFieldType type, float value)
|
||||
{
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public TextMeshProUGUI Text_Name;
|
||||
|
||||
public TMP_InputField InputField_PositionX;
|
||||
public TMP_InputField InputField_PositionY;
|
||||
public TMP_InputField InputField_PositionZ;
|
||||
public TMP_InputField InputField_RotationX;
|
||||
public TMP_InputField InputField_RotationY;
|
||||
public TMP_InputField InputField_RotationZ;
|
||||
public TMP_InputField InputField_ScaleX;
|
||||
public TMP_InputField InputField_ScaleY;
|
||||
public TMP_InputField InputField_ScaleZ;
|
||||
|
||||
public TextMeshProUGUI Text_DataName;
|
||||
public Button Button_ConnectData;
|
||||
public Button Button_RetouchData;
|
||||
public Button Button_DeleteData;
|
||||
|
||||
public TextMeshProUGUI Text_AlarmName;
|
||||
public Button Button_ConnectAlarm;
|
||||
public Button Button_RetouchAlarm;
|
||||
public Button Button_DeleteAlarm;
|
||||
|
||||
public event System.Action<List<GameObject>> onTransformChanged;
|
||||
private List<GameObject> selectedObjects = new List<GameObject>();
|
||||
private SelectedInput lastSelectedInputField = new SelectedInput(InputFieldType.none ,0.0f);
|
||||
|
||||
public Action onConnectedData;
|
||||
public Action<string> onRetouchData;
|
||||
public Action<string> onDeleteData;
|
||||
|
||||
public Action onConnectedAlarm;
|
||||
public Action<string> onRetouchAlarm;
|
||||
public Action<string> onDeleteAlarm;
|
||||
|
||||
public SaveConnectedData connectedData;
|
||||
public SaveConnectAlarmData connectedAlarmData;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
InputField_PositionX.onValueChanged.AddListener(OnPosXChanged);
|
||||
InputField_PositionY.onValueChanged.AddListener(OnPosYChanged);
|
||||
InputField_PositionZ.onValueChanged.AddListener(OnPosZChanged);
|
||||
InputField_RotationX.onValueChanged.AddListener(OnRotXChanged);
|
||||
InputField_RotationY.onValueChanged.AddListener(OnRotYChanged);
|
||||
InputField_RotationZ.onValueChanged.AddListener(OnRotZChanged);
|
||||
InputField_ScaleX.onValueChanged.AddListener(OnScaXChanged);
|
||||
InputField_ScaleY.onValueChanged.AddListener(OnScaYChanged);
|
||||
InputField_ScaleZ.onValueChanged.AddListener(OnScaZChanged);
|
||||
InputField_PositionX.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_PositionY.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_PositionZ.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_RotationX.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_RotationY.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_RotationZ.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_ScaleX.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_ScaleY.onDeselect.AddListener(OnDeselectInputField);
|
||||
InputField_ScaleZ.onDeselect.AddListener(OnDeselectInputField);
|
||||
ResetObjectInfo();
|
||||
Text_DataName.SetText("없음");
|
||||
Button_ConnectData.onClick.AddListener(OnClickConnectDataButton);
|
||||
Button_RetouchData.onClick.AddListener(OnClickRetouchDataButton);
|
||||
Button_DeleteData.onClick.AddListener(OnClickDeleteDataButton);
|
||||
Text_AlarmName.SetText("없음");
|
||||
Button_ConnectAlarm.onClick.AddListener(OnClickConnectAlarmButton);
|
||||
Button_RetouchAlarm.onClick.AddListener(OnClickRetouchAlarmButton);
|
||||
Button_DeleteAlarm.onClick.AddListener(OnClickDeleteAlarmButton);
|
||||
}
|
||||
|
||||
void OnPosXChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.posX, input);
|
||||
}
|
||||
void OnPosYChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.posY, input);
|
||||
}
|
||||
void OnPosZChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.posZ, input);
|
||||
}
|
||||
void OnRotXChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.rotX, input);
|
||||
}
|
||||
void OnRotYChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.rotY, input);
|
||||
}
|
||||
void OnRotZChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.rotZ, input);
|
||||
}
|
||||
void OnScaXChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.scaX, input);
|
||||
}
|
||||
void OnScaYChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.scaY, input);
|
||||
}
|
||||
void OnScaZChanged(string input)
|
||||
{
|
||||
OnTransformChanged(InputFieldType.scaZ, input);
|
||||
}
|
||||
void OnTransformChanged(InputFieldType type, string input)
|
||||
{
|
||||
if (selectedObjects.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float value = 0.0f;
|
||||
if (!float.TryParse(input, out value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (lastSelectedInputField.type != type)
|
||||
{
|
||||
AddUndoRedo(type, value);
|
||||
}
|
||||
lastSelectedInputField.value = value;
|
||||
foreach (GameObject gb in selectedObjects)
|
||||
{
|
||||
ChangeTransformValue(gb.transform, type, value);
|
||||
}
|
||||
onTransformChanged?.Invoke(selectedObjects);
|
||||
}
|
||||
public void OnTransformChanged(List<GameObject> objectTransforms)
|
||||
{
|
||||
selectedObjects = objectTransforms;
|
||||
if (objectTransforms.Count == 0)
|
||||
{
|
||||
ResetObjectInfo();
|
||||
return;
|
||||
}
|
||||
bool equalPosX = selectedObjects.All(gb => Mathf.Approximately(gb.transform.position.x, selectedObjects[0].transform.position.x));
|
||||
bool equalPosY = selectedObjects.All(gb => Mathf.Approximately(gb.transform.position.y, selectedObjects[0].transform.position.y));
|
||||
bool equalPosZ = selectedObjects.All(gb => Mathf.Approximately(gb.transform.position.z, selectedObjects[0].transform.position.z));
|
||||
bool equalRotX = selectedObjects.All(gb => Mathf.Approximately(gb.transform.eulerAngles.x, selectedObjects[0].transform.eulerAngles.x));
|
||||
bool equalRotY = selectedObjects.All(gb => Mathf.Approximately(gb.transform.eulerAngles.y, selectedObjects[0].transform.eulerAngles.y));
|
||||
bool equalRotZ = selectedObjects.All(gb => Mathf.Approximately(gb.transform.eulerAngles.z, selectedObjects[0].transform.eulerAngles.z));
|
||||
bool equalScaX = selectedObjects.All(gb => Mathf.Approximately(gb.transform.localScale.x, selectedObjects[0].transform.localScale.x));
|
||||
bool equalScaY = selectedObjects.All(gb => Mathf.Approximately(gb.transform.localScale.y, selectedObjects[0].transform.localScale.y));
|
||||
bool equalScaZ = selectedObjects.All(gb => Mathf.Approximately(gb.transform.localScale.z, selectedObjects[0].transform.localScale.z));
|
||||
|
||||
Transform t = selectedObjects[0].transform;
|
||||
if (equalPosX) InputField_PositionX.SetTextWithoutNotify(t.position.x.ToString("F2"));
|
||||
if (equalPosY) InputField_PositionY.SetTextWithoutNotify(t.position.y.ToString("F2"));
|
||||
if (equalPosZ) InputField_PositionZ.SetTextWithoutNotify(t.position.z.ToString("F2"));
|
||||
if (equalRotX) InputField_RotationX.SetTextWithoutNotify(t.eulerAngles.x.ToString("F2"));
|
||||
if (equalRotY) InputField_RotationY.SetTextWithoutNotify(t.eulerAngles.y.ToString("F2"));
|
||||
if (equalRotZ) InputField_RotationZ.SetTextWithoutNotify(t.eulerAngles.z.ToString("F2"));
|
||||
if (equalScaX) InputField_ScaleX.SetTextWithoutNotify(t.localScale.x.ToString("F2"));
|
||||
if (equalScaY) InputField_ScaleY.SetTextWithoutNotify(t.localScale.y.ToString("F2"));
|
||||
if (equalScaZ) InputField_ScaleZ.SetTextWithoutNotify(t.localScale.z.ToString("F2"));
|
||||
}
|
||||
void AddUndoRedo(InputFieldType type, float value)
|
||||
{
|
||||
lastSelectedInputField = new SelectedInput(type, value);
|
||||
SelectedInput saveSelectedInput = lastSelectedInputField;
|
||||
List<GameObject> transformsChanged = new List<GameObject>(selectedObjects);
|
||||
List<float> origValues;
|
||||
switch (type)
|
||||
{
|
||||
case InputFieldType.posX: origValues = transformsChanged.Select(t => t.transform.position.x).ToList(); break;
|
||||
case InputFieldType.posY: origValues = transformsChanged.Select(t => t.transform.position.y).ToList(); break;
|
||||
case InputFieldType.posZ: origValues = transformsChanged.Select(t => t.transform.position.z).ToList(); break;
|
||||
case InputFieldType.rotX: origValues = transformsChanged.Select(t => t.transform.eulerAngles.x).ToList(); break;
|
||||
case InputFieldType.rotY: origValues = transformsChanged.Select(t => t.transform.eulerAngles.y).ToList(); break;
|
||||
case InputFieldType.rotZ: origValues = transformsChanged.Select(t => t.transform.eulerAngles.z).ToList(); break;
|
||||
case InputFieldType.scaX: origValues = transformsChanged.Select(t => t.transform.localScale.x).ToList(); break;
|
||||
case InputFieldType.scaY: origValues = transformsChanged.Select(t => t.transform.localScale.y).ToList(); break;
|
||||
case InputFieldType.scaZ: origValues = transformsChanged.Select(t => t.transform.localScale.z).ToList(); break;
|
||||
default: origValues = new List<float>(transformsChanged.Count); break;
|
||||
}
|
||||
|
||||
ActionCommand command = new ActionCommand(
|
||||
() =>
|
||||
{
|
||||
for (int i = 0; i< transformsChanged.Count; i++)
|
||||
{
|
||||
ChangeTransformValue(transformsChanged[i].transform, type, saveSelectedInput.value);
|
||||
}
|
||||
onTransformChanged?.Invoke(transformsChanged);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
for (int i = 0; i < transformsChanged.Count; i++)
|
||||
{
|
||||
ChangeTransformValue(transformsChanged[i].transform, type, origValues[i]);
|
||||
}
|
||||
onTransformChanged?.Invoke(transformsChanged);
|
||||
});
|
||||
CommandInvoker.instance.Invoke(command);
|
||||
}
|
||||
void ChangeTransformValue(Transform t, InputFieldType type, float v)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case InputFieldType.posX: t.position = new Vector3(v, t.position.y, t.position.z); break;
|
||||
case InputFieldType.posY: t.position = new Vector3(t.position.x, v, t.position.z); break;
|
||||
case InputFieldType.posZ: t.position = new Vector3(t.position.x, t.position.y, v); break;
|
||||
case InputFieldType.rotX: t.eulerAngles = new Vector3(v, t.eulerAngles.y, t.eulerAngles.z); break;
|
||||
case InputFieldType.rotY: t.eulerAngles = new Vector3(t.eulerAngles.x, v, t.eulerAngles.z); break;
|
||||
case InputFieldType.rotZ: t.eulerAngles = new Vector3(t.eulerAngles.x, t.eulerAngles.y, v); break;
|
||||
case InputFieldType.scaX: t.localScale = new Vector3(v, t.localScale.y, t.localScale.z); break;
|
||||
case InputFieldType.scaY: t.localScale = new Vector3(t.localScale.x, v, t.localScale.z); break;
|
||||
case InputFieldType.scaZ: t.localScale = new Vector3(t.localScale.x, t.localScale.y, v); break;
|
||||
}
|
||||
}
|
||||
void OnDeselectInputField(string lastInput)
|
||||
{
|
||||
Debug.Log("Deselect Input Field");
|
||||
if (lastSelectedInputField.type != InputFieldType.none)
|
||||
{
|
||||
lastSelectedInputField = new SelectedInput(InputFieldType.none, 0.0f);
|
||||
}
|
||||
}
|
||||
public void SetObjectInfo(string name, List<GameObject> selectedObjects)
|
||||
{
|
||||
ResetObjectInfo();
|
||||
if (name == null || selectedObjects == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (selectedObjects.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string append = "";
|
||||
if (!name.Equals("-"))
|
||||
{
|
||||
append = string.Format(" ({0})", selectedObjects.Count);
|
||||
}
|
||||
Text_Name.text = name + append;
|
||||
OnTransformChanged(selectedObjects);
|
||||
if (lastSelectedInputField.type != InputFieldType.none)
|
||||
{
|
||||
lastSelectedInputField = new SelectedInput(InputFieldType.none, 0.0f);
|
||||
}
|
||||
}
|
||||
public void ResetObjectInfo()
|
||||
{
|
||||
Text_Name.text = "-";
|
||||
InputField_PositionX.SetTextWithoutNotify("-");
|
||||
InputField_PositionY.SetTextWithoutNotify("-");
|
||||
InputField_PositionZ.SetTextWithoutNotify("-");
|
||||
InputField_RotationX.SetTextWithoutNotify("-");
|
||||
InputField_RotationY.SetTextWithoutNotify("-");
|
||||
InputField_RotationZ.SetTextWithoutNotify("-");
|
||||
InputField_ScaleX.SetTextWithoutNotify("-");
|
||||
InputField_ScaleY.SetTextWithoutNotify("-");
|
||||
InputField_ScaleZ.SetTextWithoutNotify("-");
|
||||
if (lastSelectedInputField.type != InputFieldType.none)
|
||||
{
|
||||
lastSelectedInputField = new SelectedInput(InputFieldType.none, 0.0f);
|
||||
}
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (Text_DataName.text == "없음")
|
||||
{
|
||||
Button_ConnectData.gameObject.SetActive(true);
|
||||
Button_RetouchData.gameObject.SetActive(false);
|
||||
Button_DeleteData.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Button_ConnectData.gameObject.SetActive(false);
|
||||
Button_RetouchData.gameObject.SetActive(true);
|
||||
Button_DeleteData.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (Text_AlarmName.text == "없음")
|
||||
{
|
||||
Button_ConnectAlarm.gameObject.SetActive(true);
|
||||
Button_RetouchAlarm.gameObject.SetActive(false);
|
||||
Button_DeleteAlarm.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Button_ConnectAlarm.gameObject.SetActive(false);
|
||||
Button_RetouchAlarm.gameObject.SetActive(true);
|
||||
Button_DeleteAlarm.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
private void OnClickConnectDataButton()
|
||||
{
|
||||
onConnectedData?.Invoke();
|
||||
}
|
||||
private void OnClickRetouchDataButton()
|
||||
{
|
||||
onRetouchData?.Invoke(Text_DataName.text);
|
||||
}
|
||||
private void OnClickDeleteDataButton()
|
||||
{
|
||||
onDeleteData?.Invoke(Text_DataName.text);
|
||||
Text_DataName.SetText("없음");
|
||||
}
|
||||
|
||||
public void OnConnectData(string saveDataName, SaveConnectedData saveData)
|
||||
{
|
||||
Text_DataName.SetText(saveDataName);
|
||||
connectedData = saveData;
|
||||
}
|
||||
|
||||
private void OnClickConnectAlarmButton()
|
||||
{
|
||||
onConnectedAlarm?.Invoke();
|
||||
}
|
||||
private void OnClickRetouchAlarmButton()
|
||||
{
|
||||
onRetouchAlarm?.Invoke(Text_AlarmName.text);
|
||||
}
|
||||
private void OnClickDeleteAlarmButton()
|
||||
{
|
||||
onDeleteAlarm?.Invoke(Text_AlarmName.text);
|
||||
Text_AlarmName.SetText("없음");
|
||||
}
|
||||
|
||||
public void OnConnectAlarm(string saveAlarmName, SaveConnectAlarmData saveData)
|
||||
{
|
||||
Text_AlarmName.SetText(saveAlarmName);
|
||||
connectedAlarmData = saveData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f421057c874e14f4aae3877101e22b47
|
||||
90
Assets/NewStudioJYM/Scripts/Panel_MQTTConnectModal.cs
Normal file
90
Assets/NewStudioJYM/Scripts/Panel_MQTTConnectModal.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class Panel_MQTTConnectModal : PanelBase
|
||||
{
|
||||
private TextMeshProUGUI Text_Domain;
|
||||
private TextMeshProUGUI Text_Port;
|
||||
private RectTransform TopicContent;
|
||||
|
||||
private Button Button_AddTopic;
|
||||
private Button Button_Save;
|
||||
|
||||
private UI_DataBindingItem prf_mqttTopicItem;
|
||||
private List<UI_DataBindingItem> topicItems = new List<UI_DataBindingItem>();
|
||||
private UI_DataBindingItem selectedTopicItem;
|
||||
|
||||
public MQTTData loadMQTTData;
|
||||
public Action<string> onClickFilterButton;
|
||||
public Action<SaveMQTTData> onSaveMQTTData;
|
||||
|
||||
private void TestDataConnected()
|
||||
{
|
||||
var mqttJson = Resources.Load<TextAsset>("MQTTData").text;
|
||||
loadMQTTData = JsonConvert.DeserializeObject<MQTTData>(mqttJson);
|
||||
}
|
||||
public override void AfterAwake()
|
||||
{
|
||||
TestDataConnected();
|
||||
prf_mqttTopicItem = Resources.Load<UI_DataBindingItem>("Prefabs/UI/PRF_DataBindingItemItem");
|
||||
|
||||
Text_Domain.SetText(loadMQTTData.domain);
|
||||
Text_Port.SetText(loadMQTTData.port);
|
||||
|
||||
Button_AddTopic.onClick.AddListener(AddTopicItem);
|
||||
Button_Save.onClick.AddListener(Save);
|
||||
}
|
||||
|
||||
private void OnClickFilterButton(UI_DataBindingItem item)
|
||||
{
|
||||
selectedTopicItem = item;
|
||||
var itemName = item.GetTopicName();
|
||||
onClickFilterButton?.Invoke(itemName);
|
||||
}
|
||||
|
||||
private void AddTopicItem()
|
||||
{
|
||||
var item = Instantiate(prf_mqttTopicItem, TopicContent);
|
||||
item.onRemove += RemoveTopicItem;
|
||||
item.onFilter += OnClickFilterButton;
|
||||
topicItems.Add(item);
|
||||
}
|
||||
private void RemoveTopicItem(UI_DataBindingItem item)
|
||||
{
|
||||
topicItems.Remove(item);
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
private void Save()
|
||||
{
|
||||
var saveData = GetMQTTData();
|
||||
onSaveMQTTData?.Invoke(saveData);
|
||||
}
|
||||
public void SetFilterData(SaveFilterData filterData)
|
||||
{
|
||||
if (selectedTopicItem == null)
|
||||
return;
|
||||
|
||||
selectedTopicItem.SetFilterData(filterData);
|
||||
selectedTopicItem.SetChangedInputFieldTopicName();
|
||||
}
|
||||
|
||||
private SaveMQTTData GetMQTTData()
|
||||
{
|
||||
SaveMQTTData saveMQTTData = new SaveMQTTData();
|
||||
saveMQTTData.domain = Text_Domain.text;
|
||||
saveMQTTData.port = Text_Port.text;
|
||||
foreach (var topicItem in topicItems)
|
||||
{
|
||||
saveMQTTData.saveFilterData.Add(topicItem.GetFilterData());
|
||||
}
|
||||
return saveMQTTData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10071fcfca7c256488c4fcad74083bf1
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using Newtonsoft.Json;
|
||||
using TriLibCore.SFB;
|
||||
using System.Text;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
[Serializable]
|
||||
public class LanguageConfig
|
||||
{
|
||||
public string defaultLanguage;
|
||||
public Dictionary<string, string> languages;
|
||||
}
|
||||
public class Panel_MultilingualSettingModal : PanelBase
|
||||
{
|
||||
public TMP_Dropdown Dropdown_Languages;
|
||||
public Button Button_OpenFile;
|
||||
public Button Button_Save;
|
||||
|
||||
private string selectedLanguage;
|
||||
private Dictionary<string, string> languages = new Dictionary<string, string>();
|
||||
private string json;
|
||||
public string saveLanguage;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
Button_OpenFile.onClick.AddListener(OnClickOpenFileButton);
|
||||
Button_Save.onClick.AddListener(OnClickSaveButton);
|
||||
}
|
||||
void OnClickOpenFileButton()
|
||||
{
|
||||
StandaloneFileBrowser.OpenFilePanelAsync("Open File", "", "json", false, LoadJson);
|
||||
}
|
||||
void OnClickSaveButton()
|
||||
{
|
||||
saveLanguage = selectedLanguage;
|
||||
}
|
||||
|
||||
void LoadJson(IList<ItemWithStream> items)
|
||||
{
|
||||
if (items != null && items.Count > 0)
|
||||
{
|
||||
var item = items[0];
|
||||
using (var reader = new StreamReader(item.OpenStream(), Encoding.UTF8))
|
||||
{
|
||||
json = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("파일을 선택하지 않았습니다.");
|
||||
}
|
||||
|
||||
var data = JsonConvert.DeserializeObject<LanguageConfig>(json);
|
||||
if (data == null || data.languages == null)
|
||||
{
|
||||
Debug.LogError("데이터가 존재하지 않습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
languages = data.languages;
|
||||
SetLanguageDropdown();
|
||||
}
|
||||
private void SetLanguageDropdown()
|
||||
{
|
||||
Dropdown_Languages.ClearOptions();
|
||||
List<string> options = new List<string>();
|
||||
|
||||
foreach (var language in languages.Keys)
|
||||
{
|
||||
options.Add(language);
|
||||
}
|
||||
Dropdown_Languages.AddOptions(options);
|
||||
Dropdown_Languages.onValueChanged.AddListener(OnLanguageDropdownValueChanged);
|
||||
|
||||
var languageKey = Dropdown_Languages.options[0].text;
|
||||
selectedLanguage = languages[languageKey];
|
||||
}
|
||||
|
||||
private void OnLanguageDropdownValueChanged(int index)
|
||||
{
|
||||
var languageKey = Dropdown_Languages.options[index].text;
|
||||
selectedLanguage = languages[languageKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4af5f74e38688c3408f7bc2ef1ff30f8
|
||||
50
Assets/NewStudioJYM/Scripts/StudioJYMCanvas_Popup.cs
Normal file
50
Assets/NewStudioJYM/Scripts/StudioJYMCanvas_Popup.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using UnityEngine;
|
||||
using XED.UI;
|
||||
using XRLib;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class StudioJYMCanvas_Popup : CanvasBase, ISingle
|
||||
{
|
||||
public Panel_DataConnectModal panel_dataconnectmodal;
|
||||
public Panel_AlarmConnectModal panel_alarmconnectmodal;
|
||||
public Panel_DynamicObjectInfo panel_dynamicobjectinfo;
|
||||
public Panel_MQTTConnectModal panel_mqttconnectmodal;
|
||||
public Panel_DataFilterSetting panel_datafiltersetting;
|
||||
public Panel_APIConnectModal panel_apiconnectmodal;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
canvasHandler = new StudioJYMPopupCanvasHandler(this);
|
||||
}
|
||||
public override void AfterAwake()
|
||||
{
|
||||
var dataManager = FindAnyObjectByType<ConnectDataManager>();
|
||||
|
||||
panel_dataconnectmodal.onSaveConnectedData += dataManager.SaveData;
|
||||
panel_alarmconnectmodal.onSaveConnectAlarmData += dataManager.SaveAlarmData;
|
||||
|
||||
panel_dynamicobjectinfo.onRetouchData += dataManager.LoadData;
|
||||
panel_dynamicobjectinfo.onDeleteData += dataManager.RemoveData;
|
||||
|
||||
panel_dynamicobjectinfo.onRetouchAlarm += dataManager.LoadAlarmData;
|
||||
panel_dynamicobjectinfo.onDeleteAlarm += dataManager.RemoveAlarmData;
|
||||
|
||||
panel_mqttconnectmodal.onClickFilterButton += dataManager.SetFilterData;
|
||||
panel_mqttconnectmodal.onSaveMQTTData += dataManager.SetMQTTData;
|
||||
|
||||
panel_apiconnectmodal.onClickFilterButton += dataManager.SetFilterData;
|
||||
panel_apiconnectmodal.onSaveAPIData += dataManager.SetAPIData;
|
||||
|
||||
dataManager.onConnectData += panel_dynamicobjectinfo.OnConnectData;
|
||||
dataManager.onLoadData += panel_dataconnectmodal.SetLoadSaveData;
|
||||
|
||||
dataManager.onConnectAlarm += panel_dynamicobjectinfo.OnConnectAlarm;
|
||||
dataManager.onLoadAlarm += panel_alarmconnectmodal.LoadData;
|
||||
|
||||
dataManager.mqttData += panel_datafiltersetting.SetLoadMQTTDataList;
|
||||
dataManager.apiData += panel_datafiltersetting.SetLoadAPIDataList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce9c9e8dfd0d6774db8b84fbcc818a4e
|
||||
17
Assets/NewStudioJYM/Scripts/StudioJYMPopupCanvasHandler.cs
Normal file
17
Assets/NewStudioJYM/Scripts/StudioJYMPopupCanvasHandler.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
using XED.Manage;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class StudioJYMPopupCanvasHandler : CanvasEventHandler
|
||||
{
|
||||
public StudioJYMPopupCanvasHandler(StudioJYMCanvas_Popup canvas_Popup)
|
||||
{
|
||||
canvas_Popup.panel_dynamicobjectinfo.onConnectedData += canvas_Popup.panel_dataconnectmodal.OpenModal;
|
||||
canvas_Popup.panel_dynamicobjectinfo.onConnectedAlarm += canvas_Popup.panel_alarmconnectmodal.OpenModal;
|
||||
|
||||
canvas_Popup.panel_datafiltersetting.onSaveFilterData += canvas_Popup.panel_mqttconnectmodal.SetFilterData;
|
||||
canvas_Popup.panel_datafiltersetting.onSaveFilterData += canvas_Popup.panel_apiconnectmodal.SetFilterData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b312c88a0bcbbd04c959de79c2c4cd71
|
||||
119
Assets/NewStudioJYM/Scripts/TestAPIData.cs
Normal file
119
Assets/NewStudioJYM/Scripts/TestAPIData.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
#region LoadData
|
||||
[Serializable]
|
||||
public class Data
|
||||
{
|
||||
public string name;
|
||||
public List<DataClass> dataList;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class DataClass
|
||||
{
|
||||
public string name;
|
||||
public List<FieldData> fields;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class FieldData
|
||||
{
|
||||
public string name;
|
||||
public string type;
|
||||
public string value;
|
||||
public List<MatchingData> matchingValue = new List<MatchingData>();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class MatchingData
|
||||
{
|
||||
public string matchingValue;
|
||||
public string matchingType;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EvnetData
|
||||
[Serializable]
|
||||
public class EventData
|
||||
{
|
||||
public Dictionary<string, Dictionary<string, List<string>>> eventTargets;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SaveConnectedData
|
||||
[Serializable]
|
||||
public class SaveConnectedData
|
||||
{
|
||||
public bool isAPI;
|
||||
public string dataListOptionName;
|
||||
|
||||
public bool isLimitStorageSetting;
|
||||
|
||||
public string dataSource;
|
||||
public List<DataClass> connectDataClass = new List<DataClass>();
|
||||
public List<DataClass> otherDataClasses = new List<DataClass>();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SaveAlarmData
|
||||
[Serializable]
|
||||
public class SaveConnectAlarmData
|
||||
{
|
||||
public string alarmDataName;
|
||||
public List<AlarmField> alarmFields = new List<AlarmField>();
|
||||
}
|
||||
[Serializable]
|
||||
public class AlarmField
|
||||
{
|
||||
public string fieldName;
|
||||
public List<ComparisonCondition> comparisons = new List<ComparisonCondition>();
|
||||
}
|
||||
[Serializable]
|
||||
public class ComparisonCondition
|
||||
{
|
||||
public string comparisonOperator;
|
||||
public string value;
|
||||
public string eventTarget;
|
||||
public List<EventParameter> parameters = new List<EventParameter>();
|
||||
}
|
||||
[Serializable]
|
||||
public class EventParameter
|
||||
{
|
||||
public string eventType;
|
||||
public string parameter;
|
||||
}
|
||||
#endregion
|
||||
|
||||
[Serializable]
|
||||
public class MQTTData
|
||||
{
|
||||
public string domain;
|
||||
public string port;
|
||||
public List<DataClass> dataList = new List<DataClass>();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class SaveMQTTData
|
||||
{
|
||||
public string domain;
|
||||
public string port;
|
||||
public List<SaveFilterData> saveFilterData = new List<SaveFilterData>();
|
||||
}
|
||||
[Serializable]
|
||||
public class SaveFilterData
|
||||
{
|
||||
public string name;
|
||||
public DataClass data;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class SaveAPIData
|
||||
{
|
||||
public string selectedUrl;
|
||||
public List<SaveFilterData> saveFilterData = new List<SaveFilterData>();
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioJYM/Scripts/TestAPIData.cs.meta
Normal file
2
Assets/NewStudioJYM/Scripts/TestAPIData.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95e66905521b2554fa13ad6c1e89ffae
|
||||
111
Assets/NewStudioJYM/Scripts/UI_AddOtherDataItem.cs
Normal file
111
Assets/NewStudioJYM/Scripts/UI_AddOtherDataItem.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using XRLib.UI;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class UI_AddOtherDataItem : UIBase
|
||||
{
|
||||
private TMP_Dropdown Dropdown_ClassName;
|
||||
private RectTransform ClassDataContent;
|
||||
private Button Button_Delete;
|
||||
|
||||
private List<string> options = new List<string>();
|
||||
public List<DataClass> datas = new List<DataClass>();
|
||||
private DataClass currentDataClass;
|
||||
|
||||
private UI_AddOtherDataTypeItem addOtherDataTypeItem;
|
||||
public List<UI_AddOtherDataTypeItem> addOtherDataTypeItems = new List<UI_AddOtherDataTypeItem>();
|
||||
private RectTransform originRectTransform;
|
||||
|
||||
public Action onUpdateLayout;
|
||||
public Action<UI_AddOtherDataItem> onDestory;
|
||||
|
||||
public void SetItem(List<DataClass> dataList, DataClass dataClass, UI_AddOtherDataTypeItem addOtherDataTypeItem)
|
||||
{
|
||||
currentDataClass = dataClass;
|
||||
|
||||
this.addOtherDataTypeItem = addOtherDataTypeItem;
|
||||
originRectTransform = addOtherDataTypeItem.rectTransform;
|
||||
Button_Delete.onClick.AddListener(OnClickDeleteButton);
|
||||
|
||||
options.Clear();
|
||||
this.datas.Clear();
|
||||
|
||||
Dropdown_ClassName.ClearOptions();
|
||||
|
||||
for (int i = 0; i < dataList.Count; i++)
|
||||
{
|
||||
this.datas.Add(dataList[i]);
|
||||
options.Add(dataList[i].name);
|
||||
}
|
||||
Dropdown_ClassName.AddOptions(options);
|
||||
Dropdown_ClassName.onValueChanged.AddListener(OnValueChangedClassName);
|
||||
|
||||
var index = dataClass != null ? options.IndexOf(dataClass.name) : 0;
|
||||
|
||||
Dropdown_ClassName.SetValueWithoutNotify(index);
|
||||
GenerateDatTypeItem(index);
|
||||
}
|
||||
|
||||
private void OnClickDeleteButton()
|
||||
{
|
||||
onDestory?.Invoke(this);
|
||||
}
|
||||
private void OnValueChangedClassName(int index)
|
||||
{
|
||||
GenerateDatTypeItem(index);
|
||||
}
|
||||
private void GenerateDatTypeItem(int index)
|
||||
{
|
||||
rectTransform.sizeDelta = originRectTransform.sizeDelta;
|
||||
|
||||
foreach (var item in addOtherDataTypeItems)
|
||||
Destroy(item.gameObject);
|
||||
|
||||
addOtherDataTypeItems.Clear();
|
||||
|
||||
if (currentDataClass == null)
|
||||
{
|
||||
currentDataClass = datas[index];
|
||||
}
|
||||
|
||||
foreach (var field in currentDataClass.fields)
|
||||
{
|
||||
var item = Instantiate(addOtherDataTypeItem, ClassDataContent);
|
||||
item.SetItem(field);
|
||||
addOtherDataTypeItems.Add(item);
|
||||
|
||||
UpdateLayoutOnSettingDataAdded();
|
||||
}
|
||||
}
|
||||
private void UpdateLayoutOnSettingDataAdded()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y += addOtherDataTypeItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
onUpdateLayout?.Invoke();
|
||||
}
|
||||
public DataClass GetData()
|
||||
{
|
||||
var dataClass = new DataClass();
|
||||
dataClass.name = Dropdown_ClassName.options[Dropdown_ClassName.value].text;
|
||||
dataClass.fields = new List<FieldData>();
|
||||
|
||||
foreach (var item in addOtherDataTypeItems)
|
||||
{
|
||||
var field = item.GetFieldData();
|
||||
if (field != null)
|
||||
{
|
||||
dataClass.fields.Add(field);
|
||||
}
|
||||
}
|
||||
|
||||
return dataClass;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioJYM/Scripts/UI_AddOtherDataItem.cs.meta
Normal file
2
Assets/NewStudioJYM/Scripts/UI_AddOtherDataItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71268f3cfea70674bbc33729450e4844
|
||||
73
Assets/NewStudioJYM/Scripts/UI_AddOtherDataTypeItem.cs
Normal file
73
Assets/NewStudioJYM/Scripts/UI_AddOtherDataTypeItem.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public enum StorageDataType
|
||||
{
|
||||
Int,
|
||||
Float,
|
||||
Double,
|
||||
String
|
||||
}
|
||||
public class UI_AddOtherDataTypeItem : UIBase
|
||||
{
|
||||
private Toggle Toggle_Use;
|
||||
private TextMeshProUGUI DataName;
|
||||
private TMP_Dropdown Dropdown_Type;
|
||||
|
||||
private Dictionary<int, string> options = new Dictionary<int, string>();
|
||||
private bool isUse;
|
||||
|
||||
public void SetItem(FieldData field)
|
||||
{
|
||||
DataName.SetText(field.name);
|
||||
Toggle_Use.onValueChanged.AddListener(OnUseToggleValueChanged);
|
||||
Toggle_Use.isOn = true;
|
||||
|
||||
Dropdown_Type.ClearOptions();
|
||||
var types = Enum.GetNames(typeof(StorageDataType));
|
||||
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
{
|
||||
options.Add(i, types[i]);
|
||||
}
|
||||
Dropdown_Type.AddOptions(options.Values.ToList());
|
||||
Dropdown_Type.onValueChanged.AddListener(OnTypeChanged);
|
||||
|
||||
for (int i = 0; i < options.Count; i++)
|
||||
{
|
||||
if (field.type == options[i])
|
||||
{
|
||||
Dropdown_Type.value = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUseToggleValueChanged(bool isOn)
|
||||
{
|
||||
isUse = isOn;
|
||||
}
|
||||
|
||||
private void OnTypeChanged(int value)
|
||||
{
|
||||
|
||||
}
|
||||
public FieldData GetFieldData()
|
||||
{
|
||||
if (!isUse)
|
||||
return null;
|
||||
|
||||
FieldData field = new FieldData();
|
||||
field.name = DataName.text;
|
||||
field.type = Dropdown_Type.options[Dropdown_Type.value].text;
|
||||
|
||||
return field;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a57b7b4127cf0f42a36369f10b2b517
|
||||
135
Assets/NewStudioJYM/Scripts/UI_AlarmDataItem.cs
Normal file
135
Assets/NewStudioJYM/Scripts/UI_AlarmDataItem.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class UI_AlarmDataItem : UIBase
|
||||
{
|
||||
private Toggle Toggle_Select;
|
||||
private TextMeshProUGUI DataName;
|
||||
private Button Button_AddComparison;
|
||||
private RectTransform ComparisonContent;
|
||||
|
||||
private EventData eventData;
|
||||
|
||||
private UI_ComparisonSettingItem comparisonSettingItem;
|
||||
private UI_EventParameterItem eventParameterItem;
|
||||
private List<UI_ComparisonSettingItem> comparisonSettingItems = new List<UI_ComparisonSettingItem>();
|
||||
|
||||
public Action onUpdateLayout;
|
||||
private AlarmField loadData;
|
||||
private bool isUse;
|
||||
|
||||
public void SetItem(FieldData data, UI_ComparisonSettingItem comparisonSettingItem, UI_EventParameterItem eventParameterItem, EventData eventData)
|
||||
{
|
||||
this.comparisonSettingItem = comparisonSettingItem;
|
||||
this.eventParameterItem = eventParameterItem;
|
||||
this.eventData = eventData;
|
||||
|
||||
DataName.SetText(data.name);
|
||||
Toggle_Select.onValueChanged.AddListener(OnSelectToggleValueChanged);
|
||||
Toggle_Select.isOn = true;
|
||||
|
||||
Button_AddComparison.onClick.AddListener(OnClickAddComparsionButton);
|
||||
comparisonSettingItems.Clear();
|
||||
}
|
||||
public void SetItem(AlarmField data, UI_ComparisonSettingItem comparisonSettingItem, UI_EventParameterItem eventParameterItem, EventData eventData)
|
||||
{
|
||||
loadData = data;
|
||||
this.comparisonSettingItem = comparisonSettingItem;
|
||||
this.eventParameterItem = eventParameterItem;
|
||||
this.eventData = eventData;
|
||||
|
||||
DataName.SetText(data.fieldName);
|
||||
Toggle_Select.onValueChanged.AddListener(OnSelectToggleValueChanged);
|
||||
Toggle_Select.isOn = true;
|
||||
|
||||
Button_AddComparison.onClick.AddListener(OnClickAddComparsionButton);
|
||||
comparisonSettingItems.Clear();
|
||||
|
||||
if (loadData.comparisons.Count > 0)
|
||||
{
|
||||
foreach(var comparison in loadData.comparisons)
|
||||
{
|
||||
var item = Instantiate(comparisonSettingItem, ComparisonContent);
|
||||
item.onUpdateLayoutAddParameter += UpdateLayoutAddParameterItem;
|
||||
item.onUpdateLayoutRemoveParameter += UpdateLayoutRemoveParameterItme;
|
||||
item.SetItem(comparison, eventParameterItem, eventData);
|
||||
comparisonSettingItems.Add(item);
|
||||
|
||||
if (comparisonSettingItems.Count > 1)
|
||||
{
|
||||
UpdateLayoutAddComparisonSettingItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnSelectToggleValueChanged(bool isOn)
|
||||
{
|
||||
isUse = isOn;
|
||||
Button_AddComparison.gameObject.SetActive(isOn);
|
||||
}
|
||||
private void OnClickAddComparsionButton()
|
||||
{
|
||||
var item = Instantiate(comparisonSettingItem, ComparisonContent);
|
||||
item.onUpdateLayoutAddParameter += UpdateLayoutAddParameterItem;
|
||||
item.onUpdateLayoutRemoveParameter += UpdateLayoutRemoveParameterItme;
|
||||
item.SetItem(eventParameterItem, eventData);
|
||||
comparisonSettingItems.Add(item);
|
||||
|
||||
if (comparisonSettingItems.Count > 1)
|
||||
{
|
||||
UpdateLayoutAddComparisonSettingItem();
|
||||
}
|
||||
}
|
||||
private void UpdateLayoutAddParameterItem()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y += eventParameterItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(ComparisonContent);
|
||||
onUpdateLayout?.Invoke();
|
||||
}
|
||||
private void UpdateLayoutRemoveParameterItme()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y -= eventParameterItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(ComparisonContent);
|
||||
onUpdateLayout?.Invoke();
|
||||
|
||||
}
|
||||
private void UpdateLayoutAddComparisonSettingItem()
|
||||
{
|
||||
var itemSizeDelta = rectTransform.sizeDelta;
|
||||
itemSizeDelta.y += comparisonSettingItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = itemSizeDelta;
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(ComparisonContent);
|
||||
onUpdateLayout?.Invoke();
|
||||
}
|
||||
|
||||
public AlarmField GetData()
|
||||
{
|
||||
if (!isUse)
|
||||
return null;
|
||||
|
||||
var alarmField = new AlarmField();
|
||||
alarmField.fieldName = DataName.text;
|
||||
alarmField.comparisons = new List<ComparisonCondition>();
|
||||
|
||||
foreach (var item in comparisonSettingItems)
|
||||
{
|
||||
var field = item.GetComparisonData();
|
||||
alarmField.comparisons.Add(field);
|
||||
}
|
||||
return alarmField;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioJYM/Scripts/UI_AlarmDataItem.cs.meta
Normal file
2
Assets/NewStudioJYM/Scripts/UI_AlarmDataItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8548106673f95f241a7b7ddec36c1514
|
||||
165
Assets/NewStudioJYM/Scripts/UI_ComparisonSettingItem.cs
Normal file
165
Assets/NewStudioJYM/Scripts/UI_ComparisonSettingItem.cs
Normal file
@@ -0,0 +1,165 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
|
||||
public class UI_ComparisonSettingItem : UIBase
|
||||
{
|
||||
private TMP_Dropdown Dropdown_Comparison;
|
||||
private TMP_InputField InputField_Value;
|
||||
private Button Button_EventTarget;
|
||||
private TMP_Dropdown Dropdown_EventTarget;
|
||||
private Button Button_AddParameters;
|
||||
private RectTransform EventParametersContent;
|
||||
|
||||
private List<UI_EventParameterItem> eventParameterItems = new List<UI_EventParameterItem>();
|
||||
private UI_EventParameterItem eventParameterItem;
|
||||
|
||||
private List<string> comparisonOptions = new List<string> { ">", "<", ">=", "<=", "==", "!=" };
|
||||
private EventData eventData;
|
||||
private Dictionary<string, List<string>> eventTypes = new Dictionary<string, List<string>>();
|
||||
|
||||
public Action onUpdateLayoutAddParameter;
|
||||
public Action onUpdateLayoutRemoveParameter;
|
||||
|
||||
internal void SetItem(UI_EventParameterItem eventParameterItem, EventData eventData)
|
||||
{
|
||||
this.eventParameterItem = eventParameterItem;
|
||||
this.eventData = eventData;
|
||||
|
||||
SetComparisonDropdown();
|
||||
SetEventTargetDropdown(eventData);
|
||||
Button_EventTarget.onClick.AddListener(OnClickEvnetTargetButton);
|
||||
Button_AddParameters.onClick.AddListener(OnClickAddParametersButton);
|
||||
eventParameterItems.Clear();
|
||||
}
|
||||
public void SetItem(ComparisonCondition loadData, UI_EventParameterItem eventParameterItem , EventData eventData)
|
||||
{
|
||||
this.eventParameterItem = eventParameterItem;
|
||||
this.eventData = eventData;
|
||||
|
||||
SetComparisonDropdown();
|
||||
SetEventTargetDropdown(eventData);
|
||||
Button_EventTarget.onClick.AddListener(OnClickEvnetTargetButton);
|
||||
Button_AddParameters.onClick.AddListener(OnClickAddParametersButton);
|
||||
eventParameterItems.Clear();
|
||||
|
||||
for(int i = 0; i < Dropdown_Comparison.options.Count; i++)
|
||||
{
|
||||
if(Dropdown_Comparison.options[i].text == loadData.comparisonOperator)
|
||||
{
|
||||
Dropdown_Comparison.value = i;
|
||||
}
|
||||
}
|
||||
InputField_Value.text = loadData.value;
|
||||
|
||||
for (int i = 0; i < Dropdown_EventTarget.options.Count; i++)
|
||||
{
|
||||
if (Dropdown_EventTarget.options[i].text == loadData.eventTarget)
|
||||
{
|
||||
Dropdown_EventTarget.value = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (loadData.parameters.Count > 0)
|
||||
{
|
||||
foreach (var parameter in loadData.parameters)
|
||||
{
|
||||
var item = Instantiate(eventParameterItem, EventParametersContent);
|
||||
item.SetItem(parameter, eventTypes);
|
||||
eventParameterItems.Add(item);
|
||||
|
||||
if (eventParameterItems.Count > 1)
|
||||
{
|
||||
UpdateLayoutAddParameter();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SetComparisonDropdown()
|
||||
{
|
||||
Dropdown_Comparison.ClearOptions();
|
||||
Dropdown_Comparison.AddOptions(comparisonOptions);
|
||||
}
|
||||
private void SetEventTargetDropdown(EventData eventData)
|
||||
{
|
||||
Dropdown_EventTarget.ClearOptions();
|
||||
Dropdown_EventTarget.AddOptions(eventData.eventTargets.Keys.ToList());
|
||||
|
||||
Dropdown_EventTarget.onValueChanged.AddListener(OnEventTargetValueChanged);
|
||||
OnEventTargetValueChanged(0);
|
||||
}
|
||||
private void OnEventTargetValueChanged(int index)
|
||||
{
|
||||
string selectedTarget = Dropdown_EventTarget.options[index].text;
|
||||
if (!eventData.eventTargets.ContainsKey(selectedTarget))
|
||||
return;
|
||||
|
||||
eventTypes = eventData.eventTargets[selectedTarget];
|
||||
|
||||
for(int i = 0; i < eventParameterItems.Count-1; i++)
|
||||
{
|
||||
UpdateLayoutRemoveParameter();
|
||||
}
|
||||
|
||||
foreach (var eventParameterItem in eventParameterItems)
|
||||
{
|
||||
Destroy(eventParameterItem.gameObject);
|
||||
}
|
||||
eventParameterItems.Clear();
|
||||
}
|
||||
|
||||
private void OnClickEvnetTargetButton()
|
||||
{
|
||||
Dropdown_EventTarget.Show();
|
||||
}
|
||||
private void OnClickAddParametersButton()
|
||||
{
|
||||
var item = Instantiate(eventParameterItem, EventParametersContent);
|
||||
item.SetItem(eventTypes);
|
||||
eventParameterItems.Add(item);
|
||||
|
||||
if (eventParameterItems.Count > 1)
|
||||
{
|
||||
UpdateLayoutAddParameter();
|
||||
}
|
||||
}
|
||||
private void UpdateLayoutAddParameter()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y += eventParameterItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
onUpdateLayoutAddParameter?.Invoke();
|
||||
}
|
||||
private void UpdateLayoutRemoveParameter()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y -= eventParameterItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
onUpdateLayoutRemoveParameter?.Invoke();
|
||||
}
|
||||
|
||||
public ComparisonCondition GetComparisonData()
|
||||
{
|
||||
var comparisonCondition = new ComparisonCondition();
|
||||
comparisonCondition.comparisonOperator = Dropdown_Comparison.options[Dropdown_Comparison.value].text;
|
||||
comparisonCondition.value = InputField_Value.text;
|
||||
comparisonCondition.eventTarget = Dropdown_EventTarget.options[Dropdown_EventTarget.value].text;
|
||||
|
||||
foreach (var item in eventParameterItems)
|
||||
{
|
||||
var parameters = item.GetParametersData();
|
||||
comparisonCondition.parameters.Add(parameters);
|
||||
}
|
||||
return comparisonCondition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ce839268adb26243b9f7af4461e6ef5
|
||||
61
Assets/NewStudioJYM/Scripts/UI_DataBindingItem.cs
Normal file
61
Assets/NewStudioJYM/Scripts/UI_DataBindingItem.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class UI_DataBindingItem : UIBase
|
||||
{
|
||||
public SaveFilterData filterData;
|
||||
|
||||
private TMP_InputField InputField_TopicName;
|
||||
private Button Button_Remove;
|
||||
private Button Button_Filter;
|
||||
|
||||
public Action<UI_DataBindingItem> onRemove;
|
||||
public Action<UI_DataBindingItem> onFilter;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
Button_Remove.onClick.AddListener(OnClickRemoveButton);
|
||||
Button_Filter.onClick.AddListener(OnClickFilterButton);
|
||||
}
|
||||
private void OnClickRemoveButton()
|
||||
{
|
||||
onRemove?.Invoke(this);
|
||||
}
|
||||
private void OnClickFilterButton()
|
||||
{
|
||||
onFilter?.Invoke(this);
|
||||
}
|
||||
public string GetTopicName()
|
||||
{
|
||||
var topicName = InputField_TopicName.text;
|
||||
return topicName;
|
||||
}
|
||||
public SaveFilterData GetFilterData()
|
||||
{
|
||||
SaveFilterData saveFilterData = new SaveFilterData();
|
||||
saveFilterData = filterData;
|
||||
saveFilterData.name = GetTopicName();
|
||||
|
||||
return saveFilterData;
|
||||
}
|
||||
public void SetFilterData(SaveFilterData filterData)
|
||||
{
|
||||
this.filterData = filterData;
|
||||
}
|
||||
public void SetChangedInputFieldTopicName()
|
||||
{
|
||||
if (filterData.data == null)
|
||||
return;
|
||||
|
||||
if (filterData.data.name != null)
|
||||
{
|
||||
InputField_TopicName.text = filterData.data.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioJYM/Scripts/UI_DataBindingItem.cs.meta
Normal file
2
Assets/NewStudioJYM/Scripts/UI_DataBindingItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59ff2c49b64da2d468e5b62884f42988
|
||||
95
Assets/NewStudioJYM/Scripts/UI_DataSettingItem.cs
Normal file
95
Assets/NewStudioJYM/Scripts/UI_DataSettingItem.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class UI_DataSettingItem : UIBase
|
||||
{
|
||||
public TMP_InputField InputField_ClassName;
|
||||
private RectTransform ClassDataContent;
|
||||
|
||||
private List<UI_DataTypeSelectedItem> dataTypeSelectedItems = new List<UI_DataTypeSelectedItem>();
|
||||
private UI_DataTypeSelectedItem dataTypeSelectedItem;
|
||||
|
||||
public Action onUpdateLayout;
|
||||
|
||||
public void SetData(DataClass data, UI_DataTypeSelectedItem typeItem, UI_MatchingTypeDataItem matchingItem)
|
||||
{
|
||||
InputField_ClassName.text = data.name;
|
||||
|
||||
SetItem(data, typeItem, matchingItem);
|
||||
}
|
||||
public void SetData(string className, DataClass data, UI_DataTypeSelectedItem typeItem, UI_MatchingTypeDataItem matchingItem)
|
||||
{
|
||||
InputField_ClassName.text = className;
|
||||
SetItem(data, typeItem, matchingItem);
|
||||
}
|
||||
private void SetItem(DataClass data, UI_DataTypeSelectedItem typeItem, UI_MatchingTypeDataItem matchingItem)
|
||||
{
|
||||
dataTypeSelectedItems.Clear();
|
||||
dataTypeSelectedItem = typeItem;
|
||||
|
||||
foreach (var field in data.fields)
|
||||
{
|
||||
var item = Instantiate(typeItem, ClassDataContent);
|
||||
item.onAddMatchingData += UpdateLayoutAddMatchData;
|
||||
item.onDestroyMatchingData += UpdateLayoutRemoveMatchData;
|
||||
item.SetItem(field, matchingItem);
|
||||
|
||||
dataTypeSelectedItems.Add(item);
|
||||
UpdateLayoutAddSettingData();
|
||||
}
|
||||
}
|
||||
private void UpdateLayoutAddMatchData()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y += dataTypeSelectedItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
UpdateLayout();
|
||||
onUpdateLayout?.Invoke();
|
||||
}
|
||||
private void UpdateLayoutRemoveMatchData()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y -= dataTypeSelectedItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
UpdateLayout();
|
||||
onUpdateLayout?.Invoke();
|
||||
}
|
||||
private void UpdateLayoutAddSettingData()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y += dataTypeSelectedItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
onUpdateLayout?.Invoke();
|
||||
}
|
||||
private void UpdateLayout()
|
||||
{
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(ClassDataContent);
|
||||
}
|
||||
public DataClass GetData()
|
||||
{
|
||||
var dataClass = new DataClass();
|
||||
dataClass.name = InputField_ClassName.text;
|
||||
dataClass.fields = new List<FieldData>();
|
||||
|
||||
foreach (var item in dataTypeSelectedItems)
|
||||
{
|
||||
var field = item.GetFieldData();
|
||||
|
||||
if (field != null)
|
||||
{
|
||||
dataClass.fields.Add(field);
|
||||
}
|
||||
}
|
||||
return dataClass;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioJYM/Scripts/UI_DataSettingItem.cs.meta
Normal file
2
Assets/NewStudioJYM/Scripts/UI_DataSettingItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a946220b8630a2a45880933c6914c9d5
|
||||
151
Assets/NewStudioJYM/Scripts/UI_DataTypeSelectedItem.cs
Normal file
151
Assets/NewStudioJYM/Scripts/UI_DataTypeSelectedItem.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public enum DataType
|
||||
{
|
||||
Int,
|
||||
Float,
|
||||
Double,
|
||||
String,
|
||||
Matching
|
||||
}
|
||||
|
||||
public class UI_DataTypeSelectedItem : UIBase
|
||||
{
|
||||
private Toggle Toggle_Use;
|
||||
private TextMeshProUGUI DataName;
|
||||
private TextMeshProUGUI DataValue;
|
||||
private TMP_Dropdown Dropdown_Type;
|
||||
private Button Button_MatchingAddData;
|
||||
private RectTransform MatchingItemContent;
|
||||
|
||||
private Dictionary<int, string> options = new Dictionary<int, string>();
|
||||
private FieldData fieldData;
|
||||
private MatchingData matchingData;
|
||||
|
||||
private List<UI_MatchingTypeDataItem> matchingTypeDataItems = new List<UI_MatchingTypeDataItem>();
|
||||
private UI_MatchingTypeDataItem matchingTypeDataItem;
|
||||
private bool isUse;
|
||||
|
||||
public Action onAddMatchingData;
|
||||
public Action onDestroyMatchingData;
|
||||
|
||||
public void SetItem(FieldData field, UI_MatchingTypeDataItem matchingTypeDataItem)
|
||||
{
|
||||
matchingTypeDataItems.Clear();
|
||||
|
||||
this.matchingTypeDataItem = matchingTypeDataItem;
|
||||
fieldData = field;
|
||||
|
||||
DataName.SetText(field.name);
|
||||
DataValue.SetText(field.value);
|
||||
|
||||
Toggle_Use.onValueChanged.AddListener(OnUseToggleValueChanged);
|
||||
Button_MatchingAddData.onClick.AddListener(OnClickAddDataButton);
|
||||
SetDropDownData(field);
|
||||
|
||||
Button_MatchingAddData.gameObject.SetActive(false);
|
||||
Toggle_Use.isOn = true;
|
||||
|
||||
if (fieldData.type == "Matching")
|
||||
{
|
||||
foreach (var matchingValue in fieldData.matchingValue)
|
||||
{
|
||||
matchingData = matchingValue;
|
||||
|
||||
var item = Instantiate(matchingTypeDataItem, MatchingItemContent);
|
||||
item.SetItemData(fieldData, matchingData);
|
||||
item.onDestory += OnDestoryAddDataItem;
|
||||
matchingTypeDataItems.Add(item);
|
||||
|
||||
SetAddMatchingDataItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SetDropDownData(FieldData field)
|
||||
{
|
||||
Dropdown_Type.ClearOptions();
|
||||
var types = Enum.GetNames(typeof(DataType));
|
||||
|
||||
for(int i = 0; i < types.Length; i++)
|
||||
{
|
||||
options.Add(i, types[i]);
|
||||
}
|
||||
Dropdown_Type.AddOptions(options.Values.ToList());
|
||||
Dropdown_Type.onValueChanged.AddListener(OnTypeChanged);
|
||||
|
||||
for (int i = 0; i < options.Count; i++)
|
||||
{
|
||||
if (field.type == options[i])
|
||||
{
|
||||
Dropdown_Type.value = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnUseToggleValueChanged(bool isOn)
|
||||
{
|
||||
isUse = isOn;
|
||||
}
|
||||
private void OnClickAddDataButton()
|
||||
{
|
||||
var item = Instantiate(matchingTypeDataItem, MatchingItemContent);
|
||||
item.SetItemData(fieldData, matchingData);
|
||||
item.onDestory += OnDestoryAddDataItem;
|
||||
matchingTypeDataItems.Add(item);
|
||||
|
||||
SetAddMatchingDataItem();
|
||||
}
|
||||
private void OnDestoryAddDataItem(UI_MatchingTypeDataItem item)
|
||||
{
|
||||
matchingTypeDataItems.Clear();
|
||||
Destroy(item.gameObject);
|
||||
SetRemoveMatchingDataItem();
|
||||
}
|
||||
private void OnTypeChanged(int value)
|
||||
{
|
||||
var isActive = options[value] == DataType.Matching.ToString();
|
||||
Button_MatchingAddData.gameObject.SetActive(isActive);
|
||||
}
|
||||
private void SetAddMatchingDataItem()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y += matchingTypeDataItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
onAddMatchingData?.Invoke();
|
||||
}
|
||||
private void SetRemoveMatchingDataItem()
|
||||
{
|
||||
var height = rectTransform.sizeDelta;
|
||||
height.y -= matchingTypeDataItem.rectTransform.rect.height;
|
||||
|
||||
rectTransform.sizeDelta = height;
|
||||
onDestroyMatchingData?.Invoke();
|
||||
}
|
||||
public FieldData GetFieldData()
|
||||
{
|
||||
if (!isUse)
|
||||
return null;
|
||||
|
||||
FieldData field = new FieldData();
|
||||
field.name = DataName.text;
|
||||
field.value = DataValue.text;
|
||||
field.type = Dropdown_Type.options[Dropdown_Type.value].text;
|
||||
|
||||
foreach (var item in matchingTypeDataItems)
|
||||
{
|
||||
var matchingValue = item.GetFieldData();
|
||||
field.matchingValue.Add(matchingValue);
|
||||
}
|
||||
|
||||
return field;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db7eacdda12e2074aa6c7cdf1daf46d1
|
||||
71
Assets/NewStudioJYM/Scripts/UI_EventParameterItem.cs
Normal file
71
Assets/NewStudioJYM/Scripts/UI_EventParameterItem.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class UI_EventParameterItem : UIBase
|
||||
{
|
||||
private TMP_Dropdown Dropdown_EventType;
|
||||
private TMP_Dropdown Dropdown_Parameters;
|
||||
|
||||
private Dictionary<string, List<string>> eventTypes = new Dictionary<string, List<string>>();
|
||||
|
||||
public void SetItem(Dictionary<string, List<string>> eventTypes)
|
||||
{
|
||||
this.eventTypes = eventTypes;
|
||||
SetEventTypeDropdown(eventTypes.Keys.ToList());
|
||||
}
|
||||
public void SetItem(EventParameter parameter, Dictionary<string, List<string>> eventTypes)
|
||||
{
|
||||
this.eventTypes = eventTypes;
|
||||
SetEventTypeDropdown(eventTypes.Keys.ToList());
|
||||
|
||||
for (int i = 0; i < Dropdown_EventType.options.Count; i++)
|
||||
{
|
||||
if (Dropdown_EventType.options[i].text == parameter.eventType)
|
||||
{
|
||||
Dropdown_EventType.value = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Dropdown_Parameters.options.Count; i++)
|
||||
{
|
||||
if (Dropdown_Parameters.options[i].text == parameter.parameter)
|
||||
{
|
||||
Dropdown_Parameters.value = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SetEventTypeDropdown(List<string> eventTypes)
|
||||
{
|
||||
Dropdown_EventType.ClearOptions();
|
||||
Dropdown_EventType.AddOptions(eventTypes);
|
||||
|
||||
Dropdown_EventType.onValueChanged.AddListener(OnEventTypeChanged);
|
||||
OnEventTypeChanged(0);
|
||||
}
|
||||
void OnEventTypeChanged(int typeIndex)
|
||||
{
|
||||
string selectedType = Dropdown_EventType.options[typeIndex].text;
|
||||
var parameters = eventTypes[selectedType];
|
||||
|
||||
Dropdown_Parameters.ClearOptions();
|
||||
Dropdown_Parameters.AddOptions(parameters);
|
||||
}
|
||||
|
||||
public EventParameter GetParametersData()
|
||||
{
|
||||
var eventParameter = new EventParameter();
|
||||
eventParameter.eventType = Dropdown_EventType.options[Dropdown_EventType.value].text;
|
||||
eventParameter.parameter = Dropdown_Parameters.options[Dropdown_Parameters.value].text;
|
||||
|
||||
return eventParameter;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cebef597a42cdd349b3bc10747c15368
|
||||
54
Assets/NewStudioJYM/Scripts/UI_LoadDataHierarchyItem.cs
Normal file
54
Assets/NewStudioJYM/Scripts/UI_LoadDataHierarchyItem.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class UI_LoadDataHierarchyItem : UIBase
|
||||
{
|
||||
public DataClass data;
|
||||
private Button button;
|
||||
private TextMeshProUGUI DataName;
|
||||
|
||||
public Action<DataClass> onClickItem;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
button = GetComponent<Button>();
|
||||
|
||||
button.onClick.AddListener(OnClickDataItem);
|
||||
}
|
||||
public void SetData(DataClass data)
|
||||
{
|
||||
this.data = data;
|
||||
var dataText = GenerateHierarchyText(data);
|
||||
DataName.SetText(dataText);
|
||||
|
||||
AdjustHeightToFitText();
|
||||
}
|
||||
void AdjustHeightToFitText()
|
||||
{
|
||||
float preferredHeight = DataName.preferredHeight;
|
||||
rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, preferredHeight);
|
||||
}
|
||||
private void OnClickDataItem()
|
||||
{
|
||||
onClickItem?.Invoke(data);
|
||||
}
|
||||
private string GenerateHierarchyText(DataClass data)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine($"<b>{data.name}</b>");
|
||||
foreach (var field in data.fields)
|
||||
{
|
||||
sb.AppendLine($"\t{field.name} : {field.value}");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83d2016360c025f4a8ce58bef77cc43e
|
||||
76
Assets/NewStudioJYM/Scripts/UI_MatchingTypeDataItem.cs
Normal file
76
Assets/NewStudioJYM/Scripts/UI_MatchingTypeDataItem.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public enum MatchingDataType
|
||||
{
|
||||
Int,
|
||||
Float,
|
||||
Double,
|
||||
String
|
||||
}
|
||||
public class UI_MatchingTypeDataItem : UIBase
|
||||
{
|
||||
private TextMeshProUGUI OriginValue;
|
||||
private TMP_InputField InputField_Value;
|
||||
private TMP_Dropdown Dropdown_Type;
|
||||
private Button Button_Delete;
|
||||
|
||||
private List<string> options = new List<string>();
|
||||
public Action<UI_MatchingTypeDataItem> onDestory;
|
||||
public void SetItemData(FieldData field, MatchingData matchingData)
|
||||
{
|
||||
OriginValue.SetText(field.value);
|
||||
Button_Delete.onClick.AddListener(OnClickDeleteButton);
|
||||
|
||||
SetDropDownData();
|
||||
|
||||
if (matchingData != null)
|
||||
{
|
||||
InputField_Value.text = matchingData.matchingValue;
|
||||
var types = Enum.GetNames(typeof(MatchingDataType));
|
||||
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
{
|
||||
if (types[i] == matchingData.matchingType)
|
||||
{
|
||||
Dropdown_Type.value = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnClickDeleteButton()
|
||||
{
|
||||
onDestory?.Invoke(this);
|
||||
}
|
||||
private void SetDropDownData()
|
||||
{
|
||||
Dropdown_Type.ClearOptions();
|
||||
var types = Enum.GetNames(typeof(MatchingDataType));
|
||||
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
{
|
||||
options.Add(types[i]);
|
||||
}
|
||||
Dropdown_Type.AddOptions(options);
|
||||
Dropdown_Type.onValueChanged.AddListener(OnDataTypeChanged);
|
||||
}
|
||||
private void OnDataTypeChanged(int index)
|
||||
{
|
||||
|
||||
}
|
||||
public MatchingData GetFieldData()
|
||||
{
|
||||
MatchingData matchingData = new MatchingData();
|
||||
matchingData.matchingValue = InputField_Value.text;
|
||||
matchingData.matchingType = Dropdown_Type.options[Dropdown_Type.value].text;
|
||||
|
||||
return matchingData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bac6ec32ddf18fc418e81eef2c42690f
|
||||
8
Assets/NewStudioPGD.meta
Normal file
8
Assets/NewStudioPGD.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9372de26e0b42914693d16bc5756940f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1147
Assets/NewStudioPGD/NewStudioPGD.unity
Normal file
1147
Assets/NewStudioPGD/NewStudioPGD.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioPGD/NewStudioPGD.unity.meta
Normal file
7
Assets/NewStudioPGD/NewStudioPGD.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da3cfbbc493fa584d966b4b64ee3839e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/NewStudioPGD/Prefabs.meta
Normal file
8
Assets/NewStudioPGD/Prefabs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaaff30873d6161488de14af0f2d2d10
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5468
Assets/NewStudioPGD/Prefabs/Canvas_Popup.prefab
Normal file
5468
Assets/NewStudioPGD/Prefabs/Canvas_Popup.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c4ff86506de88747baaf66d9d637c5b
|
||||
guid: 23a5b62354b63214e81741610e6e66e2
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
6904
Assets/NewStudioPGD/Prefabs/Canvas_Static.prefab
Normal file
6904
Assets/NewStudioPGD/Prefabs/Canvas_Static.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d670e3279ac3324bba323ab3ed2bef9
|
||||
guid: f2aeca4b33a9e7948ab82c4f02cae2f2
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
8
Assets/NewStudioPGD/Scripts.meta
Normal file
8
Assets/NewStudioPGD/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d40a29733fa39c140bd24756d24d50e3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/NewStudioPGD/Scripts/Command.meta
Normal file
8
Assets/NewStudioPGD/Scripts/Command.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af761925d50d5024fb038ceb9cb1e386
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/NewStudioPGD/Scripts/Command/ExitProgramCommand.cs
Normal file
25
Assets/NewStudioPGD/Scripts/Command/ExitProgramCommand.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED.Command
|
||||
{
|
||||
public class ExitProgramCommand : IIrreversibleCommand
|
||||
{
|
||||
public ExitProgramCommand()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string id { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }
|
||||
|
||||
public bool CanExecute()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
Debug.Log("Exit");
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5e265f61efc5e44f8dcaad35017208a
|
||||
8
Assets/NewStudioPGD/Scripts/Manager.meta
Normal file
8
Assets/NewStudioPGD/Scripts/Manager.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 474df4a4abb15124fad7ca53534b2ffc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace XED.Manage
|
||||
{
|
||||
public class StudioPopupCanvasHandler : CanvasEventHandler
|
||||
{
|
||||
public StudioPopupCanvasHandler(StudioCanvas_Popup canvas_popup)
|
||||
{
|
||||
canvas_popup.panel_selectlogic.onClickAppSetting += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
canvas_popup.panel_selectlogic.onClickAuthentication += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
canvas_popup.panel_selectlogic.onClickLanguage += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
canvas_popup.panel_selectlogic.onClickLogging += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
canvas_popup.panel_selectlogic.onClickAPIConnection += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
canvas_popup.panel_selectlogic.onClickMQTTConnection += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
canvas_popup.panel_selectlogic.onClickCreate3DObject += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
canvas_popup.panel_selectlogic.onClickCreateUI += canvas_popup.panel_applogiclist.OnSelectLogic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e53080ee638fbac49a75cb27bf53baf1
|
||||
8
Assets/NewStudioPGD/Scripts/UI.meta
Normal file
8
Assets/NewStudioPGD/Scripts/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b2f4e9a44961314f97ab6ed193f2111
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/NewStudioPGD/Scripts/UI/Canvas.meta
Normal file
8
Assets/NewStudioPGD/Scripts/UI/Canvas.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11ad716c898895042b9e60cfb315cd6a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/NewStudioPGD/Scripts/UI/Canvas/StudioCanvas_Popup.cs
Normal file
20
Assets/NewStudioPGD/Scripts/UI/Canvas/StudioCanvas_Popup.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
using XED.Manage;
|
||||
using XED.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
public class StudioCanvas_Popup : CanvasBase
|
||||
{
|
||||
public Panel_AppLogicList panel_applogiclist;
|
||||
public Panel_SelectLogic panel_selectlogic;
|
||||
public Panel_AppSetting panel_appsetting;
|
||||
public Panel_Authentication panel_authentication;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
canvasHandler = new StudioPopupCanvasHandler(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 962441d825727c54b92657b0c4e5fc72
|
||||
15
Assets/NewStudioPGD/Scripts/UI/Canvas/StudioCanvas_Static.cs
Normal file
15
Assets/NewStudioPGD/Scripts/UI/Canvas/StudioCanvas_Static.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using XED.Command;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class StudioCanvas_Static : CanvasBase
|
||||
{
|
||||
public StudioPanel_Topbar studiopanel_topbar;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
//studiopanel_topbar.onClickExit += () => CommandInvoker.instance.Invoke(new ExitProgramCommand());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b45b7347fd0fe24f80dc309e5f1917a
|
||||
8
Assets/NewStudioPGD/Scripts/UI/Element.meta
Normal file
8
Assets/NewStudioPGD/Scripts/UI/Element.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e302619c0636cb24c99e8052db74db52
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/NewStudioPGD/Scripts/UI/Element/UI_AppSettingItem.cs
Normal file
39
Assets/NewStudioPGD/Scripts/UI/Element/UI_AppSettingItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class UI_AppSettingItem : UIBase
|
||||
{
|
||||
public TMP_InputField InputField_Type;
|
||||
public TMP_InputField InputField_Value;
|
||||
public TMP_Dropdown Dropdown;
|
||||
public Button Button_Remove;
|
||||
|
||||
public enum EType
|
||||
{
|
||||
APIDomain,
|
||||
APIPort,
|
||||
API,
|
||||
MQTTDomain,
|
||||
MQTTPort
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InputField_Type = transform.GetComponentsInChildren<TMP_InputField>().FirstOrDefault(x => x.name == nameof(InputField_Type));
|
||||
InputField_Value = transform.GetComponentsInChildren<TMP_InputField>().FirstOrDefault(x => x.name == nameof(InputField_Value));
|
||||
Dropdown = transform.GetComponentInChildren<TMP_Dropdown>();
|
||||
Button_Remove = transform.GetComponentInChildren<Button>();
|
||||
Button_Remove.onClick.AddListener(() => Destroy(gameObject));
|
||||
|
||||
List<string> options = Enum.GetNames(typeof(EType)).ToList();
|
||||
Dropdown.ClearOptions();
|
||||
Dropdown.AddOptions(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3bb371cc7ac46f4ea9d3afec9ab2a6e
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class UI_AuthenticationItem : UIBase
|
||||
{
|
||||
public TMP_InputField InputField;
|
||||
public TMP_Dropdown Dropdown;
|
||||
public Button Button_Remove;
|
||||
|
||||
public enum EType
|
||||
{
|
||||
String,
|
||||
Int,
|
||||
Boolean,
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InputField = transform.Find(nameof(InputField)).GetComponent<TMP_InputField>();
|
||||
Dropdown = transform.Find (nameof(Dropdown)).GetComponent<TMP_Dropdown>();
|
||||
Button_Remove = transform.Find(nameof(Button_Remove)).GetComponent<Button>();
|
||||
Button_Remove.onClick.AddListener(() => Destroy(gameObject));
|
||||
|
||||
List<string> options = Enum.GetNames(typeof(EType)).ToList();
|
||||
Dropdown.ClearOptions();
|
||||
Dropdown.AddOptions(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 972a710d67574c74f8adf612eeb0cbe8
|
||||
63
Assets/NewStudioPGD/Scripts/UI/Element/UI_LogicItem.cs
Normal file
63
Assets/NewStudioPGD/Scripts/UI/Element/UI_LogicItem.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class UI_LogicItem : UIBase
|
||||
{
|
||||
public Button Button_Edit;
|
||||
public Button Button_Remove;
|
||||
public Button Button_Add;
|
||||
|
||||
public TextMeshProUGUI Text_Title;
|
||||
|
||||
public Action<UI_LogicItem> onClickAdd;
|
||||
public Action<ELogic> onClickEdit;
|
||||
public Action<UI_LogicItem> onClickRemove;
|
||||
|
||||
private ELogic currentLogic;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
Button_Edit = transform.Find(nameof(Button_Edit)).GetComponent<Button>();
|
||||
Button_Remove = transform.Find(nameof(Button_Remove)).GetComponent<Button>();
|
||||
Button_Add = transform.Find(nameof(Button_Add)).GetComponent<Button>();
|
||||
Text_Title = transform.Find(nameof(Text_Title)).GetComponent<TextMeshProUGUI>();
|
||||
|
||||
Button_Edit.onClick.AddListener(OnClickEdit);
|
||||
Button_Remove.onClick.AddListener(OnClickRemove);
|
||||
Button_Add.onClick.AddListener(OnClickAdd);
|
||||
|
||||
Button_Edit.gameObject.SetActive(false);
|
||||
Button_Remove.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnClickEdit()
|
||||
{
|
||||
onClickEdit?.Invoke(currentLogic);
|
||||
}
|
||||
|
||||
private void OnClickRemove()
|
||||
{
|
||||
onClickRemove?.Invoke(this);
|
||||
}
|
||||
|
||||
private void OnClickAdd()
|
||||
{
|
||||
onClickAdd?.Invoke(this);
|
||||
}
|
||||
|
||||
public void OnSelectLogic(ELogic logic)
|
||||
{
|
||||
currentLogic = logic;
|
||||
Text_Title.text = logic.GetDescription();
|
||||
Button_Add.gameObject.SetActive(false);
|
||||
Button_Edit.gameObject.SetActive(true);
|
||||
Button_Remove.gameObject.SetActive(true);
|
||||
Text_Title.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2004e1ed528dd79428503210325c9aa0
|
||||
8
Assets/NewStudioPGD/Scripts/UI/Panel.meta
Normal file
8
Assets/NewStudioPGD/Scripts/UI/Panel.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57f9d4f8767e32144acafc24cabc8d0f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
102
Assets/NewStudioPGD/Scripts/UI/Panel/Panel_AppLogicList.cs
Normal file
102
Assets/NewStudioPGD/Scripts/UI/Panel/Panel_AppLogicList.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using NUnit.Framework;
|
||||
using Ookii.Dialogs;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
using XED.Manage;
|
||||
using XRLib.UI;
|
||||
using static UnityEngine.Rendering.DebugUI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class Panel_AppLogicList : PanelBase
|
||||
{
|
||||
private List<UI_LogicItem> itemList = new();
|
||||
public GameObject logicItem;
|
||||
public RectTransform itemRoot;
|
||||
|
||||
public UI_LogicItem selectItem;
|
||||
public GameObject curInspectorPanel;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
logicItem = Resources.Load<GameObject>("Prefabs/UI/PRF_LogicItem");
|
||||
CreateItem();
|
||||
}
|
||||
|
||||
private void CreateItem()
|
||||
{
|
||||
UI_LogicItem item = Instantiate(logicItem, itemRoot).GetComponent<UI_LogicItem>();
|
||||
item.onClickAdd += OnClickAdd;
|
||||
item.onClickEdit += OnClickEdit;
|
||||
item.onClickRemove += OnClickRemove;
|
||||
itemList.Add(item);
|
||||
}
|
||||
|
||||
private void OnClickAdd(UI_LogicItem item)
|
||||
{
|
||||
selectItem = item;
|
||||
EventConnector.instance.GetCanvas<StudioCanvas_Popup>().panel_selectlogic.Open(true);
|
||||
}
|
||||
|
||||
private void OnClickEdit(ELogic logic)
|
||||
{
|
||||
if (curInspectorPanel != null)
|
||||
{
|
||||
curInspectorPanel.gameObject.SetActive(false);
|
||||
curInspectorPanel = null;
|
||||
}
|
||||
|
||||
switch (logic)
|
||||
{
|
||||
case ELogic.AppSetting:
|
||||
curInspectorPanel = EventConnector.instance.GetCanvas<StudioCanvas_Popup>().panel_appsetting.gameObject;
|
||||
break;
|
||||
case ELogic.Authentication:
|
||||
curInspectorPanel = EventConnector.instance.GetCanvas<StudioCanvas_Popup>().panel_authentication.gameObject;
|
||||
break;
|
||||
case ELogic.Language:
|
||||
break;
|
||||
case ELogic.Logging:
|
||||
break;
|
||||
case ELogic.APIConnection:
|
||||
break;
|
||||
case ELogic.MQTTConnection:
|
||||
break;
|
||||
case ELogic.Create3DObject:
|
||||
break;
|
||||
case ELogic.CreateUI:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (curInspectorPanel != null)
|
||||
curInspectorPanel.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnClickRemove(UI_LogicItem item)
|
||||
{
|
||||
itemList.Remove(item);
|
||||
Destroy(item.gameObject);
|
||||
|
||||
if(selectItem == item)
|
||||
{
|
||||
selectItem = null;
|
||||
if (curInspectorPanel != null)
|
||||
curInspectorPanel.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (itemList.Count == 0)
|
||||
CreateItem();
|
||||
}
|
||||
|
||||
public void OnSelectLogic(ELogic logic)
|
||||
{
|
||||
selectItem.OnSelectLogic(logic);
|
||||
CreateItem();
|
||||
EventConnector.instance.GetCanvas<StudioCanvas_Popup>().panel_selectlogic.Open(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 046f1781b15f8e5488ff7d69458b910b
|
||||
41
Assets/NewStudioPGD/Scripts/UI/Panel/Panel_AppSetting.cs
Normal file
41
Assets/NewStudioPGD/Scripts/UI/Panel/Panel_AppSetting.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace XED.UI
|
||||
{
|
||||
public class Panel_AppSetting : PanelBase
|
||||
{
|
||||
private GameObject itemPrefab;
|
||||
private RectTransform Info;
|
||||
|
||||
public Button Button_Add;
|
||||
public Button Button_Save;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
itemPrefab = Resources.Load<GameObject>("Prefabs/UI/PRF_AppSettingItem");
|
||||
|
||||
Button_Add.onClick.AddListener(AddItem);
|
||||
Button_Save.onClick.AddListener(OnClickSave);
|
||||
|
||||
AddItem();
|
||||
}
|
||||
|
||||
private void AddItem()
|
||||
{
|
||||
GameObject item = Instantiate(itemPrefab, Info);
|
||||
item.transform.SetSiblingIndex(Info.childCount - 2);
|
||||
}
|
||||
|
||||
private void OnClickSave()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Open(bool isOpen)
|
||||
{
|
||||
SetActive(isOpen);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user