翻译所有的注释
This commit is contained in:
@@ -15,8 +15,8 @@ using UnityEngine.InputSystem;
|
||||
|
||||
namespace Kirurobo {
|
||||
/// <summary>
|
||||
/// Input System と Input Manager の違いを吸収するためのプロキシ
|
||||
/// </summary>
|
||||
/// 用于消除 Input System 和 Input Manager 差异的代理
|
||||
/// </summary>
|
||||
public class InputProxy
|
||||
{
|
||||
public static Vector3 mousePosition {
|
||||
@@ -26,7 +26,7 @@ namespace Kirurobo {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Input System の利用に合わせてキーアップを取得
|
||||
/// 配合 Input System 获取按键抬起
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool GetKeyUp(String key)
|
||||
@@ -34,22 +34,22 @@ namespace Kirurobo {
|
||||
#if ENABLE_LEGACY_INPUT_MANAGER
|
||||
return Input.GetKeyUp(key);
|
||||
#elif ENABLE_INPUT_SYSTEM
|
||||
// 簡易的な実装。keyが1文字で、かつアルファベットか数字に対応
|
||||
// 1文字以外は escape, space のみ対応
|
||||
// 简易实现。仅支持单字母字符或数字
|
||||
// 非单字符的仅支持 escape, space
|
||||
if (key.Length == 1) {
|
||||
Key k = Key.None;
|
||||
char c = key[0];
|
||||
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'));
|
||||
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')));
|
||||
if (Keyboard.current[k].wasReleasedThisFrame) return true;
|
||||
}
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
|
||||
// アルファベットの場合は大文字・小文字どちらでも可とする
|
||||
// 字母时大小写均可
|
||||
k = (Key)Enum.ToObject(typeof(Key), (int)Key.A + (int)(Char.ToUpper(c) - 'A'));
|
||||
if (Keyboard.current[k].wasReleasedThisFrame) return true;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace Kirurobo {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Input System の利用に合わせてマウス座標を取得
|
||||
/// 配合 Input System 获取鼠标坐标
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static Vector3 GetMousePosition()
|
||||
@@ -99,7 +99,7 @@ namespace Kirurobo {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// このフレームでマウスボタンが押されたか判定
|
||||
/// 判断本帧是否按下了鼠标按钮
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* ModelController
|
||||
*
|
||||
* 旋转、平移和缩放对象
|
||||
@@ -40,7 +40,7 @@ namespace Kirurobo
|
||||
public Vector2 maximumAngles = new Vector2(90f, 360f);
|
||||
|
||||
[Tooltip("Restrict to move out from screen")]
|
||||
public bool confineTranslation = true; // 並進移動をウィンドウ(Screen)の範囲に制限するか
|
||||
public bool confineTranslation = true; // 是否将位移限制在窗口(屏幕)范围内
|
||||
|
||||
[Tooltip("Default is the parent transform")]
|
||||
public Transform centerTransform; // 回転中心
|
||||
@@ -69,7 +69,7 @@ namespace Kirurobo
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
// 回転中心を独自に作成していれば、削除
|
||||
// 如果旋转中心是独立创建的,则删除
|
||||
if (centerObject) GameObject.Destroy(centerObject);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Kirurobo
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 必要なオブジェクトを取得・準備
|
||||
/// 获取并准备所需对象
|
||||
/// </summary>
|
||||
internal void Initialize()
|
||||
{
|
||||
@@ -106,8 +106,8 @@ namespace Kirurobo
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初期位置・姿勢の設定
|
||||
/// 対象となるオブジェクトがそろった後で実行する
|
||||
/// 设置初始位置和姿态
|
||||
/// 在目标对象就绪后执行
|
||||
/// </summary>
|
||||
internal void SetupTransform()
|
||||
{
|
||||
@@ -160,16 +160,16 @@ namespace Kirurobo
|
||||
mousePos = Vector3.Max(Vector3.Min(mousePos, screenMax), Vector3.zero);
|
||||
}
|
||||
|
||||
lastMousePosition = mousePos; // ドラッグ開始時にはリセット
|
||||
lastMousePosition = mousePos; // 拖动开始时重置
|
||||
}
|
||||
}
|
||||
else if (InputProxy.GetMouseButtonDown(1))
|
||||
{
|
||||
// 右ボタン(1)ドラッグでは回転を行う
|
||||
// 右键(1)拖动时进行旋转
|
||||
if (dragState == DragState.None && IsHit(mousePos))
|
||||
{
|
||||
dragState = DragState.Rotating;
|
||||
lastMousePosition = mousePos; // ドラッグ開始時にはリセット
|
||||
lastMousePosition = mousePos; // 拖动开始时重置
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace Kirurobo
|
||||
}
|
||||
else
|
||||
{
|
||||
// ボタンが離されていれば並進は終了
|
||||
// 如果按钮已松开则结束位移
|
||||
dragState = DragState.None;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user