Compare commits
131 Commits
pgd/202504
...
jym/250521
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6ce1d7cc6 | ||
| bdabb5f4ef | |||
| 4e0a05839b | |||
|
|
bf837a42c7 | ||
| 0b0d236821 | |||
| 4c02c24680 | |||
| 521b7e9de6 | |||
| cd3b70644d | |||
| ec82271fb0 | |||
| 46bf63621d | |||
| aaf4bf0981 | |||
| 41d23c984e | |||
| bdc35636bc | |||
|
|
415b4f5f49 | ||
|
|
59821ac6dc | ||
| 003e52ff2e | |||
|
|
17b472745c | ||
|
|
999c94ed1f | ||
| bfdaeaab19 | |||
| 000e328c6e | |||
| 818dc2e703 | |||
| a74afe0319 | |||
|
|
db43ffbfe1 | ||
| 911d2901ba | |||
| 69995e6d0d | |||
| b2941f6010 | |||
| 5f53518c8b | |||
|
|
b87bc2dc66 | ||
| 5dc44ba995 | |||
| 5dbe535810 | |||
| 0512d1bce3 | |||
|
|
4ccfd08ef6 | ||
|
|
78aa08dc38 | ||
|
|
d9cbd84332 | ||
| 158efff01f | |||
|
|
3a2f634096 | ||
| 3c73f1cdbc | |||
| 036e2dbfeb | |||
| e703d2fcf5 | |||
| 7b62435115 | |||
|
|
16b00a0183 | ||
|
|
297c7b1e53 | ||
|
|
e2683e77c4 | ||
| ed51e6f85a | |||
|
|
6f93f2c02c | ||
|
|
14fef6bb18 | ||
| 33074bbf32 | |||
|
|
cf8ce3303d | ||
| a1476fe166 | |||
| 61c3b40468 | |||
| 51315cbe5f | |||
| f6d787cb19 | |||
|
|
ca40a6bb4a | ||
|
|
265d6159ff | ||
|
|
43cb130001 | ||
|
|
f82c60d1fc | ||
|
|
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 |
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"
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace XED
|
||||
namespace Studio
|
||||
{
|
||||
//TODO::areabox가 아니라 TwinObject를 대상으로 동작하도록 수정
|
||||
public class ObjectDistanceLine : MonoBehaviour
|
||||
|
||||
@@ -5,7 +5,7 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace XED.UI
|
||||
namespace Studio.UI
|
||||
{
|
||||
public class FontChanger : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XRLib;
|
||||
using XED;
|
||||
using Studio;
|
||||
|
||||
[CustomAsset(".ini")]
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using UnityEditor.AddressableAssets.Settings;
|
||||
using UnityEditor.AddressableAssets;
|
||||
#endif
|
||||
|
||||
namespace XED
|
||||
namespace Studio
|
||||
{
|
||||
public class TwinObjectPreprocessingHelper
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
8
Assets/Image/UI.meta
Normal file
8
Assets/Image/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef1eb64dbdc563248ac417502b9515f8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Image/UI/image_scroll_up.png
Normal file
BIN
Assets/Image/UI/image_scroll_up.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 201 B |
117
Assets/Image/UI/image_scroll_up.png.meta
Normal file
117
Assets/Image/UI/image_scroll_up.png.meta
Normal file
@@ -0,0 +1,117 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5c740338b0b3784783863fc03a6103b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/NewStudioJYM.meta
Normal file
8
Assets/NewStudioJYM.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f1ab105e95a7ee44965ac5927623809
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25177
Assets/NewStudioJYM/3D Factory.unity
Normal file
25177
Assets/NewStudioJYM/3D Factory.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/3D Factory.unity.meta
Normal file
7
Assets/NewStudioJYM/3D Factory.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a6930af93fbf0e4ab56103bf715341e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
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:
|
||||
26557
Assets/NewStudioJYM/ExitChecker.unity
Normal file
26557
Assets/NewStudioJYM/ExitChecker.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/NewStudioJYM/ExitChecker.unity.meta
Normal file
7
Assets/NewStudioJYM/ExitChecker.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 319962c572705f943b93efea9c0d6e93
|
||||
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 Studio
|
||||
{
|
||||
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>, SaveFilterData> mqttData;
|
||||
public List<SaveMQTTData> saveMQTTDatas = new List<SaveMQTTData>();
|
||||
|
||||
public Action<string, List<DataClass>, SaveFilterData> 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(UI_DataBindingItem item)
|
||||
{
|
||||
List<DataClass> dataclasses = new List<DataClass>();
|
||||
|
||||
foreach (var data in this.loadMQTTData.dataList)
|
||||
{
|
||||
if (item.GetTopicName() == data.name)
|
||||
{
|
||||
dataclasses.Add(data);
|
||||
}
|
||||
}
|
||||
mqttData?.Invoke(dataclasses, item.filterData);
|
||||
}
|
||||
public void SetMQTTData(SaveMQTTData saveMQTTData)
|
||||
{
|
||||
saveMQTTDatas.Clear();
|
||||
saveMQTTDatas.Add(saveMQTTData);
|
||||
}
|
||||
|
||||
public void SetFilterData(UI_DataBindingItem item, DataClass dataClass)
|
||||
{
|
||||
List<DataClass> dataclasses = new List<DataClass>();
|
||||
dataclasses.Add(dataClass);
|
||||
|
||||
apiData?.Invoke(item.GetTopicName(), dataclasses, item.filterData);
|
||||
}
|
||||
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
|
||||
108
Assets/NewStudioJYM/Scripts/Panel_APIConnectModal.cs
Normal file
108
Assets/NewStudioJYM/Scripts/Panel_APIConnectModal.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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<UI_DataBindingItem, 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);
|
||||
OnUrlValueChanged(0);
|
||||
}
|
||||
|
||||
private void OnUrlValueChanged(int index)
|
||||
{
|
||||
selectedUrlData = api.dataList[index];
|
||||
}
|
||||
|
||||
private void OnClickFilterButton(UI_DataBindingItem item)
|
||||
{
|
||||
selectedTopicItem = item;
|
||||
onClickFilterButton?.Invoke(selectedTopicItem, 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
|
||||
177
Assets/NewStudioJYM/Scripts/Panel_AlarmConnectModal.cs
Normal file
177
Assets/NewStudioJYM/Scripts/Panel_AlarmConnectModal.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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
|
||||
361
Assets/NewStudioJYM/Scripts/Panel_DataConnectModal.cs
Normal file
361
Assets/NewStudioJYM/Scripts/Panel_DataConnectModal.cs
Normal file
@@ -0,0 +1,361 @@
|
||||
using Newtonsoft.Json;
|
||||
using Studio.UVC.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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 UVCDropDown 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");
|
||||
|
||||
Dropdown_DataList = GetComponentInChildren<UVCDropDown>();
|
||||
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.Init();
|
||||
|
||||
List<string> displayNames = new List<string>();
|
||||
|
||||
if (isAPI)
|
||||
{
|
||||
apiDatas.Clear();
|
||||
|
||||
foreach (var api in data)
|
||||
{
|
||||
apiDatas.Add(api);
|
||||
displayNames.Add(api.name);
|
||||
}
|
||||
|
||||
Dropdown_DataList.SetOptions(displayNames);
|
||||
Dropdown_DataList.DropDown.onValueChanged.RemoveAllListeners();
|
||||
Dropdown_DataList.DropDown.onValueChanged.AddListener(OnValueChangedAPIDropDown);
|
||||
|
||||
var notCheckIndex = currentDataListOptionName != null ? displayNames.IndexOf(currentDataListOptionName) : 0;
|
||||
var index = notCheckIndex >= 0 ? notCheckIndex : 0;
|
||||
|
||||
Dropdown_DataList.DropDown.SetValueWithoutNotify(index);
|
||||
SetLoadApiData(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
dataStorageDatas.Clear();
|
||||
|
||||
foreach (var storageData in data)
|
||||
{
|
||||
dataStorageDatas.Add(storageData);
|
||||
displayNames.Add(storageData.name);
|
||||
}
|
||||
|
||||
Dropdown_DataList.SetOptions(displayNames);
|
||||
Dropdown_DataList.DropDown.onValueChanged.RemoveAllListeners();
|
||||
Dropdown_DataList.DropDown.onValueChanged.AddListener(OnValueChangedDataStorageDropDown);
|
||||
|
||||
var notCheckIndex = currentDataListOptionName != null ? displayNames.IndexOf(currentDataListOptionName) : 0;
|
||||
var index = notCheckIndex >= 0 ? notCheckIndex : 0;
|
||||
|
||||
Dropdown_DataList.DropDown.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.GetSelectOptionName();
|
||||
|
||||
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
|
||||
143
Assets/NewStudioJYM/Scripts/Panel_DataFilterSetting.cs
Normal file
143
Assets/NewStudioJYM/Scripts/Panel_DataFilterSetting.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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;
|
||||
private bool isApiMode;
|
||||
|
||||
public Action<SaveFilterData> onSaveAPIFilterData;
|
||||
public Action<SaveFilterData> onSaveMQTTFilterData;
|
||||
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();
|
||||
if (isApiMode)
|
||||
{
|
||||
onSaveAPIFilterData?.Invoke(saveFilterData);
|
||||
}
|
||||
else
|
||||
{
|
||||
onSaveMQTTFilterData?.Invoke(saveFilterData);
|
||||
}
|
||||
|
||||
CloseModal();
|
||||
}
|
||||
public void SetLoadMQTTDataList(List<DataClass> dataClasses, SaveFilterData filterData)
|
||||
{
|
||||
isApiMode = false;
|
||||
SetLoadDataList(dataClasses);
|
||||
|
||||
if (filterData.data.fields.Count > 0)
|
||||
{
|
||||
this.className = filterData.name;
|
||||
AddDataSettingItem(filterData.data);
|
||||
}
|
||||
}
|
||||
public void SetLoadAPIDataList(string className, List<DataClass> dataClasses, SaveFilterData filterData)
|
||||
{
|
||||
isApiMode = true;
|
||||
this.className = className;
|
||||
SetLoadDataList(dataClasses);
|
||||
|
||||
if (filterData.data.fields.Count > 0)
|
||||
{
|
||||
this.className = filterData.name;
|
||||
AddDataSettingItem(filterData.data);
|
||||
}
|
||||
}
|
||||
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 Studio.Manage;
|
||||
using System.Linq;
|
||||
using Studio.Core;
|
||||
using Studio.Command;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
|
||||
namespace Studio.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
|
||||
18
Assets/NewStudioJYM/Scripts/Panel_LoggingModal.cs
Normal file
18
Assets/NewStudioJYM/Scripts/Panel_LoggingModal.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
public class Panel_LoggingModal : PanelBase
|
||||
{
|
||||
public void Open()
|
||||
{
|
||||
SetActive(true);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioJYM/Scripts/Panel_LoggingModal.cs.meta
Normal file
2
Assets/NewStudioJYM/Scripts/Panel_LoggingModal.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 887127ae2ff06194285151b68c80d0df
|
||||
131
Assets/NewStudioJYM/Scripts/Panel_MQTTConnectModal.cs
Normal file
131
Assets/NewStudioJYM/Scripts/Panel_MQTTConnectModal.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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<UI_DataBindingItem> 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");
|
||||
|
||||
SetURLText();
|
||||
|
||||
Button_AddTopic.onClick.AddListener(AddTopicItem);
|
||||
Button_Save.onClick.AddListener(Save);
|
||||
}
|
||||
|
||||
//app_config
|
||||
/// <summary>
|
||||
/// 설정한 데이터값 가져와 적용
|
||||
/// </summary>
|
||||
private void ConnectedData()
|
||||
{
|
||||
//string path = Path.Combine(Application.streamingAssetsPath, "app_config.json");
|
||||
//string json = System.IO.File.ReadAllText(path);
|
||||
//loadMQTTData = JsonUtility.FromJson<MQTTData>(json);
|
||||
|
||||
SetURLText();
|
||||
}
|
||||
/// <summary>
|
||||
/// 도메인 PORT 설정
|
||||
/// </summary>
|
||||
private void SetURLText()
|
||||
{
|
||||
Text_Domain.SetText(loadMQTTData.domain);
|
||||
Text_Port.SetText(loadMQTTData.port);
|
||||
}
|
||||
private void OnClickFilterButton(UI_DataBindingItem item)
|
||||
{
|
||||
selectedTopicItem = item;
|
||||
onClickFilterButton?.Invoke(selectedTopicItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 토픽 아이템 추가
|
||||
/// </summary>
|
||||
private void AddTopicItem()
|
||||
{
|
||||
var item = Instantiate(prf_mqttTopicItem, TopicContent);
|
||||
item.onRemove += RemoveTopicItem;
|
||||
item.onFilter += OnClickFilterButton;
|
||||
topicItems.Add(item);
|
||||
|
||||
Button_AddTopic.transform.SetAsLastSibling();
|
||||
}
|
||||
/// <summary>
|
||||
/// TopicItem 제거
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void RemoveTopicItem(UI_DataBindingItem item)
|
||||
{
|
||||
topicItems.Remove(item);
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MQTT 데이터 추가
|
||||
/// </summary>
|
||||
private void Save()
|
||||
{
|
||||
var saveData = GetMQTTData();
|
||||
onSaveMQTTData?.Invoke(saveData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="filterData"></param>
|
||||
public void SetFilterData(SaveFilterData filterData)
|
||||
{
|
||||
if (selectedTopicItem == null)
|
||||
return;
|
||||
|
||||
selectedTopicItem.SetFilterData(filterData);
|
||||
selectedTopicItem.SetChangedInputFieldTopicName();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MQTTData 가져오기
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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
|
||||
101
Assets/NewStudioJYM/Scripts/Panel_MultilingualSettingModal.cs
Normal file
101
Assets/NewStudioJYM/Scripts/Panel_MultilingualSettingModal.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
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;
|
||||
using Studio.UVC.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
[Serializable]
|
||||
public class LanguageConfig
|
||||
{
|
||||
public string defaultLanguage;
|
||||
public Dictionary<string, string> languages;
|
||||
}
|
||||
public class Panel_MultilingualSettingModal : PanelBase
|
||||
{
|
||||
public UVCDropDown 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()
|
||||
{
|
||||
Dropdown_Languages = GetComponentInChildren<UVCDropDown>();
|
||||
Dropdown_Languages.Init();
|
||||
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];
|
||||
if(string.IsNullOrEmpty(item.Name))
|
||||
{
|
||||
//TODO 팝업창 or 그냥 닫음
|
||||
Debug.Log("취소");
|
||||
return;
|
||||
}
|
||||
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.SetOptions(options);
|
||||
Dropdown_Languages.OnValueChange+=OnLanguageDropdownValueChanged;
|
||||
|
||||
var languageKey = Dropdown_Languages.GetSelectOptionName();
|
||||
selectedLanguage = languages[languageKey];
|
||||
}
|
||||
|
||||
private void OnLanguageDropdownValueChanged(int index)
|
||||
{
|
||||
var languageKey = Dropdown_Languages.GetSelectOptionName();
|
||||
selectedLanguage = languages[languageKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4af5f74e38688c3408f7bc2ef1ff30f8
|
||||
62
Assets/NewStudioJYM/Scripts/StudioJYMCanvas_Popup.cs
Normal file
62
Assets/NewStudioJYM/Scripts/StudioJYMCanvas_Popup.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Studio.UI;
|
||||
using XRLib;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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;
|
||||
public Panel_3DFactorySetting panel_3dfactorysetting;
|
||||
public Panel_DynamicObjectUISetting panel_dynamicobjectuisetting;
|
||||
public Panel_ExitChecker panel_exitchecker;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
canvasHandler = new StudioJYMPopupCanvasHandler(this);
|
||||
}
|
||||
public override void AfterAwake()
|
||||
{
|
||||
var dataManager = FindAnyObjectByType<ConnectDataManager>();
|
||||
var quitManager = FindAnyObjectByType<QuitManager>();
|
||||
|
||||
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;
|
||||
|
||||
panel_exitchecker.onSaveAndExit += quitManager.OnConfirmQuit;
|
||||
panel_exitchecker.onExit += quitManager.OnConfirmQuit;
|
||||
panel_exitchecker.onCancel += quitManager.OnCancelQuit;
|
||||
|
||||
quitManager.onOpen += panel_exitchecker.Open;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce9c9e8dfd0d6774db8b84fbcc818a4e
|
||||
19
Assets/NewStudioJYM/Scripts/StudioJYMPopupCanvasHandler.cs
Normal file
19
Assets/NewStudioJYM/Scripts/StudioJYMPopupCanvasHandler.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using Studio.Manage;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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.onSaveMQTTFilterData += canvas_Popup.panel_mqttconnectmodal.SetFilterData;
|
||||
canvas_Popup.panel_datafiltersetting.onSaveAPIFilterData += canvas_Popup.panel_apiconnectmodal.SetFilterData;
|
||||
|
||||
canvas_Popup.panel_3dfactorysetting.onUISetting += canvas_Popup.panel_dynamicobjectuisetting.SetData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b312c88a0bcbbd04c959de79c2c4cd71
|
||||
166
Assets/NewStudioJYM/Scripts/TestAPIData.cs
Normal file
166
Assets/NewStudioJYM/Scripts/TestAPIData.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
#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 isUse;
|
||||
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>();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class DynamicObjectDatas
|
||||
{
|
||||
public List<DataList> dataList = new List<DataList>();
|
||||
}
|
||||
[Serializable]
|
||||
public class DataList
|
||||
{
|
||||
public string name;
|
||||
public string dashboardStyle;
|
||||
public List<Datum> datas = new List<Datum>();
|
||||
}
|
||||
[Serializable]
|
||||
public class Datum
|
||||
{
|
||||
public string dataName;
|
||||
public string dataType;
|
||||
public string dataValue;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ModelList
|
||||
{
|
||||
public List<ModelName> modelList = new List<ModelName>();
|
||||
}
|
||||
[Serializable]
|
||||
public class ModelName
|
||||
{
|
||||
public string modelName;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class SaveModelDatas
|
||||
{
|
||||
public List<ModelData> modelDatas = new List<ModelData>();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ModelData
|
||||
{
|
||||
public string dataName;
|
||||
public string modelName;
|
||||
public DataList modelData;
|
||||
}
|
||||
|
||||
}
|
||||
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 Studio
|
||||
{
|
||||
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 Studio
|
||||
{
|
||||
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 Studio
|
||||
{
|
||||
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 Studio
|
||||
{
|
||||
|
||||
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 Studio
|
||||
{
|
||||
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 Studio
|
||||
{
|
||||
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
|
||||
150
Assets/NewStudioJYM/Scripts/UI_DataTypeSelectedItem.cs
Normal file
150
Assets/NewStudioJYM/Scripts/UI_DataTypeSelectedItem.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
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;
|
||||
|
||||
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 = field.isUse == "False" ? false : true;
|
||||
|
||||
if (fieldData.type == "Matching")
|
||||
{
|
||||
Button_MatchingAddData.gameObject.SetActive(true);
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
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()
|
||||
{
|
||||
FieldData field = new FieldData();
|
||||
field.isUse = Toggle_Use.isOn.ToString();
|
||||
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
|
||||
82
Assets/NewStudioJYM/Scripts/UI_DynamicObjectUISettingItem.cs
Normal file
82
Assets/NewStudioJYM/Scripts/UI_DynamicObjectUISettingItem.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XRLib.UI;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using System;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
public enum UIDesignStyle
|
||||
{
|
||||
Sample1,
|
||||
Sample2,
|
||||
Sample3
|
||||
}
|
||||
public class UI_DynamicObjectUISettingItem : UIBase
|
||||
{
|
||||
private TextMeshProUGUI Text_ClassName;
|
||||
private TMP_Dropdown Dropdown_UIDesignStyle;
|
||||
private RectTransform DataContent;
|
||||
|
||||
private UI_DynamicDataStyleItem prf_DynamicDataStyleItem;
|
||||
private List<UI_DynamicDataStyleItem> dynamicDataStyleItems = new List<UI_DynamicDataStyleItem>();
|
||||
|
||||
public List<DataList> dynamicObjectDatas = new List<DataList>();
|
||||
|
||||
public void SetData(DataList dynamicObjectDatas, UI_DynamicDataStyleItem dynamicDataStyleItem)
|
||||
{
|
||||
Text_ClassName.SetText(dynamicObjectDatas.name);
|
||||
prf_DynamicDataStyleItem = dynamicDataStyleItem;
|
||||
|
||||
SetUIDesignStyleDropdown(dynamicObjectDatas);
|
||||
SetDataItems(dynamicObjectDatas.datas);
|
||||
}
|
||||
private void SetUIDesignStyleDropdown(DataList dataList)
|
||||
{
|
||||
Dropdown_UIDesignStyle.ClearOptions();
|
||||
var types = Enum.GetNames(typeof(UIDesignStyle));
|
||||
List<string> options = new List<string>();
|
||||
|
||||
options.Add("Select Dashboard Style");
|
||||
|
||||
for (int i = 0; i < types.Length; i++)
|
||||
{
|
||||
options.Add(types[i]);
|
||||
}
|
||||
Dropdown_UIDesignStyle.AddOptions(options);
|
||||
|
||||
if (dataList.dashboardStyle != string.Empty)
|
||||
{
|
||||
Dropdown_UIDesignStyle.value = options.IndexOf(dataList.dashboardStyle);
|
||||
}
|
||||
}
|
||||
private void SetDataItems(List<Datum> datas)
|
||||
{
|
||||
foreach(var item in dynamicDataStyleItems)
|
||||
{
|
||||
Destroy(item.gameObject);
|
||||
}
|
||||
dynamicDataStyleItems.Clear();
|
||||
|
||||
foreach(var data in datas)
|
||||
{
|
||||
var item = Instantiate(prf_DynamicDataStyleItem, DataContent);
|
||||
item.SetData(data);
|
||||
dynamicDataStyleItems.Add(item);
|
||||
}
|
||||
}
|
||||
public DataList GetDataList()
|
||||
{
|
||||
DataList dataList = new DataList();
|
||||
dataList.name = Text_ClassName.text;
|
||||
dataList.dashboardStyle = Dropdown_UIDesignStyle.options[Dropdown_UIDesignStyle.value].text;
|
||||
|
||||
foreach (var dynamicDataStyleItem in dynamicDataStyleItems)
|
||||
{
|
||||
dataList.datas.Add(dynamicDataStyleItem.GetDatum());
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36a57cb1e80b16e48a165fa69785b249
|
||||
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 Studio
|
||||
{
|
||||
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 Studio
|
||||
{
|
||||
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 Studio
|
||||
{
|
||||
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:
|
||||
8
Assets/NewStudioPGD/DashBoard.meta
Normal file
8
Assets/NewStudioPGD/DashBoard.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74113b7751418504f8339133a27d9551
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/NewStudioPGD/DashBoard/CreateUIPanel.cs
Normal file
19
Assets/NewStudioPGD/DashBoard/CreateUIPanel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
public class CreateUIPanel : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioPGD/DashBoard/CreateUIPanel.cs.meta
Normal file
2
Assets/NewStudioPGD/DashBoard/CreateUIPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e68ae67fb2043e64fb8447ecbd14b793
|
||||
13
Assets/NewStudioPGD/DashBoard/DashBoardHeadLine.cs
Normal file
13
Assets/NewStudioPGD/DashBoard/DashBoardHeadLine.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DashBoardHeadLine : MonoBehaviour
|
||||
{
|
||||
private RectTransform rectTransform;
|
||||
public RectTransform RectTransform { get { return rectTransform; } }
|
||||
private void Awake()
|
||||
{
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9dd25c3ae25c904fb416d01a1c3f5e6
|
||||
guid: 00c1cf356f204f94fb55cfbce82d2d36
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
120
Assets/NewStudioPGD/DashBoard/SDIDashboardTest.cs
Normal file
120
Assets/NewStudioPGD/DashBoard/SDIDashboardTest.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using Studio.UVC.UI;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using Studio.UI;
|
||||
|
||||
namespace Studio
|
||||
{
|
||||
public class SDIDashboardTest : MonoBehaviour
|
||||
{
|
||||
string testJson = @"
|
||||
{
|
||||
""stockerStackAggregation"": [
|
||||
{
|
||||
""CAPACITY"": ""89.57"",
|
||||
""ENG_EQP_NAME"": ""상온Aging #03"",
|
||||
""KOR_EQP_NAME"": ""상온Aging #03"",
|
||||
""MAXIMUM_CAPACITY"": ""834"",
|
||||
""MAXIMUM_TRAY_CAPACITY"": ""2502"",
|
||||
""RACK_DISABLE_COUNT"": ""4"",
|
||||
""RACK_EMPTY_COUNT"": ""87"",
|
||||
""RACK_LOAD_COUNT"": ""747"",
|
||||
""RESERVATED_RETURN_COUNT"": ""5"",
|
||||
""STOCKER_NAME"": ""HFF09AGN0300"",
|
||||
""TIMESTAMP"": ""2025-03-25T11:59:56.000Z"",
|
||||
""TRAY_CAPACITY"": ""83.25"",
|
||||
""TRAY_COUNT"": ""2083"",
|
||||
""TRAY_REWORK_COUNT_AVG"": ""3"",
|
||||
""TRAY_REWORK_COUNT_MAX"": ""153"",
|
||||
""TRAY_REWORK_COUNT_MIN"": ""0""
|
||||
},
|
||||
{
|
||||
""CAPACITY"": ""78.21"",
|
||||
""ENG_EQP_NAME"": ""상온Aging #01"",
|
||||
""KOR_EQP_NAME"": ""상온Aging #01"",
|
||||
""MAXIMUM_CAPACITY"": ""920"",
|
||||
""MAXIMUM_TRAY_CAPACITY"": ""2800"",
|
||||
""RACK_DISABLE_COUNT"": ""2"",
|
||||
""RACK_EMPTY_COUNT"": ""200"",
|
||||
""RACK_LOAD_COUNT"": ""720"",
|
||||
""RESERVATED_RETURN_COUNT"": ""8"",
|
||||
""STOCKER_NAME"": ""HFF09AGN0100"",
|
||||
""TIMESTAMP"": ""2025-03-25T12:00:56.000Z"",
|
||||
""TRAY_CAPACITY"": ""70.88"",
|
||||
""TRAY_COUNT"": ""1980"",
|
||||
""TRAY_REWORK_COUNT_AVG"": ""5"",
|
||||
""TRAY_REWORK_COUNT_MAX"": ""140"",
|
||||
""TRAY_REWORK_COUNT_MIN"": ""1""
|
||||
},
|
||||
{
|
||||
""CAPACITY"": ""82.73"",
|
||||
""ENG_EQP_NAME"": ""상온Aging #02"",
|
||||
""KOR_EQP_NAME"": ""상온Aging #02"",
|
||||
""MAXIMUM_CAPACITY"": ""850"",
|
||||
""MAXIMUM_TRAY_CAPACITY"": ""2600"",
|
||||
""RACK_DISABLE_COUNT"": ""3"",
|
||||
""RACK_EMPTY_COUNT"": ""146"",
|
||||
""RACK_LOAD_COUNT"": ""704"",
|
||||
""RESERVATED_RETURN_COUNT"": ""7"",
|
||||
""STOCKER_NAME"": ""HFF09AGN0200"",
|
||||
""TIMESTAMP"": ""2025-03-25T12:01:56.000Z"",
|
||||
""TRAY_CAPACITY"": ""76.88"",
|
||||
""TRAY_COUNT"": ""1999"",
|
||||
""TRAY_REWORK_COUNT_AVG"": ""2"",
|
||||
""TRAY_REWORK_COUNT_MAX"": ""120"",
|
||||
""TRAY_REWORK_COUNT_MIN"": ""0""
|
||||
},
|
||||
{
|
||||
""CAPACITY"": ""64.92"",
|
||||
""ENG_EQP_NAME"": ""저온Aging #01"",
|
||||
""KOR_EQP_NAME"": ""저온Aging #01"",
|
||||
""MAXIMUM_CAPACITY"": ""780"",
|
||||
""MAXIMUM_TRAY_CAPACITY"": ""2300"",
|
||||
""RACK_DISABLE_COUNT"": ""5"",
|
||||
""RACK_EMPTY_COUNT"": ""273"",
|
||||
""RACK_LOAD_COUNT"": ""507"",
|
||||
""RESERVATED_RETURN_COUNT"": ""3"",
|
||||
""STOCKER_NAME"": ""HFF09AGN0400"",
|
||||
""TIMESTAMP"": ""2025-03-25T12:02:56.000Z"",
|
||||
""TRAY_CAPACITY"": ""62.83"",
|
||||
""TRAY_COUNT"": ""1870"",
|
||||
""TRAY_REWORK_COUNT_AVG"": ""4"",
|
||||
""TRAY_REWORK_COUNT_MAX"": ""99"",
|
||||
""TRAY_REWORK_COUNT_MIN"": ""0""
|
||||
}
|
||||
]
|
||||
}";
|
||||
|
||||
|
||||
private void TestDict()
|
||||
{
|
||||
var list = new Dictionary<string, Dictionary<string, string>>();
|
||||
|
||||
JObject root = JObject.Parse(testJson);
|
||||
JArray array = (JArray)root["stockerStackAggregation"];
|
||||
|
||||
foreach (JObject obj in array)
|
||||
{
|
||||
var entry = new Dictionary<string, string>();
|
||||
string id = obj["KOR_EQP_NAME"]?.ToString();
|
||||
|
||||
foreach (JProperty prop in obj.Properties())
|
||||
{
|
||||
entry[prop.Name] = prop.Value.ToString();
|
||||
}
|
||||
|
||||
list[id] = entry;
|
||||
}
|
||||
FindAnyObjectByType<UINewLoadFactory>().SetItem(list);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
TestDict();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/NewStudioPGD/DashBoard/SDIDashboardTest.cs.meta
Normal file
2
Assets/NewStudioPGD/DashBoard/SDIDashboardTest.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d26fb80f9d6ceb140b999f727f46b103
|
||||
71
Assets/NewStudioPGD/DashBoard/UICircleProgressBar.cs
Normal file
71
Assets/NewStudioPGD/DashBoard/UICircleProgressBar.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Localization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
public class UICircleProgressBar : MonoBehaviour
|
||||
{
|
||||
//private RectTransform FillHandler_Start;
|
||||
//private RectTransform FillHandler_End;
|
||||
|
||||
private Image Image_fill_progressbar;
|
||||
//private Image Image_CricleField_start;
|
||||
private Text Text_Value;
|
||||
private TextMeshProUGUI Text_Average;
|
||||
|
||||
public Color textColor;
|
||||
public bool IsEndPointOn;
|
||||
public void Init()
|
||||
{
|
||||
var recttransforms = GetComponentsInChildren<RectTransform>();
|
||||
var images = GetComponentsInChildren<Image>();
|
||||
|
||||
//FillHandler_Start = recttransforms.First(x=>x.name.Equals(nameof(FillHandler_Start)));
|
||||
//FillHandler_End = recttransforms.First(x => x.name.Equals(nameof(FillHandler_End)));
|
||||
//if(IsEndPointOn == false)
|
||||
// FillHandler_End.gameObject.SetActive(false);
|
||||
Image_fill_progressbar = images.First(x => x.name.Equals(nameof(Image_fill_progressbar)));
|
||||
//Image_CricleField_start = images.First(x => x.name.Equals(nameof(Image_CricleField_start)));
|
||||
|
||||
Text_Value = GetComponentInChildren<Text>();
|
||||
Text_Average = GetComponentInChildren<TextMeshProUGUI>();
|
||||
Text_Average.color = textColor;
|
||||
}
|
||||
|
||||
public float degree;
|
||||
public void SetValue(float value)
|
||||
{
|
||||
var clampAmount = Mathf.Clamp(value / 100f, 0, 1);
|
||||
Image_fill_progressbar.fillAmount = clampAmount;
|
||||
var color = SetColor(value);
|
||||
Image_fill_progressbar.color = color;
|
||||
//Image_CricleField_start.color = color;
|
||||
//var clampZ = Mathf.Clamp((value * 3.6f) -40f, 35f, 320f);
|
||||
//FillHandler_Start.transform.localEulerAngles = new Vector3(0, 0, -clampZ);
|
||||
Text_Value.text =$"{string.Format("{0:N1}" ,value)}%";
|
||||
}
|
||||
|
||||
private Color SetColor(float value)
|
||||
{
|
||||
var color = Color.white;
|
||||
|
||||
if (value > 90f)
|
||||
{
|
||||
color = Color.red;
|
||||
}
|
||||
else if (value > 80f)
|
||||
{
|
||||
color = Color.yellow;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.green;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fd0588328460cf42b8e48547e25a5a3
|
||||
50
Assets/NewStudioPGD/DashBoard/UIDetailButton.cs
Normal file
50
Assets/NewStudioPGD/DashBoard/UIDetailButton.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
public class UIDetailButton : UIBase, ITabButton
|
||||
{
|
||||
public int Index { get; set; }
|
||||
private Button button;
|
||||
[SerializeField]
|
||||
private bool selected = false;
|
||||
public UnityEvent<int, bool> onClick = new UnityEvent<int, bool>();
|
||||
|
||||
public void Init()
|
||||
{
|
||||
button = GetComponent<UnityEngine.UI.Button>();
|
||||
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
selected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
selected = true;
|
||||
}
|
||||
onClick.Invoke(Index, selected);
|
||||
});
|
||||
}
|
||||
if (selected) Select();
|
||||
else Deselect();
|
||||
}
|
||||
|
||||
public void Deselect()
|
||||
{
|
||||
selected = false;
|
||||
}
|
||||
|
||||
public void Select()
|
||||
{
|
||||
selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
Assets/NewStudioPGD/DashBoard/UIDetailButton.cs.meta
Normal file
2
Assets/NewStudioPGD/DashBoard/UIDetailButton.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fbbf8626703b7e479b10ed7a18b8380
|
||||
93
Assets/NewStudioPGD/DashBoard/UINewLoadFactory.cs
Normal file
93
Assets/NewStudioPGD/DashBoard/UINewLoadFactory.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Studio.UVC.Controller.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEditor.Localization.Plugins.XLIFF.V12;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
public class UINewLoadFactory : PanelBase
|
||||
{
|
||||
private TextMeshProUGUI Text_LoadFactory;
|
||||
private TabController tabController = new();
|
||||
protected ScrollRect scrollRect;
|
||||
private DashBoardHeadLine headLine;
|
||||
|
||||
protected Dictionary<string, UINewStockerValue> itemTable = new();
|
||||
private UINewStockerValue item;
|
||||
private RectTransform rect;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
base.AfterAwake();
|
||||
//titleKey = "realtime_load_factor";
|
||||
Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
rect = GetComponent<RectTransform>();
|
||||
headLine = GetComponentInChildren<DashBoardHeadLine>();
|
||||
Text_LoadFactory = headLine.GetComponentInChildren<TextMeshProUGUI>();
|
||||
scrollRect = GetComponentInChildren<ScrollRect>();
|
||||
|
||||
ExpandYsize();
|
||||
}
|
||||
|
||||
private void ExpandYsize()
|
||||
{
|
||||
var expandSize = 28f + 12f + 24f + 4f;
|
||||
expandSize += itemTable.Count * 169f + 4f + ((itemTable.Count - 1) * 16f);
|
||||
rect.sizeDelta = new Vector2(rect.sizeDelta.x, expandSize);
|
||||
}
|
||||
|
||||
private UINewStockerValue CreateItem(string name)
|
||||
{
|
||||
if (item == null)
|
||||
item = Resources.Load<UINewStockerValue>(UINewStockerValue.PrefabPath);
|
||||
|
||||
var newItem = Instantiate<UINewStockerValue>(item, scrollRect.content);
|
||||
//newItem.name = name;
|
||||
newItem.titleName = name;
|
||||
newItem.transform.localScale = Vector3.one;
|
||||
newItem.InIt(tabController);
|
||||
newItem.Button_Details.onClick.AddListener((int index, bool selected) =>
|
||||
{
|
||||
if (selected)
|
||||
{
|
||||
tabController.Select(index);
|
||||
}
|
||||
else
|
||||
tabController.Deselect();
|
||||
});
|
||||
|
||||
tabController.Add(newItem.Button_Details, newItem);
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public void SetItem(Dictionary<string, Dictionary<string, string>> entitiy)
|
||||
{
|
||||
foreach (var item in entitiy.Values)
|
||||
{
|
||||
string name = item["KOR_EQP_NAME"].Split(' ')[0];
|
||||
if (!itemTable.ContainsKey(name))
|
||||
{
|
||||
itemTable.Add(name, CreateItem(name));
|
||||
ExpandYsize();
|
||||
}
|
||||
itemTable[name].SetItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void Deselect()
|
||||
{
|
||||
tabController.Deselect();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02c8aba09b6cf79448d6d0699308f932
|
||||
guid: 91f1945b0d450c7449b410c927d0abf9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
71
Assets/NewStudioPGD/DashBoard/UINewLoadFactroyItem.cs
Normal file
71
Assets/NewStudioPGD/DashBoard/UINewLoadFactroyItem.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Localization;
|
||||
using UnityEngine.UI;
|
||||
using XRLib.UI;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
public class UINewLoadFactroyItem : UIBase
|
||||
{
|
||||
public static string PrefabsPath = "Prefabs/NewDashBoard/UINewLoadFactroyItem";
|
||||
|
||||
private TextMeshProUGUI Text_Total;
|
||||
private TextMeshProUGUI Text_LoadedQuantity;
|
||||
private TextMeshProUGUI Text_RoomName;
|
||||
private TextMeshProUGUI Text_Rate;
|
||||
private Image Image_Chart;
|
||||
private Image Image_Chart_Bg;
|
||||
|
||||
private float percent;
|
||||
public float Percent { get => percent; }
|
||||
|
||||
private int total;
|
||||
public int Total { get => total; }
|
||||
private int trayCount;
|
||||
public int TrayCount { get => trayCount; }
|
||||
|
||||
private bool isFirst = false;
|
||||
private RectTransform rect;
|
||||
public RectTransform Rect { get { return rect; } }
|
||||
|
||||
public Color color;
|
||||
|
||||
private void Init()
|
||||
{
|
||||
rect = GetComponent<RectTransform>();
|
||||
var textmeshpros = GetComponentsInChildren<TextMeshProUGUI>();
|
||||
Text_Total = textmeshpros.First(x => x.name.Equals(nameof(Text_Total)));
|
||||
Text_Rate = textmeshpros.First(x => x.name.Equals(nameof(Text_Rate)));
|
||||
Text_LoadedQuantity = textmeshpros.First(x => x.name.Equals(nameof(Text_LoadedQuantity)));
|
||||
Text_RoomName = textmeshpros.First(x => x.name.Equals(nameof(Text_RoomName)));
|
||||
var images = GetComponentsInChildren<Image>();
|
||||
Image_Chart_Bg = images.First(x => x.name.Equals(nameof(Image_Chart_Bg)));
|
||||
Image_Chart = images.First(x => x.name.Equals(nameof(Image_Chart)));
|
||||
Image_Chart_Bg.color = color;
|
||||
Image_Chart.color = color;
|
||||
isFirst = true;
|
||||
}
|
||||
|
||||
|
||||
public void SetItem(string roomName, string value, string total =null, string count = null)
|
||||
{
|
||||
if (isFirst == false)
|
||||
Init();
|
||||
|
||||
Text_RoomName.text = roomName;
|
||||
float.TryParse(value, out var chartValue);
|
||||
|
||||
Image_Chart.fillAmount = chartValue / 100f;
|
||||
percent = chartValue;
|
||||
Text_Rate.text = $"{chartValue}%";
|
||||
if(total != null)
|
||||
{
|
||||
Text_Total.text = $"{count}/{total}ea";
|
||||
this.trayCount = int.Parse(count);
|
||||
this.total = int.Parse(total);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 834bc067b08ed824b8b859748bb27a8c
|
||||
guid: cd225f4eeab64434ca41baeccfbba564
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
108
Assets/NewStudioPGD/DashBoard/UINewStockerValue.cs
Normal file
108
Assets/NewStudioPGD/DashBoard/UINewStockerValue.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using Studio.UVC.Controller.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Localization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
public class UINewStockerValue : MonoBehaviour, ITabContent
|
||||
{
|
||||
public static string PrefabPath = "Prefabs/NewDashBoard/UINewStockerValue";
|
||||
|
||||
private TextMeshProUGUI Text_Title;
|
||||
private TextMeshProUGUI Text_Total;
|
||||
private TextMeshProUGUI Text_TrayCount;
|
||||
private TextMeshProUGUI Text_TrayTotalCount;
|
||||
|
||||
private UICircleProgressBar circle_Progressbar;
|
||||
private UIDetailButton button_viewDetails;
|
||||
public Action onCloseSidePanel;
|
||||
public UIDetailButton Button_Details { get => button_viewDetails; }
|
||||
|
||||
public string titleName;
|
||||
private UISideLoadFactory sideItem;
|
||||
|
||||
private RectTransform rect;
|
||||
private Image image;
|
||||
public int Index { get; set; }
|
||||
private TabController controller;
|
||||
|
||||
public void InIt(TabController tabController)
|
||||
{
|
||||
controller = tabController;
|
||||
rect = GetComponent<RectTransform>();
|
||||
image = GetComponent<Image>();
|
||||
var textMeshPros = GetComponentsInChildren<TextMeshProUGUI>();
|
||||
Text_Title = textMeshPros.First(x => x.name.Equals(nameof(Text_Title)));
|
||||
Text_Total = textMeshPros.First(x => x.name.Equals(nameof(Text_Total)));
|
||||
Text_TrayCount = textMeshPros.First(x => x.name.Equals(nameof(Text_TrayCount)));
|
||||
Text_TrayTotalCount = textMeshPros.First(x => x.name.Equals(nameof(Text_TrayTotalCount)));
|
||||
circle_Progressbar = GetComponentInChildren<UICircleProgressBar>();
|
||||
circle_Progressbar.Init();
|
||||
button_viewDetails = GetComponentInChildren<UIDetailButton>();
|
||||
button_viewDetails.Init();
|
||||
sideItem = Create();
|
||||
sideItem.Init();
|
||||
sideItem.onClickClose += DeSelect;
|
||||
sideItem.SetPosition(new Vector3(rect.position.x - (rect.sizeDelta.x * 0.5f), rect.position.y));
|
||||
image.enabled = false;
|
||||
}
|
||||
|
||||
internal void SetItem(Dictionary<string, string> entity)
|
||||
{
|
||||
sideItem.SetItem(titleName, entity);
|
||||
Average();
|
||||
}
|
||||
|
||||
private void DeSelect()
|
||||
{
|
||||
//À̹ÌÁö
|
||||
image.enabled = false;
|
||||
//button_viewDetails.Deselect();
|
||||
controller.Deselect();
|
||||
}
|
||||
|
||||
private void Average()
|
||||
{
|
||||
circle_Progressbar.SetValue(sideItem.Average);
|
||||
Text_Title.text = titleName;
|
||||
Text_Total.text = "total";
|
||||
Text_TrayCount.text = $"{string.Format("{0:#,###}", sideItem.TrayCount)}";
|
||||
Text_TrayTotalCount.text = $"/{string.Format("{0:#,###}", sideItem.Total)}ea";
|
||||
Text_TrayCount.rectTransform.anchoredPosition = new Vector3(-(Text_TrayCount.preferredWidth), Text_TrayCount.rectTransform.anchoredPosition.y);
|
||||
Text_Total.rectTransform.anchoredPosition = new Vector3(-(Text_TrayCount.preferredWidth) - Text_Total.rectTransform.sizeDelta.x - 4f, Text_Total.rectTransform.anchoredPosition.y);
|
||||
}
|
||||
|
||||
private UISideLoadFactory Create()
|
||||
{
|
||||
var asset = Resources.Load<GameObject>(UISideLoadFactory.PrefabsPath);
|
||||
var canvas = FindAnyObjectByType<CreateUIPanel>();
|
||||
var item = Instantiate<GameObject>(asset, canvas.transform);
|
||||
item.transform.localScale = Vector3.one;
|
||||
var panel = item.AddComponent<UISidePanel>();
|
||||
return panel;
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
if (sideItem == null)
|
||||
return;
|
||||
image.enabled = true;
|
||||
sideItem.SetPosition(new Vector3(rect.position.x - (rect.sizeDelta.x * 0.5f), rect.position.y));
|
||||
sideItem.Show();
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
if (sideItem == null)
|
||||
return;
|
||||
image.enabled = false;
|
||||
sideItem.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6317ef72ffa482d4288657d201a3c6aa
|
||||
guid: ad249143eaba4224aa632f3ce1fc9d6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
124
Assets/NewStudioPGD/DashBoard/UISideLoadFactory.cs
Normal file
124
Assets/NewStudioPGD/DashBoard/UISideLoadFactory.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Studio.UVC.UI
|
||||
{
|
||||
public abstract class UISideLoadFactory : MonoBehaviour
|
||||
{
|
||||
public static string PrefabsPath = "Prefabs/NewDashBoard/UISideLoadFactory";
|
||||
|
||||
private RectTransform canvasRect;
|
||||
private Button button_close;
|
||||
protected string titleName;
|
||||
protected TextMeshProUGUI Text_Title;
|
||||
protected ScrollRect scrollRect;
|
||||
|
||||
private UINewLoadFactroyItem item;
|
||||
protected RectTransform rect;
|
||||
|
||||
protected Dictionary<string, UINewLoadFactroyItem> itemTable = new();
|
||||
|
||||
protected float average;
|
||||
public float Average { get => average; }
|
||||
|
||||
protected int total;
|
||||
public int Total { get => total; }
|
||||
protected int trayCount;
|
||||
public int TrayCount { get => trayCount; }
|
||||
|
||||
public virtual void Init()
|
||||
{
|
||||
rect = GetComponent<RectTransform>();
|
||||
button_close = GetComponentInChildren<Button>();
|
||||
Text_Title = GetComponentInChildren<TextMeshProUGUI>();
|
||||
scrollRect = GetComponentInChildren<ScrollRect>();
|
||||
canvasRect = FindAnyObjectByType<CreateUIPanel>().GetComponent<RectTransform>();
|
||||
button_close.onClick.AddListener(OnClickClose);
|
||||
}
|
||||
|
||||
public Action onClickClose;
|
||||
private void OnClickClose()
|
||||
{
|
||||
Hide();
|
||||
onClickClose?.Invoke();
|
||||
}
|
||||
|
||||
public virtual void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
public virtual void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
public abstract void SetItem(string titleName, Dictionary<string, string> item);
|
||||
public abstract void ExpandYsize();
|
||||
public virtual void SetPosition(Vector3 size)
|
||||
{
|
||||
var xPos = + size.x - rect.sizeDelta.x-32f;
|
||||
var yPos = size.y;
|
||||
rect.position = new Vector2(xPos, yPos);
|
||||
Vector3 minPosition = canvasRect.rect.min - rect.rect.min;
|
||||
Vector3 maxPosition = canvasRect.rect.max - rect.rect.max;
|
||||
yPos = Mathf.Clamp(canvasRect.localPosition.y, minPosition.y, maxPosition.y - 56f);
|
||||
rect.position = new Vector2(xPos, rect.position.y);
|
||||
}
|
||||
|
||||
protected void AverageLoadFactory()
|
||||
{
|
||||
var total = 0f;
|
||||
foreach (var baritem in itemTable)
|
||||
{
|
||||
if (baritem.Key.Equals("average"))
|
||||
continue;
|
||||
var item = baritem.Value;
|
||||
total += item.Percent;
|
||||
}
|
||||
average = total / (float)itemTable.Count;
|
||||
}
|
||||
protected void TotalLoadedQuantity()
|
||||
{
|
||||
var traycount = 0;
|
||||
var total = 0;
|
||||
|
||||
foreach (var quantityBar in itemTable)
|
||||
{
|
||||
if (quantityBar.Key.Equals("total"))
|
||||
continue;
|
||||
var item = quantityBar.Value;
|
||||
traycount += item.TrayCount;
|
||||
total += item.Total;
|
||||
}
|
||||
|
||||
this.total = total;
|
||||
this.trayCount = traycount;
|
||||
}
|
||||
|
||||
protected UINewLoadFactroyItem BaseSetLoadFactory(string key, RectTransform parent = null)
|
||||
{
|
||||
if (!itemTable.ContainsKey(key))
|
||||
{
|
||||
var item = CreateItem(parent);
|
||||
itemTable.Add(key, item);
|
||||
return item;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public UINewLoadFactroyItem CreateItem(RectTransform parent)
|
||||
{
|
||||
if (item == null)
|
||||
item = Resources.Load<UINewLoadFactroyItem>(UINewLoadFactroyItem.PrefabsPath);
|
||||
|
||||
parent = parent == null ? scrollRect.content : parent;
|
||||
var newItem = Instantiate<UINewLoadFactroyItem>(item, parent);
|
||||
newItem.transform.localScale = Vector3.one;
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/NewStudioPGD/DashBoard/UISideLoadFactory.cs.meta
Normal file
11
Assets/NewStudioPGD/DashBoard/UISideLoadFactory.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 123a62780b21b4c4b9bb3e25558ef1a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user