This commit is contained in:
SepComet
2026-02-26 13:21:43 +08:00
parent a118803f1a
commit 4daefa17d5
1259 changed files with 290021 additions and 1 deletions
@@ -0,0 +1,30 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using System.IO;
using UnityEngine;
using UnityGameFramework.Editor;
using UnityGameFramework.Editor.ResourceTools;
namespace GeometryTD.Editor
{
public static class GameFrameworkConfigs
{
[BuildSettingsConfigPath]
public static string BuildSettingsConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/BuildSettings.xml"));
[ResourceCollectionConfigPath]
public static string ResourceCollectionConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/ResourceCollection.xml"));
[ResourceEditorConfigPath]
public static string ResourceEditorConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/ResourceEditor.xml"));
[ResourceBuilderConfigPath]
public static string ResourceBuilderConfig = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "GameMain/Configs/ResourceBuilder.xml"));
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 36618c709c84656438dd91e565226606
timeCreated: 1528026150
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,83 @@
using GameFramework;
using System.IO;
using UnityEditor;
using UnityEngine;
using UnityGameFramework.Editor.ResourceTools;
namespace GeometryTD.Editor
{
public sealed class GeometryTDBuildEventHandler : IBuildEventHandler
{
public bool ContinueOnFailure
{
get
{
return false;
}
}
public void OnPreprocessAllPlatforms(string productName, string companyName, string gameIdentifier, string gameFrameworkVersion, string unityVersion, string applicableGameVersion, int internalResourceVersion,
Platform platforms, AssetBundleCompressionType assetBundleCompression, string compressionHelperTypeName, bool additionalCompressionSelected, bool forceRebuildAssetBundleSelected, string buildEventHandlerTypeName, string outputDirectory, BuildAssetBundleOptions buildAssetBundleOptions,
string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
{
string streamingAssetsPath = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "StreamingAssets"));
string[] fileNames = Directory.GetFiles(streamingAssetsPath, "*", SearchOption.AllDirectories);
foreach (string fileName in fileNames)
{
if (fileName.Contains(".gitkeep"))
{
continue;
}
File.Delete(fileName);
}
Utility.Path.RemoveEmptyDirectory(streamingAssetsPath);
}
public void OnPostprocessAllPlatforms(string productName, string companyName, string gameIdentifier, string gameFrameworkVersion, string unityVersion, string applicableGameVersion, int internalResourceVersion,
Platform platforms, AssetBundleCompressionType assetBundleCompression, string compressionHelperTypeName, bool additionalCompressionSelected, bool forceRebuildAssetBundleSelected, string buildEventHandlerTypeName, string outputDirectory, BuildAssetBundleOptions buildAssetBundleOptions,
string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
{
}
public void OnPreprocessPlatform(Platform platform, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath)
{
}
public void OnBuildAssetBundlesComplete(Platform platform, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, AssetBundleManifest assetBundleManifest)
{
}
public void OnOutputUpdatableVersionListData(Platform platform, string versionListPath, int versionListLength, int versionListHashCode, int versionListCompressedLength, int versionListCompressedHashCode)
{
}
public void OnPostprocessPlatform(Platform platform, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, bool isSuccess)
{
if (!outputPackageSelected)
{
return;
}
if (platform != Platform.Windows)
{
return;
}
string streamingAssetsPath = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "StreamingAssets"));
string[] fileNames = Directory.GetFiles(outputPackagePath, "*", SearchOption.AllDirectories);
foreach (string fileName in fileNames)
{
string destFileName = Utility.Path.GetRegularPath(Path.Combine(streamingAssetsPath, fileName.Substring(outputPackagePath.Length)));
FileInfo destFileInfo = new FileInfo(destFileName);
if (!destFileInfo.Directory.Exists)
{
destFileInfo.Directory.Create();
}
File.Copy(fileName, destFileName);
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 64311189c3f9ae140b59a31db9831950
timeCreated: 1528026151
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using System.IO;
[InitializeOnLoad]
public class SceneSwitchLeft
{
static SceneSwitchLeft()
{
// 注册到全局工具栏绘制事件
SceneView.duringSceneGui += OnSceneGUI;
}
static void OnSceneGUI(SceneView sceneView)
{
// 在 Scene 视图的左上角绘制一个下拉菜单
Handles.BeginGUI();
GUILayout.BeginArea(new Rect(10, 10, 200, 100));
if (EditorGUILayout.DropdownButton(new GUIContent("快速切换场景"), FocusType.Passive, EditorStyles.toolbarDropDown))
{
ShowSceneMenu();
}
GUILayout.EndArea();
Handles.EndGUI();
}
static void ShowSceneMenu()
{
GenericMenu menu = new GenericMenu();
// 查找项目中所有启用(Enabled)的场景
string[] sceneGuids = AssetDatabase.FindAssets("t:Scene");
foreach (string guid in sceneGuids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
string name = Path.GetFileNameWithoutExtension(path);
menu.AddItem(new GUIContent(name), false, () => {
if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
EditorSceneManager.OpenScene(path);
}
});
}
menu.ShowAsContext();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e7f70b2d5386e4941ab913255891bb99
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: