리팩토링
This commit is contained in:
@@ -3112,6 +3112,32 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 827571245}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &833546890 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 4357501051956785434, guid: 2c4ff86506de88747baaf66d9d637c5b, type: 3}
|
||||
m_PrefabInstance: {fileID: 1319277344}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &833546892
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 833546890}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8d1f9c7add0ac3345ac4cc9e8c59084a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
identifier:
|
||||
password:
|
||||
onLoadFbxFile:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onRemoveFbxFile:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
isLoadTaskComplete: 1
|
||||
--- !u!1 &837752632
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -8654,10 +8680,14 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: CustomAssetConnector
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedComponents:
|
||||
- {fileID: 7645908678807808531, guid: 2c4ff86506de88747baaf66d9d637c5b, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 4357501051956785434, guid: 2c4ff86506de88747baaf66d9d637c5b, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 833546892}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 2c4ff86506de88747baaf66d9d637c5b, type: 3}
|
||||
--- !u!1 &1321269470
|
||||
GameObject:
|
||||
@@ -12081,6 +12111,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
openTime: 0.1
|
||||
isButtonImageToggle: 0
|
||||
closeColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
openColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
BG: {fileID: 627801129964666679}
|
||||
@@ -14704,6 +14735,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
openTime: 0.1
|
||||
isButtonImageToggle: 0
|
||||
closeColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
openColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
BG: {fileID: 4396171917364011593}
|
||||
@@ -16827,6 +16859,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
openTime: 0.1
|
||||
isButtonImageToggle: 0
|
||||
closeColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
openColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
BG: {fileID: 725141755715026998}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace XED.Asset
|
||||
public GameObject selectedItem;
|
||||
public CustomAssetRenderObject selectRenderObject;
|
||||
|
||||
public SaveLoadFBXData saveLoadFBXData;
|
||||
public FBXFileManager saveLoadFBXData;
|
||||
public RenderObjectHandler renderObjectHandler;
|
||||
public System.Action<string, List<GameObject>> onSelectObjects;
|
||||
public System.Action onDeselectObjects;
|
||||
@@ -40,7 +40,7 @@ namespace XED.Asset
|
||||
ProjectManager projectManager;
|
||||
void Awake()
|
||||
{
|
||||
saveLoadFBXData = FindFirstObjectByType<SaveLoadFBXData>();
|
||||
saveLoadFBXData = FindFirstObjectByType<FBXFileManager>();
|
||||
renderObjectHandler = FindFirstObjectByType<RenderObjectHandler>();
|
||||
assetDataHandler = new CustomAssetDataHandler(this);
|
||||
assetEventHandler = new CustomAssetEventHandler(this);
|
||||
@@ -77,10 +77,6 @@ namespace XED.Asset
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//for (int i = 0; i < connectedAssets.Count; i++)
|
||||
//{
|
||||
// Debug.Log(connectedAssets[i].hierarchyItem.name + " "+ connectedAssets[i].hierarchyItem.GetSiblingIndex());
|
||||
//}
|
||||
if (selectedAssetData != null)
|
||||
{
|
||||
Vector3? pos = GetMousePointOnYPlane(objectShowDistance);
|
||||
@@ -93,12 +89,6 @@ namespace XED.Asset
|
||||
}
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD>
|
||||
void OnLoadInterworkingData()
|
||||
{
|
||||
HierarchyItem item = InterworkingDataScrollView.AddItem("IdName", HierarchyItemType.data);
|
||||
}
|
||||
|
||||
public void OnAssetSelected(HierarchyItem item)
|
||||
{
|
||||
if (item == null || item.linkedObject == null)
|
||||
|
||||
54
Assets/Scripts/Studio/AssetTool/CustomAssetDataRepository.cs
Normal file
54
Assets/Scripts/Studio/AssetTool/CustomAssetDataRepository.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using XED.Util;
|
||||
|
||||
namespace XED.Repositories
|
||||
{
|
||||
public class CustomAssetDataRepository
|
||||
{
|
||||
List<CustomAssetData> assetDatas = new List<CustomAssetData>();
|
||||
|
||||
public bool isEmpty => assetDatas.Count == 0;
|
||||
|
||||
public void Add(CustomAssetData data)
|
||||
{
|
||||
assetDatas.Add(data);
|
||||
}
|
||||
|
||||
public bool TryGetDataFromPath(string path, out CustomAssetData data)
|
||||
{
|
||||
data = FindFromPath(path);
|
||||
return data != null;
|
||||
}
|
||||
|
||||
public CustomAssetData FindFromPath(string path)
|
||||
{
|
||||
if(path==null)
|
||||
return null;
|
||||
|
||||
return assetDatas.Find(data => data.localFBXPath == path);
|
||||
}
|
||||
|
||||
internal void Remove(CustomAssetData assetData)
|
||||
{
|
||||
assetDatas.Remove(assetData);
|
||||
}
|
||||
|
||||
internal bool TryGetDataFromName(string name, out CustomAssetData p)
|
||||
{
|
||||
p = FindFromName(name);
|
||||
return p != null;
|
||||
}
|
||||
|
||||
private CustomAssetData FindFromName(string name)
|
||||
{
|
||||
return assetDatas.Find(data => data.assetName == name);
|
||||
}
|
||||
|
||||
internal void AddRange(List<CustomAssetData> assetDatas)
|
||||
{
|
||||
this.assetDatas.AddRange(assetDatas);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ccbf3d7b9e0ec8449cdc0c122d7a050
|
||||
@@ -8,63 +8,42 @@ using XED.Util;
|
||||
using System.Threading.Tasks;
|
||||
using MessagePack;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using UnityEngine.EventSystems;
|
||||
using MessagePack.Resolvers;
|
||||
using UnityEngine.Rendering;
|
||||
using XED.Repositories;
|
||||
|
||||
namespace XED.Asset
|
||||
namespace XED.Manage
|
||||
{
|
||||
public class SaveLoadFBXData : MonoBehaviour
|
||||
public class FBXFileManager : MonoBehaviour
|
||||
{
|
||||
CustomAssetDataRepository dataRepo;
|
||||
|
||||
public string identifier;
|
||||
public string password;
|
||||
public UnityEvent<string, string, CustomAssetData> onLoadFbxFile;
|
||||
public UnityEvent<string> onRemoveFbxFile;
|
||||
public event System.Action onBeginLoadAsset;
|
||||
private SaveData saveData;
|
||||
private List<CustomAssetData> listAssets = new List<CustomAssetData>();
|
||||
|
||||
private Queue<string> loadFilePath = new Queue<string>();
|
||||
private SharedMaterial sharedMaterial;
|
||||
private MessagePackFileManager<SaveData> fileManager;
|
||||
private MessagePackFileManager<SaveData> messagePacker;
|
||||
private bool isSaveTaskComplete = true;
|
||||
public bool isLoadTaskComplete = true;
|
||||
|
||||
void Start()
|
||||
{
|
||||
dataRepo = new CustomAssetDataRepository();
|
||||
saveData = new SaveData();
|
||||
sharedMaterial = new SharedMaterial();
|
||||
fileManager = new MessagePackFileManager<SaveData>();
|
||||
fileManager.Initialize();
|
||||
messagePacker = new MessagePackFileManager<SaveData>();
|
||||
messagePacker.Initialize();
|
||||
|
||||
identifier = identifier.Length == 0 ? "defaultAssetData" : identifier;
|
||||
StartCoroutine(CoroutineLoadLocalFiles());
|
||||
string baseDataPath = Application.streamingAssetsPath + "/baseAssetData";
|
||||
LoadLocalData(baseDataPath);
|
||||
}
|
||||
bool IsWebURL(string path)
|
||||
{
|
||||
return path.StartsWith("http://") || path.StartsWith("https://");
|
||||
}
|
||||
public void LoadLocalFBXFile()
|
||||
{
|
||||
TriLibCore.SFB.StandaloneFileBrowser.OpenFilePanelAsync("Load Local (File)", "C:\\Users", "fbx", false, OnLoadLocalFBXFile);
|
||||
}
|
||||
|
||||
private void OnLoadLocalFBXFile(IList<ItemWithStream> list)
|
||||
{
|
||||
onBeginLoadAsset?.Invoke();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (!list[i].HasData)
|
||||
continue;
|
||||
var path = list[i].Name;
|
||||
if (listAssets.Find((x) => x.localFBXPath == path) != null)
|
||||
return;
|
||||
loadFilePath.Enqueue(path);
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadLocalFBXDirectory()
|
||||
{
|
||||
@@ -81,22 +60,17 @@ namespace XED.Asset
|
||||
var path = list[i].Name;
|
||||
Debug.Log("path " + path);
|
||||
var files = Directory.GetFiles(path, "*.fbx", SearchOption.AllDirectories);
|
||||
if (listAssets.Find((x) => x.localFBXPath == path) != null)
|
||||
|
||||
if (dataRepo.TryGetDataFromPath(path, out var p))
|
||||
return;
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
loadFilePath.Enqueue(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SaveToLocalData(string path = "")
|
||||
{
|
||||
if (isSaveTaskComplete == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StartCoroutine(CoroutineSaveToLocalData(null, path));
|
||||
}
|
||||
|
||||
public void SaveToLocalData(List<CustomAssetData> assetDatas, string path = "")
|
||||
{
|
||||
if (isSaveTaskComplete == false)
|
||||
@@ -114,76 +88,13 @@ namespace XED.Asset
|
||||
onBeginLoadAsset?.Invoke();
|
||||
StartCoroutine(CoroutineLoadFromLocalData(path));
|
||||
}
|
||||
public void OnLoadLocalFBXFile(string[] paths)
|
||||
{
|
||||
if (paths != null && paths.Length > 0 && !string.IsNullOrEmpty(paths[0]))
|
||||
{
|
||||
if (listAssets.Find((x) => x.localFBXPath == paths[0]) != null)
|
||||
return;
|
||||
loadFilePath.Enqueue(paths[0]);
|
||||
}
|
||||
}
|
||||
public void OnLoadLocalFBXDirectory(string[] paths)
|
||||
{
|
||||
if (paths != null && paths.Length > 0 && !string.IsNullOrEmpty(paths[0]))
|
||||
{
|
||||
string[] files = Directory.GetFiles(paths[0], "*.fbx", SearchOption.AllDirectories);
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
string filePath = files[i];
|
||||
if (listAssets.Find((x) => x.localFBXPath == filePath) != null)
|
||||
continue;
|
||||
loadFilePath.Enqueue(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Load(string path)
|
||||
{
|
||||
string name = System.IO.Path.GetFileNameWithoutExtension(path);
|
||||
string directoryPath = Path.GetDirectoryName(path);
|
||||
string lastFolderName = Path.GetFileName(directoryPath);
|
||||
GameObject newObject = new GameObject(name);
|
||||
newObject.transform.parent = transform;
|
||||
CustomAssetData assetData = newObject.AddComponent<CustomAssetData>();
|
||||
assetData.assetName = name;
|
||||
assetData.folderName = lastFolderName;
|
||||
assetData.LoadLocalFBX(path);
|
||||
listAssets.Add(assetData);
|
||||
onLoadFbxFile?.Invoke(name, lastFolderName, assetData);
|
||||
}
|
||||
|
||||
public CustomAssetData GetCustomAssetData(string name)
|
||||
{
|
||||
return listAssets.FirstOrDefault(x => x.name == name);
|
||||
return dataRepo.FindFromPath(name);
|
||||
//return listAssets.FirstOrDefault(x => x.name == name);
|
||||
}
|
||||
public async Task SaveAsyncJson(string filename, SaveData data)
|
||||
{
|
||||
string filePath = Path.Combine(Application.persistentDataPath, filename);
|
||||
string json = JsonConvert.SerializeObject(data);
|
||||
using (StreamWriter writer = new StreamWriter(filePath, false, Encoding.UTF8))
|
||||
{
|
||||
await writer.WriteAsync(json);
|
||||
}
|
||||
}
|
||||
public async Task<SaveData> LoadAsyncJson(string filename)
|
||||
{
|
||||
string filePath = Path.Combine(Application.persistentDataPath, filename);
|
||||
|
||||
if (!File.Exists(filePath)) return default;
|
||||
|
||||
try
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(filePath, Encoding.UTF8))
|
||||
{
|
||||
string json = await reader.ReadToEndAsync();
|
||||
return JsonConvert.DeserializeObject<SaveData>(json);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Load Error: {ex}");
|
||||
return default;
|
||||
}
|
||||
}
|
||||
IEnumerator CoroutineLoadLocalFiles()
|
||||
{
|
||||
while (true)
|
||||
@@ -197,11 +108,18 @@ namespace XED.Asset
|
||||
string lastRevisionDate = File.GetLastAccessTime(path).ToShortDateString();
|
||||
string uploadDate = DateTime.Now.ToShortDateString();
|
||||
|
||||
if (listAssets.Find(x => x.name == name) != null)
|
||||
//if (listAssets.Find(x => x.name == name) != null)
|
||||
//{
|
||||
// yield return null;
|
||||
// continue;
|
||||
//}
|
||||
|
||||
if (dataRepo.TryGetDataFromName(name, out var p))
|
||||
{
|
||||
yield return null;
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObject newObject = new GameObject(name);
|
||||
newObject.transform.parent = transform;
|
||||
CustomAssetData assetData = newObject.AddComponent<CustomAssetData>();
|
||||
@@ -213,12 +131,12 @@ namespace XED.Asset
|
||||
assetData.Creator = "xr@uvc.co.kr";
|
||||
assetData.Manager = "xr@uvc.co.kr";
|
||||
assetData.LoadLocalFBX(path);
|
||||
listAssets.Add(assetData);
|
||||
dataRepo.Add(assetData);
|
||||
onLoadFbxFile?.Invoke(name, lastFolderName, assetData);
|
||||
yield return new WaitUntil(() => (assetData.isLoadComplete == true && assetData.progress == 1) || assetData.isLoadError == true);
|
||||
if (assetData.isLoadError)
|
||||
{
|
||||
listAssets.Remove(assetData);
|
||||
dataRepo.Remove(assetData);
|
||||
onRemoveFbxFile?.Invoke(name);
|
||||
}
|
||||
yield return null;
|
||||
@@ -226,16 +144,29 @@ namespace XED.Asset
|
||||
}
|
||||
IEnumerator CoroutineSaveToLocalData(List<CustomAssetData> assetDatas, string path)
|
||||
{
|
||||
if (assetDatas == null || assetDatas.Count == 0)
|
||||
//if (assetDatas == null || assetDatas.Count == 0)
|
||||
//{
|
||||
// assetDatas = listAssets;
|
||||
//}
|
||||
//if (assetDatas.Count == 0)
|
||||
//{
|
||||
// Debug.Log("No AssetDatas to Save");
|
||||
// isSaveTaskComplete = true;
|
||||
// yield break;
|
||||
//}
|
||||
|
||||
if (dataRepo.isEmpty)
|
||||
{
|
||||
assetDatas = listAssets;
|
||||
dataRepo.AddRange(assetDatas);
|
||||
}
|
||||
if (assetDatas.Count == 0)
|
||||
|
||||
if (dataRepo.isEmpty)
|
||||
{
|
||||
Debug.Log("No AssetDatas to Save");
|
||||
isSaveTaskComplete = true;
|
||||
yield break;
|
||||
}
|
||||
|
||||
isSaveTaskComplete = false;
|
||||
List<SavedModelData> savedModels = new List<SavedModelData>();
|
||||
List<ThumbnailData> thumbnails = new List<ThumbnailData>();
|
||||
@@ -259,7 +190,7 @@ namespace XED.Asset
|
||||
modelData.attributes[6] = new string[] { "Manager", assetData.Manager };
|
||||
|
||||
Texture2D thumbnail = RuntimePreviewGenerator.GenerateModelPreview(assetData.loadedObject.transform, 320, 200);
|
||||
thumbnail = MakeReadableTexture(thumbnail);
|
||||
thumbnail = thumbnail.MakeReadableTexture();
|
||||
thumbnails.Add(new ThumbnailData(thumbnail.EncodeToPNG()));
|
||||
savedModels.Add(modelData);
|
||||
}
|
||||
@@ -271,31 +202,32 @@ namespace XED.Asset
|
||||
//Task task = SaveAsync(identifier, saveData);
|
||||
|
||||
string filePath = string.IsNullOrEmpty(path) ? Path.Combine(Application.persistentDataPath, identifier) : path;
|
||||
Task task = Task.Run(() => fileManager.SaveAsync(filePath, saveData));
|
||||
Task task = Task.Run(() => messagePacker.SaveAsync(filePath, saveData));
|
||||
|
||||
yield return new WaitUntil(() => task.IsCompleted);
|
||||
isSaveTaskComplete = true;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
Texture2D MakeReadableTexture(Texture2D source)
|
||||
string GetLocalPath(string path)
|
||||
{
|
||||
RenderTexture renderTexture = RenderTexture.GetTemporary(
|
||||
source.width,
|
||||
source.height,
|
||||
0,
|
||||
RenderTextureFormat.Default,
|
||||
RenderTextureReadWrite.Linear);
|
||||
|
||||
Graphics.Blit(source, renderTexture);
|
||||
RenderTexture previous = RenderTexture.active;
|
||||
RenderTexture.active = renderTexture;
|
||||
Texture2D readableTexture = new Texture2D(source.width, source.height);
|
||||
readableTexture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
|
||||
readableTexture.Apply();
|
||||
RenderTexture.active = previous;
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
return readableTexture;
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return Path.Combine(Application.persistentDataPath, identifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
bool CheckFilePathExists(string filePath)
|
||||
{
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
Debug.Log("No File Found At : " + filePath);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
IEnumerator CoroutineLoadFromLocalData(string path)
|
||||
@@ -303,16 +235,22 @@ namespace XED.Asset
|
||||
isLoadTaskComplete = false;
|
||||
float loadTime = 0;
|
||||
|
||||
//Task<SaveData> task = LoadAsync(identifier);
|
||||
//string filePath = string.IsNullOrEmpty(path) ? Path.Combine(Application.persistentDataPath, identifier) : path;
|
||||
string filePath = GetLocalPath(path);
|
||||
|
||||
string filePath = string.IsNullOrEmpty(path) ? Path.Combine(Application.persistentDataPath, identifier) : path;
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
if (!CheckFilePathExists(filePath))
|
||||
{
|
||||
Debug.Log("No File Found At : " + filePath);
|
||||
isLoadTaskComplete = true;
|
||||
yield break;
|
||||
}
|
||||
Task<SaveData> task = Task<SaveData>.Run(() => fileManager.LoadAsync(filePath));
|
||||
//if (!System.IO.File.Exists(filePath))
|
||||
//{
|
||||
// Debug.Log("No File Found At : " + filePath);
|
||||
// isLoadTaskComplete = true;
|
||||
// yield break;
|
||||
//}
|
||||
|
||||
Task<SaveData> task = Task<SaveData>.Run(() => messagePacker.LoadAsync(filePath));
|
||||
yield return new WaitUntil(() => task.IsCompleted);
|
||||
|
||||
if (task.Result == null)
|
||||
@@ -336,21 +274,38 @@ namespace XED.Asset
|
||||
}
|
||||
for (int i = 0; i < saveData.modelDatas.Length; i++)
|
||||
{
|
||||
SavedModelData modelData = saveData.modelDatas[i];
|
||||
if (!LoadSaveData(saveData, i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
loadTime += Time.deltaTime;
|
||||
if (loadTime > 1.0f / 30.0f)
|
||||
{
|
||||
loadTime = 0;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
isLoadTaskComplete = true;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
bool LoadSaveData(SaveData saveData, int index)
|
||||
{
|
||||
var modelData = saveData.modelDatas[index];
|
||||
string assetName = modelData.attributes.FirstOrDefault(x => x[0].Equals("assetName"))?[1];
|
||||
|
||||
if (dataRepo.TryGetDataFromName(assetName, out var p))
|
||||
return false;
|
||||
|
||||
string folderName = modelData.attributes.FirstOrDefault(x => x[0].Equals("folderName"))?[1];
|
||||
string createDate = modelData.attributes.FirstOrDefault(x => x[0].Equals("createDate"))?[1];
|
||||
string lastRevisionDate = modelData.attributes.FirstOrDefault(x => x[0].Equals("lastRevisionDate"))?[1];
|
||||
string uploadDate = modelData.attributes.FirstOrDefault(x => x[0].Equals("uploadDate"))?[1];
|
||||
string creator = modelData.attributes.FirstOrDefault(x => x[0].Equals("creator"))?[1];
|
||||
string manager = modelData.attributes.FirstOrDefault(x => x[0].Equals("manager"))?[1];
|
||||
Texture2D thumbnail = new Texture2D(1, 1);
|
||||
thumbnail.LoadImage(saveData.thumbnailDatas[i].data);
|
||||
|
||||
if (listAssets.Find(x => x.name == assetName) != null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Texture2D thumbnail = new Texture2D(1, 1);
|
||||
thumbnail.LoadImage(saveData.thumbnailDatas[index].data);
|
||||
GameObject newObject = new GameObject(assetName);
|
||||
newObject.transform.parent = transform;
|
||||
CustomAssetData assetData = newObject.AddComponent<CustomAssetData>();
|
||||
@@ -364,34 +319,12 @@ namespace XED.Asset
|
||||
assetData.loadedObject = modelData.LoadModelData(sharedMaterial);
|
||||
assetData.thumbnail = thumbnail;
|
||||
assetData.OnLoadComplete();
|
||||
listAssets.Add(assetData);
|
||||
|
||||
dataRepo.Add(assetData);
|
||||
//listAssets.Add(assetData);
|
||||
onLoadFbxFile?.Invoke(assetData.assetName, assetData.folderName, assetData);
|
||||
loadTime += Time.deltaTime;
|
||||
if (loadTime > 1.0f / 30.0f)
|
||||
{
|
||||
loadTime = 0;
|
||||
yield return null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
isLoadTaskComplete = true;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
public class LoadFBXData
|
||||
{
|
||||
public string path;
|
||||
public GameObject loadedGB;
|
||||
public bool isLoadComplete;
|
||||
public bool isLoadError;
|
||||
public List<Transform> drawTransforms;
|
||||
public LoadFBXData(string path)
|
||||
{
|
||||
this.path = path;
|
||||
loadedGB = null;
|
||||
isLoadComplete = false;
|
||||
isLoadError = false;
|
||||
drawTransforms = new List<Transform>();
|
||||
}
|
||||
}
|
||||
public class SharedMaterial
|
||||
{
|
||||
@@ -1141,56 +1074,3 @@ namespace XED.Asset
|
||||
}
|
||||
}
|
||||
}
|
||||
public class MessagePackFileManager<T>
|
||||
{
|
||||
public void Initialize()
|
||||
{
|
||||
StaticCompositeResolver.Instance.Register(
|
||||
GeneratedResolver.Instance,
|
||||
StandardResolver.Instance
|
||||
);
|
||||
MessagePackSerializer.DefaultOptions = MessagePackSerializerOptions.Standard.WithResolver(
|
||||
StaticCompositeResolver.Instance
|
||||
);
|
||||
}
|
||||
public async Task<T> LoadAsync(string filePath)
|
||||
{
|
||||
var lz4Option = MessagePackSerializerOptions.Standard.
|
||||
WithCompression(MessagePackCompression.Lz4Block).
|
||||
WithResolver(StaticCompositeResolver.Instance);
|
||||
byte[] readByte = null;
|
||||
T deserailze = default(T);
|
||||
try
|
||||
{
|
||||
readByte = await File.ReadAllBytesAsync(filePath);
|
||||
deserailze = MessagePackSerializer.Deserialize<T>(readByte, lz4Option);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Task Error: {ex.Message}\n{ex.StackTrace}");
|
||||
int byteLength = 0;
|
||||
if (readByte != null)
|
||||
{
|
||||
byteLength = (int)readByte.Length;
|
||||
}
|
||||
Debug.LogError("Read Byte Size : " + byteLength.ToString());
|
||||
}
|
||||
return deserailze;
|
||||
}
|
||||
|
||||
public async Task SaveAsync(string filePath, T data)
|
||||
{
|
||||
var lz4Option = MessagePackSerializerOptions.Standard.
|
||||
WithCompression(MessagePackCompression.Lz4Block).
|
||||
WithResolver(StaticCompositeResolver.Instance);
|
||||
try
|
||||
{
|
||||
byte[] bytes = MessagePackSerializer.Serialize<T>(data, lz4Option);
|
||||
await File.WriteAllBytesAsync(filePath, bytes);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Task Error: {ex.Message}\n{ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Studio/AssetTool/FBXFileManager.cs.meta
Normal file
2
Assets/Scripts/Studio/AssetTool/FBXFileManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d1f9c7add0ac3345ac4cc9e8c59084a
|
||||
64
Assets/Scripts/Studio/AssetTool/MessagePackFileManager.cs
Normal file
64
Assets/Scripts/Studio/AssetTool/MessagePackFileManager.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using MessagePack.Resolvers;
|
||||
using MessagePack;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED.Manage
|
||||
{
|
||||
|
||||
public class MessagePackFileManager<T>
|
||||
{
|
||||
public void Initialize()
|
||||
{
|
||||
StaticCompositeResolver.Instance.Register(
|
||||
GeneratedResolver.Instance,
|
||||
StandardResolver.Instance
|
||||
);
|
||||
MessagePackSerializer.DefaultOptions = MessagePackSerializerOptions.Standard.WithResolver(
|
||||
StaticCompositeResolver.Instance
|
||||
);
|
||||
}
|
||||
public async Task<T> LoadAsync(string filePath)
|
||||
{
|
||||
var lz4Option = MessagePackSerializerOptions.Standard.
|
||||
WithCompression(MessagePackCompression.Lz4Block).
|
||||
WithResolver(StaticCompositeResolver.Instance);
|
||||
byte[] readByte = null;
|
||||
T deserailze = default(T);
|
||||
try
|
||||
{
|
||||
readByte = await File.ReadAllBytesAsync(filePath);
|
||||
deserailze = MessagePackSerializer.Deserialize<T>(readByte, lz4Option);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Task Error: {ex.Message}\n{ex.StackTrace}");
|
||||
int byteLength = 0;
|
||||
if (readByte != null)
|
||||
{
|
||||
byteLength = (int)readByte.Length;
|
||||
}
|
||||
Debug.LogError("Read Byte Size : " + byteLength.ToString());
|
||||
}
|
||||
return deserailze;
|
||||
}
|
||||
|
||||
public async Task SaveAsync(string filePath, T data)
|
||||
{
|
||||
var lz4Option = MessagePackSerializerOptions.Standard.
|
||||
WithCompression(MessagePackCompression.Lz4Block).
|
||||
WithResolver(StaticCompositeResolver.Instance);
|
||||
try
|
||||
{
|
||||
byte[] bytes = MessagePackSerializer.Serialize<T>(data, lz4Option);
|
||||
await File.WriteAllBytesAsync(filePath, bytes);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Task Error: {ex.Message}\n{ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 592137e8c153e864caf3162a9433b79f
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 427e19b97938787438145787dd188128
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/Scripts/Studio/AssetTool/TextureUtil.cs
Normal file
28
Assets/Scripts/Studio/AssetTool/TextureUtil.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED.Util
|
||||
{
|
||||
public static class TextureUtil
|
||||
{
|
||||
public static Texture2D MakeReadableTexture(this Texture2D source)
|
||||
{
|
||||
RenderTexture renderTexture = RenderTexture.GetTemporary(
|
||||
source.width,
|
||||
source.height,
|
||||
0,
|
||||
RenderTextureFormat.Default,
|
||||
RenderTextureReadWrite.Linear);
|
||||
|
||||
Graphics.Blit(source, renderTexture);
|
||||
RenderTexture previous = RenderTexture.active;
|
||||
RenderTexture.active = renderTexture;
|
||||
Texture2D readableTexture = new Texture2D(source.width, source.height);
|
||||
readableTexture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
|
||||
readableTexture.Apply();
|
||||
RenderTexture.active = previous;
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
return readableTexture;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Studio/AssetTool/TextureUtil.cs.meta
Normal file
2
Assets/Scripts/Studio/AssetTool/TextureUtil.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 527bb02ec2a94884aa8e02aa0dd24777
|
||||
@@ -1,61 +0,0 @@
|
||||
using AmazingAssets.WireframeShader;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
[RequireComponent(typeof(MeshRenderer)), RequireComponent(typeof(MeshFilter))]
|
||||
public class CreateWireFrame : MonoBehaviour
|
||||
{
|
||||
//MeshFilter meshFilter;
|
||||
private bool tryQuad;
|
||||
private Mesh wireframeMesh;
|
||||
private Material mat;
|
||||
private MeshFilter targetMeshFilter;
|
||||
private MeshRenderer mr;
|
||||
|
||||
public override void AfterAwake()
|
||||
{
|
||||
var matrial = Resources.Load<Material>("Materials/Mat_Cutout");
|
||||
mat = matrial;
|
||||
targetMeshFilter = GetComponent<MeshFilter>();
|
||||
mr = GetComponent<MeshRenderer>();
|
||||
mr.material = mat;
|
||||
}
|
||||
|
||||
public void CombineMeshes(List<MeshFilter> meshFilters)
|
||||
{
|
||||
if (meshFilters.Count == 0)
|
||||
return;
|
||||
var combine = new CombineInstance[meshFilters.Count];
|
||||
|
||||
for (var i = 0; i < meshFilters.Count; i++)
|
||||
{
|
||||
combine[i].mesh = meshFilters[i].sharedMesh;
|
||||
combine[i].transform = meshFilters[i].transform.localToWorldMatrix;
|
||||
}
|
||||
|
||||
var mesh = new Mesh();
|
||||
mesh.CombineMeshes(combine);
|
||||
targetMeshFilter.mesh = mesh;
|
||||
WireFrameCreate(targetMeshFilter);
|
||||
}
|
||||
public void WireFrameCreate(MeshFilter meshFilter)
|
||||
{
|
||||
targetMeshFilter.mesh = meshFilter.mesh;
|
||||
if (wireframeMesh != null)
|
||||
UnityEngine.GameObject.DestroyImmediate(wireframeMesh);
|
||||
|
||||
wireframeMesh = targetMeshFilter.sharedMesh.GenerateWireframeMesh(false, tryQuad);
|
||||
targetMeshFilter.sharedMesh = wireframeMesh;
|
||||
}
|
||||
|
||||
public void Displayable(bool value)
|
||||
{
|
||||
if (mr == null)
|
||||
return;
|
||||
mr.enabled = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ba8c050aa2df094996232819d8cd149
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,176 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using XRLib;
|
||||
using XED.Manage;
|
||||
using static UnityEngine.Rendering.DebugUI;
|
||||
|
||||
namespace XED
|
||||
{
|
||||
[Serializable]
|
||||
public class FloorCreateManager:MonoBehaviour,ISingle
|
||||
{
|
||||
[SerializeField]
|
||||
private List<Room> allRoomsCase = new();
|
||||
[SerializeField]
|
||||
private List<Room> rooms = new();
|
||||
private ConvexHull convexHull = new();
|
||||
public Action<Floor> onCreateFloor;
|
||||
public List<Floor> floors = new();
|
||||
private Dictionary<Floor, List<LinePoint>> floorTable = new();
|
||||
private Dictionary<LinePoint, List<Floor>> floorsMap = new();
|
||||
|
||||
//Wall 생성될때
|
||||
//Point 움직임, 제거 이벤트 발생 할때
|
||||
|
||||
//메쉬는 유지해야함.
|
||||
//계산은
|
||||
public override void AfterAwake()
|
||||
{
|
||||
}
|
||||
|
||||
public void FindCycles(HashSet<LinePoint> linePoints)
|
||||
{
|
||||
allRoomsCase.Clear();
|
||||
foreach (var point in linePoints)
|
||||
{
|
||||
FindOnePointCycle(point);
|
||||
}
|
||||
|
||||
FindSmallRoom();
|
||||
//Floor 생성 해야함
|
||||
|
||||
}
|
||||
|
||||
public void FindOnePointCycle(LinePoint point)
|
||||
{
|
||||
if (point.connectPoints.Count < 2)
|
||||
return;
|
||||
//Add할 타이밍
|
||||
//분할될 타이밍
|
||||
var connectPoints = point.connectPoints;
|
||||
foreach (var connectPoint in connectPoints)
|
||||
{
|
||||
var room = new Room();
|
||||
room.AddLinePoint(point);
|
||||
AddConnectPoint(connectPoint, room);
|
||||
}
|
||||
}
|
||||
private void AddConnectPoint(LinePoint point, Room room)
|
||||
{
|
||||
if (point.visited)
|
||||
return;
|
||||
if (room.IsContains(point))
|
||||
{
|
||||
if (room.points.Count < 3)
|
||||
return;
|
||||
room.firstPoints = room.points.First();
|
||||
allRoomsCase.Add(room);
|
||||
return;
|
||||
}
|
||||
|
||||
point.visited = true;
|
||||
room.AddLinePoint(point);
|
||||
var connectPoints = point.connectPoints;
|
||||
foreach (var connectPoint in connectPoints)
|
||||
{
|
||||
var temp = new Room();
|
||||
temp.points = room.points.ToList();
|
||||
AddConnectPoint(connectPoint, temp);
|
||||
}
|
||||
point.visited = false; ;
|
||||
}
|
||||
|
||||
private void FindSmallRoom()
|
||||
{
|
||||
var roomFistPoint = new HashSet<LinePoint>();
|
||||
|
||||
foreach (var room in allRoomsCase)
|
||||
{
|
||||
roomFistPoint.Add(room.firstPoints);
|
||||
}
|
||||
|
||||
foreach (var tt in roomFistPoint)
|
||||
{
|
||||
var re = allRoomsCase.Where(f => f.firstPoints.Equals(tt))
|
||||
.OrderBy(f => f.points.Count).ToList();
|
||||
//최소 points의 개수
|
||||
var minCount = re.Select(f => f.points.Count).First();
|
||||
foreach (var aa in re)
|
||||
{
|
||||
if (aa.points.Count != minCount)
|
||||
continue;
|
||||
if (CheckDuplicationRoom(aa))
|
||||
continue;
|
||||
|
||||
convexHull.RoomLinePoint(aa);
|
||||
rooms.Add(aa);
|
||||
// CreateFloor(aa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateFloor(Room room)
|
||||
{
|
||||
bool isequal = false;
|
||||
foreach (var fl in floorTable)
|
||||
{
|
||||
isequal = Enumerable.SequenceEqual(room.points.OrderBy(x => x.name), fl.Value.OrderBy(z => z.name));
|
||||
if (isequal)
|
||||
break;
|
||||
}
|
||||
|
||||
if(!isequal)
|
||||
{
|
||||
var poolManager = FindSingle<ObjectPoolManager>();
|
||||
var floor = poolManager.Get<Floor>();
|
||||
|
||||
foreach (var value in room.points)
|
||||
{
|
||||
FloorTableAdd(floor, value);
|
||||
FloorMap(value, floor);
|
||||
}
|
||||
floor.Set(room);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FloorTableAdd(Floor floor,LinePoint point)
|
||||
{
|
||||
if (!floorTable.ContainsKey(floor))
|
||||
floorTable.Add(floor, new());
|
||||
floorTable[floor].Add(point);
|
||||
}
|
||||
|
||||
private void FloorMap(LinePoint point, Floor floor)
|
||||
{
|
||||
if (!floorsMap.ContainsKey(point))
|
||||
floorsMap.Add(point, new());
|
||||
floorsMap[point].Add(floor);
|
||||
}
|
||||
|
||||
public void RemoveRoom(Room room)
|
||||
{
|
||||
|
||||
}
|
||||
private bool CheckDuplicationRoom(Room checkRoom)
|
||||
{
|
||||
foreach (var room in rooms)
|
||||
{
|
||||
if (checkRoom.points.Count != room.points.Count)
|
||||
continue;
|
||||
bool isequal = Enumerable.SequenceEqual(room.points.OrderBy(x => x.name), checkRoom.points.OrderBy(z => z.name));
|
||||
if (isequal)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Floor 지워지는 시점..
|
||||
//재계산 하는 시점
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e59bc0ea8ba19ad458898c86f08aecd8
|
||||
@@ -1,40 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
public class OpenFileName
|
||||
{
|
||||
public int structSize = 0;
|
||||
public IntPtr dlgOwner = IntPtr.Zero;
|
||||
public IntPtr instance = IntPtr.Zero;
|
||||
public String filter = null;
|
||||
public String customFilter = null;
|
||||
public int maxCustFilter = 0;
|
||||
public int filterIndex = 0;
|
||||
public String file = null;
|
||||
public int maxFile = 0;
|
||||
public String fileTitle = null;
|
||||
public int maxFileTitle = 0;
|
||||
public String initialDir = null;
|
||||
public String title = null;
|
||||
public int flags = 0;
|
||||
public short fileOffset = 0;
|
||||
public short fileExtension = 0;
|
||||
public String defExt = null;
|
||||
public IntPtr custData = IntPtr.Zero;
|
||||
public IntPtr hook = IntPtr.Zero;
|
||||
public String templateName = null;
|
||||
public IntPtr reservedPtr = IntPtr.Zero;
|
||||
public int reservedInt = 0;
|
||||
public int flagsEx = 0;
|
||||
}
|
||||
|
||||
public class ofnDll
|
||||
{
|
||||
[DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)]
|
||||
public static extern bool GetOpenFileName([In, Out] OpenFileName ofn);
|
||||
public static bool OpenFileName([In, Out] OpenFileName ofn)
|
||||
{
|
||||
return GetOpenFileName(ofn);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bbd69400cf49ce40b31141de01817d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,21 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED.Util
|
||||
{
|
||||
public static class UtilityFunction
|
||||
{
|
||||
public static Transform FindDeepChild(Transform parent, string name)
|
||||
{
|
||||
foreach (Transform child in parent)
|
||||
{
|
||||
if (child.name == name)
|
||||
return child;
|
||||
|
||||
Transform result = FindDeepChild(child, name);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8ef75561e2eef84db1fdad226542515
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XED.ComponentSystem
|
||||
{
|
||||
public abstract class ActionComponent
|
||||
{
|
||||
public enum EventType
|
||||
{
|
||||
Start,
|
||||
Complete,
|
||||
}
|
||||
|
||||
public bool isStarted;
|
||||
|
||||
public Action<ActionComponent> onStart;
|
||||
public Action<ActionComponent> onComplete;
|
||||
|
||||
public Dictionary<EventType, List<ActionComponent>> subscribers = new();
|
||||
public abstract void Start();
|
||||
public abstract void Run();
|
||||
|
||||
public void Subscribe(EventType et, ActionComponent ac)
|
||||
{
|
||||
if (!subscribers.ContainsKey(et))
|
||||
{
|
||||
subscribers.Add(et, new List<ActionComponent>());
|
||||
}
|
||||
|
||||
subscribers[et].Add(ac);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Timer : ActionComponent
|
||||
{
|
||||
public float timer;
|
||||
public float duration;
|
||||
|
||||
public override void Run()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
timer = 0f;
|
||||
onStart?.Invoke(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8e1cd05849bbd143b88ed45db8e6ea1
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using XRLib;
|
||||
|
||||
namespace XED.ComponentSystem
|
||||
{
|
||||
public class ActionComponentRunner : MonoBehaviour, ISingle
|
||||
{
|
||||
public List<ActionComponent> components =new();
|
||||
public void Add(ActionComponent ac)
|
||||
{
|
||||
components.Add(ac);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
foreach (var c in components)
|
||||
{
|
||||
if (!c.isStarted)
|
||||
c.Start();
|
||||
|
||||
c.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33290f25a5450894d8bb61de724f0e8b
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace XED.ComponentSystem
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ComponentAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d65dda02ed26020469f00b424182e8fd
|
||||
@@ -1,9 +0,0 @@
|
||||
using XRLib;
|
||||
|
||||
namespace XED.ComponentSystem
|
||||
{
|
||||
public class ComponentViewer : MonoBehaviour, ISingle
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da2e7c23b7b19724ca9502b10051699e
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace XED.ComponentSystem
|
||||
{
|
||||
public class DropdownAttribute : ComponentAttribute
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72d9ca4b84a83d44faa0782c8d091dcf
|
||||
@@ -1,10 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace XED.ComponentSystem
|
||||
{
|
||||
public class InputAttribute : ComponentAttribute
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bf39c253f9582444b29eca9a2735f8f
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a82b8cc88b7c5504baf7945c65a835d9
|
||||
guid: c98df20933569634ab50df6409b85478
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -33,7 +33,7 @@ namespace XED
|
||||
private TwoPointLine line;
|
||||
public Color wallColor;
|
||||
|
||||
private CreateWireFrame wireFrame;
|
||||
//private CreateWireFrame wireFrame;
|
||||
public HashSet<LinePoint> includedPoints = new();
|
||||
private Dictionary<VirtualPoint, bool> linePointTable = new Dictionary<VirtualPoint, bool>();
|
||||
|
||||
@@ -47,9 +47,9 @@ namespace XED
|
||||
public override void AfterAwake()
|
||||
{
|
||||
var mat = Resources.Load<Material>("Materials/Mat_WallMat");
|
||||
wireFrame = new GameObject("WireFrame").AddComponent<CreateWireFrame>();
|
||||
wireFrame.transform.SetParent(transform);
|
||||
wireFrame.Displayable(false);
|
||||
//wireFrame = new GameObject("WireFrame").AddComponent<CreateWireFrame>();
|
||||
//wireFrame.transform.SetParent(transform);
|
||||
//wireFrame.Displayable(false);
|
||||
meshfilter = GetComponent<MeshFilter>();
|
||||
mr = GetComponent<MeshRenderer>();
|
||||
mr.material = mat;
|
||||
@@ -393,7 +393,7 @@ namespace XED
|
||||
if (IsDisplayable)
|
||||
{
|
||||
line.SetActive(value);
|
||||
wireFrame.Displayable(!value);
|
||||
//wireFrame.Displayable(!value);
|
||||
mr.enabled = !value;
|
||||
var centrPoints = GetCenterPoints();
|
||||
foreach (var point in centrPoints)
|
||||
@@ -404,7 +404,7 @@ namespace XED
|
||||
else
|
||||
{
|
||||
line.SetActive(false);
|
||||
wireFrame.Displayable(false);
|
||||
//wireFrame.Displayable(false);
|
||||
mr.enabled = false;
|
||||
var centrPoints = GetCenterPoints();
|
||||
foreach (var point in centrPoints)
|
||||
@@ -60,7 +60,6 @@ namespace XED
|
||||
public Wall prf_Wall;
|
||||
public WallGroup prf_WallGroup;
|
||||
|
||||
private FloorCreateManager fm;
|
||||
|
||||
private int cc;
|
||||
public Action<HashSet<Wall>> onCreateWallMesh;
|
||||
@@ -82,20 +81,16 @@ namespace XED
|
||||
wallLines.Add(wallLine);
|
||||
}
|
||||
}
|
||||
|
||||
private RTGController rtgController;
|
||||
public override void AfterAwake()
|
||||
{
|
||||
renderParent = new GameObject("LineRenderParent");
|
||||
lineMat = Resources.Load<Material>("Materials/Mat_LineRender");
|
||||
fm = FindSingle<FloorCreateManager>();
|
||||
|
||||
prf_LinePoint = Resources.Load<LinePoint>("Prefabs/PRF_LinePoint");
|
||||
prf_Wall = Resources.Load<Wall>("Prefabs/PRF_Wall");
|
||||
prf_WallGroup = Resources.Load<WallGroup>("Prefabs/PRF_WallGroup");
|
||||
|
||||
meshCreator = FindSingle<MeshCreator>();
|
||||
rtgController = new();
|
||||
handler = GetInputHandler();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace XED.Manage
|
||||
var projectManager = FindSingle<ProjectManager>();
|
||||
|
||||
GameObject assetWindow = canvas_Popup.panel_assetlibrary.gameObject;
|
||||
SaveLoadFBXData saveLoadFBXData = customAssetConnector.saveLoadFBXData;
|
||||
FBXFileManager saveLoadFBXData = customAssetConnector.saveLoadFBXData;
|
||||
GameObject componentWindow = canvas_Popup.panel_hierarchy.gameObject;
|
||||
GameObject interferedobjectlistWindow = canvas_Popup.panel_interferedobjectlist.gameObject;
|
||||
|
||||
@@ -47,13 +47,10 @@ namespace XED.Manage
|
||||
{
|
||||
customAssetConnector.onRemoveObjects += renderObjectHandler.DeselectAll;
|
||||
customAssetConnector.onSelectObjects += ((name, objects) => { canvas_Popup.panel_objectinfo.gameObject.SetActive(true); });
|
||||
//customAssetConnector.onSelectObjects += ((name, objects) => { canvas_Popup.panel_objectalign.gameObject.SetActive(true); });
|
||||
customAssetConnector.onSelectObjects += canvas_Popup.panel_objectinfo.SetObjectInfo;
|
||||
customAssetConnector.onSelectObjects += canvas_Popup.panel_objectdistance.SelectObjectFromClick;
|
||||
customAssetConnector.onRemoveObjects += canvas_Popup.panel_objectinfo.ResetObjectInfo;
|
||||
customAssetConnector.onDeselectObjects += (() => { canvas_Popup.panel_objectinfo.gameObject.SetActive(false); });
|
||||
//customAssetConnector.onDeselectObjects += (() => { canvas_Popup.panel_objectalign.gameObject.SetActive(false); });
|
||||
//customAssetConnector.onAssetDropped += (() => componentWindow.SetActive(true));
|
||||
|
||||
renderObjectHandler.onDeselectAll += canvas_Popup.panel_objectinfo.ResetObjectInfo;
|
||||
renderObjectHandler.onTransformChanged += canvas_Popup.panel_objectinfo.OnTransformChanged;
|
||||
@@ -72,11 +69,8 @@ namespace XED.Manage
|
||||
agvNodeManager.onNodeDeselected += nodeGizmoController.Detach;
|
||||
agvNodeManager.onNodeSettingSelected += canvas_Popup.agvnodepopup.Popup;
|
||||
agvNodeManager.onNodeDeselected += canvas_Popup.agvnodepopup.Popdown;
|
||||
//agvNodeManager.onNodeSequenceOrdered += agvManager.ordertoAGV;
|
||||
agvNodeManager.onNodeSequenceUpdated += canvas_Popup.agvnodemodepopup.UpdateTextSelectedAGVNode;
|
||||
|
||||
//agvManager.onOrderStarted += agvNodeLinkManager.AddLines;
|
||||
|
||||
projectManager.onLoadAsset += customAssetConnector.OnLoadAsset;
|
||||
projectManager.onRestoreHierarchy += customAssetConnector.OnRestoreHierarchy;
|
||||
}
|
||||
@@ -106,12 +100,6 @@ namespace XED.Manage
|
||||
canvas_static.panel_toolbar.onClickRemove += renderObjectHandler.RemoveItem;
|
||||
canvas_static.panel_toolbar.onClickCopy += renderObjectHandler.CopyItem;
|
||||
|
||||
canvas_static.panel_toolbar.onClickStartDrawWall += wallBuilder.DrawWallStart;
|
||||
|
||||
canvas_static.panel_toolbar.onClickModifyWall += wallBuilder.SetDrawState;
|
||||
canvas_static.panel_toolbar.onClickRemoveWall += wallBuilder.SetDrawState;
|
||||
canvas_static.panel_toolbar.onClickEndWall += wallBuilder.SetDrawState;
|
||||
|
||||
canvas_Popup.agvnodepopup.Button_Plus.onClick.AddListener(agvNodeManager.AddNode);
|
||||
canvas_Popup.agvnodepopup.Button_Minus.onClick.AddListener(agvNodeManager.RemoveNode);
|
||||
canvas_Popup.agvnodepopup.DropDown_AGVNodeType.onValueChanged.AddListener(agvNodeManager.NodeTypeChange);
|
||||
@@ -120,10 +108,6 @@ namespace XED.Manage
|
||||
canvas_Popup.agvnodemodepopup.Button_AGVNodeLoad.onClick.AddListener(agvNodeManager.Load);
|
||||
canvas_Popup.agvnodemodepopup.Button_AGVNodeSave.onClick.AddListener(agvNodeManager.Save);
|
||||
canvas_Popup.agvnodemodepopup.onAGVNodeModeChanged += agvNodeManager.ChangeSelectMode;
|
||||
canvas_DragArea.panel_draghandler.onDragBoxSelect += customAssetConnector.assetEventHandler.OnDragBoxSelect;
|
||||
|
||||
canvas_static.panel_toolbar.onClickAGVMode += () => statusPanel.SetMode(ModePanel.ProgramMode.AGVPathDrawing);
|
||||
canvas_static.panel_toolbar.onClickStartDrawWall += ()=>statusPanel.SetMode(ModePanel.ProgramMode.WallDrawing);
|
||||
|
||||
canvas_Popup.panel_assetlibrary.scrollView.onSelect.AddListener(canvas_Popup.panel_assetproperties.Open);
|
||||
canvas_Popup.panel_assetlibrary.scrollView.onHover.AddListener(canvas_Popup.panel_thumbnail.HandleOpenClose);
|
||||
@@ -134,6 +118,8 @@ namespace XED.Manage
|
||||
|
||||
canvas_Popup.panel_thumbnail.onOpen += saveLoadFBXData.GetCustomAssetData;
|
||||
canvas_Popup.panel_thumbnail.onGetPosition += canvas_Popup.panel_assetlibrary.GetPositionX;
|
||||
|
||||
canvas_DragArea.panel_draghandler.onDragBoxSelect += customAssetConnector.assetEventHandler.OnDragBoxSelect;
|
||||
}
|
||||
|
||||
void StatusConnection()
|
||||
@@ -141,9 +127,7 @@ namespace XED.Manage
|
||||
statusPanel.AddController(renderObjectHandler);
|
||||
statusPanel.AddController(wallBuilder);
|
||||
statusPanel.AddController(agvNodeManager);
|
||||
|
||||
statusPanel.AddModeEnterEvent(ModePanel.ProgramMode.AGVPathDrawing, canvas_Popup.agvnodemodepopup.Open);
|
||||
|
||||
statusPanel.SetMode(ModePanel.ProgramMode.ObjectLayout);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace XED.Manage
|
||||
{
|
||||
SceneData sceneData = fileBrowserHandler.OpenFileBrowser<SceneData>("OpenProject");
|
||||
|
||||
if (sceneData == null || !FindAnyObjectByType<SaveLoadFBXData>().isLoadTaskComplete)
|
||||
if (sceneData == null || !FindAnyObjectByType<FBXFileManager>().isLoadTaskComplete)
|
||||
return;
|
||||
|
||||
NewProject();
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Pool;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
using XED.Core;
|
||||
using XED.Util;
|
||||
using TMPro;
|
||||
using XED.Manage;
|
||||
|
||||
namespace XED.Hierarchy
|
||||
{
|
||||
public class PooledScrollView : UnityEngine.MonoBehaviour
|
||||
public class PooledScrollView : MonoBehaviour
|
||||
{
|
||||
private RectTransform content; // Content RectTransform of the ScrollView.
|
||||
private CustomScrollRect scrollRect; // ScrollRect component.
|
||||
@@ -42,7 +38,7 @@ namespace XED.Hierarchy
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
content = UtilityFunction.FindDeepChild(transform, "Content").GetComponent<RectTransform>();
|
||||
content = Find<RectTransform>("Content");
|
||||
scrollRect = GetComponent<CustomScrollRect>();
|
||||
if (searchInput == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user