1
0
mirror of https://github.com/soarqin/DSP_Mods_TO.git synced 2025-12-12 01:23:31 +08:00
Files
DSP_Mods_TO/XianTu/XianTuTest.cs
2024-05-03 00:28:53 +08:00

69 lines
2.0 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.IO;
using AssetsLoader;
using UnityEngine;
using XianTu.UI;
namespace XianTu
{
internal class XianTuTest : MonoBehaviour
{
private void Awake()
{
var abload = ABLoader.LoadFromFile("xiantu", "Assets/AB");
Singleton<LoadManager>.Instance.SetLoader(abload);
_canvas = new UIManager();
cube = GameObject.Find("Cube");
_canvas.PanelManager.Push("BlueTuPatchUI");
var data = BlueTuUIData.Instance;
var trans = cube.transform;
BlueTuUIData.Instance.OnValueChange += delegate
{
trans.localScale = data.Scale;
trans.position = data.Bias;
trans.eulerAngles = new Vector3(0f, data.Rotate, 0f);
};
}
private static void LoadTest()
{
var text = Path.Combine("Assets/XianTu/AB", "xiantu");
var assetBundle = AssetBundle.LoadFromFile(text);
var allAssetNames = assetBundle.GetAllAssetNames();
foreach (var text2 in allAssetNames)
{
Debug.Log("全路径: " + text2);
var text3 = text2.Substring(0, text2.IndexOf("prefabs"));
Debug.Log("测试切割" + text3);
var text4 = text2.Substring(text2.LastIndexOf('/') + 1);
text4 = text4.Split(['.'])[0];
Debug.Log("名字: " + text4);
var gameObject = assetBundle.LoadAsset<GameObject>(text4);
bool flag = gameObject;
if (flag)
{
var gameObject2 = Instantiate(gameObject);
gameObject2.name = "路径: " + text4;
}
}
Debug.Log("路径streamingAssetsPath" + Application.streamingAssetsPath);
Debug.Log("dataPath" + Application.dataPath);
Debug.Log("persistentDataPath" + Application.persistentDataPath);
}
private void Update()
{
var keyDown = Input.GetKeyDown(hotKey);
if (keyDown)
{
_canvas.SetActive(!_canvas.ActiveSelf);
}
}
private UIManager _canvas;
public KeyCode hotKey = KeyCode.F2;
public GameObject cube;
}
}