补充示例

This commit is contained in:
2026-07-25 15:42:00 +08:00
parent d4ae58193d
commit 07bb4c7c9c
54 changed files with 569 additions and 328 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b9161ad40887a5746afa1d4eb780f60a guid: 1b2fb2965b4b647beb75e5d55e9c8d6b
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 326ddcba926f5e849bde9a0e0fb87ee1 guid: e224aeabe6945c54e845bf690e104015
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
+186
View File
@@ -0,0 +1,186 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &9167954367597434767
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9167954367597434766}
- component: {fileID: 9167954367597434803}
- component: {fileID: 9167954367597434764}
- component: {fileID: 9167954367597434765}
m_Layer: 2
m_Name: WindowMoveHandle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &9167954367597434766
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367597434767}
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_Children: []
m_Father: {fileID: 9167954367673589915}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &9167954367597434803
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367597434767}
m_CullTransparentMesh: 0
--- !u!114 &9167954367597434764
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367597434767}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!114 &9167954367597434765
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367597434767}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e7879148f4ed9cc42aa2ef8f22bf92c0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &9167954367673589911
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9167954367673589915}
- component: {fileID: 9167954367673589908}
- component: {fileID: 9167954367673589909}
- component: {fileID: 9167954367673589910}
m_Layer: 5
m_Name: DragMoveCanvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &9167954367673589915
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367673589911}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 9167954367597434766}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &9167954367673589908
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367673589911}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 1
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: -99
m_TargetDisplay: 0
--- !u!114 &9167954367673589909
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367673589911}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &9167954367673589910
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9167954367673589911}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
@@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 536bc02f6b95d694cbf83ddcac597970 guid: d7dcf50428b152040847878685fe0746
AssemblyDefinitionImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
@@ -0,0 +1,58 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2416199871598626844
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2416199871598626842}
- component: {fileID: 2416199871598626845}
m_Layer: 0
m_Name: UniWindowController
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2416199871598626842
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2416199871598626844}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2416199871598626845
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2416199871598626844}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eb951500192d2430eb3e306480cc2f31, type: 3}
m_Name:
m_EditorClassIdentifier:
_isTransparent: 0
_isTopmost: 0
_isZoomed: 0
isHitTestEnabled: 1
hitTestType: 1
opacityThreshold: 0.1
forceWindowed: 0
transparentType: 1
keyColor:
serializedVersion: 2
rgba: 65537
onObject: 1
pickedColor: {r: 0, g: 0, b: 0, a: 0}
@@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9cdd0222c2019eb4f984a69d349fa385 guid: e893aefd93740714b999573b02916984
AssemblyDefinitionImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
@@ -15,7 +15,7 @@ namespace Kirurobo
private void Awake() private void Awake()
{ {
// 设为单例。若已有实例则销毁自身 // シングルトンとする。既にインスタンスがあれば自分を破棄
if (this != Instance) if (this != Instance)
{ {
Destroy(this.gameObject); Destroy(this.gameObject);
@@ -29,7 +29,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 场景加载时记录主相机 /// シーンロード時にメインカメラを記憶
/// </summary> /// </summary>
/// <param name="arg0"></param> /// <param name="arg0"></param>
/// <param name="arg1"></param> /// <param name="arg1"></param>
@@ -39,19 +39,19 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 打开指定名称的场景 /// 指定の名前のシーンを開く
/// </summary> /// </summary>
/// <param name="name">场景名</param> /// <param name="name">シーン名</param>
public void LoadScene(string name) public void LoadScene(string name)
{ {
if (name == "SimpleSample") if (name == "SimpleSample")
{ {
// SimpleSample 时无脚本控制,在此处设置透明 // SimpleSample の場合はスクリプトでの制御がないため、ここで透明化
UniWindowController.current.isTransparent = true; UniWindowController.current.isTransparent = true;
} }
else if (name == "FullScreenSample") else if (name == "FullScreenSample")
{ {
// FullScreenSample 时强制最大化 // FullScreenSample の場合は強制的に最大化
UniWindowController.current.shouldFitMonitor = true; UniWindowController.current.shouldFitMonitor = true;
} }
@@ -59,7 +59,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 退出 /// 終了
/// </summary> /// </summary>
public void Quit() public void Quit()
{ {
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7f5802e9dd8c9bf4fb15aa0be21a95fc guid: c83c7f09afe53854b909aed0ea55a3cd
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
@@ -1,6 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4f4b26af82054284b89cba410c27b75d guid: bca881472b6085049ad37ab0ad8fe61e
folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 970bccad986844364a272b0245fed77e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4890085278179872738
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b650a883366376446b7db29169c59420
timeCreated: 1545989238
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c4f4adeee10bff845b320d93a6b82f54
timeCreated: 1545989238
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 38b9db02f63429f49bd117e7f988d985
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
/** /**
* UniWindowController 的示例脚本 * A sample script of UniWindowContoller
* *
* Author: Kirurobo http://twitter.com/kirurobo * Author: Kirurobo http://twitter.com/kirurobo
* License: MIT * License: MIT
@@ -13,7 +13,7 @@ using UnityEngine.UI;
namespace Kirurobo namespace Kirurobo
{ {
/// <summary> /// <summary>
/// 使用 Toggle 开关 WindowController 设置的示例 /// WindowControllerの設定をToggleでオン/オフするサンプル
/// </summary> /// </summary>
public class UiSampleController : MonoBehaviour public class UiSampleController : MonoBehaviour
{ {
@@ -21,14 +21,14 @@ namespace Kirurobo
private UniWindowMoveHandle uniWinMoveHandle; private UniWindowMoveHandle uniWinMoveHandle;
private RectTransform canvasRect; private RectTransform canvasRect;
private float mouseMoveSS = 0f; // 鼠标轨迹平方和。[px^2] private float mouseMoveSS = 0f; // Sum of mouse trajectory squares. [px^2]
private float mouseMoveSSThreshold = 36f; // 点击(非拖拽)阈值。[px^2] private float mouseMoveSSThreshold = 36f; // Click (not dragging) threshold. [px^2]
private Vector3 lastMousePosition; // 右键点击位置。 private Vector3 lastMousePosition; // Right clicked position.
private float lastEventOccurredTime = -5f; // 上次事件发生的时间戳 [s] private float lastEventOccurredTime = -5f; // Timestamp the last event occurred [s]
private float eventMessageTimeout = 1f; // 在此时间段内显示事件消息 [s] private float eventMessageTimeout = 1f; // Show event message while this period [s]
#if ENABLE_LEGACY_INPUT_MANAGER #if ENABLE_LEGACY_INPUT_MANAGER
private float touchDuration = 0f; private float touchDuration = 0f;
private float touchDurationThreshold = 0.5f; // 长按时间阈值。[s] private float touchDurationThreshold = 0.5f; // Long tap time threshold. [s]
#endif #endif
public Toggle transparentToggle; public Toggle transparentToggle;
public Slider alphaSlider; public Slider alphaSlider;
@@ -55,28 +55,28 @@ namespace Kirurobo
public RectTransform borderlinePanel; public RectTransform borderlinePanel;
/// <summary> /// <summary>
/// 初始化 /// 初期化
/// </summary> /// </summary>
void Start() void Start()
{ {
// 查找 UniWindowController // UniWindowController を探す
uniwinc = UniWindowController.current; uniwinc = UniWindowController.current;
// 查找 UniWindowDragMove // UniWindowDragMove を探す
uniWinMoveHandle = GameObject.FindAnyObjectByType<UniWindowMoveHandle>(); uniWinMoveHandle = GameObject.FindAnyObjectByType<UniWindowMoveHandle>();
// 获取 Canvas 的 RectTransform // CanvasのRectTransform取得
if (menuPanel) canvasRect = menuPanel.GetComponentInParent<Canvas>().GetComponent<RectTransform>(); if (menuPanel) canvasRect = menuPanel.GetComponentInParent<Canvas>().GetComponent<RectTransform>();
// 根据有效显示器数量创建选项 // 有効なモニタ数に合わせて選択肢を作成
UpdateMonitorDropdown(); UpdateMonitorDropdown();
// 将 Toggle 的选中状态与当前状态同步 // Toggleのチェック状態を、現在の状態に合わせる
UpdateUI(); UpdateUI();
if (uniwinc) if (uniwinc)
{ {
// 操作 UI 时将其反映到窗口 // UIを操作された際にはウィンドウに反映されるようにする
transparentToggle?.onValueChanged.AddListener(val => uniwinc.isTransparent = val); transparentToggle?.onValueChanged.AddListener(val => uniwinc.isTransparent = val);
alphaSlider?.onValueChanged.AddListener(val => uniwinc.alphaValue = val); alphaSlider?.onValueChanged.AddListener(val => uniwinc.alphaValue = val);
topmostToggle?.onValueChanged.AddListener(val => uniwinc.isTopmost = val); topmostToggle?.onValueChanged.AddListener(val => uniwinc.isTopmost = val);
@@ -100,25 +100,25 @@ namespace Kirurobo
if (uniWinMoveHandle) dragMoveToggle?.onValueChanged.AddListener(val => uniWinMoveHandle.enabled = val); if (uniWinMoveHandle) dragMoveToggle?.onValueChanged.AddListener(val => uniWinMoveHandle.enabled = val);
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
// 如果不是 Windows,则禁用透明方式选择 // Windows でなければ、透過方法の選択は無効とする
//if (transparentTypeDropdown) transparentTypeDropdown.interactable = false; //if (transparentTypeDropdown) transparentTypeDropdown.interactable = false;
//if (transparentTypeDropdown) transparentTypeDropdown.enabled = false; //if (transparentTypeDropdown) transparentTypeDropdown.enabled = false;
if (transparentTypeDropdown) transparentTypeDropdown.gameObject.SetActive(false); if (transparentTypeDropdown) transparentTypeDropdown.gameObject.SetActive(false);
#endif #endif
// 添加事件 // Add events
uniwinc.OnStateChanged += (type) => uniwinc.OnStateChanged += (type) =>
{ {
UpdateUI(); UpdateUI();
//Debug.Log("Window state changed: " + type); //Debug.Log("Window state changed: " + type);
ShowEventMessage("状态改变: " + type); ShowEventMessage("State changed: " + type);
//ShowEventMessage("State changed: " + type + "4:isKey 2:canBecomeKey, 1:canBecomeMain : " + uniwinc.GetDebugInfo().ToString()); //ShowEventMessage("State changed: " + type + "4:isKey 2:canBecomeKey, 1:canBecomeMain : " + uniwinc.GetDebugInfo().ToString());
ShowClientSize(); ShowClientSize();
}; };
uniwinc.OnMonitorChanged += () => { uniwinc.OnMonitorChanged += () => {
UpdateMonitorDropdown(); UpdateMonitorDropdown();
UpdateUI(); UpdateUI();
ShowEventMessage("分辨率已改变!"); ShowEventMessage("Resolution changed!");
ShowClientSize(); ShowClientSize();
}; };
uniwinc.OnDropFiles += files => uniwinc.OnDropFiles += files =>
@@ -127,12 +127,12 @@ namespace Kirurobo
}; };
} }
// 即使 UinWinC 未就绪也能运行的 Listener // UinWinCが準備できてなくても動くListener
showBorderlineToggle?.onValueChanged.AddListener(val => borderlinePanel.gameObject.SetActive(val)); showBorderlineToggle?.onValueChanged.AddListener(val => borderlinePanel.gameObject.SetActive(val));
} }
/// <summary> /// <summary>
/// 显示带超时功能的消息 /// Show the message with timeout
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
private void ShowEventMessage(string message) private void ShowEventMessage(string message)
@@ -144,20 +144,20 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 每帧执行的处理 /// 毎フレーム行う処理
/// </summary> /// </summary>
private void Update() private void Update()
{ {
// 更新点击测试相关的显示 // ヒットテスト関連の表示を更新
UpdateHitTestUI(); UpdateHitTestUI();
// 显示窗口位置和大小以确认运行状态 // 動作確認のためウィンドウ位置・サイズを表示
if ((lastEventOccurredTime + eventMessageTimeout) < Time.time) if ((lastEventOccurredTime + eventMessageTimeout) < Time.time)
{ {
ShowWindowMetrics(); ShowWindowMetrics();
} }
// 鼠标右键点击显示菜单。移动距离在阈值以下视为点击。 // マウス右ボタンクリックでメニューを表示させる。閾値以下の移動ならクリックとみなす。
if (InputProxy.GetMouseButtonDown(1)) if (InputProxy.GetMouseButtonDown(1))
{ {
lastMousePosition = InputProxy.mousePosition; lastMousePosition = InputProxy.mousePosition;
@@ -178,7 +178,7 @@ namespace Kirurobo
} }
#if ENABLE_LEGACY_INPUT_MANAGER #if ENABLE_LEGACY_INPUT_MANAGER
// 长按也可显示菜单 // ロングタッチでもメニューを表示させる
if (Input.touchSupported && (Input.touchCount > 0)) if (Input.touchSupported && (Input.touchCount > 0))
{ {
Touch touch = Input.GetTouch(0); Touch touch = Input.GetTouch(0);
@@ -203,38 +203,38 @@ namespace Kirurobo
} }
} }
#elif ENABLE_INPUT_SYSTEM #elif ENABLE_INPUT_SYSTEM
// 目前 New Input System 不支持触摸 // 現状、New Input System ではタッチ対応は無し
// EnhancedTouch 不能与 InputAction 同时使用? // EnhancedTouch は InputAction と併用不可?
#endif #endif
// 按键也可更改设置 // キーでも設定変更
if (uniwinc) if (uniwinc)
{ {
// 切换透明模式 // Toggle transparent
if (InputProxy.GetKeyUp("t")) if (InputProxy.GetKeyUp("t"))
{ {
uniwinc.isTransparent = !uniwinc.isTransparent; uniwinc.isTransparent = !uniwinc.isTransparent;
} }
// 切换始终置顶 // Toggle always on the front
if (InputProxy.GetKeyUp("f")) if (InputProxy.GetKeyUp("f"))
{ {
uniwinc.isTopmost = !uniwinc.isTopmost; uniwinc.isTopmost = !uniwinc.isTopmost;
} }
// 切换始终置底 // Toggle always on the bottom
if (InputProxy.GetKeyUp("b")) if (InputProxy.GetKeyUp("b"))
{ {
uniwinc.isBottommost = !uniwinc.isBottommost; uniwinc.isBottommost = !uniwinc.isBottommost;
} }
// 切换最大化 // Toggle zoom
if (InputProxy.GetKeyUp("z")) if (InputProxy.GetKeyUp("z"))
{ {
uniwinc.isZoomed = !uniwinc.isZoomed; uniwinc.isZoomed = !uniwinc.isZoomed;
} }
// 切换自由定位 // Toggle free positioning
if (InputProxy.GetKeyUp("p")) if (InputProxy.GetKeyUp("p"))
{ {
uniwinc.isFreePositioningEnabled = !uniwinc.isFreePositioningEnabled; uniwinc.isFreePositioningEnabled = !uniwinc.isFreePositioningEnabled;
@@ -242,13 +242,13 @@ namespace Kirurobo
} }
// 测试打开文件面板 // Test for OpenFilePanel
if (InputProxy.GetKeyUp("o")) if (InputProxy.GetKeyUp("o"))
{ {
FilePanel.Settings ds = new FilePanel.Settings FilePanel.Settings ds = new FilePanel.Settings
{ {
flags = FilePanel.Flag.AllowMultipleSelection, flags = FilePanel.Flag.AllowMultipleSelection,
title = "打开!", title = "Open!",
filters = new FilePanel.Filter[]{ filters = new FilePanel.Filter[]{
new FilePanel.Filter("Image files", "png", "jpg", "jpeg"), new FilePanel.Filter("Image files", "png", "jpg", "jpeg"),
new FilePanel.Filter("All files", "*"), new FilePanel.Filter("All files", "*"),
@@ -259,17 +259,17 @@ namespace Kirurobo
FilePanel.OpenFilePanel(ds, (files) => ShowEventMessage(string.Join(Environment.NewLine, files))); FilePanel.OpenFilePanel(ds, (files) => ShowEventMessage(string.Join(Environment.NewLine, files)));
} }
// 测试保存文件面板 // Test for SaveFilePanel
if (InputProxy.GetKeyUp("s")) if (InputProxy.GetKeyUp("s"))
{ {
FilePanel.Settings ds = new FilePanel.Settings FilePanel.Settings ds = new FilePanel.Settings
{ {
flags = FilePanel.Flag.AllowMultipleSelection, flags = FilePanel.Flag.AllowMultipleSelection,
title = "保存!", title = "Save!",
filters = new FilePanel.Filter[]{ filters = new FilePanel.Filter[]{
//// TODO: 指定文件类型时,macOS 保存对话框打开会失败 //// TODO: ファイル種類指定があると、macOSの保存ダイアログを開くことに失敗する
//// 给 NSSavePanel.accessoryView 指定内容时会发生此问题。 //// NSSavePanel.accessoryView に何か指定すると発生する。
//// NSOpenPanel 继承自它,但不会发生此问题。 //// それが継承された NSOpenPanel では発生しない。
// new FilePanel.Filter("Shell script", "sh"), // new FilePanel.Filter("Shell script", "sh"),
// new FilePanel.Filter("Log", "log"), // new FilePanel.Filter("Log", "log"),
// new FilePanel.Filter("Plain text", "txt"), // new FilePanel.Filter("Plain text", "txt"),
@@ -281,7 +281,7 @@ namespace Kirurobo
FilePanel.SaveFilePanel(ds, (files) => ShowEventMessage(string.Join(Environment.NewLine, files))); FilePanel.SaveFilePanel(ds, (files) => ShowEventMessage(string.Join(Environment.NewLine, files)));
} }
// 按下 [ESC] 时退出或停止播放 // Quit or stop playing when pressed [ESC]
if (InputProxy.GetKeyUp("escape")) if (InputProxy.GetKeyUp("escape"))
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
@@ -293,8 +293,8 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 重置持续触摸时间的记录 /// タッチされ続けている時間の記録をリセット
/// 仅在 Legacy Input Manager 中处理以避免警告 /// 警告が出ないように Legacy Input Manager でのみ処理している
/// </summary> /// </summary>
void ResetTouchDuration() { void ResetTouchDuration() {
#if ENABLE_LEGACY_INPUT_MANAGER #if ENABLE_LEGACY_INPUT_MANAGER
@@ -303,7 +303,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 适配显示器下拉列表更改时的处理 /// フィット対象モニタドロップダウンが変更された時の処理
/// </summary> /// </summary>
/// <param name="val"></param> /// <param name="val"></param>
void SetFitToMonitor(int val) void SetFitToMonitor(int val)
@@ -312,25 +312,25 @@ namespace Kirurobo
if (val < 1) if (val < 1)
{ {
// 下拉列表第一项为不适配 // ドロップダウンの先頭は、フィット無し
uniwinc.shouldFitMonitor = false; uniwinc.shouldFitMonitor = false;
// 允许更改最大化状态 // 最大化を変更できるようにする
if (zoomedToggle) zoomedToggle.interactable = true; if (zoomedToggle) zoomedToggle.interactable = true;
} }
else else
{ {
// 由于从第二项开始,显示器编号减1 // 次からなので、モニタ番号は1を引く
uniwinc.monitorToFit = val - 1; uniwinc.monitorToFit = val - 1;
uniwinc.shouldFitMonitor = true; // 从false变为true时才会移动窗口,因此先指定显示器编号再更改 uniwinc.shouldFitMonitor = true; // これがfalseからtrueにしたタイミングで移動されるため、モニタ番号を指定してから変更
// 禁止更改最大化状态 // 最大化を変更不可にする
if (zoomedToggle) zoomedToggle.interactable = false; if (zoomedToggle) zoomedToggle.interactable = false;
} }
} }
/// <summary> /// <summary>
/// 显示窗口位置和坐标 /// ウィンドウ位置と座標を表示
/// </summary> /// </summary>
void ShowWindowMetrics() void ShowWindowMetrics()
{ {
@@ -339,18 +339,18 @@ namespace Kirurobo
var winPos = uniwinc.windowPosition; var winPos = uniwinc.windowPosition;
//var curPos = uniwinc.GetClientCursorPosition(); //var curPos = uniwinc.GetClientCursorPosition();
OutputMessage( OutputMessage(
"位置: " + winPos "Pos.: " + winPos
+ "\n大小: " + uniwinc.windowSize + "\nSize: " + uniwinc.windowSize
+ "\n相对鼠标:" + (uniwinc.cursorPosition - winPos) + "\nRel. Cur.:" + (uniwinc.cursorPosition - winPos)
//+ "\nScr. Cur.:" + curPos //+ "\nScr. Cur.:" + curPos
+ "\nUnity鼠标:" + (Vector2)InputProxy.mousePosition + "\nUnity Cur.:" + (Vector2)InputProxy.mousePosition
); );
ShowClientSize(); ShowClientSize();
} }
} }
/// <summary> /// <summary>
/// 聚焦时刷新 UI /// Refresh UI on focused
/// </summary> /// </summary>
/// <param name="hasFocus"></param> /// <param name="hasFocus"></param>
private void OnApplicationFocus(bool hasFocus) private void OnApplicationFocus(bool hasFocus)
@@ -361,20 +361,20 @@ namespace Kirurobo
if (uniwinc) if (uniwinc)
{ {
OutputMessage("已聚焦"); OutputMessage("Focused");
} }
else else
{ {
OutputMessage("未找到 UniWindowController"); OutputMessage("No UniWindowController");
} }
} }
} }
/// <summary> /// <summary>
/// 在指定坐标显示上下文菜单 /// 指定した座標にコンテキストメニューを表示する
/// </summary> /// </summary>
/// <param name="position">指定中心坐标</param> /// <param name="position">中心座標指定</param>
private void ShowMenu(Vector2 position) private void ShowMenu(Vector2 position)
{ {
if (menuPanel) if (menuPanel)
@@ -383,11 +383,11 @@ namespace Kirurobo
float w = menuPanel.rect.width; float w = menuPanel.rect.width;
float h = menuPanel.rect.height; float h = menuPanel.rect.height;
// 以指定坐标为中心进行位置调整 // 指定座標に中心が来る前提で位置調整
pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // 如果超出则向上移动 pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // はみ出していれば上に寄せる
pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 如果超出右侧则向左移动 pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 右にはみ出していれば左に寄せる
menuPanel.pivot = Vector2.one * 0.5f; // 设置为中心 menuPanel.pivot = Vector2.one * 0.5f; // Set the center
menuPanel.anchorMin = Vector2.zero; menuPanel.anchorMin = Vector2.zero;
menuPanel.anchorMax = Vector2.zero; menuPanel.anchorMax = Vector2.zero;
menuPanel.anchoredPosition = pos; menuPanel.anchoredPosition = pos;
@@ -396,7 +396,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 关闭上下文菜单 /// コンテキストメニューを閉じる
/// </summary> /// </summary>
private void CloseMenu() private void CloseMenu()
{ {
@@ -407,7 +407,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 将实际状态反映到 UI 显示 /// 実際の状態をUI表示に反映
/// </summary> /// </summary>
private void UpdateUI() private void UpdateUI()
{ {
@@ -476,11 +476,11 @@ namespace Kirurobo
hitTestTypeDropdown.RefreshShownValue(); hitTestTypeDropdown.RefreshShownValue();
} }
// 同时更新点击测试部分的显示 // ヒットテスト部分の表示も更新
UpdateHitTestUI(); UpdateHitTestUI();
} }
// 即使没有 UniWinC 也能运行的部分 // UniWinC 無しでも動作する部分
if (showBorderlineToggle && borderlinePanel) if (showBorderlineToggle && borderlinePanel)
{ {
borderlinePanel.gameObject.SetActive(showBorderlineToggle.isOn); borderlinePanel.gameObject.SetActive(showBorderlineToggle.isOn);
@@ -488,8 +488,8 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 更新点击测试相关的 UI /// ヒットテスト関連のUI更新
/// 由于会自动变化,需要比 UpdateUI() 更频繁地更新 /// 自動で変化するため UpdateUI() よりも高頻度で更新の必要がある
/// </summary> /// </summary>
public void UpdateHitTestUI() public void UpdateHitTestUI()
{ {
@@ -530,7 +530,7 @@ namespace Kirurobo
if (pickedColorText) if (pickedColorText)
{ {
pickedColorText.text = $"颜色拾取器已禁用"; pickedColorText.text = $"Color picker is disabled";
pickedColorText.color = Color.gray; pickedColorText.color = Color.gray;
} }
} }
@@ -538,14 +538,14 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 更新显示器选择下拉列表的选项 /// モニタ選択ドロップダウンの選択肢を更新
/// 之后需要调用 UpdateUI() /// この後にUpdateUI()を呼ぶこと
/// </summary> /// </summary>
void UpdateMonitorDropdown() void UpdateMonitorDropdown()
{ {
if (!fitWindowDropdown) return; if (!fitWindowDropdown) return;
// 删除除第一项以外的选项 // 先頭以外の選択肢を削除
fitWindowDropdown.options.RemoveRange(1, fitWindowDropdown.options.Count - 1); fitWindowDropdown.options.RemoveRange(1, fitWindowDropdown.options.Count - 1);
if (!uniwinc) if (!uniwinc)
@@ -557,7 +557,7 @@ namespace Kirurobo
int count = UniWindowController.GetMonitorCount(); int count = UniWindowController.GetMonitorCount();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
fitWindowDropdown.options.Add(new Dropdown.OptionData("适配显示器 " + i)); fitWindowDropdown.options.Add(new Dropdown.OptionData("Fit to Monitor " + i));
} }
if (uniwinc.monitorToFit >= count) if (uniwinc.monitorToFit >= count)
{ {
@@ -567,7 +567,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 如果 UI 中有文本框,则显示消息。否则输出到控制台 /// テキスト枠がUIにあれば、そこにメッセージを出す。無ければコンソールに出力
/// </summary> /// </summary>
/// <param name="text"></param> /// <param name="text"></param>
public void OutputMessage(string text) public void OutputMessage(string text)
@@ -583,7 +583,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 如果 UI 中有客户端大小文本框,则显示消息。否则输出到控制台 /// クライアントサイズ用テキスト枠がUIにあれば、そこにメッセージを出す。無ければコンソールに出力
/// </summary> /// </summary>
public void ShowClientSize() public void ShowClientSize()
{ {
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3b335a5bc9945c9469568d1aba1b14e8
timeCreated: 1545989238
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
 /** /**
* 全屏示例的 UI 控制器 * UI controller for the fullscreen sample
* *
* Author: Kirurobo http://twitter.com/kirurobo * Author: Kirurobo http://twitter.com/kirurobo
* License: MIT * License: MIT
@@ -11,18 +11,18 @@ using UnityEngine.UI;
namespace Kirurobo namespace Kirurobo
{ {
/// <summary> /// <summary>
/// 使用 Toggle 开关 WindowController 设置的示例 /// WindowControllerの設定をToggleでオン/オフするサンプル
/// </summary> /// </summary>
public class FullscreenSample : MonoBehaviour public class FullscreenSample : MonoBehaviour
{ {
private UniWindowController uniwinc; private UniWindowController uniwinc;
private RectTransform canvasRect; private RectTransform canvasRect;
private float mouseMoveSS = 0f; // 鼠标轨迹平方和。[px^2] private float mouseMoveSS = 0f; // Sum of mouse trajectory squares. [px^2]
private float mouseMoveSSThreshold = 36f; // 点击(非拖拽)阈值。[px^2] private float mouseMoveSSThreshold = 36f; // Click (not dragging) threshold. [px^2]
private Vector3 lastMousePosition; // 右键点击位置。 private Vector3 lastMousePosition; // Right clicked position.
private float touchDuration = 0f; private float touchDuration = 0f;
private float touchDurationThreshold = 0.5f; // 长按时间阈值。[s] private float touchDurationThreshold = 0.5f; // Long tap time threshold. [s]
public Toggle transparentToggle; public Toggle transparentToggle;
public Toggle topmostToggle; public Toggle topmostToggle;
@@ -33,28 +33,28 @@ namespace Kirurobo
public RectTransform menuPanel; public RectTransform menuPanel;
/// <summary> /// <summary>
/// 设置 /// Setup
/// </summary> /// </summary>
void Start() void Start()
{ {
// 查找 UniWindowController // UniWindowController を探す
uniwinc = GameObject.FindAnyObjectByType<UniWindowController>(); uniwinc = GameObject.FindAnyObjectByType<UniWindowController>();
// 获取 Canvas 的 RectTransform // CanvasのRectTransform取得
if (menuPanel) canvasRect = menuPanel.GetComponentInParent<Canvas>().GetComponent<RectTransform>(); if (menuPanel) canvasRect = menuPanel.GetComponentInParent<Canvas>().GetComponent<RectTransform>();
// 根据有效显示器数量创建选项 // 有効なモニタ数に合わせて選択肢を作成
UpdateMonitorDropdown(); UpdateMonitorDropdown();
// 将 Toggle 的选中状态与当前状态同步 // Toggleのチェック状態を、現在の状態に合わせる
UpdateUI(); UpdateUI();
// 初始状态下关闭菜单 // 初期状態ではメニューを閉じておく
CloseMenu(); CloseMenu();
if (uniwinc) if (uniwinc)
{ {
// 操作 UI 时将其反映到窗口 // UIを操作された際にはウィンドウに反映されるようにする
transparentToggle?.onValueChanged.AddListener(val => uniwinc.isTransparent = val); transparentToggle?.onValueChanged.AddListener(val => uniwinc.isTransparent = val);
topmostToggle?.onValueChanged.AddListener(val => uniwinc.isTopmost = val); topmostToggle?.onValueChanged.AddListener(val => uniwinc.isTopmost = val);
bottommostToggle?.onValueChanged.AddListener(val => uniwinc.isBottommost = val); bottommostToggle?.onValueChanged.AddListener(val => uniwinc.isBottommost = val);
@@ -77,12 +77,12 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 每帧执行 /// Perform every frame
/// </summary> /// </summary>
private void Update() private void Update()
{ {
// 鼠标右键点击时显示上下文菜单。 // Show the context menu when right clicked.
// 如果鼠标移动距离在阈值以下,则视为点击 // If mouse movement is closer than a threshold, it is considered a click
if (InputProxy.GetMouseButtonDown(1)) if (InputProxy.GetMouseButtonDown(1))
{ {
lastMousePosition = InputProxy.mousePosition; lastMousePosition = InputProxy.mousePosition;
@@ -102,9 +102,9 @@ namespace Kirurobo
touchDuration = 0f; touchDuration = 0f;
} }
// 暂时仅在 Legacy Input Manager 中处理触摸 // ひとまず Legacy Input Manager でのみタッチ処理を扱う
#if ENABLE_LEGACY_INPUT_MANAGER #if ENABLE_LEGACY_INPUT_MANAGER
// 长按也可显示菜单 // Show the menu also when long touched
if (Input.touchSupported && (Input.touchCount > 0)) if (Input.touchSupported && (Input.touchCount > 0))
{ {
Touch touch = Input.GetTouch(0); Touch touch = Input.GetTouch(0);
@@ -130,7 +130,7 @@ namespace Kirurobo
} }
#endif #endif
// 按下 [Space] 键也可显示菜单 // Show the menu also when pressed [Space] key
if (InputProxy.GetKeyUp("space")) if (InputProxy.GetKeyUp("space"))
{ {
if (menuPanel) if (menuPanel)
@@ -144,7 +144,7 @@ namespace Kirurobo
} }
} }
// 按下 [ESC] 时退出或停止播放 // Quit or stop playing when pressed [ESC]
if (InputProxy.GetKeyUp("escape")) if (InputProxy.GetKeyUp("escape"))
{ {
Quit(); Quit();
@@ -161,7 +161,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 适配显示器下拉列表更改时的处理 /// フィット対象モニタドロップダウンが変更された時の処理
/// </summary> /// </summary>
/// <param name="val"></param> /// <param name="val"></param>
void SetFitToMonitor(int val) void SetFitToMonitor(int val)
@@ -170,21 +170,21 @@ namespace Kirurobo
if (val < 1) if (val < 1)
{ {
// 下拉列表第一项为不适配 // ドロップダウンの先頭は、フィット無し
uniwinc.shouldFitMonitor = false; uniwinc.shouldFitMonitor = false;
} }
else else
{ {
// 由于从第二项开始,显示器编号减1 // 次からなので、モニタ番号は1を引く
uniwinc.monitorToFit = val - 1; uniwinc.monitorToFit = val - 1;
uniwinc.shouldFitMonitor = true; // 从false变为true时才会移动窗口,因此先指定显示器编号再更改 uniwinc.shouldFitMonitor = true; // これがfalseからtrueにしたタイミングで移動されるため、モニタ番号を指定してから変更
} }
} }
/// <summary> /// <summary>
/// 在指定坐标显示上下文菜单 /// 指定した座標にコンテキストメニューを表示する
/// </summary> /// </summary>
/// <param name="position">指定中心坐标</param> /// <param name="position">中心座標指定</param>
private void ShowMenu(Vector2 position) private void ShowMenu(Vector2 position)
{ {
if (menuPanel) if (menuPanel)
@@ -193,11 +193,11 @@ namespace Kirurobo
float w = menuPanel.rect.width; float w = menuPanel.rect.width;
float h = menuPanel.rect.height; float h = menuPanel.rect.height;
// 以指定坐标为中心进行位置调整 // 指定座標に中心が来る前提で位置調整
pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // 如果超出则向上移动 pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // はみ出していれば上に寄せる
pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 如果超出右侧则向左移动 pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 右にはみ出していれば左に寄せる
menuPanel.pivot = Vector2.one * 0.5f; // 设置为中心 menuPanel.pivot = Vector2.one * 0.5f; // Set the center
menuPanel.anchorMin = Vector2.zero; menuPanel.anchorMin = Vector2.zero;
menuPanel.anchorMax = Vector2.zero; menuPanel.anchorMax = Vector2.zero;
menuPanel.anchoredPosition = pos; menuPanel.anchoredPosition = pos;
@@ -207,7 +207,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 关闭上下文菜单 /// コンテキストメニューを閉じる
/// </summary> /// </summary>
private void CloseMenu() private void CloseMenu()
{ {
@@ -218,7 +218,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 将实际状态反映到 UI 显示 /// 実際の状態をUI表示に反映
/// </summary> /// </summary>
private void UpdateUI() private void UpdateUI()
{ {
@@ -255,14 +255,14 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 更新显示器选择下拉列表的选项 /// モニタ選択ドロップダウンの選択肢を更新
/// 之后需要调用 UpdateUI() /// この後にUpdateUI()を呼ぶこと
/// </summary> /// </summary>
void UpdateMonitorDropdown() void UpdateMonitorDropdown()
{ {
if (!fitWindowDropdown) return; if (!fitWindowDropdown) return;
// 删除除第一项以外的选项 // 先頭以外の選択肢を削除
fitWindowDropdown.options.RemoveRange(1, fitWindowDropdown.options.Count - 1); fitWindowDropdown.options.RemoveRange(1, fitWindowDropdown.options.Count - 1);
if (!uniwinc) if (!uniwinc)
@@ -274,7 +274,7 @@ namespace Kirurobo
int count = UniWindowController.GetMonitorCount(); int count = UniWindowController.GetMonitorCount();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
fitWindowDropdown.options.Add(new Dropdown.OptionData("适配显示器 " + i)); fitWindowDropdown.options.Add(new Dropdown.OptionData("Fit to Monitor " + i));
} }
if (uniwinc.monitorToFit >= count) if (uniwinc.monitorToFit >= count)
{ {
@@ -284,7 +284,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 显示带超时功能的消息 /// Show the message with timeout
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
private void ShowEventMessage(string message) private void ShowEventMessage(string message)
@@ -293,7 +293,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 如果 UI 中有文本框,则显示消息。否则输出到控制台 /// テキスト枠がUIにあれば、そこにメッセージを出す。無ければコンソールに出力
/// </summary> /// </summary>
/// <param name="text"></param> /// <param name="text"></param>
public void OutputMessage(string text) public void OutputMessage(string text)
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7b16c3acbffcdc7478199eacc7ec8497 guid: d027a988a73c645949379ea67c528652
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
@@ -1,6 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8878429ebc524544d849c1bc8884262a guid: cc8dc9342a8c4436397f75a2389ffc1a
folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b5563f201a09e4d65a6987f796daf7ac
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4890085278179872738
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6fcffb6aae595400e8ee042864de7ccb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0208720e8ee7e413abe0abd9e4497fba
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4184b0617c337434892dafbd45a3e5ce
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b9e9365bee95a4312b88783e135b628c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -6,7 +6,7 @@ using UnityEngine.UI;
namespace Kirurobo namespace Kirurobo
{ {
/// <summary> /// <summary>
/// 基础文件面板示例 /// Basic filepanel sample
/// </summary> /// </summary>
public class FileDialogSample : MonoBehaviour public class FileDialogSample : MonoBehaviour
{ {
@@ -15,82 +15,82 @@ namespace Kirurobo
public Button saveFileButton; public Button saveFileButton;
public Text messageText; public Text messageText;
// 首次更新前调用 Start // Start is called before the first frame update
void Start() void Start()
{ {
openFileButton.onClick.AddListener(OpenSingleFile); openFileButton.onClick.AddListener(OpenSingleFile);
openMultipleFilesButton.onClick.AddListener(OpenMultipleFiles); openMultipleFilesButton.onClick.AddListener(OpenMultipleFiles);
saveFileButton.onClick.AddListener(OpenSaveFile); saveFileButton.onClick.AddListener(OpenSaveFile);
messageText.text = "点击按钮!"; messageText.text = "Click a button!";
} }
// 每帧调用 Update // Update is called once per frame
void Update() void Update()
{ {
} }
/// <summary> /// <summary>
/// 打开单个文件的对话框。 /// Open the open file dialog to select single file.
/// </summary> /// </summary>
private void OpenSingleFile() { private void OpenSingleFile() {
FilePanel.Settings settings = new FilePanel.Settings(); FilePanel.Settings settings = new FilePanel.Settings();
settings.filters = new FilePanel.Filter[] settings.filters = new FilePanel.Filter[]
{ {
new FilePanel.Filter("所有文件", "*"), new FilePanel.Filter("All files", "*"),
new FilePanel.Filter("图片文件 (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), new FilePanel.Filter("Image files (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"),
new FilePanel.Filter("文档 (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"), new FilePanel.Filter("Documents (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"),
}; };
settings.title = "打开文件!"; settings.title = "Open a file!";
settings.initialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures); settings.initialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures);
messageText.text = ""; messageText.text = "";
FilePanel.OpenFilePanel(settings, (files) => FilePanel.OpenFilePanel(settings, (files) =>
{ {
messageText.text = "打开文件\n" + string.Join("\n", files); messageText.text = "Open a file\n" + string.Join("\n", files);
}); });
} }
/// <summary> /// <summary>
/// 打开多个文件的对话框。 /// Open the open file dialog to select multiple files.
/// </summary> /// </summary>
private void OpenMultipleFiles() { private void OpenMultipleFiles() {
FilePanel.Settings settings = new FilePanel.Settings(); FilePanel.Settings settings = new FilePanel.Settings();
settings.filters = new FilePanel.Filter[] settings.filters = new FilePanel.Filter[]
{ {
new FilePanel.Filter("图片文件 (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), new FilePanel.Filter("Image files (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"),
new FilePanel.Filter("文档 (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"), new FilePanel.Filter("Documents (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"),
new FilePanel.Filter("所有文件", "*"), new FilePanel.Filter("All files", "*"),
}; };
settings.flags = FilePanel.Flag.AllowMultipleSelection; settings.flags = FilePanel.Flag.AllowMultipleSelection;
settings.title = "打开多个文件!"; settings.title = "Open multiple files!";
settings.initialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); settings.initialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
messageText.text = ""; messageText.text = "";
FilePanel.OpenFilePanel(settings, (files) => FilePanel.OpenFilePanel(settings, (files) =>
{ {
messageText.text = "打开多个文件\n" + string.Join("\n", files); messageText.text = "Open multiple files\n" + string.Join("\n", files);
}); });
} }
/// <summary> /// <summary>
/// 打开保存文件对话框。 /// Open the save file dialog.
/// </summary> /// </summary>
private void OpenSaveFile() { private void OpenSaveFile() {
FilePanel.Settings settings = new FilePanel.Settings(); FilePanel.Settings settings = new FilePanel.Settings();
settings.filters = new FilePanel.Filter[] settings.filters = new FilePanel.Filter[]
{ {
new FilePanel.Filter("文本文件 (*.txt;*.log)", "txt", "log"), new FilePanel.Filter("Text file (*.txt;*.log)", "txt", "log"),
new FilePanel.Filter("图片文件 (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), new FilePanel.Filter("Image files (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"),
new FilePanel.Filter("所有文件", "*"), new FilePanel.Filter("All files", "*"),
}; };
settings.title = "实际上不会执行保存操作"; settings.title = "No save is actually performed";
settings.initialFile = "Test.txt"; settings.initialFile = "Test.txt";
messageText.text = ""; messageText.text = "";
FilePanel.SaveFilePanel(settings, (files) => FilePanel.SaveFilePanel(settings, (files) =>
{ {
messageText.text = "选中的文件\n" + string.Join("\n", files); messageText.text = "Selected file\n" + string.Join("\n", files);
}); });
} }
} }
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb6dba400744842c1b9025c020a1dd4e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,6 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e6602e0b6b65ef7438c1a83bcf07d1b2 guid: 48a0f5141a4d64ffd86a58d24b841e0c
folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 24c3b38da5d7645cca546e4a61bf8980
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4890085278179872738
userData:
assetBundleName:
assetBundleVariant:
+7 -7
View File
@@ -2,31 +2,31 @@ using UnityEngine;
namespace Kirurobo { namespace Kirurobo {
/// <summary> /// <summary>
/// 使附加的对象以恒定速度进行偏航旋转 /// アタッチしたオブジェクトを一定速度でヨー回転させる
/// </summary> /// </summary>
public class AutoRotator : MonoBehaviour { public class AutoRotator : MonoBehaviour {
/// <summary> /// <summary>
/// 旋转速度 [度/秒] /// 回転速度 [deg/s]
/// </summary> /// </summary>
public float angularVelocity = 90f; public float angularVelocity = 90f;
/// <summary> /// <summary>
/// 旋转轴(偏航旋转,方向向上) /// 回転軸(ヨー回転のため上向き)
/// </summary> /// </summary>
Vector3 rotationAxis = Vector3.up; Vector3 rotationAxis = Vector3.up;
/// <summary> /// <summary>
/// 初始姿态 /// 初期姿勢
/// </summary> /// </summary>
Quaternion initialLocalRotation; Quaternion initialLocalRotation;
// 用于初始化 // Use this for initialization
void Start () { void Start () {
// 记录初始姿态 // 初期姿勢を記憶
initialLocalRotation = transform.localRotation; initialLocalRotation = transform.localRotation;
} }
// 每帧调用 Update // Update is called once per frame
void Update () { void Update () {
var rotation = Quaternion.Euler(0f, Time.time * angularVelocity, 0f); var rotation = Quaternion.Euler(0f, Time.time * angularVelocity, 0f);
transform.localRotation = initialLocalRotation * rotation; transform.localRotation = initialLocalRotation * rotation;
+1 -1
View File
@@ -9,7 +9,7 @@ using UnityEngine.InputSystem;
namespace Kirurobo { namespace Kirurobo {
/// <summary> /// <summary>
/// 为快速兼容 Legacy InputManager 和 InputSystem 而准备的类 /// Legacy InputManager と InputSystem の両方に取り急ぎ対応するために用意したクラスです
/// </summary> /// </summary>
#if ENABLE_LEGACY_INPUT_MANAGER #if ENABLE_LEGACY_INPUT_MANAGER
public class InputModuleProxy : UnityEngine.EventSystems.StandaloneInputModule public class InputModuleProxy : UnityEngine.EventSystems.StandaloneInputModule
+15 -15
View File
@@ -1,8 +1,8 @@
/** /**
* UniWindowController 的示例脚本 * A sample script of UniWindowContoller
* *
* 作者: Kirurobo http://twitter.com/kirurobo * Author: Kirurobo http://twitter.com/kirurobo
* 许可证: MIT * License: MIT
*/ */
using System; using System;
@@ -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文字で、かつアルファベットか数字に対応
// 非单字符的仅支持 escape, space // 1文字以外は 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()
@@ -80,7 +80,7 @@ namespace Kirurobo {
} }
/// <summary> /// <summary>
/// 判断鼠标按钮当前是否被按下 /// マウスボタンが現在押されているか判定
/// </summary> /// </summary>
/// <param name="button"></param> /// <param name="button"></param>
/// <returns></returns> /// <returns></returns>
@@ -99,7 +99,7 @@ namespace Kirurobo {
} }
/// <summary> /// <summary>
/// 判断本帧是否按下了鼠标按钮 /// このフレームでマウスボタンが押されたか判定
/// </summary> /// </summary>
/// <param name="button"></param> /// <param name="button"></param>
/// <returns></returns> /// <returns></returns>
@@ -118,7 +118,7 @@ namespace Kirurobo {
} }
/// <summary> /// <summary>
/// 判断本帧是否松开了鼠标按钮 /// このフレームでマウスボタンが離されたか判定
/// </summary> /// </summary>
/// <param name="button"></param> /// <param name="button"></param>
/// <returns></returns> /// <returns></returns>
+34 -34
View File
@@ -1,10 +1,10 @@
/* /*
* ModelController * ModelController
* *
* 旋转、平移和缩放对象 * Rotate, translate and scale the object
* *
* 作者: Kirurobo http://twitter.com/kirurobo * Author: Kirurobo http://twitter.com/kirurobo
* 许可证: MIT * License: MIT
*/ */
using System; using System;
@@ -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; // 是否将位移限制在窗口(屏幕)范围内 public bool confineTranslation = true; // 並進移動をウィンドウ(Screen)の範囲に制限するか
[Tooltip("Default is the parent transform")] [Tooltip("Default is the parent transform")]
public Transform centerTransform; // 回転中心 public Transform centerTransform; // 回転中心
@@ -48,12 +48,12 @@ namespace Kirurobo
[Tooltip("Default is the main camera")] [Tooltip("Default is the main camera")]
public Camera currentCamera; public Camera currentCamera;
internal GameObject centerObject = null; // 当未指定旋转中心Transform时创建的对象 internal GameObject centerObject = null; // 回転中心Transformが指定されなかった場合に作成される
internal Vector3 rotation; internal Vector3 rotation;
internal Vector3 translation; internal Vector3 translation;
internal Vector3 lastMousePosition; // 上一帧的鼠标坐标 internal Vector3 lastMousePosition; // 直前フレームでのマウス座標
internal DragState dragState; // 拖动时根据开始时的按钮设置对应状态 internal DragState dragState; // ドラッグ中は開始時のボタンに合わせた内容にする
internal Vector3 relativePosition; internal Vector3 relativePosition;
internal Quaternion relativeRotation; internal Quaternion relativeRotation;
@@ -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,12 +106,12 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 设置初始位置和姿态 /// 初期位置・姿勢の設定
/// 在目标对象就绪后执行 /// 対象となるオブジェクトがそろった後で実行する
/// </summary> /// </summary>
internal void SetupTransform() internal void SetupTransform()
{ {
relativePosition = transform.position- centerTransform.position; // 从对象到中心坐标的向量 relativePosition = transform.position- centerTransform.position; // オブジェクトから中心座標へのベクトル
relativeRotation = transform.rotation * Quaternion.Inverse(centerTransform.rotation); relativeRotation = transform.rotation * Quaternion.Inverse(centerTransform.rotation);
originalLocalScale = transform.localScale; originalLocalScale = transform.localScale;
@@ -131,7 +131,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 应用旋转和平移 /// Apply rotation and translation
/// </summary> /// </summary>
internal void UpdateTransform() internal void UpdateTransform()
{ {
@@ -148,38 +148,38 @@ namespace Kirurobo
if (InputProxy.GetMouseButtonDown(0)) if (InputProxy.GetMouseButtonDown(0))
{ {
// 左键(0)拖动时进行平移 // 左ボタン(0)ドラッグでは並進移動を行う
if (dragState == DragState.None && IsHit(mousePos)) if (dragState == DragState.None && IsHit(mousePos))
{ {
dragState = DragState.Translating; dragState = DragState.Translating;
// 限制在屏幕范围内 // 画面範囲に制限する
if (confineTranslation) if (confineTranslation)
{ {
Vector3 screenMax = new Vector3(Screen.width, Screen.height); Vector3 screenMax = new Vector3(Screen.width, Screen.height);
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; // ドラッグ開始時にはリセット
} }
} }
// 通过拖动旋转 // ドラッグで回転
if (dragState == DragState.Rotating) if (dragState == DragState.Rotating)
{ {
// 仅在按下按钮时操作 // ボタンが押されている間のみ操作
if (InputProxy.GetMouseButton(1)) if (InputProxy.GetMouseButton(1))
{ {
// 通过拖动旋转 // ドラッグで回転
if ((axes & RotationAxes.Yaw) > RotationAxes.None) if ((axes & RotationAxes.Yaw) > RotationAxes.None)
{ {
rotation.y -= (mousePos.x - lastMousePosition.x) * 360f / Screen.width * yawSensitivity; rotation.y -= (mousePos.x - lastMousePosition.x) * 360f / Screen.width * yawSensitivity;
@@ -196,18 +196,18 @@ namespace Kirurobo
} }
else else
{ {
// 如果右键已松开则结束旋转 // 右ボタンが離されていれば回転は終了
dragState = DragState.None; dragState = DragState.None;
} }
} }
// 通过拖动平移 // ドラッグで並進移動
if (dragState == DragState.Translating) if (dragState == DragState.Translating)
{ {
// 仅在按下按钮时操作 // ボタンが押されている間のみ操作
if (InputProxy.GetMouseButton(0)) if (InputProxy.GetMouseButton(0))
{ {
// 限制在屏幕范围内 // 画面範囲に制限する
if (confineTranslation) if (confineTranslation)
{ {
Vector3 screenMax = new Vector3(Screen.width, Screen.height); Vector3 screenMax = new Vector3(Screen.width, Screen.height);
@@ -224,22 +224,22 @@ namespace Kirurobo
} }
else else
{ {
// 如果按钮已松开则结束位移 // ボタンが離されていれば並進は終了
dragState = DragState.None; dragState = DragState.None;
} }
} }
// 暂时仅在使用 Legacy Input Manager 时接受滚轮操作 // ひとまず Legacy Input Manager でのみホイール操作を受け付けるものとしてリリース
#if ENABLE_LEGACY_INPUT_MANAGER #if ENABLE_LEGACY_INPUT_MANAGER
// 如果滚轮转动,则进行缩放 // ホイールが回転されれば、拡大縮小
if (!Mathf.Approximately(Input.GetAxis("Mouse ScrollWheel"), 0f) && IsHit(mousePos)) if (!Mathf.Approximately(Input.GetAxis("Mouse ScrollWheel"), 0f) && IsHit(mousePos))
{ {
// 滚轮操作量 // ホイールによる操作量
float wheelDelta = Input.GetAxis("Mouse ScrollWheel") * scaleSensitivity; float wheelDelta = Input.GetAxis("Mouse ScrollWheel") * scaleSensitivity;
// 更改缩放倍率 // 倍率を変更
zoom -= wheelDelta; zoom -= wheelDelta;
zoom = Mathf.Clamp(zoom, -1f, 2f); // 视场角的对数范围 [度] zoom = Mathf.Clamp(zoom, -1f, 2f); // Logarithm of field-of-view [deg] range
UpdateTransform(); UpdateTransform();
} }
@@ -249,7 +249,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 判断鼠标操作时是否点击到对象 /// マウスでの操作時、オブジェクトにヒットしたか判定
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
internal bool IsHit(Vector3 screenPosition) internal bool IsHit(Vector3 screenPosition)
@@ -266,7 +266,7 @@ namespace Kirurobo
} }
/// <summary> /// <summary>
/// 若角度超出指定范围,则进行修正 /// 指定範囲から外れる角度の場合、補正する
/// </summary> /// </summary>
/// <param name="angle"></param> /// <param name="angle"></param>
/// <param name="min"></param> /// <param name="min"></param>
-5
View File
@@ -1,5 +0,0 @@
{
"displayName": "FileDialog",
"description": "Demonstrates native file open/save dialog integration.",
"createSeparatePackage": false
}
-5
View File
@@ -1,5 +0,0 @@
{
"displayName": "Fullscreen",
"description": "Fullscreen mode example with right-click context menu and 3D snowman scene.",
"createSeparatePackage": false
}
-5
View File
@@ -1,5 +0,0 @@
{
"displayName": "Menu",
"description": "Sample menu scene for navigating between different example scenes.",
"createSeparatePackage": false
}
-5
View File
@@ -1,5 +0,0 @@
{
"displayName": "SimpleSample",
"description": "A minimal example demonstrating basic window control setup.",
"createSeparatePackage": false
}
-5
View File
@@ -1,5 +0,0 @@
{
"displayName": "UiSample",
"description": "Complete UI demonstration with toggles and sliders for controlling window properties (transparency, topmost, click-through, etc.).",
"createSeparatePackage": false
}
-29
View File
@@ -1,29 +0,0 @@
using UnityEngine;
using UnityEditor;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
namespace Lrss3.Xuniwindowcontroller.Editor.Tests
{
class EditorExampleTest
{
[Test]
public void EditorSampleTestSimplePasses()
{
// Use the Assert class to test conditions.
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityTest]
public IEnumerator EditorSampleTestWithEnumeratorPasses()
{
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
}
}
}
@@ -1,14 +0,0 @@
{
"name": "Lrss3.Xuniwindowcontroller.Editor.Tests",
"references": [
"Lrss3.Xuniwindowcontroller.Editor",
"Lrss3.Xuniwindowcontroller"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": []
}
@@ -1,11 +0,0 @@
{
"name": "Lrss3.Xuniwindowcontroller.Tests",
"references": [
"Lrss3.Xuniwindowcontroller"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [],
"excludePlatforms": []
}
-28
View File
@@ -1,28 +0,0 @@
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
namespace Lrss3.Xuniwindowcontroller.Tests
{
class RuntimeExampleTest
{
[Test]
public void PlayModeSampleTestSimplePasses()
{
// Use the Assert class to test conditions.
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityTest]
public IEnumerator PlayModeSampleTestWithEnumeratorPasses()
{
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
}
}
}
+10 -5
View File
@@ -22,27 +22,32 @@
{ {
"displayName": "Menu", "displayName": "Menu",
"description": "Sample menu scene for navigating between different example scenes.", "description": "Sample menu scene for navigating between different example scenes.",
"path": "Samples~/Menu" "path": "Samples~/00_Menu"
}, },
{ {
"displayName": "SimpleSample", "displayName": "SimpleSample",
"description": "A minimal example demonstrating basic window control setup.", "description": "A minimal example demonstrating basic window control setup.",
"path": "Samples~/SimpleSample" "path": "Samples~/01_SimpleSample"
}, },
{ {
"displayName": "UiSample", "displayName": "UiSample",
"description": "Complete UI demonstration with toggles and sliders for controlling window properties (transparency, topmost, click-through, etc.).", "description": "Complete UI demonstration with toggles and sliders for controlling window properties (transparency, topmost, click-through, etc.).",
"path": "Samples~/UiSample" "path": "Samples~/02_UiSample"
}, },
{ {
"displayName": "Fullscreen", "displayName": "Fullscreen",
"description": "Fullscreen mode example with right-click context menu and 3D snowman scene.", "description": "Fullscreen mode example with right-click context menu and 3D snowman scene.",
"path": "Samples~/Fullscreen" "path": "Samples~/03_Fullscreen"
}, },
{ {
"displayName": "FileDialog", "displayName": "FileDialog",
"description": "Demonstrates native file open/save dialog integration.", "description": "Demonstrates native file open/save dialog integration.",
"path": "Samples~/FileDialog" "path": "Samples~/04_FileDialog"
},
{
"displayName": "Common",
"description": "",
"path": "Samples~/Common"
} }
] ]
} }