add alicizax.unity.editor.extension

This commit is contained in:
陈思海 2025-01-26 20:55:39 +08:00
parent f580691e8a
commit ea39ed27a3
160 changed files with 2684 additions and 1083 deletions

View File

@ -219,7 +219,7 @@ namespace BuildCli
buildParameters.FileNameStyle = EFileNameStyle.BundleName_HashName;
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.ClearAndCopyByTags;
buildParameters.BuildinFileCopyParams = "Launch";
buildParameters.EncryptionServices = CreateEncryptionInstance("DefaultPackage", EBuildPipeline.ScriptableBuildPipeline);
buildParameters.EncryptionServices = CreateEncryptionInstance("DefaultPackage", EBuildPipeline.BuiltinBuildPipeline);
// 启用共享资源打包
buildParameters.EnableSharePackRule = true;

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d4c8155609124d828af3f732a15a0992
timeCreated: 1737867267

View File

@ -0,0 +1,51 @@
namespace BuildCli.YooExtension
{
using System;
using System.IO;
using YooAsset;
/// <summary>
/// 文件偏移加密方式
/// </summary>
public class FileOffsetEncryption : IEncryptionServices
{
public EncryptResult Encrypt(EncryptFileInfo fileInfo)
{
int offset = 32;
byte[] fileData = File.ReadAllBytes(fileInfo.FileLoadPath);
var encryptedData = new byte[fileData.Length + offset];
Buffer.BlockCopy(fileData, 0, encryptedData, offset, fileData.Length);
EncryptResult result = new EncryptResult();
result.Encrypted = true;
result.EncryptedData = encryptedData;
return result;
}
}
//
// /// <summary>
// /// 文件流加密方式
// /// </summary>
// public class FileStreamEncryption : IEncryptionServices
// {
// public EncryptResult Encrypt(EncryptFileInfo fileInfo)
// {
// if (fileInfo.BundleName.Contains("DLL"))
// {
//
// }
//
// var fileData = File.ReadAllBytes(fileInfo.FileLoadPath);
// for (int i = 0; i < fileData.Length; i++)
// {
// fileData[i] ^= BundleStream.KEY;
// }
//
// EncryptResult result = new EncryptResult();
// result.Encrypted = true;
// result.EncryptedData = fileData;
// return result;
// }
// }
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 39b42829cd724f10999caec280e260f7
timeCreated: 1737867622

View File

@ -0,0 +1,47 @@
using UnityEditor;
using YooAsset.Editor;
namespace BuildCli.YooExtension
{
public class GameIgnoreRule : IIgnoreRule
{
/// <summary>
/// 查询是否为忽略文件
/// </summary>
public bool IsIgnore(AssetInfo assetInfo)
{
if (assetInfo.AssetPath.StartsWith("Assets/") == false && assetInfo.AssetPath.StartsWith("Packages/") == false)
{
UnityEngine.Debug.LogError($"Invalid asset path : {assetInfo.AssetPath}");
return true;
}
// 忽略文件夹
if (AssetDatabase.IsValidFolder(assetInfo.AssetPath))
return true;
// 忽略编辑器图标资源
if (assetInfo.AssetPath.Contains("/Gizmos/"))
return true;
// 忽略编辑器专属资源
if (assetInfo.AssetPath.Contains("/Editor/") || assetInfo.AssetPath.Contains("/Editor Resources/"))
return true;
// 忽略编辑器下的类型资源
if (assetInfo.AssetType == typeof(LightingDataAsset))
return true;
if (assetInfo.AssetType == typeof(LightmapParameters))
return true;
// 忽略Unity引擎无法识别的文件
if (assetInfo.AssetType == typeof(UnityEditor.DefaultAsset))
{
UnityEngine.Debug.LogWarning($"Cannot pack default asset : {assetInfo.AssetPath}");
return true;
}
return DefaultIgnoreRule.IgnoreFileExtensions.Contains(assetInfo.FileExtension);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 61fc20278e7f482cb871fb5c6259a70b
timeCreated: 1737867291

View File

@ -1,6 +1,7 @@
using UnityEngine;
using UnityEditor;
using System;
using AlicizaX.EditorExtension.Editor;
namespace BuildCli
{
@ -9,7 +10,7 @@ namespace BuildCli
private string saveFileName = string.Empty;
private string saveDirPathKey = "CaptureSaveDirPathKey";
[UnityEditor.MenuItem("开发工具/截图工具", false, 102)]
[UnityEditor.MenuItem("开发工具/常用Tools/截图工具", false, 102)]
private static void Capture()
{
if (HasOpenInstances<CaptureWindow>())

View File

@ -119,519 +119,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &17177054
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 17177055}
- component: {fileID: 17177056}
m_Layer: 0
m_Name: EventKit
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &17177055
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 17177054}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &17177056
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 17177054}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7eec9f691e06464cbfc45f619c7fee9d, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType:
--- !u!1 &77951143
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 77951144}
- component: {fileID: 77951145}
m_Layer: 0
m_Name: Event
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &77951144
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 77951143}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &77951145
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 77951143}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 48602115335c4223a70dc35cd6b29bbd, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Event.Runtime.EventManager
--- !u!1 &110080585
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 110080586}
- component: {fileID: 110080587}
m_Layer: 0
m_Name: Resources
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &110080586
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110080585}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &110080587
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110080585}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 91e581bb79676824f8c04687f21ed727, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Resource.Runtime.ResourceManager
m_GamePlayMode: 2
m_Milliseconds: 30
m_defaultPackageName: DefaultPackage
m_AssetAutoReleaseInterval: 60
m_AssetCapacity: 64
m_AssetExpireTime: 60
m_AssetPriority: 0
--- !u!1 &187276826
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 187276827}
- component: {fileID: 187276828}
m_Layer: 0
m_Name: ResourcesExt
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &187276827
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 187276826}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &187276828
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 187276826}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e3adf1e69b12944448c9fe6ae10983cb, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType:
m_CheckCanReleaseInterval: 30
m_AutoReleaseInterval: 60
--- !u!1 &354344801
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 354344802}
- component: {fileID: 354344803}
m_Layer: 0
m_Name: UI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &354344802
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 354344801}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &354344803
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 354344801}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 028204b1d2277bd4782816ee91aeed81, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.UI.Runtime.UIManager
uiRoot: {fileID: 4612363183729467837, guid: 9368ff38b2090b2468f8358242026e4b, type: 3}
--- !u!1 &539295520
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 539295521}
- component: {fileID: 539295522}
m_Layer: 0
m_Name: Scene
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &539295521
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 539295520}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &539295522
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 539295520}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6ccaedadefd0fbf498241670caa387e8, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Scene.Runtime.GameSceneManager
m_EnableLoadSceneUpdateEvent: 1
m_EnableLoadSceneDependencyAssetEvent: 1
--- !u!1 &559090126
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 559090127}
- component: {fileID: 559090128}
m_Layer: 0
m_Name: Config
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &559090127
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 559090126}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &559090128
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 559090126}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: be92abf1b6aa472c9ff7ebd49bbab9bf, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Config.Runtime.ConfigManager
--- !u!1 &804333829
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 804333830}
- component: {fileID: 804333831}
m_Layer: 0
m_Name: Procedure
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &804333830
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 804333829}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &804333831
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 804333829}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4d13b628448e4c71a78c4e51756cf98c, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Procedure.Runtime.ProcedureManager
m_AvailableProcedureTypeNames:
- Unity.Startup.Procedure.ProcedureClearCache
- Unity.Startup.Procedure.ProcedureCreateDownloader
- Unity.Startup.Procedure.ProcedureDownloadWebFiles
- Unity.Startup.Procedure.ProcedureGameLauncherState
- Unity.Startup.Procedure.ProcedureGetAppVersionInfoState
- Unity.Startup.Procedure.ProcedureGetGlobalInfoState
- Unity.Startup.Procedure.ProcedureLauncherState
- Unity.Startup.Procedure.ProcedureLoadAssembly
- Unity.Startup.Procedure.ProcedurePatchDone
- Unity.Startup.Procedure.ProcedurePatchInit
- Unity.Startup.Procedure.ProcedureUpdateManifest
- Unity.Startup.Procedure.ProcedureUpdateStaticVersion
m_EntranceProcedureTypeName: Unity.Startup.Procedure.ProcedureLauncherState
--- !u!1 &965054549
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 965054550}
- component: {fileID: 965054551}
m_Layer: 0
m_Name: Audio
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &965054550
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 965054549}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &965054551
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 965054549}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7d0b3cff83fd3874394b1b456bb54dab, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Audio.Runtime.AudioManager
m_AudioMixer: {fileID: 24100000, guid: 1af7a1b121ae17541a1967d430cef006, type: 2}
m_InstanceRoot: {fileID: 965054550}
m_AudioGroupConfigs:
- m_Name: Music
m_Mute: 0
m_Volume: 0.5
m_AgentHelperCount: 1
AudioType: 2
audioRolloffMode: 1
minDistance: 15
maxDistance: 50
- m_Name: Sound
m_Mute: 1
m_Volume: 0.5
m_AgentHelperCount: 4
AudioType: 0
audioRolloffMode: 0
minDistance: 1
maxDistance: 500
- m_Name: UISound
m_Mute: 0
m_Volume: 0.5
m_AgentHelperCount: 4
AudioType: 1
audioRolloffMode: 0
minDistance: 1
maxDistance: 500
- m_Name: Voice
m_Mute: 0
m_Volume: 0.5
m_AgentHelperCount: 1
AudioType: 3
audioRolloffMode: 0
minDistance: 1
maxDistance: 500
--- !u!1 &1107828071
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1107828072}
- component: {fileID: 1107828073}
m_Layer: 0
m_Name: Setting
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1107828072
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1107828071}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1107828073
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1107828071}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dd5fa5f9376d4c2abee7a298edbfbd19, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Setting.Runtime.SettingManager
m_SettingHelperTypeName: AlicizaX.Setting.Runtime.DefaultSettingHelper
m_CustomSettingHelper: {fileID: 0}
--- !u!1 &1378554099
GameObject:
m_ObjectHideFlags: 0
@ -769,321 +256,66 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1455375113
GameObject:
--- !u!1001 &9151303530987613966
PrefabInstance:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1455375114}
- component: {fileID: 1455375115}
m_Layer: 0
m_Name: Entry
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1455375114
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1455375113}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2121063206}
- {fileID: 2066725839}
- {fileID: 804333830}
- {fileID: 1107828072}
- {fileID: 2110718264}
- {fileID: 17177055}
- {fileID: 77951144}
- {fileID: 110080586}
- {fileID: 187276827}
- {fileID: 539295521}
- {fileID: 2030429591}
- {fileID: 965054550}
- {fileID: 559090127}
- {fileID: 2081231531}
- {fileID: 354344802}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1455375115
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1455375113}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 252fa1bb9e36411fb4582d0656b987bf, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType:
m_FrameRate: 120
m_GameSpeed: 1
m_RunInBackground: 1
m_NeverSleep: 1
--- !u!1 &2030429590
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2030429591}
- component: {fileID: 2030429592}
m_Layer: 0
m_Name: Debugger
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2030429591
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2030429590}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2030429592
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2030429590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f05eaceeebe870a4595e51f998ed518b, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Debugger.Runtime.DebuggerManager
m_Skin: {fileID: 11400000, guid: dce698819fdb70b42b393d9b0b6d420e, type: 2}
m_ActiveWindow: 0
m_ShowFullWindow: 0
m_ConsoleWindow:
m_LockScroll: 1
m_MaxLine: 100
m_InfoFilter: 1
m_WarningFilter: 1
m_ErrorFilter: 1
m_FatalFilter: 1
m_InfoColor:
serializedVersion: 2
rgba: 4294967295
m_WarningColor:
serializedVersion: 2
rgba: 4278512639
m_ErrorColor:
serializedVersion: 2
rgba: 4278190335
m_FatalColor:
serializedVersion: 2
rgba: 4281545650
--- !u!1 &2066725838
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2066725839}
- component: {fileID: 2066725840}
m_Layer: 0
m_Name: Object Pool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2066725839
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2066725838}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2066725840
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2066725838}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1e28a727443c86c40aeb42ff20e0a343, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.ObjectPool.ObjectPoolManager
--- !u!1 &2081231530
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2081231531}
- component: {fileID: 2081231532}
m_Layer: 0
m_Name: Fsm
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2081231531
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2081231530}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2081231532
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2081231530}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a69e41ab65d84e83a0468f1a2cc3926f, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Fsm.Runtime.FsmManager
--- !u!1 &2110718263
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2110718264}
- component: {fileID: 2110718265}
m_Layer: 0
m_Name: Timer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2110718264
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2110718263}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2110718265
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2110718263}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6bbfa5f028024a70812e412b33c0a86a, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType: AlicizaX.Timer.Runtime.TimerManager
--- !u!1 &2121063205
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2121063206}
- component: {fileID: 2121063207}
m_Layer: 0
m_Name: Reference Pool
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2121063206
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2121063205}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1455375114}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2121063207
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2121063205}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8ae4d40d7e878bc498492dc9c410d071, type: 3}
m_Name:
m_EditorClassIdentifier:
componentType:
m_EnableStrictCheck: 0
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 872693327694151783, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7543149531317296434, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
propertyPath: m_Name
value: Entry
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8e4808bf30e54a8439a661bfa35ee982, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1455375114}
- {fileID: 9151303530987613966}
- {fileID: 1378554103}

View File

@ -1,61 +0,0 @@
// using System;
// using System.Linq;
// using System.Reflection;
// using AlicizaX.Runtime;
// using HybridCLR;
//
// namespace Unity.Startup.Procedure
// {
// public static class HotfixHelper
// {
// const string HotfixName = "Unity.Hotfix";
//
// public static async void StartHotfix()
// {
// if (ApplicationHelper.IsEditor)
// {
// var assemblies = Utility.Assembly.GetAssemblies();
// foreach (var assembly in assemblies)
// {
// if (assembly.GetName().Name.Equals(HotfixName, StringComparison.OrdinalIgnoreCase))
// {
// Run(assembly);
// break;
// }
// }
//
// return;
// }
//
// Log.Info("开始加载AOT DLL");
//
// var aotDlls = AOTGenericReferences.PatchedAOTAssemblyList.ToArray();
// foreach (var aotDll in aotDlls)
// {
// Log.Info("开始加载AOT DLL ==> " + aotDll);
// var assetHandle = GameApp.Resource.LoadAssetAsyncHandle<UnityEngine.Object>(Utility.Asset.Path.GetAOTCodePath(aotDll));
// var aotBytes = assetHandle.GetAssetObject<UnityEngine.TextAsset>().bytes;
// RuntimeApi.LoadMetadataForAOTAssembly(aotBytes, HomologousImageMode.SuperSet);
// }
//
// Log.Info("结束加载AOT DLL");
// Log.Info("开始加载Unity.Hotfix.dll");
// var assetHotfixDllPath = Utility.Asset.Path.GetCodePath(HotfixName + Utility.Const.FileNameSuffix.DLL);
// var assetHotfixDllOperationHandle = GameApp.Resource.LoadAssetAsyncHandle<UnityEngine.Object>(assetHotfixDllPath);
// var assemblyDataHotfixDll = assetHotfixDllOperationHandle.GetAssetObject<UnityEngine.TextAsset>().bytes;
// Log.Info("开始加载程序集Hotfix");
// var hotfixAssembly = Assembly.Load(assemblyDataHotfixDll, null);
// Run(hotfixAssembly);
// }
//
// private static void Run(Assembly assembly)
// {
// Log.Info("加载程序集Hotfix 结束 Assembly " + assembly.FullName);
// var entryType = assembly.GetType("Hotfix.HotfixLauncher");
// Log.Info("加载程序集Hotfix 结束 EntryType " + entryType.FullName);
// var method = entryType.GetMethod("Main");
// Log.Info("加载程序集Hotfix 结束 EntryType=>method " + method?.Name);
// method?.Invoke(null, null);
// }
// }
// }

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 9d1ad4e910614930b986e764fe6fce62
timeCreated: 1680094814

View File

@ -18,11 +18,6 @@ namespace Unity.Startup.Procedure
{
}
public static void ShowLogText(string text)
{
Log.Info("TipText:{0}", text);
}
private static float _lastUpdateDownloadedSize;
private static float _totalSpeed;
private static int _speedSampleCount;
@ -44,7 +39,7 @@ namespace Unity.Startup.Procedure
}
}
public static void SetProgressUpdate(object sender, GameEventArgs gameEventArgs)
private static void SetProgressUpdate(object sender, GameEventArgs gameEventArgs)
{
var message = (AssetDownloadProgressUpdateEventArgs)gameEventArgs;
_currentDownloadBytes = message.CurrentDownloadSizeBytes;
@ -74,4 +69,4 @@ namespace Unity.Startup.Procedure
return ts.ToString(@"mm\:ss");
}
}
}
}

View File

@ -22,7 +22,7 @@ namespace Unity.Startup.Procedure
private void ClearCacheCompleted(AsyncOperationBase obj)
{
Log.Debug($"清理包裹缓存完成");
Log.Info($"清理包裹缓存完成");
ChangeState<ProcedureLoadAssembly>(owner);
}
}

View File

@ -9,10 +9,12 @@ namespace Unity.Startup.Procedure
{
internal sealed class ProcedureCreateDownloader : ProcedureBase
{
private const int DownloadingMaxNum = 10;
private const int FailedTryAgain = 3;
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
{
base.OnEnter(procedureOwner);
GameApp.Event.Fire(this, AssetPatchStatesChangeEventArgs.Create(EPatchStates.CreateDownloader));
CreateDownloader(procedureOwner);
}
@ -20,10 +22,7 @@ namespace Unity.Startup.Procedure
void CreateDownloader(IFsm<IProcedureManager> procedureOwner)
{
// Debug.Log("创建补丁下载器.");
int downloadingMaxNum = 10;
int failedTryAgain = 3;
ResourceDownloaderOperation downloader = YooAssets.CreateResourceDownloader(downloadingMaxNum, failedTryAgain);
ResourceDownloaderOperation downloader = YooAssets.CreateResourceDownloader(DownloadingMaxNum, FailedTryAgain);
var downloaderVarObject = new VarObject();
downloaderVarObject.SetValue(downloader);
procedureOwner.SetData<VarObject>("Downloader", downloaderVarObject);
@ -34,8 +33,6 @@ namespace Unity.Startup.Procedure
}
else
{
Debug.Log($"一共发现了{downloader.TotalDownloadCount}个资源需要更新下载。");
// 发现新更新文件后,挂起流程系统
int totalDownloadCount = downloader.TotalDownloadCount;
long totalDownloadBytes = downloader.TotalDownloadBytes;
@ -44,7 +41,7 @@ namespace Unity.Startup.Procedure
sizeMb = Mathf.Clamp(sizeMb, 0.1f, float.MaxValue);
string totalSizeMb = sizeMb.ToString("f1");
Debug.Log($"总共需要下载文件大小为:{totalSizeMb}");
Log.Info($"一共发现了{downloader.TotalDownloadCount}个资源需要更新下载,总共需要下载文件大小为:{totalSizeMb}!");
//这里进行确认 如果要下载在进行跳转到Download

View File

@ -40,7 +40,7 @@ namespace Unity.Startup.Procedure
// 检测下载结果
if (downloader.Status != EOperationStatus.Succeed)
{
Log.Debug("全部下载完毕!");
Log.Error("资源更新失败!");
return;
}

View File

@ -21,7 +21,6 @@ namespace Unity.Startup.Procedure
// 编辑器下的模拟模式
if (GameApp.Resource.GamePlayMode == EPlayMode.EditorSimulateMode)
{
Debug.Log("当前为编辑器模式,直接启动 FsmGetAppVersionInfoState");
ChangeState<ProcedurePatchInit>(procedureOwner);
return;
}
@ -61,4 +60,4 @@ namespace Unity.Startup.Procedure
}
}
}
}
}

View File

@ -17,17 +17,14 @@ namespace Unity.Startup.Procedure
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
{
base.OnEnter(procedureOwner);
// 编辑器下的模拟模式
if (GameApp.Resource.GamePlayMode == EPlayMode.EditorSimulateMode)
{
Log.Debug("当前为编辑器模式,直接启动 ProcedureGetAppVersionInfoState");
ChangeState<ProcedureGetAppVersionInfoState>(procedureOwner);
return;
}
if (GameApp.Resource.GamePlayMode == EPlayMode.OfflinePlayMode)
{
Log.Debug("当前为离线模式,直接启动 ProcedurePatchInit");
ChangeState<ProcedurePatchInit>(procedureOwner);
return;
}
@ -73,4 +70,4 @@ namespace Unity.Startup.Procedure
}
}
}
}
}

View File

@ -30,7 +30,7 @@ namespace Unity.Startup.Procedure
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
{
base.OnEnter(procedureOwner);
Log.Info("HyBridCLR ProcedureLoadAssembly OnEnter");
Log.Info(" ProcedureLoadAssembly OnEnter");
m_LoadAssemblyComplete = false;
m_HotfixAssemblys = new List<Assembly>();
@ -284,4 +284,4 @@ namespace Unity.Startup.Procedure
GameApp.Resource.UnloadAsset(textAsset);
}
}
}
}

View File

@ -22,7 +22,7 @@ MonoBehaviour:
LocationToLower: 0
IncludeAssetGUID: 0
AutoCollectShaders: 1
IgnoreRuleName: NormalIgnoreRule
IgnoreRuleName: GameIgnoreRule
Groups:
- GroupName: Entity
GroupDesc: "\u89D2\u8272"

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dcf5732141edc614185c12b4efb68227
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
{
"name": "AlicizaX.EditorExtension.Editor",
"rootNamespace": "AlicizaX.EditorExtension.Editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 99a2a63c2a1143c4ba448165a98a5108
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5753f0f3f47dd234699b76df886f3f81
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,400 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UObject = UnityEngine.Object;
namespace AlicizaX.EditorExtension.Editor
{
/// <summary>
/// 通用表格绘制器
/// </summary>
public sealed class GenericTableWindow : EditorWindow
{
/// <summary>
/// 打开通用表格绘制器
/// </summary>
/// <param name="target">表格数据目标实例</param>
/// <param name="fieldName">表格数据的字段名称</param>
public static void OpenWindow(UObject target, string fieldName)
{
GenericTableWindow window = GetWindow<GenericTableWindow>();
window.titleContent.image = EditorGUIUtility.IconContent("ScriptableObject Icon").image;
window.titleContent.text = "Generic Table";
window.OnInit(target, fieldName);
}
private const int Border = 10;
private const int TitleHeight = 20;
private Dictionary<string, FieldInfo> _fieldInfos = new Dictionary<string, FieldInfo>();
private TableView<object> _tableView;
private UObject _target;
private string _targetName;
private void OnInit(UObject target, string fieldName)
{
FieldInfo fieldInfo = target.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (fieldInfo == null)
{
Debug.LogWarning($"通用表格绘制器:未从 {target.GetType().FullName} 中找到字段 {fieldName}");
Close();
return;
}
List<object> datas = GetDatas(fieldInfo.GetValue(target));
if (datas.Count <= 0)
{
Debug.LogWarning($"通用表格绘制器:{target.GetType().FullName} 的字段 {fieldName} 长度为0或不是数组、集合类型");
Close();
return;
}
List<TableColumn<object>> columns = GetColumns(datas[0].GetType());
if (columns.Count <= 0)
{
Debug.LogWarning($"通用表格绘制器:{target.GetType().FullName} 的字段 {fieldName} 不是复杂类型,或类型中不含有可序列化字段!");
Close();
return;
}
_tableView = new TableView<object>(datas, columns);
_tableView.IsEnableContextClick = false;
_target = target;
_targetName = $"{_target.GetType().FullName}.{fieldName} ({_target.name})";
}
private void OnGUI()
{
if (GUILayout.Button(_targetName, EditorStyles.toolbarButton))
{
Selection.activeObject = _target;
EditorGUIUtility.PingObject(_target);
}
GUILayout.FlexibleSpace();
Rect rect = new Rect(0, 0, position.width, position.height);
rect.x += Border;
rect.y += Border + TitleHeight;
rect.width -= Border * 2;
rect.height -= Border * 2 + TitleHeight;
_tableView.OnGUI(rect);
}
private void Update()
{
if (EditorApplication.isCompiling || _tableView == null || _target == null)
{
Close();
}
}
private List<object> GetDatas(object field)
{
List<object> datas = new List<object>();
Array array = field as Array;
IEnumerable<object> list = field as IEnumerable<object>;
if (array != null)
{
foreach (var item in array)
{
datas.Add(item);
}
}
else if (list != null)
{
foreach (var item in list)
{
datas.Add(item);
}
}
return datas;
}
private List<TableColumn<object>> GetColumns(Type type)
{
_fieldInfos.Clear();
FieldInfo[] fieldInfos = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
for (int i = 0; i < fieldInfos.Length; i++)
{
if (fieldInfos[i].IsPublic || fieldInfos[i].IsDefined(typeof(SerializeField), true))
{
if (!_fieldInfos.ContainsKey(fieldInfos[i].Name))
{
_fieldInfos.Add(fieldInfos[i].Name, fieldInfos[i]);
}
}
}
List<TableColumn<object>> columns = new List<TableColumn<object>>();
foreach (var item in _fieldInfos)
{
TableColumn<object> column = null;
FieldInfo field = item.Value;
if (field.FieldType.IsEnum)
{
column = GetEnumColumn(field);
}
else if (field.FieldType == typeof(string))
{
column = GetStringColumn(field);
}
else if (field.FieldType == typeof(int))
{
column = GetIntColumn(field);
}
else if (field.FieldType == typeof(float))
{
column = GetFloatColumn(field);
}
else if (field.FieldType == typeof(bool))
{
column = GetBoolColumn(field);
}
else if (field.FieldType == typeof(Vector2))
{
column = GetVector2Column(field);
}
else if (field.FieldType == typeof(Vector3))
{
column = GetVector3Column(field);
}
else if (field.FieldType == typeof(Color))
{
column = GetColorColumn(field);
}
else if (field.FieldType.IsSubclassOf(typeof(UObject)))
{
column = GetObjectColumn(field);
}
if (column != null)
{
column.autoResize = false;
column.headerContent = new GUIContent(field.Name);
columns.Add(column);
}
}
return columns;
}
private TableColumn<object> GetEnumColumn(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 100;
column.canSort = false;
column.Compare = null;
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
Enum value = EditorGUI.EnumPopup(rect, (Enum)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
private TableColumn<object> GetStringColumn(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 100;
column.canSort = true;
column.Compare = (a, b) =>
{
string x = (string)field.GetValue(a);
string y = (string)field.GetValue(b);
return x.CompareTo(y);
};
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
string value = EditorGUI.TextField(rect, (string)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
/// <summary>
/// 标记目标已改变
/// </summary>
/// <param name="target">目标</param>
protected void HasChanged(UnityEngine.Object target)
{
if (target != null)
{
EditorUtility.SetDirty(target);
if (EditorApplication.isPlaying)
return;
GameObject gameObject = target as GameObject;
if (gameObject != null && gameObject.scene != null)
{
EditorSceneManager.MarkSceneDirty(gameObject.scene);
}
Component component = target as Component;
if (component != null && component.gameObject.scene != null)
{
EditorSceneManager.MarkSceneDirty(component.gameObject.scene);
}
}
}
private TableColumn<object> GetIntColumn(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 100;
column.canSort = true;
column.Compare = (a, b) =>
{
int x = (int)field.GetValue(a);
int y = (int)field.GetValue(b);
return x.CompareTo(y);
};
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
int value = EditorGUI.IntField(rect, (int)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
private TableColumn<object> GetFloatColumn(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 100;
column.canSort = true;
column.Compare = (a, b) =>
{
float x = (float)field.GetValue(a);
float y = (float)field.GetValue(b);
return x.CompareTo(y);
};
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
float value = EditorGUI.FloatField(rect, (float)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
private TableColumn<object> GetBoolColumn(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 40;
column.canSort = false;
column.Compare = null;
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
bool value = EditorGUI.Toggle(rect, (bool)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
private TableColumn<object> GetVector2Column(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 100;
column.canSort = false;
column.Compare = null;
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
Vector2 value = EditorGUI.Vector2Field(rect, "", (Vector2)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
private TableColumn<object> GetVector3Column(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 150;
column.canSort = false;
column.Compare = null;
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
Vector3 value = EditorGUI.Vector3Field(rect, "", (Vector3)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
private TableColumn<object> GetColorColumn(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 100;
column.canSort = false;
column.Compare = null;
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
Color value = EditorGUI.ColorField(rect, (Color)field.GetValue(data));
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
private TableColumn<object> GetObjectColumn(FieldInfo field)
{
TableColumn<object> column = new TableColumn<object>();
column.width = 150;
column.canSort = false;
column.Compare = null;
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.BeginChangeCheck();
UObject value = EditorGUI.ObjectField(rect, field.GetValue(data) as UObject, field.FieldType, true);
if (EditorGUI.EndChangeCheck())
{
field.SetValue(data, value);
HasChanged(_target);
}
};
return column;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a34a47e0625875a4fbc767a12877f83b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
using UnityEditor.IMGUI.Controls;
using UnityEngine;
namespace AlicizaX.EditorExtension.Editor
{
/// <summary>
/// 表格视图列元素
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
public sealed class TableColumn<T> : MultiColumnHeaderState.Column where T : class, new()
{
/// <summary>
/// 绘制列元素的方法
/// </summary>
public DrawCellMethod<T> DrawCell;
/// <summary>
/// 对比列元素的方法
/// </summary>
public CompareMethod<T> Compare;
}
/// <summary>
/// 绘制列元素的方法
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
/// <param name="cellRect">绘制区域</param>
/// <param name="data">绘制数据</param>
/// <param name="rowIndex">在表格中的行索引</param>
/// <param name="isSelected">是否选中</param>
/// <param name="isFocused">是否焦点</param>
public delegate void DrawCellMethod<T>(Rect cellRect, T data, int rowIndex, bool isSelected, bool isFocused);
/// <summary>
/// 对比列元素的方法
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
/// <param name="data1">数据1</param>
/// <param name="data2">数据2</param>
/// <returns>排序号</returns>
public delegate int CompareMethod<T>(T data1, T data2);
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9b002487fdbda054e992d8fb6be22157
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,447 @@
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
namespace AlicizaX.EditorExtension.Editor
{
/// <summary>
/// 表格视图
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
public sealed class TableView<T> : TreeView where T : class, new()
{
/// <summary>
/// 表格数据
/// </summary>
private List<T> _datas;
/// <summary>
/// 当前选择的表格数据
/// </summary>
private List<T> _selectionDatas;
/// <summary>
/// 根元素
/// </summary>
private TableViewItem<T> _rootItem;
/// <summary>
/// 所有的元素
/// </summary>
private List<TableViewItem<T>> _items;
/// <summary>
/// 所有的元素绘制项
/// </summary>
private List<TreeViewItem> _drawItems;
/// <summary>
/// 搜索控件
/// </summary>
private SearchField _searchField;
/// <summary>
/// 元素ID标记
/// </summary>
private int _idSign = 0;
/// <summary>
/// 当选择项改变
/// </summary>
public event Action<List<T>> OnSelectionChanged;
/// <summary>
/// 搜索数据时的方法
/// </summary>
public Func<T, string, bool> OnSearch;
/// <summary>
/// 行高度
/// </summary>
public float RowHeight
{
get
{
return rowHeight;
}
set
{
rowHeight = value;
}
}
/// <summary>
/// 是否启用上下文右键点击
/// </summary>
public bool IsEnableContextClick { get; set; } = true;
/// <summary>
/// 是否允许多选
/// </summary>
public bool IsCanMultiSelect { get; set; } = true;
/// <summary>
/// 是否启用搜索框
/// </summary>
public bool IsEnableSearch { get; set; } = false;
/// <summary>
/// 表格视图
/// </summary>
/// <param name="datas">表格视图数据</param>
/// <param name="columns">表格视图的所有列</param>
public TableView(List<T> datas, List<TableColumn<T>> columns) : base(new TreeViewState())
{
showAlternatingRowBackgrounds = true;
showBorder = true;
rowHeight = EditorGUIUtility.singleLineHeight + 4;
columns.Insert(0, GetIndexColumn());
multiColumnHeader = new MultiColumnHeader(new MultiColumnHeaderState(columns.ToArray()));
multiColumnHeader.sortingChanged += OnSortingChanged;
multiColumnHeader.visibleColumnsChanged += OnVisibleColumnsChanged;
_datas = datas;
_selectionDatas = new List<T>();
_rootItem = new TableViewItem<T>(-1, -1, null);
_items = new List<TableViewItem<T>>();
for (var i = 0; i < _datas.Count; i++)
{
_items.Add(new TableViewItem<T>(_idSign, 0, _datas[i]));
_idSign += 1;
}
_drawItems = new List<TreeViewItem>();
_searchField = new SearchField();
Reload();
}
/// <summary>
/// 构造根节点
/// </summary>
protected override TreeViewItem BuildRoot()
{
return _rootItem;
}
/// <summary>
/// 构造所有行
/// </summary>
protected override IList<TreeViewItem> BuildRows(TreeViewItem root)
{
_drawItems.Clear();
if (hasSearch && OnSearch != null)
{
for (int i = 0; i < _items.Count; i++)
{
if (OnSearch(_items[i].Data, searchString))
{
_drawItems.Add(_items[i]);
}
}
}
else
{
for (int i = 0; i < _items.Count; i++)
{
_drawItems.Add(_items[i]);
}
}
return _drawItems;
}
/// <summary>
/// 绘制行
/// </summary>
protected override void RowGUI(RowGUIArgs args)
{
TableViewItem<T> item = args.item as TableViewItem<T>;
int visibleColumns = args.GetNumVisibleColumns();
for (var i = 0; i < visibleColumns; i++)
{
Rect cellRect = args.GetCellRect(i);
int index = args.GetColumn(i);
CenterRectUsingSingleLineHeight(ref cellRect);
TableColumn<T> column = multiColumnHeader.GetColumn(index) as TableColumn<T>;
column.DrawCell?.Invoke(cellRect, item.Data, args.row, args.selected, args.focused);
}
}
/// <summary>
/// 上下文右键点击
/// </summary>
protected override void ContextClicked()
{
if (!IsEnableContextClick)
return;
List<T> selectedItems = new List<T>();
foreach (var itemID in GetSelection())
{
TableViewItem<T> item = _items.Find((it) => { return it.id == itemID; });
if (item != null) selectedItems.Add(item.Data);
}
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Add row"), false, () =>
{
AddData(new T());
});
if (selectedItems.Count > 0)
{
menu.AddItem(new GUIContent("Delete selected rows"), false, () =>
{
DeleteDatas(selectedItems);
});
}
menu.AddSeparator("");
menu.AddItem(new GUIContent("Clear rows"), false, () =>
{
ClearData();
});
menu.ShowAsContext();
}
/// <summary>
/// 当选择项改变
/// </summary>
protected override void SelectionChanged(IList<int> selectedIds)
{
base.SelectionChanged(selectedIds);
_selectionDatas.Clear();
foreach (var itemID in selectedIds)
{
TableViewItem<T> item = _items.Find((it) => { return it.id == itemID; });
if (item != null) _selectionDatas.Add(item.Data);
}
OnSelectionChanged?.Invoke(_selectionDatas);
}
/// <summary>
/// 是否允许多选
/// </summary>
protected override bool CanMultiSelect(TreeViewItem item)
{
return IsCanMultiSelect;
}
/// <summary>
/// 绘制表格视图
/// </summary>
/// <param name="rect">绘制区域</param>
public override void OnGUI(Rect rect)
{
if (IsEnableSearch)
{
Rect sub = new Rect(rect.x, rect.y, 60, 16);
EditorGUI.LabelField(sub, "Search: ");
sub.Set(rect.x + 60, rect.y, rect.width - 60, 18);
searchString = _searchField.OnGUI(sub, searchString);
rect.y += 18;
rect.height -= 18;
base.OnGUI(rect);
}
else
{
base.OnGUI(rect);
}
}
/// <summary>
/// 获取索引列
/// </summary>
private TableColumn<T> GetIndexColumn()
{
TableColumn<T> column = new TableColumn<T>();
column.autoResize = false;
column.headerContent = new GUIContent("Index");
column.width = 50;
column.canSort = false;
column.Compare = null;
column.DrawCell = (rect, data, rowIndex, isSelected, isFocused) =>
{
EditorGUI.LabelField(rect, rowIndex.ToString());
};
return column;
}
/// <summary>
/// 当重新排序
/// </summary>
private void OnSortingChanged(MultiColumnHeader columnheader)
{
bool isAscending = multiColumnHeader.IsSortedAscending(multiColumnHeader.sortedColumnIndex);
TableColumn<T> column = multiColumnHeader.GetColumn(multiColumnHeader.sortedColumnIndex) as TableColumn<T>;
if (column.Compare != null)
{
_items.Sort((a, b) =>
{
if (isAscending)
{
return -column.Compare(a.Data, b.Data);
}
else
{
return column.Compare(a.Data, b.Data);
}
});
Reload();
}
}
/// <summary>
/// 当列激活状态改变
/// </summary>
private void OnVisibleColumnsChanged(MultiColumnHeader columnheader)
{
Reload();
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="data">数据</param>
public void AddData(T data)
{
if (_datas.Contains(data))
return;
_datas.Add(data);
_items.Add(new TableViewItem<T>(_idSign, 0, data));
_idSign += 1;
Reload();
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="datas">数据</param>
public void AddDatas(List<T> datas)
{
for (int i = 0; i < datas.Count; i++)
{
T data = datas[i];
if (_datas.Contains(data))
continue;
_datas.Add(data);
_items.Add(new TableViewItem<T>(_idSign, 0, data));
_idSign += 1;
}
Reload();
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="data">数据</param>
public void DeleteData(T data)
{
if (!_datas.Contains(data))
return;
_datas.Remove(data);
TableViewItem<T> item = _items.Find((i) => { return i.Data == data; });
if (item != null)
{
_items.Remove(item);
}
Reload();
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="datas">数据</param>
public void DeleteDatas(List<T> datas)
{
for (int i = 0; i < datas.Count; i++)
{
T data = datas[i];
if (!_datas.Contains(data))
continue;
_datas.Remove(data);
TableViewItem<T> item = _items.Find((t) => { return t.Data == data; });
if (item != null)
{
_items.Remove(item);
}
}
Reload();
}
/// <summary>
/// 选中数据
/// </summary>
/// <param name="data">数据</param>
public void SelectData(T data)
{
if (!_datas.Contains(data))
return;
TableViewItem<T> item = _items.Find((i) => { return i.Data == data; });
if (item != null)
{
SetSelection(new int[] { item.id });
}
}
/// <summary>
/// 选中数据
/// </summary>
/// <param name="data">数据</param>
/// <param name="options">选中的操作</param>
public void SelectData(T data, TreeViewSelectionOptions options)
{
if (!_datas.Contains(data))
return;
TableViewItem<T> item = _items.Find((i) => { return i.Data == data; });
if (item != null)
{
SetSelection(new int[] { item.id }, options);
}
}
/// <summary>
/// 选中数据
/// </summary>
/// <param name="datas">数据</param>
public void SelectDatas(List<T> datas)
{
List<int> ids = new List<int>();
for (int i = 0; i < datas.Count; i++)
{
T data = datas[i];
if (!_datas.Contains(data))
continue;
TableViewItem<T> item = _items.Find((t) => { return t.Data == data; });
if (item != null)
{
ids.Add(item.id);
}
}
if (ids.Count > 0)
{
SetSelection(ids);
}
}
/// <summary>
/// 选中数据
/// </summary>
/// <param name="datas">数据</param>
/// <param name="options">选中的操作</param>
public void SelectDatas(List<T> datas, TreeViewSelectionOptions options)
{
List<int> ids = new List<int>();
for (int i = 0; i < datas.Count; i++)
{
T data = datas[i];
if (!_datas.Contains(data))
continue;
TableViewItem<T> item = _items.Find((t) => { return t.Data == data; });
if (item != null)
{
ids.Add(item.id);
}
}
if (ids.Count > 0)
{
SetSelection(ids, options);
}
}
/// <summary>
/// 清空所有数据
/// </summary>
public void ClearData()
{
_datas.Clear();
_items.Clear();
Reload();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2dc09f5c4e49ffa4c95e07952c1d3060
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
using UnityEditor.IMGUI.Controls;
namespace AlicizaX.EditorExtension.Editor
{
/// <summary>
/// 表格视图元素
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
public sealed class TableViewItem<T> : TreeViewItem where T : class, new()
{
/// <summary>
/// 元素的数据
/// </summary>
public T Data { get; private set; }
public TableViewItem(int id, int depth, T data) : base(id, depth, data == null ? "Root" : data.ToString())
{
Data = data;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb77ca1d28395ff4f9a06dd3bfb23351
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,123 @@
// using System;
// using System.Collections.Generic;
// using AlicizaX.EditorExtension.Editor;
// using UnityEditor;
// using UnityEngine;
//
// public class TestWindow : EditorWindow
// {
// [MenuItem("Test/Table Window")]
// private static void OpenWindow()
// {
// GetWindow<TestWindow>();
// }
//
// private List<Student> _students;
// private List<TableColumn<Student>> _tableColumns;
// private TableView<Student> _tableView;
//
//
// private void OnEnable()
// {
// _students = new List<Student>();
//
// _tableColumns = new List<TableColumn<Student>>();
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("姓名"),
// width = 100,
// canSort = true,
// autoResize = false,
// Compare = (a, b) => { return a.name.CompareTo(b.name); },
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.name = EditorGUI.TextField(cellRect, data.name); },
// });
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("性别"),
// width = 100,
// canSort = true,
// autoResize = false,
// Compare = (a, b) => { return a.sex.CompareTo(b.sex); },
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.sex = (Sex)EditorGUI.EnumPopup(cellRect, data.sex); },
// });
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("年龄"),
// width = 100,
// canSort = true,
// autoResize = false,
// Compare = (a, b) => { return a.age.CompareTo(b.age); },
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.age = EditorGUI.IntField(cellRect, data.age); },
// });
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("班级"),
// width = 100,
// canSort = true,
// autoResize = false,
// Compare = (a, b) => { return a.grade.CompareTo(b.grade); },
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.grade = EditorGUI.TextField(cellRect, data.grade); },
// });
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("家庭住址"),
// width = 100,
// canSort = true,
// autoResize = false,
// Compare = (a, b) => { return a.address.CompareTo(b.address); },
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.address = EditorGUI.TextField(cellRect, data.address); },
// });
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("实体"),
// width = 100,
// canSort = false,
// autoResize = false,
// Compare = null,
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.entity = (GameObject)EditorGUI.ObjectField(cellRect, data.entity, typeof(GameObject), true); },
// });
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("颜色"),
// width = 100,
// canSort = false,
// autoResize = false,
// Compare = null,
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.col = EditorGUI.ColorField(cellRect, data.col); },
// });
// _tableColumns.Add(new TableColumn<Student>()
// {
// headerContent = new GUIContent("头像"),
// width = 100,
// canSort = false,
// autoResize = false,
// Compare = null,
// DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.headImage = (Texture)EditorGUI.ObjectField(cellRect, data.headImage, typeof(Texture), true); },
// });
//
// _tableView = new TableView<Student>(_students, _tableColumns);
// }
//
// private void OnGUI()
// {
// _tableView.OnGUI(new Rect(0, 0, position.width, position.height));
// }
//
// public class Student
// {
// public string name;
// public Sex sex;
// public int age;
// public string grade;
// public string address;
// public GameObject entity;
// public Color col;
// public Texture headImage;
// }
//
// public enum Sex
// {
// Man,
// Woman
// }
// }

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b4499d5ef3354ae2aeeefaf2b84ce7fe
timeCreated: 1737877281

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d0db87a441d3456ba21f8d2e561bb3ce
timeCreated: 1737880132

View File

@ -0,0 +1,34 @@
namespace AlicizaX.EditorExtension.Editor
{
public static class EditorGUIStyleTools
{
#region Styles
public static class Styles
{
public static readonly string Box = "Box";
public static readonly string IconButton = "IconButton";
public static readonly string InvisibleButton = "InvisibleButton";
public static readonly string LargeButton = "LargeButton";
public static readonly string LargeButtonLeft = "LargeButtonLeft";
public static readonly string LargeButtonMid = "LargeButtonMid";
public static readonly string LargeButtonRight = "LargeButtonRight";
public static readonly string ButtonLeft = "ButtonLeft";
public static readonly string ButtonMid = "ButtonMid";
public static readonly string ButtonRight = "ButtonRight";
public static readonly string MiniPopup = "MiniPopup";
public static readonly string Wordwrapminibutton = "Wordwrapminibutton";
public static readonly string OLPlus = "OL Plus";
public static readonly string OLMinus = "OL Minus";
public static readonly string Label = "Label";
public static readonly string SearchTextField = "SearchTextField";
public static readonly string SearchCancelButton = "SearchCancelButton";
public static readonly string SearchCancelButtonEmpty = "SearchCancelButtonEmpty";
public static readonly string ToolbarSearchTextField = "ToolbarSearchTextField";
public static readonly string ToolbarSearchCancelButton = "ToolbarSearchCancelButton";
public static readonly string ToolbarSearchCancelButtonEmpty = "ToolbarSearchCancelButtonEmpty";
}
#endregion
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 92da4b7892cf43449486990821d1410d
timeCreated: 1737880134

View File

@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;
namespace BuildCli
namespace AlicizaX.EditorExtension.Editor
{
public class GameEditorPrefs
{

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [2023] [ALianBlank of copyright owner][alianblank@outlook.com][https://alianblank.com/]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0c520ab496dfeb045b9ad728585fd3ff
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e41f42c82ca94ef4ca278c3ef73000ad
guid: 68154f52a1971584ead0467fcd6bd806
folderAsset: yes
DefaultImporter:
externalObjects: {}

Some files were not shown because too many files have changed in this diff Show More