123 lines
3.0 KiB
C#
123 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using TriLibCore;
|
|
using UnityEngine;
|
|
using ZXL.Helper;
|
|
|
|
namespace ZXLAAA
|
|
{
|
|
|
|
class FileSystemObject
|
|
{
|
|
|
|
}
|
|
|
|
class File: FileSystemObject
|
|
{
|
|
|
|
}
|
|
|
|
class Directory : FileSystemObject
|
|
{
|
|
|
|
}
|
|
public class TestFileSystem: MonoBehaviour
|
|
{
|
|
SortedDictionary<string,FileSystemObject> objects = new SortedDictionary<string,FileSystemObject>();
|
|
private GameObject _g;
|
|
|
|
private Timer timer;
|
|
|
|
|
|
private void Start()
|
|
{
|
|
var o = new GameObject("p");
|
|
string path = @"F:\SceneEditor3D\Assets\My project\Assets\连接处\连接处.fbx";
|
|
AssetLoader.LoadModelFromFile(path, null, null, (c,p)=>
|
|
{
|
|
if (p >= 1.0f)
|
|
{
|
|
print("Converted to " + o.transform.childCount);
|
|
if (o.transform.childCount == 1)
|
|
{
|
|
var newGameObject= o.transform.GetChild(0).gameObject;
|
|
var meshfilter = newGameObject.GetComponentInChildren<MeshFilter>();
|
|
if (meshfilter)
|
|
{
|
|
print("Mesh Filter: " + meshfilter.mesh.vertices.Length);
|
|
}
|
|
}
|
|
}
|
|
}, null, o,null,
|
|
null,true,null);
|
|
}
|
|
|
|
[ContextMenu("Test")]
|
|
void Test()
|
|
{
|
|
_g = new GameObject("aaaa") { hideFlags = HideFlags.HideInHierarchy };
|
|
|
|
print(this.gameObject.transform.root);
|
|
|
|
CreateDirectory("Root/");
|
|
CreateDirectory("Root/A/B");
|
|
CreateDirectory("Root/A/B/D");
|
|
CreateDirectory("Root/A/");
|
|
CreateFile("Root/A/B/11.txt");
|
|
CreateFile("Root/A/12221.txt");
|
|
CreateFile("Root/A/122212222.txt");
|
|
CreateFile("Root/A/B/D/122212222.txt");
|
|
Print();
|
|
}
|
|
|
|
[ContextMenu("Convert")]
|
|
void Convert()
|
|
{
|
|
|
|
}
|
|
|
|
private void Callback(object state)
|
|
{
|
|
|
|
}
|
|
|
|
[ContextMenu("Show")]
|
|
void Show()
|
|
{
|
|
_g.hideFlags = HideFlags.None;
|
|
}
|
|
|
|
[ContextMenu("Close")]
|
|
void Close()
|
|
{
|
|
if(_g)
|
|
GameObject.DestroyImmediate(_g);
|
|
if (timer!=null)
|
|
{
|
|
timer.Dispose();
|
|
timer = null;
|
|
}
|
|
}
|
|
|
|
void Print()
|
|
{
|
|
foreach (var fileSystemObject in objects)
|
|
{
|
|
print(fileSystemObject.Key);
|
|
}
|
|
}
|
|
|
|
void CreateDirectory(string path)
|
|
{
|
|
Directory dir = new Directory();
|
|
objects.Add(path,dir);
|
|
}
|
|
|
|
void CreateFile(string path)
|
|
{
|
|
objects.Add(path, new File());
|
|
}
|
|
|
|
}
|
|
} |