From 9c22d6f86acc22cf3593071ed2bc33ce817cbcf8 Mon Sep 17 00:00:00 2001 From: wlt233 <1486185683@qq.com> Date: Thu, 16 Mar 2023 01:02:59 +0800 Subject: [PATCH] rename file --- Assets/Main.cs | 73 +++++++++++++++++++++++++++++++++++++++++++++ Assets/Main.cs.meta | 11 +++++++ 2 files changed, 84 insertions(+) create mode 100644 Assets/Main.cs create mode 100644 Assets/Main.cs.meta diff --git a/Assets/Main.cs b/Assets/Main.cs new file mode 100644 index 0000000..1c8f0ad --- /dev/null +++ b/Assets/Main.cs @@ -0,0 +1,73 @@ +using System.IO; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Illusion; + + +public class Main : MonoBehaviour +{ + private string abPath = ""; + private string abDir; + private List abNameList = new List(); + private int idx = 0; + private int count; + + private GameObject charm; + private WeaponController controller; + + public List styleId; + private int style = -1; + public List effectId; + private int effect = -1; + private int mode = -1; + + void Start() + { + if (abPath == "" || abPath == "null") + { + abPath = FileUtil.OpenFile(); + } + FileInfo fileInfo = new FileInfo(abPath); + abDir = fileInfo.DirectoryName; + DirectoryInfo folderInfo = new DirectoryInfo(abDir); + int t = 0; + foreach (FileInfo NextFile in folderInfo.GetFiles()) + { + Debug.Log(NextFile.Name); + abNameList.Add(NextFile.Name); + if (NextFile.Name == fileInfo.Name) + { + idx = t; + } + t++; + } + count = abNameList.Count; + var bundle = AssetBundle.LoadFromFile(abDir + '\\' +abNameList[idx % count]); + foreach (var name in bundle.GetAllAssetNames()) + { + Debug.Log(name); + charm = (GameObject)Instantiate(bundle.LoadAsset(name)); + charm.transform.localScale = new Vector3(100, 100, 100); + controller = charm.GetComponent(); + //charm.AddComponent(); + styleId.Clear(); + for (int i = 0; i < controller.weaponMaterialList.Length; i++) + { + styleId.Add(controller.weaponMaterialList[i].colorIndex); + } + effectId.Clear(); + for (int i = 0; i < controller.specialEffectList.Length; i++) + { + effectId.Add(controller.specialEffectList[i].id); + } + } + bundle.Unload(false); + } + + + void Update() + { + + } +} diff --git a/Assets/Main.cs.meta b/Assets/Main.cs.meta new file mode 100644 index 0000000..2cda8ec --- /dev/null +++ b/Assets/Main.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0f380ef75cfc644449da67063fa2fc84 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: