翻译所有的注释

This commit is contained in:
2026-07-10 12:20:54 +08:00
parent 5a70aaeed2
commit 9f83fd74ec
5 changed files with 76 additions and 76 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
@@ -11,7 +11,7 @@ namespace Kirurobo
//[MenuItem("Build/Build OSX")]
static void PerformBuild()
{
// コマンドライン引数の最後が出力パスだとする
// 假设命令行参数的最后一个参数为输出路径
//string outputPath = System.Environment.GetCommandLineArgs().Last();
// var buildPlayerOptions = new BuildPlayerOptions();
@@ -20,12 +20,12 @@ namespace Kirurobo
// buildPlayerOptions.target = BuildTarget.StandaloneOSX;
// buildPlayerOptions.options = BuildOptions.None;
// 事前にエディタから設定したビルド設定を利用
// 使用预先在编辑器中设置的构建设置
var scenes = EditorBuildSettings.scenes;
var buildTarget = EditorUserBuildSettings.activeBuildTarget;
var locationPath = EditorUserBuildSettings.GetBuildLocation(buildTarget);
// ビルド対象は環境に合わせて上書き
// 根据环境覆盖构建目标
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
buildTarget = BuildTarget.StandaloneOSX;
locationPath = "Builds/macOS/" + Application.productName;
@@ -42,7 +42,7 @@ namespace Kirurobo
options = BuildOptions.None
};
// // 内容チェック用
// // 用于内容检查
// foreach (var scene in buildPlayerOptions.scenes)
// {
// Debug.Log(scene);
+46 -46
View File
@@ -5,8 +5,8 @@
* License: MIT
*/
// Assembry Definition を有効にしてから、ビルド時に Editor クラスがないとエラーが出る。
// そこで丸ごと UNITY_EDITOR が無い場合は無視するものとした
// 启用了程序集定义后,如果构建时没有 Editor 类会报错。
// 因此整体用 UNITY_EDITOR 包裹,没有时直接忽略
#if UNITY_EDITOR
using System.Linq;
@@ -18,32 +18,32 @@ using UnityEngine.Rendering;
namespace Kirurobo
{
/// <summary>
/// UniWindowControllerのためのエディタカスタマイズ部分
/// UniWindowController 的编辑器自定义部分
/// </summary>
[CustomEditor(typeof(UniWindowController))]
public class UniWindowControllerEditor : Editor
{
/// <summary>
/// カーソル下の色を表示するためのプロパティ
/// 用于显示光标下方颜色的属性
/// </summary>
SerializedProperty pickedColor;
/// <summary>
/// ゲームビューのウィンドウ
/// 游戏视图窗口
/// </summary>
private EditorWindow gameViewWindow;
/// <summary>
/// プロジェクト設定に関する警告を閉じておくか
/// 是否已关闭项目设置相关的警告
private bool isWarningDismissed = false;
/// <summary>
/// URP に関する警告を閉じておくか
/// 是否已关闭 URP 相关警告
/// </summary>
private bool isUrpWarningDismissed = true;
/// <summary>
/// URP が有効かどうか
/// URP 是否有效
/// </summary>
private bool hasUrp = false;
@@ -53,7 +53,7 @@ namespace Kirurobo
pickedColor = serializedObject.FindProperty("pickedColor");
// URP が有効か否かを判定
// 判断 URP 是否有效
hasUrp = GetUrpSettings();
}
@@ -63,7 +63,7 @@ namespace Kirurobo
}
/// <summary>
/// URPが有効か否かを検出
/// 检测 URP 是否有效
/// </summary>
/// <returns></returns>
private bool GetUrpSettings()
@@ -71,7 +71,7 @@ namespace Kirurobo
var renderPipelineAsset = GraphicsSettings.defaultRenderPipeline;
if (renderPipelineAsset == null || renderPipelineAsset.GetType().Name != "UniversalRenderPipelineAsset")
{
// URP が設定されていない
// URP 未设置
return false;
}
return true;
@@ -88,16 +88,16 @@ namespace Kirurobo
}
/// <summary>
/// インスペクタでの表示をカスタマイズ
/// 自定义检视面板的显示
/// </summary>
/// <description>
/// 参考情報および、推奨設定の変更欄を表示します。
/// 显示参考信息以及推荐设置的更改栏。
/// </description>
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
// カーソル下の色が得られていれば、その透明度を参考として表示
// 如果获取到了光标下的颜色,则显示其透明度作为参考
if (pickedColor != null)
{
EditorGUI.BeginDisabledGroup(true);
@@ -105,29 +105,29 @@ namespace Kirurobo
EditorGUI.EndDisabledGroup();
}
// Project Settings の推奨設定を表示
// 显示 Project Settings 的推荐设置
isWarningDismissed = ShowPlayerSettingsValidation(isWarningDismissed);
// URP 関連の推奨設定を表示
// 显示 URP 相关推荐设置
isUrpWarningDismissed = ShowUrpSettingsValidation(isUrpWarningDismissed);
}
/// <summary>
/// Project Settings に関する推奨設定の自動設定欄を表示
/// 显示 Project Settings 相关推荐设置的自动配置栏
/// </summary>
private bool ShowPlayerSettingsValidation(bool dismissed) {
// 以下は Project Settings 関連
// 以下是 Project Settings 相关
EditorGUILayout.Space();
bool enableValidation = EditorGUILayout.Foldout(!dismissed, "播放器设置验证");
// チェックするかどうかを記憶
// 记录是否启用检查
if (enableValidation == dismissed)
{
dismissed = !enableValidation;
}
// 推奨設定のチェック
// 检查推荐设置
//if (!isWarningDismissed)
if (enableValidation)
{
@@ -184,23 +184,23 @@ namespace Kirurobo
}
/// <summary>
/// URP に関する推奨設定の自動設定欄を表示
/// 显示 URP 相关推荐设置的自动配置栏
/// </summary>
private bool ShowUrpSettingsValidation(bool dismissed) {
// URP が無効ならば何もしない
// 如果 URP 未启用则不执行任何操作
if (!hasUrp) return dismissed;
// 以下は URP 関連の自動設定
// 以下是 URP 相关自动设置
EditorGUILayout.Space();
bool enableValidation = EditorGUILayout.Foldout(!dismissed, "URP 设置验证");
// チェックするかどうかを記憶
// 记录是否启用检查
if (enableValidation == dismissed)
{
dismissed = !enableValidation;
}
// 推奨設定のチェック
//if (!isWarningDismissed)
// 检查推荐设置
if (enableValidation)
{
if (ValidateUrpSettings(false))
@@ -283,7 +283,7 @@ namespace Kirurobo
EditorGUILayout.HelpBox(message, MessageType.Info, true);
GUILayout.FlexibleSpace();
// 自動設定できない対象は、プロジェクトウィンドウで示すのみ
// 无法自动设置的对象,仅在项目窗口中标识
if (target != null)
{
EditorGUILayout.BeginVertical();
@@ -305,7 +305,7 @@ namespace Kirurobo
{
bool invalid = false;
// バックグラウンドでも実行する。クリックスルー切替などで必要
// 在后台运行。点击穿透切换等功能需要此设置
if (!PlayerSettings.runInBackground)
{
invalid = true;
@@ -316,7 +316,7 @@ namespace Kirurobo
);
}
// サイズ変更可能なウィンドウとする。必須ではないがウィンドウ枠無効時にサイズも変わるので変更可能である方が自然
// 设为可调整大小的窗口。非必需,但当窗口边框无效时大小会变化,因此可调整更自然
if (!PlayerSettings.resizableWindow)
{
invalid = true;
@@ -327,9 +327,9 @@ namespace Kirurobo
);
}
// フルスクリーンでなくウィンドウとする
// 设为窗口模式而非全屏
#if UNITY_2018_1_OR_NEWER
// Unity 2018 からはフルスクリーン指定の仕様が変わった
// Unity 2018 起全屏指定的行为发生了变化
if (PlayerSettings.fullScreenMode != FullScreenMode.Windowed)
{
invalid = true;
@@ -352,7 +352,7 @@ namespace Kirurobo
}
#endif
// フルスクリーンとウィンドウの切替を無効とする
// 禁止全屏与窗口模式的切换
if (PlayerSettings.allowFullscreenSwitch)
{
invalid = true;
@@ -363,9 +363,9 @@ namespace Kirurobo
);
}
// Windowsでは Use DXGI Flip Mode Swapchain を無効にしないと透過できない
// ↓Unity 2019.1.6未満だと useFlipModelSwapchain は無いはず
// なので除外のため書き連ねてあるが、ここまでサポートしなくて良い気もする。
// Windows 下不禁用 Use DXGI Flip Mode Swapchain 则无法透明
// ↓Unity 2019.1.6 以下应该没有 useFlipModelSwapchain
// 因此为了排除这些版本而逐一列出,但可能不需要支持到这么老的版本
#if UNITY_2019_1_6
#elif UNITY_2019_1_5
#elif UNITY_2019_1_4
@@ -374,7 +374,7 @@ namespace Kirurobo
#elif UNITY_2019_1_1
#elif UNITY_2019_1_0
#elif UNITY_2019_1_OR_NEWER
// Unity 2019.1.7 以降であれば、Player 設定 の Use DXGI Flip... 無効化を推奨
// Unity 2019.1.7 以上推荐在 Player 设置中禁用 Use DXGI Flip...
if (PlayerSettings.useFlipModelSwapchain)
{
invalid = true;
@@ -385,10 +385,10 @@ namespace Kirurobo
);
}
// Direct3D12 は透過ウィンドウに対応していないので、Graphics APIs for Windows から除外することを推奨
// Direct3D12 不支持透明窗口,建议从 Graphics APIs for Windows 中移除
if (PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.StandaloneWindows))
{
// 自動の場合も警告を出す
// 自动选择图形 API 时也发出警告
ShowInfo(
"Direct3D12 不支持透明窗口。" +
"请考虑在播放器设置中使用 Direct3D11 替代'自动图形 API for Windows'设置。",
@@ -397,7 +397,7 @@ namespace Kirurobo
}
else if (PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows).Contains(GraphicsDeviceType.Direct3D12))
{
// Graphhics APIs for Windows に Direct3D12 が含まれている場合は警告を出す
// Graphics APIs for Windows 中包含 Direct3D12 时发出警告
ShowInfo(
"Direct3D12 不支持透明窗口。" +
"请从播放器设置的'图形 API for Windows'中移除 Direct3D12。",
@@ -418,7 +418,7 @@ namespace Kirurobo
{
bool invalid = false;
// Universal Render Pipelineが有効ならば、HDRの無効化を推奨
// 如果启用了 Universal Render Pipeline,建议禁用 HDR
foreach (var cam in Camera.allCameras)
{
if (cam.allowHDR) {
@@ -444,7 +444,7 @@ namespace Kirurobo
var urpAsset = GraphicsSettings.defaultRenderPipeline;
if (hasUrp && urpAsset != null)
{
// hasUrp == true の時点で urpAsset は UniversalRenderPipelineAsset であるはず。そのため allowPostProcessAlphaOutput があるはず
// hasUrp == true 时 urpAsset 应该是 UniversalRenderPipelineAsset,因此应该存在 allowPostProcessAlphaOutput
var alphaProcessingProperty = urpAsset.GetType().GetProperty("allowPostProcessAlphaOutput", BindingFlags.Public | BindingFlags.Instance);
if (alphaProcessingProperty != null)
{
@@ -490,7 +490,7 @@ namespace Kirurobo
Object obj = property.serializedObject.targetObject;
// Range(min, max) が設定されていれば取得
// 如果设置了 Range(min, max) 则获取
FieldInfo fieldInfo = obj.GetType().GetField(
property.name,
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static
@@ -500,10 +500,10 @@ namespace Kirurobo
if (EditorApplication.isPlayingOrWillChangePlaymode)
{
// 変数の先頭が '_' であることが動作の条件
// 以 '_' 开头作为操作条件的依据
if (property.name[0] == '_')
{
string propertyName = property.name.Substring(1); // '_' なしをプロパティ名として取得
string propertyName = property.name.Substring(1); // 获取去掉 '_' 后的属性名
PropertyInfo info = obj.GetType().GetProperty(propertyName);
MethodInfo getMethod = default(MethodInfo);
MethodInfo setMethod = default(MethodInfo);
@@ -553,7 +553,7 @@ namespace Kirurobo
}
else
{
// bool, float 以外は今のところ非対応で Readonly とする
// bool、float 以外的类型暂不支持,设为只读
GUI.enabled = false;
EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = true;
@@ -569,7 +569,7 @@ namespace Kirurobo
}
else
{
// Range 指定があればスライダー
// 有 Range 指定则显示为滑块
if (range != null)
{
EditorGUI.Slider(position, property, range.min, range.max, label);