diff --git a/Convention/Editor/File.cs b/Convention/Editor/File.cs new file mode 100644 index 0000000..61d71cd --- /dev/null +++ b/Convention/Editor/File.cs @@ -0,0 +1,61 @@ +using System.Collections; +using System.Collections.Generic; +using System.IO; +using Convention.SO; +using UnityEditor; +using UnityEngine; + +namespace Convention +{ + public class FileEditor : AbstractCustomEditor + { + [MenuItem("Convention/AssetBundle/Create for Android")] + static void CreatAssetBundle() + { + string path = Path.Combine(Application.streamingAssetsPath, "AssetBundle", "Android"); + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.Android); + UnityEngine.Debug.Log("Android Finish!"); + } + + [MenuItem("Convention/AssetBundle/Create for IOS")] + static void BuildAllAssetBundlesForIOS() + { + string dirName = "AssetBundles/IOS/IOS"; + if (!Directory.Exists(dirName)) + { + Directory.CreateDirectory(dirName); + } + BuildPipeline.BuildAssetBundles(dirName, BuildAssetBundleOptions.None, BuildTarget.iOS); + UnityEngine.Debug.Log("IOS Finish!"); + + } + + [MenuItem("Convention/AssetBundle/Create for Windows")] + static void CreatPCAssetBundleForwINDOWS() + { + string path = Path.Combine(Application.streamingAssetsPath, "AssetBundle", "Windows"); + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64); + UnityEngine.Debug.Log("Windows Finish!"); + } + + [MenuItem("Convention/AssetBundle/Create for Mac")] + static void CreatPCAssetBundleForMac() + { + string path = Path.Combine(Application.streamingAssetsPath, "AssetBundle", "Mac"); + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.StandaloneOSX); + UnityEngine.Debug.Log("Mac Finish!"); + } + } +} diff --git a/Convention/Editor/File.cs.meta b/Convention/Editor/File.cs.meta new file mode 100644 index 0000000..0e26158 --- /dev/null +++ b/Convention/Editor/File.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0fde7509f09639547adff8534a7d9698 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Convention/[Runtime]/AudioSystem.cs b/Convention/[Runtime]/AudioSystem.cs index 360d595..06fa0da 100644 --- a/Convention/[Runtime]/AudioSystem.cs +++ b/Convention/[Runtime]/AudioSystem.cs @@ -412,18 +412,18 @@ namespace Convention BandNegativeCheck(); } - void Update() - { - float[] spectrum = new float[256]; - AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular); - for (int i = 1; i < spectrum.Length - 1; i++) - { - Debug.DrawLine(new Vector3(i - 1, spectrum[i] + 10, 0), new Vector3(i, spectrum[i + 1] + 10, 0), Color.red); - Debug.DrawLine(new Vector3(i - 1, Mathf.Log(spectrum[i - 1]) + 10, 2), new Vector3(i, Mathf.Log(spectrum[i]) + 10, 2), Color.cyan); - Debug.DrawLine(new Vector3(Mathf.Log(i - 1), spectrum[i - 1] - 10, 1), new Vector3(Mathf.Log(i), spectrum[i] - 10, 1), Color.green); - Debug.DrawLine(new Vector3(Mathf.Log(i - 1), Mathf.Log(spectrum[i - 1]), 3), new Vector3(Mathf.Log(i), Mathf.Log(spectrum[i]), 3), Color.blue); - } - } + //void Update() + //{ + // float[] spectrum = new float[256]; + // AudioListener.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular); + // for (int i = 1; i < spectrum.Length - 1; i++) + // { + // Debug.DrawLine(new Vector3(i - 1, spectrum[i] + 10, 0), new Vector3(i, spectrum[i + 1] + 10, 0), Color.red); + // Debug.DrawLine(new Vector3(i - 1, Mathf.Log(spectrum[i - 1]) + 10, 2), new Vector3(i, Mathf.Log(spectrum[i]) + 10, 2), Color.cyan); + // Debug.DrawLine(new Vector3(Mathf.Log(i - 1), spectrum[i - 1] - 10, 1), new Vector3(Mathf.Log(i), spectrum[i] - 10, 1), Color.green); + // Debug.DrawLine(new Vector3(Mathf.Log(i - 1), Mathf.Log(spectrum[i - 1]), 3), new Vector3(Mathf.Log(i), Mathf.Log(spectrum[i]), 3), Color.blue); + // } + //} } } diff --git a/Convention/[Runtime]/Camera/FreeSceneCamera.cs b/Convention/[Runtime]/Camera/FreeSceneCamera.cs index d681197..4ab5142 100644 --- a/Convention/[Runtime]/Camera/FreeSceneCamera.cs +++ b/Convention/[Runtime]/Camera/FreeSceneCamera.cs @@ -37,19 +37,35 @@ namespace Convention private void Update() { Vector3 dxyz = Vector3.zero; - Vector3 rxyz = Vector3.zero; + //Vector3 rxyz = Vector3.zero; if (Keyboard.current[Key.W].isPressed || Keyboard.current[Key.UpArrow].isPressed) - dxyz += TargetFollow.forward; + { + var temp = TargetFollow.forward; + //temp.y = 0; + dxyz += temp.normalized; + } if (Keyboard.current[Key.A].isPressed || Keyboard.current[Key.LeftArrow].isPressed) - dxyz += -TargetFollow.right; + { + var temp = TargetFollow.right; + temp.y = 0; + dxyz -= temp.normalized; + } if (Keyboard.current[Key.D].isPressed || Keyboard.current[Key.RightArrow].isPressed) - dxyz += TargetFollow.right; + { + var temp = TargetFollow.right; + temp.y = 0; + dxyz += temp.normalized; + } if (Keyboard.current[Key.S].isPressed || Keyboard.current[Key.DownArrow].isPressed) - dxyz += -TargetFollow.forward; + { + var temp = TargetFollow.forward; + //temp.y = 0; + dxyz -= temp.normalized; + } if (Keyboard.current[Key.Space].isPressed) - dxyz += TargetFollow.up; + dxyz += Vector3.up; if (Keyboard.current[Key.LeftShift].isPressed) - dxyz += -TargetFollow.up; + dxyz -= Vector3.up; var drotation = Vector3.zero; if (isFocus) @@ -60,13 +76,15 @@ namespace Convention // - TargetFollow.Translate(dxyz * moveSpeed, Space.Self); + TargetFollow.Translate(dxyz * moveSpeed, Space.World); TargetFollow.Rotate(drotation * rotationSpeed, Space.Self); // if (Keyboard.current[Key.Escape].isPressed) isFocus = false; + if (Keyboard.current[Key.LeftCtrl].isPressed && Keyboard.current[Key.LeftShift].isPressed) + TargetFollow.localEulerAngles = new(0, TargetFollow.eulerAngles.y, 0); } } } diff --git a/Convention/[Runtime]/File.cs b/Convention/[Runtime]/File.cs index 142eff4..0ca56d0 100644 --- a/Convention/[Runtime]/File.cs +++ b/Convention/[Runtime]/File.cs @@ -79,6 +79,13 @@ namespace Convention } public string GetName(bool is_ignore_extension = false) { + if (OriginInfo != null) + { + if (OriginInfo is FileInfo finfo) + return is_ignore_extension ? Path.GetFileNameWithoutExtension(finfo.FullName) : finfo.Name; + else if (OriginInfo is DirectoryInfo dinfo) + return dinfo.Name; + } var result = this.FullPath[..( (this.FullPath.Contains('.') && is_ignore_extension) ? this.FullPath.LastIndexOf('.') @@ -89,8 +96,8 @@ namespace Convention ? ^1 : ^0 )]; - return result[(Mathf.Max(result.Contains('/') ? result.LastIndexOf('/') : -1, - result.Contains('\\') ? result.LastIndexOf('\\') : -1) + 1)..]; + //result.LastIndexOf('\\') return -1 when '\\' was not been contained + return result[(Mathf.Max(result.LastIndexOf('/'), result.LastIndexOf('\\')) + 1)..]; } public string GetExtension() { diff --git a/Convention/[Visual]/UIComponent/Variant/MainWindow/SceneGameWindow.cs b/Convention/[Visual]/UIComponent/Variant/MainWindow/SceneGameWindow.cs index e608f7f..8055ab3 100644 --- a/Convention/[Visual]/UIComponent/Variant/MainWindow/SceneGameWindow.cs +++ b/Convention/[Visual]/UIComponent/Variant/MainWindow/SceneGameWindow.cs @@ -22,8 +22,11 @@ namespace Convention.WindowsUI.Variant public BaseWindowBar.RegisteredPageWrapper GameWindowIndex { get; private set; } + public bool IsSelectSceneCamera { get; private set; } + public void CameraSelect(bool isScene) { + IsSelectSceneCamera = isScene; SceneCamera.gameObject.SetActive(isScene); ModuleCamera.gameObject.SetActive(!isScene); if (m_GameObjectOnSceneOnly != null)