44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
#nullable enable
|
|
using UnityEngine;
|
|
#if UNITY_STANDALONE_WIN
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
#endif
|
|
|
|
namespace UVC.UI.Commands
|
|
{
|
|
public class MinimizeApplicationCommand : ICommand
|
|
{
|
|
|
|
#if UNITY_STANDALONE_WIN
|
|
[DllImport("user32.dll")]
|
|
private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
|
|
|
|
[DllImport("user32.dll")]
|
|
private static extern IntPtr GetActiveWindow();
|
|
|
|
private const int SW_MINIMIZE = 6;
|
|
#endif
|
|
|
|
public void Execute(object? parameter = null)
|
|
{
|
|
// 파라미터는 여기서는 사용되지 않을 수 있음
|
|
if (parameter != null)
|
|
{
|
|
Debug.Log($"MinimizeApplicationCommand 실행됨 (파라미터 무시됨: {parameter})");
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("MinimizeApplicationCommand 실행됨");
|
|
}
|
|
|
|
#if UNITY_STANDALONE_WIN
|
|
ShowWindow(GetActiveWindow(), SW_MINIMIZE);
|
|
#else
|
|
Debug.Log("창 최소화는 Windows 독립 실행형에서만 지원됩니다.");
|
|
#endif
|
|
|
|
}
|
|
}
|
|
}
|