Added keystrokes to UiSample
Added debug function
This commit is contained in:
Binary file not shown.
@@ -179,6 +179,9 @@ namespace Kirurobo
|
||||
|
||||
[DllImport("LibUniWinC")]
|
||||
public static extern void SetKeyColor(uint colorref);
|
||||
|
||||
[DllImport("LibUniWinC")]
|
||||
public static extern int GetDebugInfo();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -767,6 +770,17 @@ namespace Kirurobo
|
||||
}
|
||||
Debug.Log(message);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Receive information for debugging
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Obsolete]
|
||||
public static int GetDebugInfo()
|
||||
{
|
||||
return LibUniWinC.GetDebugInfo();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -921,5 +921,19 @@ namespace Kirurobo
|
||||
//uniWin.SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// デバッグ専用。その都度参考となる情報を受けるための関数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Obsolete]
|
||||
public int GetDebugInfo()
|
||||
{
|
||||
if (uniWinCore != null) {
|
||||
return UniWinCore.GetDebugInfo();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2050,7 +2050,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Bottommost (WIP)
|
||||
m_Text: Bottommost [B]
|
||||
--- !u!1 &8301087647529909540
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2432,7 +2432,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Transparent
|
||||
m_Text: Transparent [T]
|
||||
--- !u!1 &8301087647621619055
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5876,7 +5876,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Zoomed
|
||||
m_Text: Zoomed [Z]
|
||||
--- !u!1 &8301087649171761010
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -6960,9 +6960,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 'Topmost
|
||||
|
||||
'
|
||||
m_Text: Topmost [F]
|
||||
--- !u!1 &8301087649501092118
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -108,6 +108,7 @@ namespace Kirurobo
|
||||
UpdateUI();
|
||||
//Debug.Log("Window state changed: " + type);
|
||||
ShowEventMessage("State changed: " + type);
|
||||
//ShowEventMessage("State changed: " + type + "4:isKey 2:canBecomeKey, 1:canBecomeMain : " + uniwinc.GetDebugInfo().ToString());
|
||||
};
|
||||
uniwinc.OnMonitorChanged += () => {
|
||||
UpdateMonitorDropdown();
|
||||
@@ -195,26 +196,35 @@ namespace Kirurobo
|
||||
}
|
||||
}
|
||||
|
||||
// サンプルとしての処理
|
||||
// キーでも設定変更
|
||||
if (uniwinc)
|
||||
{
|
||||
// [Space]キーを押すと強制的にクリックスルーを解除
|
||||
// 操作不能となったときの対応
|
||||
// ただし自動判定が有効ならすぐ変化の可能性もある
|
||||
if (Input.GetKeyUp(KeyCode.Space))
|
||||
{
|
||||
uniwinc.isClickThrough = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(KeyCode.T))
|
||||
{
|
||||
if (uniwinc)
|
||||
// Toggle transparent
|
||||
if (Input.GetKeyUp(KeyCode.T))
|
||||
{
|
||||
uniwinc.isTransparent = !uniwinc.isTransparent;
|
||||
}
|
||||
|
||||
// Toggle always on the front
|
||||
if (Input.GetKeyUp(KeyCode.F))
|
||||
{
|
||||
uniwinc.isTopmost = !uniwinc.isTopmost;
|
||||
}
|
||||
|
||||
// Toggle always on the bottom
|
||||
if (Input.GetKeyUp(KeyCode.B))
|
||||
{
|
||||
uniwinc.isBottommost = !uniwinc.isBottommost;
|
||||
}
|
||||
|
||||
// Toggle zoom
|
||||
if (Input.GetKeyUp(KeyCode.Z))
|
||||
{
|
||||
uniwinc.isZoomed = !uniwinc.isZoomed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Test for OpenFilePanel
|
||||
if (Input.GetKeyUp(KeyCode.O))
|
||||
{
|
||||
|
||||
@@ -121,7 +121,7 @@ PlayerSettings:
|
||||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 0.8.1
|
||||
bundleVersion: 0.8.2
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
|
||||
@@ -175,3 +175,8 @@ UNIWINC_EXPORT BOOL OpenSavePanel(const void* lpPanelSettings, UniChar* lpwsBuff
|
||||
return [LibUniWinC openSavePanelWithLpSettings: lpPanelSettings lpBuffer: lpwsBuffer bufferSize: bufferSize];
|
||||
}
|
||||
|
||||
|
||||
// for debugging
|
||||
UNIWINC_EXPORT SInt32 GetDebugInfo() {
|
||||
return [LibUniWinC getDebugInfo];
|
||||
}
|
||||
|
||||
@@ -445,9 +445,11 @@ public class LibUniWinC : NSObject {
|
||||
/// - isTransparent: trueなら透過、falseなら戻す
|
||||
private static func _setWindowTransparent(window: NSWindow, isTransparent: Bool) -> Void {
|
||||
if (isTransparent) {
|
||||
//window.styleMask = orgWindowInfo.styleMask
|
||||
//window.styleMask = []
|
||||
// window.styleMask = orgWindowInfo.styleMask
|
||||
// //window.styleMask = []
|
||||
// if (state.isBorderless) {
|
||||
// window.titlebarAppearsTransparent = true
|
||||
// window.titleVisibility = .hidden
|
||||
// window.styleMask.insert(.borderless)
|
||||
// }
|
||||
window.backgroundColor = NSColor.clear
|
||||
@@ -490,10 +492,12 @@ public class LibUniWinC : NSObject {
|
||||
/// - isBorderless: 枠なしにするか
|
||||
private static func _setWindowBorderless(window: NSWindow, isBorderless: Bool) -> Void {
|
||||
if (isBorderless) {
|
||||
window.styleMask.insert(.borderless)
|
||||
window.styleMask = [.borderless]
|
||||
//window.styleMask.insert(.borderless)
|
||||
window.titlebarAppearsTransparent = true
|
||||
window.titleVisibility = .hidden
|
||||
} else {
|
||||
window.styleMask = orgWindowInfo.styleMask
|
||||
if (!orgWindowInfo.styleMask.contains(.borderless)) {
|
||||
// 初期状態で.borderlessだったならばそれは残す
|
||||
window.styleMask.remove(.borderless)
|
||||
@@ -521,9 +525,6 @@ public class LibUniWinC : NSObject {
|
||||
if let window: NSWindow = targetWindow {
|
||||
_setWindowTransparent(window: window, isTransparent: isTransparent)
|
||||
_setContentViewTransparent(window: window, isTransparent: isTransparent)
|
||||
|
||||
// Reapply borderless state
|
||||
_setWindowBorderless(window: window, isBorderless: state.isBorderless)
|
||||
}
|
||||
|
||||
if (state.isTransparent != isTransparent) {
|
||||
@@ -547,6 +548,10 @@ public class LibUniWinC : NSObject {
|
||||
|
||||
_setWindowBorderless(window: window, isBorderless: isBorderless)
|
||||
|
||||
// 透過切り替え直後にキー操作が効かなくなるためキーウインドウにしたい。だがうまくはいかないよう。透過だとキーにできないのは仕方がなさそう…
|
||||
// window.makeMain()
|
||||
// window.makeKey()
|
||||
|
||||
if (state.isZoomed) {
|
||||
if (!window.isZoomed) {
|
||||
window.zoom(nil)
|
||||
@@ -558,12 +563,13 @@ public class LibUniWinC : NSObject {
|
||||
window.setFrame(rect, display: true, animate: false)
|
||||
}
|
||||
} else {
|
||||
if (!isBorderless && state.isBorderless) {
|
||||
// Restore the window size when the window become bordered
|
||||
if (state.normalWindowRect.width != 0 && state.normalWindowRect.height != 0) {
|
||||
window.setFrame(state.normalWindowRect, display: true, animate: false)
|
||||
}
|
||||
}
|
||||
// 枠なしを切り替えるたびにウィンドウサイズが小さくなったので、これはコメントアウト
|
||||
// if (!isBorderless && state.isBorderless) {
|
||||
// // Restore the window size when the window become bordered
|
||||
// if (state.normalWindowRect.width != 0 && state.normalWindowRect.height != 0) {
|
||||
// window.setFrame(state.normalWindowRect, display: true, animate: false)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1097,4 +1103,16 @@ public class LibUniWinC : NSObject {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/// Return some information for debugging
|
||||
@objc public static func getDebugInfo() -> Int32 {
|
||||
var result: Int32 = 0
|
||||
|
||||
if (targetWindow != nil) {
|
||||
if (targetWindow!.canBecomeMain) { result += 1 }
|
||||
if (targetWindow!.canBecomeKey) { result += 2 }
|
||||
if (targetWindow!.isKeyWindow) { result += 4 }
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user