翻译所有的注释

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;
using UnityEditor.Build; using UnityEditor.Build;
using UnityEditor.Build.Reporting; using UnityEditor.Build.Reporting;
@@ -11,7 +11,7 @@ namespace Kirurobo
//[MenuItem("Build/Build OSX")] //[MenuItem("Build/Build OSX")]
static void PerformBuild() static void PerformBuild()
{ {
// コマンドライン引数の最後が出力パスだとする // 假设命令行参数的最后一个参数为输出路径
//string outputPath = System.Environment.GetCommandLineArgs().Last(); //string outputPath = System.Environment.GetCommandLineArgs().Last();
// var buildPlayerOptions = new BuildPlayerOptions(); // var buildPlayerOptions = new BuildPlayerOptions();
@@ -20,12 +20,12 @@ namespace Kirurobo
// buildPlayerOptions.target = BuildTarget.StandaloneOSX; // buildPlayerOptions.target = BuildTarget.StandaloneOSX;
// buildPlayerOptions.options = BuildOptions.None; // buildPlayerOptions.options = BuildOptions.None;
// 事前にエディタから設定したビルド設定を利用 // 使用预先在编辑器中设置的构建设置
var scenes = EditorBuildSettings.scenes; var scenes = EditorBuildSettings.scenes;
var buildTarget = EditorUserBuildSettings.activeBuildTarget; var buildTarget = EditorUserBuildSettings.activeBuildTarget;
var locationPath = EditorUserBuildSettings.GetBuildLocation(buildTarget); var locationPath = EditorUserBuildSettings.GetBuildLocation(buildTarget);
// ビルド対象は環境に合わせて上書き // 根据环境覆盖构建目标
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
buildTarget = BuildTarget.StandaloneOSX; buildTarget = BuildTarget.StandaloneOSX;
locationPath = "Builds/macOS/" + Application.productName; locationPath = "Builds/macOS/" + Application.productName;
@@ -42,7 +42,7 @@ namespace Kirurobo
options = BuildOptions.None options = BuildOptions.None
}; };
// // 内容チェック用 // // 用于内容检查
// foreach (var scene in buildPlayerOptions.scenes) // foreach (var scene in buildPlayerOptions.scenes)
// { // {
// Debug.Log(scene); // Debug.Log(scene);
+46 -46
View File
@@ -5,8 +5,8 @@
* License: MIT * License: MIT
*/ */
// Assembry Definition を有効にしてから、ビルド時に Editor クラスがないとエラーが出る。 // 启用了程序集定义后,如果构建时没有 Editor 类会报错。
// そこで丸ごと UNITY_EDITOR が無い場合は無視するものとした // 因此整体用 UNITY_EDITOR 包裹,没有时直接忽略
#if UNITY_EDITOR #if UNITY_EDITOR
using System.Linq; using System.Linq;
@@ -18,32 +18,32 @@ using UnityEngine.Rendering;
namespace Kirurobo namespace Kirurobo
{ {
/// <summary> /// <summary>
/// UniWindowControllerのためのエディタカスタマイズ部分 /// UniWindowController 的编辑器自定义部分
/// </summary> /// </summary>
[CustomEditor(typeof(UniWindowController))] [CustomEditor(typeof(UniWindowController))]
public class UniWindowControllerEditor : Editor public class UniWindowControllerEditor : Editor
{ {
/// <summary> /// <summary>
/// カーソル下の色を表示するためのプロパティ /// 用于显示光标下方颜色的属性
/// </summary> /// </summary>
SerializedProperty pickedColor; SerializedProperty pickedColor;
/// <summary> /// <summary>
/// ゲームビューのウィンドウ /// 游戏视图窗口
/// </summary> /// </summary>
private EditorWindow gameViewWindow; private EditorWindow gameViewWindow;
/// <summary> /// <summary>
/// プロジェクト設定に関する警告を閉じておくか /// 是否已关闭项目设置相关的警告
private bool isWarningDismissed = false; private bool isWarningDismissed = false;
/// <summary> /// <summary>
/// URP に関する警告を閉じておくか /// 是否已关闭 URP 相关警告
/// </summary> /// </summary>
private bool isUrpWarningDismissed = true; private bool isUrpWarningDismissed = true;
/// <summary> /// <summary>
/// URP が有効かどうか /// URP 是否有效
/// </summary> /// </summary>
private bool hasUrp = false; private bool hasUrp = false;
@@ -53,7 +53,7 @@ namespace Kirurobo
pickedColor = serializedObject.FindProperty("pickedColor"); pickedColor = serializedObject.FindProperty("pickedColor");
// URP が有効か否かを判定 // 判断 URP 是否有效
hasUrp = GetUrpSettings(); hasUrp = GetUrpSettings();
} }
@@ -63,7 +63,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// URPが有効か否かを検出 /// 检测 URP 是否有效
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private bool GetUrpSettings() private bool GetUrpSettings()
@@ -71,7 +71,7 @@ namespace Kirurobo
var renderPipelineAsset = GraphicsSettings.defaultRenderPipeline; var renderPipelineAsset = GraphicsSettings.defaultRenderPipeline;
if (renderPipelineAsset == null || renderPipelineAsset.GetType().Name != "UniversalRenderPipelineAsset") if (renderPipelineAsset == null || renderPipelineAsset.GetType().Name != "UniversalRenderPipelineAsset")
{ {
// URP が設定されていない // URP 未设置
return false; return false;
} }
return true; return true;
@@ -88,16 +88,16 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// インスペクタでの表示をカスタマイズ /// 自定义检视面板的显示
/// </summary> /// </summary>
/// <description> /// <description>
/// 参考情報および、推奨設定の変更欄を表示します。 /// 显示参考信息以及推荐设置的更改栏。
/// </description> /// </description>
public override void OnInspectorGUI() public override void OnInspectorGUI()
{ {
base.OnInspectorGUI(); base.OnInspectorGUI();
// カーソル下の色が得られていれば、その透明度を参考として表示 // 如果获取到了光标下的颜色,则显示其透明度作为参考
if (pickedColor != null) if (pickedColor != null)
{ {
EditorGUI.BeginDisabledGroup(true); EditorGUI.BeginDisabledGroup(true);
@@ -105,29 +105,29 @@ namespace Kirurobo
EditorGUI.EndDisabledGroup(); EditorGUI.EndDisabledGroup();
} }
// Project Settings の推奨設定を表示 // 显示 Project Settings 的推荐设置
isWarningDismissed = ShowPlayerSettingsValidation(isWarningDismissed); isWarningDismissed = ShowPlayerSettingsValidation(isWarningDismissed);
// URP 関連の推奨設定を表示 // 显示 URP 相关推荐设置
isUrpWarningDismissed = ShowUrpSettingsValidation(isUrpWarningDismissed); isUrpWarningDismissed = ShowUrpSettingsValidation(isUrpWarningDismissed);
} }
/// <summary> /// <summary>
/// Project Settings に関する推奨設定の自動設定欄を表示 /// 显示 Project Settings 相关推荐设置的自动配置栏
/// </summary> /// </summary>
private bool ShowPlayerSettingsValidation(bool dismissed) { private bool ShowPlayerSettingsValidation(bool dismissed) {
// 以下は Project Settings 関連 // 以下是 Project Settings 相关
EditorGUILayout.Space(); EditorGUILayout.Space();
bool enableValidation = EditorGUILayout.Foldout(!dismissed, "播放器设置验证"); bool enableValidation = EditorGUILayout.Foldout(!dismissed, "播放器设置验证");
// チェックするかどうかを記憶 // 记录是否启用检查
if (enableValidation == dismissed) if (enableValidation == dismissed)
{ {
dismissed = !enableValidation; dismissed = !enableValidation;
} }
// 推奨設定のチェック // 检查推荐设置
//if (!isWarningDismissed) //if (!isWarningDismissed)
if (enableValidation) if (enableValidation)
{ {
@@ -184,23 +184,23 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// URP に関する推奨設定の自動設定欄を表示 /// 显示 URP 相关推荐设置的自动配置栏
/// </summary> /// </summary>
private bool ShowUrpSettingsValidation(bool dismissed) { private bool ShowUrpSettingsValidation(bool dismissed) {
// URP が無効ならば何もしない // 如果 URP 未启用则不执行任何操作
if (!hasUrp) return dismissed; if (!hasUrp) return dismissed;
// 以下は URP 関連の自動設定 // 以下是 URP 相关自动设置
EditorGUILayout.Space(); EditorGUILayout.Space();
bool enableValidation = EditorGUILayout.Foldout(!dismissed, "URP 设置验证"); bool enableValidation = EditorGUILayout.Foldout(!dismissed, "URP 设置验证");
// チェックするかどうかを記憶 // 记录是否启用检查
if (enableValidation == dismissed) if (enableValidation == dismissed)
{ {
dismissed = !enableValidation; dismissed = !enableValidation;
} }
// 推奨設定のチェック
//if (!isWarningDismissed) // 检查推荐设置
if (enableValidation) if (enableValidation)
{ {
if (ValidateUrpSettings(false)) if (ValidateUrpSettings(false))
@@ -283,7 +283,7 @@ namespace Kirurobo
EditorGUILayout.HelpBox(message, MessageType.Info, true); EditorGUILayout.HelpBox(message, MessageType.Info, true);
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
// 自動設定できない対象は、プロジェクトウィンドウで示すのみ // 无法自动设置的对象,仅在项目窗口中标识
if (target != null) if (target != null)
{ {
EditorGUILayout.BeginVertical(); EditorGUILayout.BeginVertical();
@@ -305,7 +305,7 @@ namespace Kirurobo
{ {
bool invalid = false; bool invalid = false;
// バックグラウンドでも実行する。クリックスルー切替などで必要 // 在后台运行。点击穿透切换等功能需要此设置
if (!PlayerSettings.runInBackground) if (!PlayerSettings.runInBackground)
{ {
invalid = true; invalid = true;
@@ -316,7 +316,7 @@ namespace Kirurobo
); );
} }
// サイズ変更可能なウィンドウとする。必須ではないがウィンドウ枠無効時にサイズも変わるので変更可能である方が自然 // 设为可调整大小的窗口。非必需,但当窗口边框无效时大小会变化,因此可调整更自然
if (!PlayerSettings.resizableWindow) if (!PlayerSettings.resizableWindow)
{ {
invalid = true; invalid = true;
@@ -327,9 +327,9 @@ namespace Kirurobo
); );
} }
// フルスクリーンでなくウィンドウとする // 设为窗口模式而非全屏
#if UNITY_2018_1_OR_NEWER #if UNITY_2018_1_OR_NEWER
// Unity 2018 からはフルスクリーン指定の仕様が変わった // Unity 2018 起全屏指定的行为发生了变化
if (PlayerSettings.fullScreenMode != FullScreenMode.Windowed) if (PlayerSettings.fullScreenMode != FullScreenMode.Windowed)
{ {
invalid = true; invalid = true;
@@ -352,7 +352,7 @@ namespace Kirurobo
} }
#endif #endif
// フルスクリーンとウィンドウの切替を無効とする // 禁止全屏与窗口模式的切换
if (PlayerSettings.allowFullscreenSwitch) if (PlayerSettings.allowFullscreenSwitch)
{ {
invalid = true; invalid = true;
@@ -363,9 +363,9 @@ namespace Kirurobo
); );
} }
// Windowsでは Use DXGI Flip Mode Swapchain を無効にしないと透過できない // Windows 下不禁用 Use DXGI Flip Mode Swapchain 则无法透明
// ↓Unity 2019.1.6未満だと useFlipModelSwapchain は無いはず // ↓Unity 2019.1.6 以下应该没有 useFlipModelSwapchain
// なので除外のため書き連ねてあるが、ここまでサポートしなくて良い気もする。 // 因此为了排除这些版本而逐一列出,但可能不需要支持到这么老的版本
#if UNITY_2019_1_6 #if UNITY_2019_1_6
#elif UNITY_2019_1_5 #elif UNITY_2019_1_5
#elif UNITY_2019_1_4 #elif UNITY_2019_1_4
@@ -374,7 +374,7 @@ namespace Kirurobo
#elif UNITY_2019_1_1 #elif UNITY_2019_1_1
#elif UNITY_2019_1_0 #elif UNITY_2019_1_0
#elif UNITY_2019_1_OR_NEWER #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) if (PlayerSettings.useFlipModelSwapchain)
{ {
invalid = true; invalid = true;
@@ -385,10 +385,10 @@ namespace Kirurobo
); );
} }
// Direct3D12 は透過ウィンドウに対応していないので、Graphics APIs for Windows から除外することを推奨 // Direct3D12 不支持透明窗口,建议从 Graphics APIs for Windows 中移除
if (PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.StandaloneWindows)) if (PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.StandaloneWindows))
{ {
// 自動の場合も警告を出す // 自动选择图形 API 时也发出警告
ShowInfo( ShowInfo(
"Direct3D12 不支持透明窗口。" + "Direct3D12 不支持透明窗口。" +
"请考虑在播放器设置中使用 Direct3D11 替代'自动图形 API for Windows'设置。", "请考虑在播放器设置中使用 Direct3D11 替代'自动图形 API for Windows'设置。",
@@ -397,7 +397,7 @@ namespace Kirurobo
} }
else if (PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows).Contains(GraphicsDeviceType.Direct3D12)) else if (PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneWindows).Contains(GraphicsDeviceType.Direct3D12))
{ {
// Graphhics APIs for Windows に Direct3D12 が含まれている場合は警告を出す // Graphics APIs for Windows 中包含 Direct3D12 时发出警告
ShowInfo( ShowInfo(
"Direct3D12 不支持透明窗口。" + "Direct3D12 不支持透明窗口。" +
"请从播放器设置的'图形 API for Windows'中移除 Direct3D12。", "请从播放器设置的'图形 API for Windows'中移除 Direct3D12。",
@@ -418,7 +418,7 @@ namespace Kirurobo
{ {
bool invalid = false; bool invalid = false;
// Universal Render Pipelineが有効ならば、HDRの無効化を推奨 // 如果启用了 Universal Render Pipeline,建议禁用 HDR
foreach (var cam in Camera.allCameras) foreach (var cam in Camera.allCameras)
{ {
if (cam.allowHDR) { if (cam.allowHDR) {
@@ -444,7 +444,7 @@ namespace Kirurobo
var urpAsset = GraphicsSettings.defaultRenderPipeline; var urpAsset = GraphicsSettings.defaultRenderPipeline;
if (hasUrp && urpAsset != null) if (hasUrp && urpAsset != null)
{ {
// hasUrp == true の時点で urpAsset は UniversalRenderPipelineAsset であるはず。そのため allowPostProcessAlphaOutput があるはず // hasUrp == true 时 urpAsset 应该是 UniversalRenderPipelineAsset,因此应该存在 allowPostProcessAlphaOutput
var alphaProcessingProperty = urpAsset.GetType().GetProperty("allowPostProcessAlphaOutput", BindingFlags.Public | BindingFlags.Instance); var alphaProcessingProperty = urpAsset.GetType().GetProperty("allowPostProcessAlphaOutput", BindingFlags.Public | BindingFlags.Instance);
if (alphaProcessingProperty != null) if (alphaProcessingProperty != null)
{ {
@@ -490,7 +490,7 @@ namespace Kirurobo
Object obj = property.serializedObject.targetObject; Object obj = property.serializedObject.targetObject;
// Range(min, max) が設定されていれば取得 // 如果设置了 Range(min, max) 则获取
FieldInfo fieldInfo = obj.GetType().GetField( FieldInfo fieldInfo = obj.GetType().GetField(
property.name, property.name,
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static
@@ -500,10 +500,10 @@ namespace Kirurobo
if (EditorApplication.isPlayingOrWillChangePlaymode) if (EditorApplication.isPlayingOrWillChangePlaymode)
{ {
// 変数の先頭が '_' であることが動作の条件 // 以 '_' 开头作为操作条件的依据
if (property.name[0] == '_') if (property.name[0] == '_')
{ {
string propertyName = property.name.Substring(1); // '_' なしをプロパティ名として取得 string propertyName = property.name.Substring(1); // 获取去掉 '_' 后的属性名
PropertyInfo info = obj.GetType().GetProperty(propertyName); PropertyInfo info = obj.GetType().GetProperty(propertyName);
MethodInfo getMethod = default(MethodInfo); MethodInfo getMethod = default(MethodInfo);
MethodInfo setMethod = default(MethodInfo); MethodInfo setMethod = default(MethodInfo);
@@ -553,7 +553,7 @@ namespace Kirurobo
} }
else else
{ {
// bool, float 以外は今のところ非対応で Readonly とする // bool、float 以外的类型暂不支持,设为只读
GUI.enabled = false; GUI.enabled = false;
EditorGUI.PropertyField(position, property, label, true); EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = true; GUI.enabled = true;
@@ -569,7 +569,7 @@ namespace Kirurobo
} }
else else
{ {
// Range 指定があればスライダー // 有 Range 指定则显示为滑块
if (range != null) if (range != null)
{ {
EditorGUI.Slider(position, property, range.min, range.max, label); EditorGUI.Slider(position, property, range.min, range.max, label);
+5 -5
View File
@@ -1,4 +1,4 @@
/* /*
* UniWinCore.cs * UniWinCore.cs
* *
* Author: Kirurobo http://twitter.com/kirurobo * Author: Kirurobo http://twitter.com/kirurobo
@@ -356,8 +356,8 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// ファイル、フォルダがドロップされた時に呼ばれるコールバック /// 文件或文件夹被拖放时调用的回调
/// 文字列を配列に直すことと、フラグを立てるまで行う /// 将字符串转换为数组,并设置标志位
/// </summary> /// </summary>
/// <param name="paths"></param> /// <param name="paths"></param>
[MonoPInvokeCallback(typeof(LibUniWinC.StringCallback))] [MonoPInvokeCallback(typeof(LibUniWinC.StringCallback))]
@@ -457,8 +457,8 @@ namespace Kirurobo
public void DetachWindow() public void DetachWindow()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
// エディタの場合、ウィンドウスタイルでは常に最前面と得られていない可能性があるため、 // 在编辑器中,窗口样式可能无法正确获取置顶状态,
// 最前面ではないのが本来と決め打ちで、デタッチ時無効化する // 因此默认视为非置顶,在分离时强制取消置顶
EnableTopmost(false); EnableTopmost(false);
#endif #endif
LibUniWinC.DetachWindow(); LibUniWinC.DetachWindow();
+10 -10
View File
@@ -15,8 +15,8 @@ using UnityEngine.InputSystem;
namespace Kirurobo { namespace Kirurobo {
/// <summary> /// <summary>
/// Input System と Input Manager の違いを吸収するためのプロキシ /// 用于消除 Input System 和 Input Manager 差异的代理
/// </summary> /// </summary>
public class InputProxy public class InputProxy
{ {
public static Vector3 mousePosition { public static Vector3 mousePosition {
@@ -26,7 +26,7 @@ namespace Kirurobo {
} }
/// <summary> /// <summary>
/// Input System の利用に合わせてキーアップを取得 /// 配合 Input System 获取按键抬起
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static bool GetKeyUp(String key) public static bool GetKeyUp(String key)
@@ -34,22 +34,22 @@ namespace Kirurobo {
#if ENABLE_LEGACY_INPUT_MANAGER #if ENABLE_LEGACY_INPUT_MANAGER
return Input.GetKeyUp(key); return Input.GetKeyUp(key);
#elif ENABLE_INPUT_SYSTEM #elif ENABLE_INPUT_SYSTEM
// 簡易的な実装。keyが1文字で、かつアルファベットか数字に対応 // 简易实现。仅支持单字母字符或数字
// 1文字以外は escape, space のみ対応 // 非单字符的仅支持 escape, space
if (key.Length == 1) { if (key.Length == 1) {
Key k = Key.None; Key k = Key.None;
char c = key[0]; char c = key[0];
if (c >= '0' && c <= '9') { if (c >= '0' && c <= '9') {
// 数字の場合はDigit0~Digit9とNumpad0~Numpad9の両方に反応 // 数字时同时响应 Digit0~Digit9 和 Numpad0~Numpad9
k = (Key)Enum.ToObject(typeof(Key), (int)Key.Numpad0 + (int)(c - '0')); k = (Key)Enum.ToObject(typeof(Key), (int)Key.Numpad0 + (int)(c - '0'));
if (Keyboard.current[k].wasReleasedThisFrame) return true; if (Keyboard.current[k].wasReleasedThisFrame) return true;
// Digitの場合はDigit0の値が最大 // Digit 键中 Digit0 的数值最大
k = (Key)Enum.ToObject(typeof(Key), (int)Key.Digit1 + (int)((c == '0' ? 9 : c - '1'))); k = (Key)Enum.ToObject(typeof(Key), (int)Key.Digit1 + (int)((c == '0' ? 9 : c - '1')));
if (Keyboard.current[k].wasReleasedThisFrame) return true; if (Keyboard.current[k].wasReleasedThisFrame) return true;
} }
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
// アルファベットの場合は大文字・小文字どちらでも可とする // 字母时大小写均可
k = (Key)Enum.ToObject(typeof(Key), (int)Key.A + (int)(Char.ToUpper(c) - 'A')); k = (Key)Enum.ToObject(typeof(Key), (int)Key.A + (int)(Char.ToUpper(c) - 'A'));
if (Keyboard.current[k].wasReleasedThisFrame) return true; if (Keyboard.current[k].wasReleasedThisFrame) return true;
} }
@@ -65,7 +65,7 @@ namespace Kirurobo {
} }
/// <summary> /// <summary>
/// Input System の利用に合わせてマウス座標を取得 /// 配合 Input System 获取鼠标坐标
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static Vector3 GetMousePosition() private static Vector3 GetMousePosition()
@@ -99,7 +99,7 @@ namespace Kirurobo {
} }
/// <summary> /// <summary>
/// このフレームでマウスボタンが押されたか判定 /// 判断本帧是否按下了鼠标按钮
/// </summary> /// </summary>
/// <param name="button"></param> /// <param name="button"></param>
/// <returns></returns> /// <returns></returns>
+10 -10
View File
@@ -1,4 +1,4 @@
/* /*
* ModelController * ModelController
* *
* 旋转、平移和缩放对象 * 旋转、平移和缩放对象
@@ -40,7 +40,7 @@ namespace Kirurobo
public Vector2 maximumAngles = new Vector2(90f, 360f); public Vector2 maximumAngles = new Vector2(90f, 360f);
[Tooltip("Restrict to move out from screen")] [Tooltip("Restrict to move out from screen")]
public bool confineTranslation = true; // 並進移動をウィンドウ(Screen)の範囲に制限するか public bool confineTranslation = true; // 是否将位移限制在窗口(屏幕)范围内
[Tooltip("Default is the parent transform")] [Tooltip("Default is the parent transform")]
public Transform centerTransform; // 回転中心 public Transform centerTransform; // 回転中心
@@ -69,7 +69,7 @@ namespace Kirurobo
void OnDestroy() void OnDestroy()
{ {
// 回転中心を独自に作成していれば、削除 // 如果旋转中心是独立创建的,则删除
if (centerObject) GameObject.Destroy(centerObject); if (centerObject) GameObject.Destroy(centerObject);
} }
@@ -82,7 +82,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 必要なオブジェクトを取得・準備 /// 获取并准备所需对象
/// </summary> /// </summary>
internal void Initialize() internal void Initialize()
{ {
@@ -106,8 +106,8 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 初期位置・姿勢の設定 /// 设置初始位置和姿态
/// 対象となるオブジェクトがそろった後で実行する /// 在目标对象就绪后执行
/// </summary> /// </summary>
internal void SetupTransform() internal void SetupTransform()
{ {
@@ -160,16 +160,16 @@ namespace Kirurobo
mousePos = Vector3.Max(Vector3.Min(mousePos, screenMax), Vector3.zero); mousePos = Vector3.Max(Vector3.Min(mousePos, screenMax), Vector3.zero);
} }
lastMousePosition = mousePos; // ドラッグ開始時にはリセット lastMousePosition = mousePos; // 拖动开始时重置
} }
} }
else if (InputProxy.GetMouseButtonDown(1)) else if (InputProxy.GetMouseButtonDown(1))
{ {
// 右ボタン(1)ドラッグでは回転を行う // 右键(1)拖动时进行旋转
if (dragState == DragState.None && IsHit(mousePos)) if (dragState == DragState.None && IsHit(mousePos))
{ {
dragState = DragState.Rotating; dragState = DragState.Rotating;
lastMousePosition = mousePos; // ドラッグ開始時にはリセット lastMousePosition = mousePos; // 拖动开始时重置
} }
} }
@@ -224,7 +224,7 @@ namespace Kirurobo
} }
else else
{ {
// ボタンが離されていれば並進は終了 // 如果按钮已松开则结束位移
dragState = DragState.None; dragState = DragState.None;
} }
} }