init uniWindowController 0.9.8

This commit is contained in:
2026-06-14 22:49:28 +08:00
commit bfce70eb6f
95 changed files with 30126 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
# XUniWindowController
**XUniWindowController** is a Unity native plugin that provides comprehensive standalone application window control for Windows and macOS builds.
It is a UPM package port of [UniWindowController](https://github.com/kirurobo/UniWindowController) by Kirurobo.
## Usage
Add the `UniWindowController` component to any GameObject in your scene. Access it via:
```csharp
var winc = UniWindowController.current;
winc.isTransparent = true;
winc.isTopmost = true;
winc.windowSize = new Vector2(1280, 720);
```
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `isTransparent` | `bool` | Enable/disable window transparency |
| `alphaValue` | `float` | Window opacity (0.0 ~ 1.0) |
| `isTopmost` | `bool` | Keep window always on top |
| `isBottommost` | `bool` | Keep window always on bottom |
| `isZoomed` | `bool` | Maximize/restore window |
| `isClickThrough` | `bool` | Enable/disable mouse click-through |
| `windowPosition` | `Vector2Int` | Get/set window position (screen coordinates) |
| `windowSize` | `Vector2Int` | Get/set window size (pixels) |
| `clientSize` | `Vector2Int` | Get client area size (read-only) |
| `allowDropFiles` | `bool` | Enable/disable file drag-and-drop |
| `hitTestType` | `HitTestType` | Click-through detection mode |
| `transparentType` | `TransparentType` | Transparency algorithm |
| `shouldFitMonitor` | `bool` | Fit window to a specific monitor |
| `monitorToFit` | `int` | Target monitor index |
### Events
| Event | Description |
|-------|-------------|
| `OnStateChanged` | Fired when window style, z-order, or size changes |
| `OnMonitorChanged` | Fired when display configuration changes (resolution, monitor count) |
| `OnDropFiles` | Fired when files are dragged and dropped onto the window |
## Samples
Import samples via **Package Manager > XUniWindowController > Samples**.
The following samples are included:
- **Menu** — Navigation menu for browsing all sample scenes
- **SimpleSample** — Minimal setup demonstrating basic window control
- **UiSample** — Complete UI with toggles, sliders, dropdowns for all window properties
- **Fullscreen** — Fullscreen mode with right-click context menu and a 3D snowman scene
- **FileDialog** — Native file open/save dialog integration
## Technical Details
### Windows Architecture
The plugin uses `LibUniWinC.dll` (C++ Win32 DLL) to control window behavior through native Win32 API calls:
- `SetWindowLong` / `GetWindowLong` — Window style modification (borderless, layered, click-through)
- `SetWindowPos` — Position, size, and Z-order (topmost/bottommost)
- `DwmExtendFrameIntoClientArea` — DWM alpha transparency
- `SetLayeredWindowAttributes` — ColorKey transparency mode
- `SetWindowsHookEx` / custom `WNDPROC` — Window message interception (file drop, display change, resize)
- `DragAcceptFiles` — File drag-and-drop
- `GetOpenFileNameW` / `GetSaveFileNameW` — Native file dialogs
### macOS Architecture
The plugin uses `LibUniWinC.bundle` (Swift / Cocoa) to control window behavior through Cocoa APIs:
- `NSWindow.styleMask` — Borderless mode
- `NSWindow.level` — Z-order (topmost/bottommost)
- `NSWindow.isOpaque` / `backgroundColor` — Transparency
- `NSWindow.ignoresMouseEvents` — Click-through
- `NSDraggingDestination` protocol — File drag-and-drop
- `NSOpenPanel` / `NSSavePanel` — Native file dialogs
- `constrainFrameRect` method swizzling — Free window positioning
- `NotificationCenter` — Window state change observation
### Package Contents
| Location | Description |
|----------|-------------|
| `Runtime/Scripts/` | Core C# scripts (UniWindowController, UniWinCore, FilePanel, etc.) |
| `Runtime/Plugins/` | Native plugin binaries (.dll for Windows, .bundle for macOS) |
| `Editor/Scripts/` | Editor extensions (Inspector UI, batch build, PlayerSettings validation) |
| `Samples~/` | Sample scenes and scripts |
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1c67695e4c6a6d24f9fcdc3374c61073
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f7d50d96d22abb249aa89d22ffeceb31
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

+114
View File
@@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 77aeb9a6b2955d14cbc743feb1a80851
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant: